[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] xen/vsprintf: Introduce %pd formatter for domains



>>> On 01.10.18 at 12:02, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 01/10/18 10:08, Jan Beulich wrote:
>>>>> On 28.09.18 at 19:22, <andrew.cooper3@xxxxxxxxxx> wrote:
>>> +static char *print_domain(char *str, char *end, const struct domain *d)
>>> +{
>>> +    const char *name = NULL;
>>> +
>>> +    /* Some debugging may have an optionally-NULL pointer. */
>>> +    if ( unlikely(!d) )
>>> +        return string(str, end, "NULL", -1, -1, 0);
>>> +
>>> +    if ( str < end )
>>> +        *str = 'd';
>>> +
>>> +    switch ( d->domain_id )
>>> +    {
>>> +    case DOMID_IO:   name = "[IO]";   break;
>>> +    case DOMID_XEN:  name = "[XEN]";  break;
>>> +    case DOMID_COW:  name = "[COW]";  break;
>>> +    case DOMID_IDLE: name = "[IDLE]"; break;
>>     default: ASSERT_UNREACHABLE();
>>
>> ?
> 
> No - specifically not in this case.
> 
> This path is used when printing crash information, and falling back to a
> number is better behaviour than falling into an infinite loop,
> overflowing the primary stack, then taking a #DF (which escalates to
> triple fault on AMD), without printing anything useful.

Ah, good point. Perhaps worth a brief comment instead of a "default:"
then?

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.