Re: [PATCH] printk: Correctly handle preemption in console_unlock()

From: Sergey Senozhatsky
Date: Mon Jan 16 2017 - 08:44:04 EST


On (01/16/17 22:26), Sergey Senozhatsky wrote:
> On (01/16/17 13:48), Petr Mladek wrote:
> [..]
> > The async printk code looks like this:
> >
> > vprintk_emit(...)
> > {
> >
> >
> > if (can_printk_async()) {
> > /* Offload printing to a schedulable context. */
> > printk_kthread_need_flush_console = true;
> > wake_up_process(printk_kthread);
> > } else {
> > /*
> > * Try to acquire and then immediately release the
> > * console semaphore. The release will print out
> > * buffers and wake up /dev/kmsg and syslog() users.
> > */
> > if (console_trylock())
> > console_unlock();
> > }
> >
> > So, there is still the console_trylock() for the sync mode. Or do I
> > see an outdated variant?
>
> no, it doesn't.

I meant that none of this is happening in vprintk_emit(). there is no
console_sem in vprintk_emit() at all. eveything is done in deferred printk.

-ss