tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: apparently missing locking in if_bnx.c



On Tue, Mar 06, 2012 at 09:43:42AM -0500, Thor Lancelot Simon wrote:
> On Tue, Mar 06, 2012 at 12:51:29PM +0100, Manuel Bouyer wrote:
> >
> > No network driver is SMP-safe at this time, so they're all running
> > under KERNEL_LOCK. splnet() is enough to protect the queues.
> 
> I think there are a few that are SMP-safe.  One of Matt's for a powerpc board,
> and probably ixgbe.
> 
> I know there are extensive patches floating around out there to make wm and
> some of the software "interfaces" SMP-safe.  I'll let their authors speak up
> for themselves if they think it's appropriate...

It's possible some of then have already been made SMP-safe (I think xennet
is, or is close to be). But all the driver's entry points from upper
level (e.g. if_ethersubr.c, netinet, etc ...) should still be called with
KERNEL_LOCK held (partly because most network drivers are not SMP-safe
yet; parly because the upper levels are not SMP-safe either).
If the driver's interrupt is not registered SMP-safe it will be called
with KERNEL_LOCK too, and so the whole driver can safely use spl locking.

Now it's possible some code path enters a network driver without KERNEL_LOCK;
but this would be a bug that could cause concurency issues, and I don't think
the right place to fix it is in the driver itself at this time (or all drivers
would have to be fixed at once).

I tested the KASSERT I mentionned with in the wm driver, they didn't fire.
But I don't have much beside ethernet v4 and v6 configured.
A more complicated setup may be needed to reproduce the problem and
discover the faultly code path.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index