Re: [patch] SMP race fix [was Re: SMP lockup & 3c509 on 2.2.x [aka. the Deadly 'ping -f']]

Linus Torvalds (torvalds@transmeta.com)
Wed, 5 May 1999 17:38:40 -0700 (PDT)


On Thu, 6 May 1999, Alan Cox wrote:
>
> Its demonstrably not doable. I had to work around the APIC latency with the
> 8390 driver.

Indeed. And other architectures have similar problems.

Even the i8259 has the problem, although in that particular case it is
limited to irq7 for some strange and wonderful implementation reasons, and
very few people use irq7 ;)

(And on the i8259 we _could_ look at the pending stuff, it's just an
implementation detail that we currently don't)

> I ended up doing
>
> disable_irq(blah)
> synchronize_irq();
>
> spin_lock(...)
>
> Simply trying to stop the irq on the card didnt work. Sometimes one was
> hiding.

I just basically think that that is the only way to do it - it may
work 99.9% of the time with the old-fashioned way if you have a 8259
controller, but we certainly have architectures without them.

(And I agree with Andrea that the synchronize_irq() should not be there:
it is done by disable_irq() internally although obviously this whole
discussion is about a race in that particular function - but that should
be considered a disable_irq() bug rather than something that warrants code
like the above ;)

Linus

-
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/