lkml.org 
[lkml]   [2010]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[032/116] [PATCH] sparc64: Make prom entry spinlock NMI safe.
2.6.32-stable review patch.  If anyone has any objections, please let us know.

------------------

From: David S. Miller <davem@davemloft.net>

[ Upstream commit 8a4fd1e4922413cfdfa6c51a59efb720d904a5eb ]

If we do something like try to print to the OF console from an NMI
while we're already in OpenFirmware, we'll deadlock on the spinlock.

Use a raw spinlock and disable NMIs when we take it.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
arch/sparc/prom/p1275.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

--- a/arch/sparc/prom/p1275.c
+++ b/arch/sparc/prom/p1275.c
@@ -32,8 +32,7 @@ extern void prom_cif_interface(void);
extern void prom_cif_callback(void);

/*
- * This provides SMP safety on the p1275buf. prom_callback() drops this lock
- * to allow recursuve acquisition.
+ * This provides SMP safety on the p1275buf.
*/
DEFINE_SPINLOCK(prom_entry_lock);

@@ -47,7 +46,9 @@ long p1275_cmd(const char *service, long

p = p1275buf.prom_buffer;

- spin_lock_irqsave(&prom_entry_lock, flags);
+ raw_local_save_flags(flags);
+ raw_local_irq_restore(PIL_NMI);
+ spin_lock(&prom_entry_lock);

p1275buf.prom_args[0] = (unsigned long)p; /* service */
strcpy (p, service);
@@ -139,7 +140,8 @@ long p1275_cmd(const char *service, long
va_end(list);
x = p1275buf.prom_args [nargs + 3];

- spin_unlock_irqrestore(&prom_entry_lock, flags);
+ spin_unlock(&prom_entry_lock);
+ raw_local_irq_restore(flags);

return x;
}



\
 
 \ /
  Last update: 2010-03-31 02:17    [W:1.583 / U:8.460 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site