FW: spinlocks dont work

From: RANDAZZO
Date: Fri Feb 13 2004 - 16:19:13 EST


On a uniprocessor system, with config_smp NOT Defined...

Note the following example:

driver 'A' calls spin_lock_irqsave and gets through (but does not call
..unlock).
driver 'B' calls spin_lock_irqsave and gets through???

How can B get through if A did not unlock yet?

-Mike

-----Original Message-----
From: Richard B. Johnson [mailto:root@xxxxxxxxxxxxxxxxxx]
Sent: Friday, February 13, 2004 3:25 PM
To: RANDAZZO@xxxxxxxxxxx
Subject: RE: spinlocks dont work


On Fri, 13 Feb 2004 RANDAZZO@xxxxxxxxxxx wrote:

> if I need to lock out in the ISR, and I haven't
> compiled for SMP, what can I use instead?
>
> Mike

spinlock_t mylock = SPIN_LOCK_UNLOCKED;

You put:
unsigned int flags;

spin_lock_irqsave(&mylock, flags);
//
// Critical section code
//
spin_unlock_irqrestore(&mylock flags);

...this construct around any critical section. If you
don't know how to write interrupt service routines and
insist upon enabling interrupts within the ISR, you
need the same thing in the ISR.


Whether or not it's compiled for SMP should not then make
any difference because the 'cli' in the macro will still
exist.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.24 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.


"This message may contain company proprietary information. If you are not
the intended recipient, any disclosure, copying, distribution or reliance on
the contents of this message is prohibited. If you received this message in
error, please delete and notify me."

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/