Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jul 2007 18:02:37 +0200
From:      Max Laier <max@love2party.net>
To:        freebsd-smp@freebsd.org
Cc:        Lee Brotherston <lee@nerds.org.uk>
Subject:   Re: Pfil and SMP
Message-ID:  <200707231802.47772.max@love2party.net>
In-Reply-To: <20070723101557.GE63302@nerds.org.uk>
References:  <20070723101557.GE63302@nerds.org.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart15596386.jYJoask1gG
Content-Type: text/plain;
  charset="iso-8859-6"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Monday 23 July 2007, Lee Brotherston wrote:
> Apologies if this is an area which has been covered somewhere, but my
> google skills don't seem to have uncovered it.
>
> I am working with the pfil interface and use pfil_add_hook to process
> or drop a number of packets.  However as my test equipment is only
> single processor I have been unable to test in an SMP environment.
> So, the crux of my query is...
>
> Does the SMP setup in FreeBSD 6.x & 7.x, leave the possibility that
> the two instances of the function named in the pfil_add_hook call, may
> be running at once?  Or is there some kind of locking which prevents
> this?  My reason for asking is that there is a state table which I do
> not want altering in two places at once, and so I will impliment
> internal locks.
>
> (If possible I'd appreciate being CC'd on replies as I'm not currently
> subscribed).

pfil(9) is protected by rw_locks (CURRENT) or a handrolled version of=20
reader/writer locks (RELENG_6) and thus does not prevent more than one=20
thread in the hook function at once.  You have to roll your own locking=20
if required.

=2D-=20
/"\  Best regards,                      | mlaier@freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier@EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News

--nextPart15596386.jYJoask1gG
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQBGpNEnXyyEoT62BG0RApITAJ9G7L2aIhjBFl09pyyAIiR+Ze7E/gCeONSt
yyZZUPxyRfmUJ9uUugSl3hg=
=4tzZ
-----END PGP SIGNATURE-----

--nextPart15596386.jYJoask1gG--



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