lkml.org 
[lkml]   [2018]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Would you help to tell why async printk solution was not taken to upstream kernel ?
On (03/05/18 15:45), Steven Rostedt wrote:
> On Mon, 5 Mar 2018 11:14:16 +0900
> Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> wrote:
>
> > It can print more than "one full buffer worth". In theory and on practice.
>
> How so? As soon as another process adds to the buffer, it will take
> over the printing.

The very same CPU which holds the console_sem can add messages to the
logbuf.

There are at least 3 cases I can easily think of.


#1 preemption under console_sem

console_lock()
for (;;) {
local_irq_save()
call_console_drivers()
local_irq_restore()
<< preemption >>
printk // from another task, same CPU
}


#2 IRQ->printk under console_sem

console_lock()
for (;;) {
local_irq_save()
call_console_drivers()
local_irq_restore()
<< IRQ >>
printk
}


#3 This, eventually, becomes #2. But the root cause and, thus,
probability are completely different. printks from console drivers
(some console drivers are really complex, with dependencies on timers,
networking, etc. etc.). We currently handle those via
printk_safe -> IRQ work. But I think we kinda should stop doing so.

console_lock()
for (;;) {
local_irq_save()
call_console_drivers()
printk()
local_irq_restore()
}

-ss

\
 
 \ /
  Last update: 2018-03-06 03:01    [W:0.151 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site