Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Nov 2000 10:32:59 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Jonathan Lemon <jlemon@flugsvamp.com>
Cc:        smp@FreeBSD.org
Subject:   RE: patch to make bpf mpsafe
Message-ID:  <XFMail.001127103259.jhb@FreeBSD.org>
In-Reply-To: <20001126110554.H69183@prism.flugsvamp.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 26-Nov-00 Jonathan Lemon wrote:
>   Attached is a patch to make bpf mpsafe (and also cleans up some cruft).
> BPF happened to be the first subsystem called by ether_input, so was the
> first thing that I looked at.
> 
> 3 levels of mutexes are added:
> 
>    bpf_mtx  - global to BPF, protects BPF interface list, device open
>       (bif_next, bif_ifp)
>    bpf interface mtx - protects per-interface descriptor list
>       (bd_next, bd_bif, ifp->if_bpf)
>    bpf descriptor mtx - protects fields in the individual descriptor.
> 
> Locking order is top to bottom, but the hierarchy can be entered at
> any point.
> 
> Network drivers start by locking the interface mutex, then walking the
> list, locking each descriptor as it is manipulated.
> 
> User level code reading from the bpf descriptor sleeps on the descriptor 
> mutex. This has been lightly tested with an mpsafe network driver.  
> Comments welcome.

Couple of things:
- need to add the explicit lock order to the witness code :)
- go ahead and kill the splimp()'s.  If this is all they are protecting and
  they are now protected by mutexes, the spl()'s can die.  They just obfuscate
  the code otherwise.

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.001127103259.jhb>