Re: [RFC,PATCH 3/4] Change synchronize_kernel to _rcu and _sched

From: Francois Romieu
Date: Sat Apr 09 2005 - 17:43:24 EST


Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> :
[...]
> I always thought that all callers of dev->hard_start_xmit() acquire
> dev->xmit_lock before calling hard_start_xmit().
>
> Is that assumption wrong? I think I even rely on that in one of my
> drivers.

Afaik, no, it is right.

This part of the r8169 driver handles the window starting where qdisc_run()
tests netif_queue_stopped() to the spin_trylock(&dev->xmit_lock) in
qdisc_restart: the lock is not taken and dev->hard_start_xmit() will happen
in the near future ("near" or "preempt safe near" is not relevant here).
The driver must wait for the late newcomer to do its whole work before
it can release the Tx ring, whence the former synchronize_kernel().

r8169_down() looks a bit baroque because it can race with the irq handler
or dev->poll() or the recovery timer and none of those spin_locks either.

I may have missed something though. Feel free to educate.

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