public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* spin_locks without smp.
@ 2003-01-10 11:42 Maciej Soltysiak
  2003-01-10 11:45 ` William Lee Irwin III
  2003-01-10 13:29 ` Alan Cox
  0 siblings, 2 replies; 14+ messages in thread
From: Maciej Soltysiak @ 2003-01-10 11:42 UTC (permalink / raw)
  To: linux-kernel

Hi,

while browsing through the network drivers about the etherleak issue i
found that some drivers have:

#ifdef CONFIG_SMP
	spin_lock_irqsave(...)
#endif

and some just:

	spin_lock_irqsave(...)

or similar.
Which version should be practiced? i thought spinlocks are irrelevant
without SMP so we should use #ifdef to shorten the execution path.

Regards,
Maciej Soltysiak


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [PATCH]Re: spin_locks without smp.
@ 2003-01-10 17:19 Manfred Spraul
  2003-01-10 18:18 ` Alan Cox
  0 siblings, 1 reply; 14+ messages in thread
From: Manfred Spraul @ 2003-01-10 17:19 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, Maciej Soltysiak, William Lee Irwin III

Alan wrote:

>On Fri, 2003-01-10 at 13:04, William Lee Irwin III wrote:
>> Okay, what I'm getting here is that the UP case already has preempt
>> disabled b/c the locks are taken in IRQ context?
>
>The tx/timeout path isnt always in IRQ context.
>
It is.
tx and timeout are both called at BH context with the dev_xmit spinlock 
held. See Documentation/networking/netdevices.txt

What about

    disable_irq();
    spin_lock(&np->lock);

That's what 8390.c uses, no need for an #ifdef.

--
    Manfred


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [PATCH]Re: spin_locks without smp.
@ 2003-01-11 13:22 Mikael Pettersson
  2003-01-11 14:29 ` Alan Cox
  0 siblings, 1 reply; 14+ messages in thread
From: Mikael Pettersson @ 2003-01-11 13:22 UTC (permalink / raw)
  To: alan, manfred; +Cc: linux-kernel, solt, wli

On 10 Jan 2003 18:18:39 +0000, Alan Cox wrote:
>On Fri, 2003-01-10 at 17:19, Manfred Spraul wrote:
>> 
>>     disable_irq();
>>     spin_lock(&np->lock);
>> 
>> That's what 8390.c uses, no need for an #ifdef.
>
>Does someone have a card they can test that on. If so then I agree
>entirely it is the best way to go 

I have an ISA NE2000 available for testing, if someone feeds me patches.
Only UP hardware, though.

/Mikael

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2003-01-11 13:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-10 11:42 spin_locks without smp Maciej Soltysiak
2003-01-10 11:45 ` William Lee Irwin III
2003-01-10 11:48   ` William Lee Irwin III
2003-01-10 12:09     ` [PATCH]Re: " Maciej Soltysiak
2003-01-10 13:20       ` Alan Cox
2003-01-10 13:04         ` William Lee Irwin III
2003-01-10 14:19           ` Alan Cox
2003-01-10 13:23   ` Alan Cox
2003-01-10 12:41     ` William Lee Irwin III
2003-01-10 13:29 ` Alan Cox
  -- strict thread matches above, loose matches on Subject: below --
2003-01-10 17:19 [PATCH]Re: " Manfred Spraul
2003-01-10 18:18 ` Alan Cox
2003-01-11 13:22 Mikael Pettersson
2003-01-11 14:29 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox