Messages in this thread | | | Date | Thu, 17 Jan 2008 17:31:49 -0800 (PST) | From | Linus Torvalds <> | Subject | Re: [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
| |