Page MenuHomeFreeBSD

pf: change pf_rules_lock and pf_ioctl_lock to per-vnet locks
ClosedPublic

Authored by kp on Apr 18 2023, 2:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, May 12, 11:09 AM
Unknown Object (File)
Dec 20 2023, 4:53 AM
Unknown Object (File)
Dec 11 2023, 11:24 PM
Unknown Object (File)
Aug 15 2023, 2:33 AM
Unknown Object (File)
Aug 15 2023, 12:58 AM
Unknown Object (File)
Jul 9 2023, 7:31 PM
Unknown Object (File)
May 16 2023, 5:04 PM
Unknown Object (File)
May 2 2023, 8:43 AM

Details

Summary

Both pf_rules_lock and pf_ioctl_lock only ever affect one vnet, so
there's no point in having these locks affect other vnets.
(In fact, the only lock in pf that can affect multiple vnets is
pf_end_lock.)

That's especially important for the rules lock, because taking the write
lock suspends all network traffic until it's released. This will reduce
the impact a vnet running pf can have on other vnets, and improve
concurrency on machines running multiple pf-enabled vnets.

Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kp requested review of this revision.Apr 18 2023, 2:13 PM
zlei added a subscriber: zlei.

Generally looks good to me.

sys/netpfil/pf/pf_ioctl.c
281

pf_ioctl_lock is not used outside pf_ioctl.c, can be defined as static one.

This revision is now accepted and ready to land.Apr 18 2023, 3:11 PM