Subject: [linux-audio-dev] SMP low latency patch: tested - race condition
From: Paul Barton-Davis (pbd_AT_Op.Net)
Date: ti marras 30 1999 - 15:47:06 EST
Benno -
i finally got to testing out Ingo's suggestions for the SMP low
latency fix. alas, it appears to introduce a race condition. I tried 2
bootups. The first one hung during the microcode download to my
Tropez+; the second one hung during a probe for an ethernet card
(which i don't have installed). 2.2.10 with the LL patch never does
this.
I don't have Ingo's mailing address, so perhaps you could let him
know. Enclosed below is my /usr/src/linux/include/asm/smplock.h. If I
had more time right now, I would look into it myself, but I don't.
--p
/*
* <asm/smplock.h>
*
* i386 SMP lock implementation
*/
#include <linux/interrupt.h>
#include <linux/condsched.h>
#include <asm/spinlock.h>
extern spinlock_t kernel_flag;
/*
* Release global kernel lock and global interrupt lock
*/
#define release_kernel_lock(task, cpu) \
do { \
if (task->lock_depth >= 0) \
spin_unlock(&kernel_flag); \
release_irqlock(cpu); \
__sti(); \
} while (0)
/*
* Re-acquire the kernel lock
*/
#ifdef NOT_LOW_LATENCY
#define reacquire_kernel_lock(task) \
do { \
if (task->lock_depth >= 0) \
spin_lock(&kernel_flag); \
} while (0)
#else
#define reacquire_kernel_lock(task) \
do { \
if (task->lock_depth >= 0) \
while (!spin_trylock(&kernel_flag)) \
if (current->need_resched) \
schedule(); \
} while (0)
#endif /* NOT_LOW_LATENCY */
/*
* Getting the big kernel lock.
*
* This cannot happen asynchronously,
* so we only need to worry about other
* CPU's.
*/
extern __inline__ void lock_kernel(void)
{
#ifdef NOT_LOW_LATENCY
__asm__ __volatile__(
"incl %1\n\t"
"jne 9f"
spin_lock_string
"\n9:"
:"=m" (__dummy_lock(&kernel_flag)),
"=m" (current->lock_depth));
#else
if (!++current->lock_depth) {
reacquire_kernel_lock(current);
}
#endif /* NOT_LOW_LATENCY */
}
extern __inline__ void unlock_kernel(void)
{
__asm__ __volatile__(
"decl %1\n\t"
"jns 9f\n\t"
spin_unlock_string
"\n9:"
:"=m" (__dummy_lock(&kernel_flag)),
"=m" (current->lock_depth));
}
This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:23:26 EST