Re: [PATCH] Don't sleep in oops_begin()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2007-09-17 at 20:12 +0200, Andi Kleen wrote:
> 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 <ak@xxxxxxx>
> 
> 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..

>  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

-
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux