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

Re: [Xen-devel] [PATCH 2/2] xen/debug: make debugtrace more clever regarding repeating entries



>>> On 14.03.19 at 14:40, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 14/03/2019 13:38, Juergen Gross wrote:
>> On 14/03/2019 14:33, Jan Beulich wrote:
>>>>>> On 14.03.19 at 10:37, <jgross@xxxxxxxx> wrote:
>>>> --- a/xen/drivers/char/console.c
>>>> +++ b/xen/drivers/char/console.c
>>>> @@ -1225,13 +1225,28 @@ void debugtrace_dump(void)
>>>>      watchdog_enable();
>>>>  }
>>>>  
>>>> +static void debugtrace_add_to_buf(char *buf)
>>>> +{
>>>> +    char *p;
>>>> +
>>>> +    for ( p = buf; *p != '\0'; p++ )
>>>> +    {
>>>> +        debugtrace_buf[debugtrace_prd++] = *p;
>>>> +        /* Always leave a nul byte at the end of the buffer. */
>>>> +        if ( debugtrace_prd == (debugtrace_bytes - 1) )
>>>> +            debugtrace_prd = 0;
>>>> +    }
>>>> +}
>>>> +
>>>>  void debugtrace_printk(const char *fmt, ...)
>>>>  {
>>>> -    static char    buf[1024];
>>>> -    static u32 count;
>>>> +    static char buf[1024];
>>>> +    static char last_buf[1024];
>>>> +    static u32 count, last_count;
>>> Please change to uint32_t or even better simply to unsigned int.
>> Okay.
>>
>>>> @@ -1243,25 +1258,32 @@ void debugtrace_printk(const char *fmt, ...)
>>>>  
>>>>      ASSERT(debugtrace_buf[debugtrace_bytes - 1] == 0);
>>>>  
>>>> -    snprintf(buf, sizeof(buf), "%u ", ++count);
>>>> -
>>>>      va_start(args, fmt);
>>>> -    (void)vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), fmt, 
>>>> args);
>>>> +    (void)vsnprintf(buf, sizeof(buf), fmt, args);
>>> Please take the opportunity and drop the stray cast.
>> Will do.
> 
> Both can be done on commit, surely?

Perhaps, albeit iirc the first would amount to more than just s/u32/.../
on the line in question.

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