Re: [PATCH] Don't sleep in oops_begin()
From: Daniel Walker <hidden>
Date: 2007-09-17 18:30:46
On Mon, 2007-09-17 at 20:12 +0200, Andi Kleen wrote:
quoted hunk ↗ jump to hunk
When the kernel is oopsing no realtime guarantees are needed anymore and sleeping here is unsafe; e.g. in case the crash site had interrupts disabled. - Convert die_lock to a raw spinlock - Really disable interrupts Signed-off-by: Andi Kleen <redacted> Index: linux-2.6.23-rc4-rt1/arch/x86_64/kernel/traps.c ===================================================================--- linux-2.6.23-rc4-rt1.orig/arch/x86_64/kernel/traps.c +++ linux-2.6.23-rc4-rt1/arch/x86_64/kernel/traps.c@@ -467,7 +467,7 @@ void out_of_line_bug(void) EXPORT_SYMBOL(out_of_line_bug); #endif -static DEFINE_SPINLOCK(die_lock); +static __raw_spinlock_t die_lock = __RAW_SPIN_LOCK_UNLOCKED;
You mean DEFINE_RAW_SPINLOCK() maybe? Unless I'm not following what your doing here..
quoted hunk ↗ jump to hunk
static int die_owner = -1; static unsigned int die_nest_count;@@ -479,13 +479,13 @@ unsigned __kprobes long oops_begin(void) oops_enter(); /* racy, but better than risking deadlock. */ - local_irq_save(flags); + raw_local_irq_save(flags);
local_irq_save() should disable interrupts .. The difference between the two is one does interrupt off trace accounting
cpu = smp_processor_id();
- if (!spin_trylock(&die_lock)) {
+ if (!__raw_spin_trylock(&die_lock)) {If you use DEFINE_RAW_SPINLOCK() above you shouldn't need to mod these individually .. A call to spin_trylock() will automatically change depending on the lock type. Daniel