[RFC-PATCH] Prevent tasks from sleeping in die()

David Wilder dwilder at us.ibm.com
Thu May 11 10:19:34 EST 2006


I am seeing an issue in die() when voluntary preemption is enabled.
die() 
->>show_regs()->>show_instructions()->>__get_user_nocheck()->>might_sleep()
If multiple CPUs call die() and one should sleep other CPUs may block on 
the die_lock held by the sleeping CPU.  This problem is seen when a 
soft-reset is issued as all CPUs call die() at roughly the same time.

Is this the correct way to fix this problem?

Signed-of-by: <wilder at us.ibm.com>

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 064a525..dc45bcd 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -101,6 +101,15 @@ int die(const char *str, struct pt_regs
    if (debugger(regs))
        return 1;

+    /* If voluntary preemption is on we can sleep
+     * in show_regs().  This is bad as we hold the
+    * die_lock. Ether the task is exiting or the system
+    * is crashing so there is no need to restore the
+    * NEED_RESCHED flag.
+    */
+    clear_need_resched();
+
+
        console_verbose();
        spin_lock_irq(&die_lock);
        bust_spinlocks(1);

-- 
David Wilder
IBM Linux Technology Center
Beaverton, Oregon, USA 
dwilder at us.ibm.com
(503)578-3789




More information about the Linuxppc-dev mailing list