Re: [PATCH] printk deadlocks if called with runqueue lock held

Jan Kiszka
2008-01-18T14:56:18Z

Steven Rostedt wrote:
...
> @@ -978,7 +980,13 @@ void release_console_sem(void)
> console_locked = 0;
> up(&console_sem);

Hmm, just looking at this fragment: Doesn't up() include the risk of
running onto the runqueue lock as well?

> spin_unlock_irqrestore(&logbuf_lock, flags);
> - if (wake_klogd)
> + /*
> + * If we try to wake up klogd while printing with the runqueue lock
> + * held, this will deadlock. We don't have access to the runqueue
> + * lock from here, but just checking for interrupts disabled
> + * should be enough.
> + */
> + if (!irqs_disabled() && wake_klogd)
> wake_up_klogd();
> }
> EXPORT_SYMBOL(release_console_sem);

Jan