[POWERPC] Fix device-tree locking vs. interrupts
authorBenjamin Herrenschmidt <benh@ozlabs.org>
Wed, 9 Apr 2008 07:21:36 +0000 (17:21 +1000)
committerPaul Mackerras <paulus@samba.org>
Fri, 18 Apr 2008 05:37:16 +0000 (15:37 +1000)
commitf4ac7b5eb79ef15819c966b1f6b84bf443949123
treecfc81caaa2d1d50f0986c99cf59764060993eb60
parentf13f4ca8036516ca1b99a41f95f7dea7e4dce104
[POWERPC] Fix device-tree locking vs. interrupts

Lockdep found out that we can occasionally take the device-tree
lock for reading from softirq time (from rtas_token called
by the rtas real time clock code called by the NTP code),
while we take it occasionally for writing without masking
interrupts. The combination of those two can thus deadlock.

While some of those cases of interrupt read lock could be fixed
(such as caching the RTAS tokens) I figured that taking the
lock for writing is so rare (device-tree modification) that we
may as well penalize that case and allow reading from interrupts.

Thus, this turns all the writers to take the lock with irqs
masked to avoid the situation.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/prom.c