Re: Spinlocks, intr levels et al

From: Manfred Spraul (manfreds@colorfullife.com)
Date: Wed Jan 05 2000 - 15:43:06 EST


Kanoj Sarcar wrote:
>
> I have read Documentation/spinlocks.txt.
>
> My problem is this: I have a lock L that is acquired from intr level,
> as well as from process context. Hence, L is grabbed/released with
> spin_lock_irqsave/spin_unlock_irqrestore. While L is held from process
> context, it is possible that the code needs to do an intercpu action
> (eg flush_tlb_all).

I think you cannot do any intercpu action with disabled interrupts: what
if both cpu's try to perform a different intercpu action?

IIRC I found 3 places that send ipi's with disabled interrupts:

* mtrr: it's easy to fix that, just move the "set_mtrr_prepare()" behind
the smp_call_function().

* panic(), machine_restart(): both functions call smp_send_stop(), and
this function uses smp_call_function to issue an ipi.
I don't know how to fix this problem, therefore I didn't post a patch.

> The only solution I can think of is to have a
> new routine spin_lock_irqsave_intercpu() that raises intr level,
> tries to get the lock, on failure drops the intr level, and retries.
>

This is only reliable if there is only _one_ such spinlock. As soon as
you have 2 users, you have a lock-up.

--
	Manfred

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



This archive was generated by hypermail 2b29 : Fri Jan 07 2000 - 21:00:04 EST