netdev
[Top] [All Lists]

Re: tx_timeout and timer serialisation

To: Andrey Savochkin <saw@xxxxxxxxxxxxx>
Subject: Re: tx_timeout and timer serialisation
From: Andrew Morton <andrewm@xxxxxxxxxx>
Date: Mon, 22 May 2000 21:13:20 +1000
Cc: netdev@xxxxxxxxxxx
References: <3925BB00.B1CDDFE7@xxxxxxxxxxxxxxxx> <Pine.LNX.4.10.10005192039250.825-100000@xxxxxxxxxxxxx>, <Pine.LNX.4.10.10005192039250.825-100000@xxxxxxxxxxxxx>; <20000520122715.A7682@xxxxxxxxxxxxx> <39262113.19447850@xxxxxxxxxx>, <39262113.19447850@xxxxxxxxxx>; <20000520133557.A8149@xxxxxxxxxxxxx> <39267696.ACCE4DF3@xxxxxxxxxx>, <39267696.ACCE4DF3@xxxxxxxxxx>; from "Andrew Morton" on Sat, May 20, 2000 at 09:27:18PM <20000522094419.A12225@xxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
Andrey Savochkin wrote:
> 
> Hello,

Hi, Andrey.

> ... 
> For eepro100 it should be
> 
> --- eepro100.c  Tue Apr  4 11:05:23 2000
> +++ eepro100.c-timer    Mon May 22 09:35:52 2000
> @@ -1799,7 +1799,9 @@
>                            dev->name, inw(ioaddr + SCBStatus));
> 
>         /* Shut off the media monitoring timer. */
> +       start_bh_atomic();
>         del_timer(&sp->timer);
> +       end_bh_atomic();
> 
>         /* Shutting down the chip nicely fails to disable flow control. So.. 
> */
>         outl(PortPartialReset, ioaddr + SCBPort);

hmm..  But if the timer handler was running before the
start_bh_atomic(), it will continue to run during and after the
del_timer().

_Somewhere_ the mainline code needs to spin until the timer handler has
finished.

So we need a lock to serialise del_timer() wrt the handlers.  It can be
either the global_bh_lock or the timerlist_lock; it doesn't matter a
lot.  I'm using the timerlist_lock at present because it looks to me
like global_bh_lock has its head on the chopping block - sometime we're
going to make timer handlers non-serialised and things which play with
global_bh_lock will probably break.

> ...
> 
> As far as I remember, all BHs were single threaded in 2.2 kernels, so if
> we're in BH, handler can't run on another CPU.

That is also the case in 2.3.  Timer handlers are globally serialised. 
Only one handler can be running at a time, system-wide.


Where's Alexey, BTW?  If he's busily coding a fix for this I'm gonna
strangle him :)


-- 
-akpm-

<Prev in Thread] Current Thread [Next in Thread>