netdev
[Top] [All Lists]

Re: PATCH 2.4.0.9.2: export ethtool interface

To: "David S. Miller" <davem@xxxxxxxxxx>
Subject: Re: PATCH 2.4.0.9.2: export ethtool interface
From: Andi Kleen <ak@xxxxxx>
Date: Thu, 21 Sep 2000 15:30:57 +0200
Cc: ak@xxxxxx, andrewm@xxxxxxxxxx, becker@xxxxxxxxx, havanna_moon@xxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <200009211223.FAA11621@xxxxxxxxxxxxxxx>; from David S. Miller on Thu, Sep 21, 2000 at 02:35:53PM +0200
References: <39C883CF.9FB262FC@xxxxxxxxxx> <Pine.LNX.4.10.10009201152510.1031-100000@xxxxxxxxxxxxx> <39C9F123.D8FA4F68@xxxxxxxxxx> <20000921133302.36264@xxxxxxxxxxxx> <200009211159.EAA09358@xxxxxxxxxxxxxxx> <20000921143042.A3635@xxxxxxxxxxx> <200009211223.FAA11621@xxxxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
On Thu, Sep 21, 2000 at 02:35:53PM +0200, David S. Miller wrote:
>    Date: Thu, 21 Sep 2000 14:30:42 +0200
>    From: Andi Kleen <ak@xxxxxx>
> 
>    Also I would propose to run dev->do_ioctl and probably other device
>    methods inside the BKL, they are not performance critical anyways
>    and it is much safer.
> 
> Why, that's really dumb.
> 
> All of net/* and drivers/net/* runs %100 asynchronous and threaded on
> SMP systems.  Your suggested change would create a new exception :-)

The difference is that hard_start_xmit et.al. are guaranteed to not reenter
on the same CPU. No such guarantee for the ioctl. I would not be surprised
if lots of them are not reentrant. Of course it could be fixed by adding
a reentrancy lock, but that would be overkill because the BKL does fine
for such things. They usually do also not synchronize against the RX/TX
threads properly (e.g. no hw register lock), that needs to be fixed in the 
drivers, but I think it would be useless to add no-reeentrancy-against-itself
locks in all low level driver ioctls, that is better in higher levels.

Quick grep in drivers/net/* shows several drivers which are unsafe, mostly
by not protecting their data structures or hardware state: 

depca (  while(lp->tx_old != lp->tx_new);    /* Wait for the ring to empty */
looks pretty scary in a ioctl BTW ), 

dgrs

ppp_synctty: calls n_tty_ioctl, which is surely not non BLK safe

even the happy meal ioctls look quite unsafe. 

...


-Andi

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