[openib-general] Re: [PATCH (updated)] ipoib: dont lock tx on completion

Michael S. Tsirkin mst at mellanox.co.il
Thu Feb 10 00:38:21 PST 2005


Quoting r. Roland Dreier <roland at topspin.com>:
> Subject: Re: [PATCH (updated)] ipoib: dont lock tx on completion
> 
>     Michael> By testing again, and waking the net queue if completions
>     Michael> arrived, we can avoid taking the tx lock on send
>     Michael> completion in ip over ib, reducing the lock contention.
> 
>     Michael> An exception is when the interface is locked: in that
>     Michael> case we have to look at the head and tail values, so its
>     Michael> easier to take the lock than worry about smp issues.
> 
> Hmm, I still need to think about this for a while.  For example, I
> can't convince myself easily that nothing bad can happen if we test
> netif_queue_stopped() outside of a locked region.
> 
>  - R.
> 

We are now only looking at tx_tail and netif_queue_stopped
outside the lock (tx_head is only used inside the lock):

We have a write barrier in between, so
its guaranteed tx_tail is written before we test netif_queue_stopped.

On the other hand, the send code has a barrier after it stops the
interface, so this bit is written before we test
tx_tail the second time.

So, in the scenario where send stops the interface, either
the completion code will see it stopped, or the send code will see
tx tail updated.

OK?

-- 
MST - Michael S. Tsirkin



More information about the general mailing list