Yes, I agree, that sounds way cleaner than just not lock at all in
console_write(). But then of course you could still runt into a race
condition where another thread is already spinning for the lock. As
soon as we drop the lock, the other thread would grab it... and when
console_write() is called via handle_sysrq(), it's already too late,
isn't it?
Ugh ? handle_sysrq() is called from irq, this should be an irqsafe
lock, another thread on another cpu would just cause us to wait a bit...
I think this is a generic issue that all serial drivers supporting
sysrq() face. Instead of putting some special different solution into
each driver, I'd say the code from sn_sal_console_write() needs to be
generalized.
Cc'ing the serial maintainer exactly for this reason.
Russell, what is the preferred solution for this deadlock-prone
situation?
quoted
I'll have a look, thanks much.
Ben.
--
Benjamin Herrenschmidt [off-list ref]
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/