[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 15:55, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 01/10/18 11:25, Jan Beulich wrote:
>>>>> On 01.10.18 at 12:23, <andrew.cooper3@xxxxxxxxxx> wrote:
>>> On 01/10/18 11:14, Jan Beulich wrote:
>>>>>>> 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?
>>> This incremental diff?
>> LGTM, thanks.
> 
> I've committed this now, but its just occurred to me that we couldn't
> possibly have had a default case, because that is the common case for
> most domains.

Oh, indeed, but still, while the "unreachable" part of my suggestion
was indeed wrong, but it still could have been
ASSERT(d->domain_id < DOMID_FIRST_RESERVED). But I agree this
wouldn't have been overly helpful.

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®.