login
Header Space

 
 

Re: Spinlocks waiting with interrupts disabled / preempt disabled.

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ingo Molnar <mingo@...>
Cc: <linux-kernel@...>, Peter Zijlstra <a.p.zijlstra@...>
Date: Wednesday, May 7, 2008 - 1:24 pm

Looks like an issue with old code in SLES10. Upstream has:

/*
 * If lockdep is enabled then we use the non-preemption spin-ops
 * even on CONFIG_PREEMPT, because lockdep assumes that interrupts are
 * not re-enabled during lock-acquire (which the preempt-spin-ops do):
 */
#if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC)

.. followed by function definitions that disable interrupts before 
spinning.

#else

...

unsigned long __lockfunc _##op##_lock_irqsave(locktype##_t *lock)       \
{                                                                       \
        unsigned long flags;                                            \
                                                                        \
        for (;;) {                                                      \
                preempt_disable();                                      \
                local_irq_save(flags);                                  \
                if (likely(_raw_##op##_trylock(lock)))                  \
                        break;                                          \
                local_irq_restore(flags);                               \
                preempt_enable();                                       \
                                                                        \
                if (!(lock)->break_lock)                                \
                        (lock)->break_lock = 1;                         \
                while (!op##_can_lock(lock) && (lock)->break_lock)      \
                        _raw_##op##_relax(&lock->raw_lock);             \
        }                                                               \
        (lock)->break_lock = 0;                                         \
        return flags;                                                   \
}                                                                       \
                                       
So this is only an issue if certain debug options are enabled.

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Spinlocks waiting with interrupts disabled / preempt dis..., Christoph Lameter, (Wed May 7, 1:24 pm)
Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoi..., Christoph Lameter, (Mon Jun 23, 2:20 pm)
Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoi..., Christoph Lameter, (Mon Jun 23, 4:45 pm)
Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoi..., Jeremy Fitzhardinge, (Wed Jun 25, 10:51 pm)
Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoi..., Jeremy Fitzhardinge, (Mon Jul 7, 4:14 pm)
Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoi..., Jeremy Fitzhardinge, (Tue Jul 8, 1:57 am)
Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoi..., Jeremy Fitzhardinge, (Tue Jul 8, 11:58 am)
Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoi..., Jeremy Fitzhardinge, (Mon Jul 7, 11:53 am)
Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoi..., Jeremy Fitzhardinge, (Mon Jul 7, 11:56 am)
Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoi..., Christoph Lameter, (Thu Jun 26, 1:02 pm)
Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoi..., Jeremy Fitzhardinge, (Thu Jun 26, 11:49 am)
Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoi..., Christoph Lameter, (Fri May 9, 12:28 pm)
speck-geostationary