Re: [PATCH] printk: inject caller information into the body of message

From: Tetsuo Handa
Date: Thu Oct 11 2018 - 06:20:54 EST


On 2018/10/10 19:14, Tetsuo Handa wrote:
> On 2018/10/10 6:19, Tetsuo Handa wrote:
>> Do you think that adding cmpxchg() & retry logic to this API generates better
>> result than simple fallback? buffered_printk() does not add a new locking dependency
>> is a good point of this API. Showing the backtrace (by enabling a debug kernel config
>> option for this API) will be sufficient.
>>
>
> This is an idea for reporting out of buffers event. I would add a kernel config
> option for whether to report that event. Maybe I should offload the reporting
> to a workqueue context, for reporting from get_printk_context() requires that
> get_printk_context() callers have to be printk()-safe, and
> get_printk_context() callers might be already in vprintk_safe()/vprintk_nmi()
> context even if it is possible to call printk().
>

I dropped DEFINE_PRINTK_BUFFER() in order to hide "struct printk_buffer" because
I added reporting functionality for out of static "struct printk_buffer" and
made that number configurable at kernel compile option. I think we can start
evaluating with only static buffers. Then, we will consider whether we need to
expose "struct printk_buffer" in order to allow allocating from kernel stack
memory. Maybe allocating from slab memory is sufficient if someone happened to
want to reserve several "struct printk_buffer" buffers for its lifetime.

Thus, here is v4.