Re: [RFC PATCH v1 10/25] printk: redirect emit/store to new ringbuffer

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

 



On 2019-02-25, Petr Mladek <pmladek@xxxxxxxx> wrote:
>> >> vprintk_emit and vprintk_store are the main functions that all printk
>> >> variants eventually go through. Change these to store the message in
>> >> the new printk ring buffer that the printk kthread is reading.
>> >
>> > Please, are there any candidates or plans to reuse the new ring
>> > buffer implementation?
>> 
>> As you pointed out below, this patch already uses the ring buffer
>> implementation for a totally different purpose: NMI safe dynamic memory
>> allocation.
>
> I have found an alternative solution. We could calculate the length
> of the formatted string without any buffer:
>
> 	va_list args_copy;
>
> 	va_copy(args_copy, args);
> 	len = vscprintf(NULL, fmt, args_copy);
> 	va_end(args_copy);
>
> This vsprintf() mode was implemented for exactly this purpose.

For vprintk_emit() that would work. As you will see in later (patch 23),
the sprint_rb ringbuffer is used for dynamic memory allocation for
kmsg_dump functions as well.

The current printk implementation allows readers to read directly from
the ringbuffer. The proposed ringbuffer requires the reader (printk) to
have its own buffers.

We may be able to find an alternate solution here as well if that is
desired.

John Ogness



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux