lkml.org 
[lkml]   [2008]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] printk deadlocks if called with runqueue lock held


On Thu, 17 Jan 2008, Steven Rostedt wrote:
>
> Calling printk with interrupts disabled should only be done for
> emergencies and debugging anyway.

Agreed, I think this is sane.

> And with this patch, my code ran fine ;-)

Patch looks fine, but I'm saddened:

> + /*
> + * 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();

..because we actually *have* the old hardware irq enable/disable value in
in that "flags" parameter we just restored, so it's more than a bit sad to
then ask again whether they were disabled or not!

IOW, I think this should be

if (raw_irqs_disabled_flags(flags) && wake_klogd)
wake_up_klogd();

Of course, not all architectures seem to suport that thing (it's currently
only used by the CONFIG_TRACE_IRQFLAGS config option).

Damn. So close, yet so far away.

Linus


\
 
 \ /
  Last update: 2008-01-18 02:35    [W:0.087 / U:0.960 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site