Skip to contentSkip to conversation

Prevent tasks from sleeping in die()

RFC-PATCH David Wilder 2 participants 2 messages May 10, 2006 PowerPC

lore
Share & tools
lore
#0 lore raw

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?

arch/powerpc/kernel/traps.c +9 -0
index 064a525..dc45bcd 100644
@@ -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);
Signature · 4 lines
David Wilder
IBM Linux Technology Center
Beaverton, Oregon, USA [email protected]
(503)578-3789
#1 lore raw
Quoted 3 lines · David Wilder

I am seeing an issue in die() when voluntary preemption is enabled. die() ->>show_regs()->>show_instructions()->>__get_user_nocheck()->>might_sleep()

Are you using Linus' current git tree? It has a patch that fixes this problem by making __get_user_nocheck do the might_sleep only if the address you give it is a user address.

Paul.