Re: [PATCH] printk deadlocks if called with runqueue lock held
From: Linus Torvalds
Date: Thu Jan 17 2008 - 20:33:09 EST
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/