From owner-svn-src-head@freebsd.org Wed May 30 12:14:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42CBFEF5ADC; Wed, 30 May 2018 12:14:08 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5C817FD87; Wed, 30 May 2018 12:14:07 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from hermann ([141.89.155.168]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LeBPM-1g6ynT2ZTw-00pxNn; Wed, 30 May 2018 14:13:59 +0200 Date: Wed, 30 May 2018 14:13:57 +0200 From: "Hartmann, O." To: Kristof Provost Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334375 - in head/sys: net netpfil/pf Message-ID: <20180530141347.1bf868ac@hermann> In-Reply-To: <201805300711.w4U7BYjS066960@repo.freebsd.org> References: <201805300711.w4U7BYjS066960@repo.freebsd.org> Organization: walstatt.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:rja4vSJndbIeSD13E5O0HDfSqebQhZ40Zts5KrlFoavq+KEW37S mz/4idc0uoLNjXCXqfct/CPrqItb8Ype98yI51FVB0jzbeYP8LamFY2GdDZai6DtfZ12vxP +rbvUECTKpmLyqtuqorniT6l6AUcREiIEJNHY812WQYvn2xzvRVHEDArcoR2sIIOtryyFgI ssrD6UiU5tNFQbXcZEWXw== X-UI-Out-Filterresults: notjunk:1;V01:K0:inGICIJri1g=:HOGhJFH0FVUijZ5AQUBnP8 mQL4CTS0NdyQM7LdkJlWo8torFVap5qsAKhb1UAZELfyNoUlQtX7MLjDCiN7a21SroW267OU3 mYl0nuFgs3aZgZq9crORfJhKqtgxUHro/7g3yI8TGxUkgognxd62DqJel5lMTS0NCpF4GCjCH 5DEhrehJqvHLWE9ijJxuqJ/yy9z1gYRIGo8B8iPO+z4tnd0rJLI2P4lg+ao/NU1/L7xBsGRkz si/kX7QsXeTwEm67XQ/7FtYfBXJnj/iB3RvXRDt8V4It1+DNgReDFR2BdpsvTmJbsvmrgpMLb lZ4AxEYntDemBVv1fG0maHsCljEE7WkHDhg/52JyePv9K32l2woptfPgo4TX9G7mZoVwqSFW2 UXiHCUYghvUM5uATK0oBbkIpANESp6owEo37vWTtNS4xGWE/keJxYwphnqcvSRI928CLZ68hW NqLAPJwhLiJ1vzfF6vZJc765ji8anQn4vvO1oSQrgPwT5G/FQyy7/jESmyHnaYGLHbZdo0hDY isfDpL7CR2Lg6cz96FS2Hqr3pz1oJ8yfY+chMYlG2oGzl/xSyXj7rpLEsM/rAZ6hbrHzBAoJF xj51A+bYi+lF9cl+rvFUpv/WW7CbaL09hSu2iy42jTpwMAi7bmjA1qV+ljUO+pajNjwT288TG YiG5dsLjDWYIgSjJwE2MGp4JwA+z8ef76GFsloe86tpgDHWtp7dwPCoe9rYjcf1m5vMc/ag5d Rg5444lRaOw4/2/yDCQy9yIL3BSEA31LXYaC5AvtSr3X+9vaUnz/j0FLh/PYBYxB9894hb0TT LP1ula7 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 12:14:08 -0000 On Wed, 30 May 2018 07:11:34 +0000 (UTC) Kristof Provost wrote: > Author: kp > Date: Wed May 30 07:11:33 2018 > New Revision: 334375 > URL: https://svnweb.freebsd.org/changeset/base/334375 > > Log: > pf: Replace rwlock on PF_RULES_LOCK with rmlock > > Given that PF_RULES_LOCK is a mostly read lock, replace the rwlock > with rmlock. This change improves packet processing rate in high pps > environments. Benchmarking by olivier@ shows a 65% improvement in pps. > > While here, also eliminate all appearances of "sys/rwlock.h" > includes since it is not used anymore. > > Submitted by: farrokhi@ > Differential Revision: https://reviews.freebsd.org/D15502 > > Modified: > head/sys/net/pfvar.h > head/sys/netpfil/pf/if_pfsync.c > head/sys/netpfil/pf/pf.c > head/sys/netpfil/pf/pf_if.c > head/sys/netpfil/pf/pf_ioctl.c > head/sys/netpfil/pf/pf_lb.c > head/sys/netpfil/pf/pf_norm.c > head/sys/netpfil/pf/pf_osfp.c > head/sys/netpfil/pf/pf_table.c > > Modified: head/sys/net/pfvar.h > ============================================================================== > --- head/sys/net/pfvar.h Wed May 30 06:29:22 2018 > (r334374) +++ head/sys/net/pfvar.h Wed May 30 07:11:33 > 2018 (r334375) @@ -38,8 +38,10 @@ > #include > #include > #include > +#include > #include > #include > +#include > #include > #include > > @@ -147,14 +149,15 @@ extern struct mtx pf_unlnkdrules_mtx; > #define PF_UNLNKDRULES_LOCK() > mtx_lock(&pf_unlnkdrules_mtx) #define > PF_UNLNKDRULES_UNLOCK() mtx_unlock(&pf_unlnkdrules_mtx) > -extern struct rwlock pf_rules_lock; > -#define PF_RULES_RLOCK() rw_rlock(&pf_rules_lock) > -#define PF_RULES_RUNLOCK() rw_runlock(&pf_rules_lock) > -#define PF_RULES_WLOCK() rw_wlock(&pf_rules_lock) > -#define PF_RULES_WUNLOCK() rw_wunlock(&pf_rules_lock) > -#define PF_RULES_ASSERT() rw_assert(&pf_rules_lock, > RA_LOCKED) -#define PF_RULES_RASSERT() > rw_assert(&pf_rules_lock, RA_RLOCKED) -#define > PF_RULES_WASSERT() rw_assert(&pf_rules_lock, RA_WLOCKED) > +extern struct rmlock pf_rules_lock; +#define > PF_RULES_RLOCK_TRACKER struct rm_priotracker _pf_rules_tracker > +#define PF_RULES_RLOCK() rm_rlock(&pf_rules_lock, > &_pf_rules_tracker) +#define PF_RULES_RUNLOCK() > rm_runlock(&pf_rules_lock, &_pf_rules_tracker) +#define > PF_RULES_WLOCK() rm_wlock(&pf_rules_lock) +#define > PF_RULES_WUNLOCK() rm_wunlock(&pf_rules_lock) +#define > PF_RULES_ASSERT() rm_assert(&pf_rules_lock, RA_LOCKED) > +#define PF_RULES_RASSERT() rm_assert(&pf_rules_lock, > RA_RLOCKED) +#define PF_RULES_WASSERT() > rm_assert(&pf_rules_lock, RA_WLOCKED) extern struct sx pf_end_lock; > > Modified: head/sys/netpfil/pf/if_pfsync.c > ============================================================================== > --- head/sys/netpfil/pf/if_pfsync.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/if_pfsync.c Wed > May 30 07:11:33 2018 (r334375) @@ -587,6 +587,8 @@ > pfsync_input(struct mbuf **mp, int *offp __unused, int int rv; > uint16_t count; > > + PF_RULES_RLOCK_TRACKER; > + > *mp = NULL; > V_pfsyncstats.pfsyncs_ipackets++; > > > Modified: head/sys/netpfil/pf/pf.c > ============================================================================== > --- head/sys/netpfil/pf/pf.c Wed May 30 06:29:22 2018 > (r334374) +++ head/sys/netpfil/pf/pf.c Wed May 30 07:11:33 > 2018 (r334375) @@ -5874,6 +5874,8 @@ pf_test(int dir, int > pflags, struct ifnet *ifp, struct struct pf_pdesc pd; > int off, dirndx, pqid = 0; > > + PF_RULES_RLOCK_TRACKER; > + > M_ASSERTPKTHDR(m); > > if (!V_pf_status.running) > @@ -6261,6 +6263,7 @@ pf_test6(int dir, int pflags, struct ifnet > *ifp, struc struct pf_pdesc pd; > int off, terminal = 0, dirndx, > rh_cnt = 0, pqid = 0; > + PF_RULES_RLOCK_TRACKER; > M_ASSERTPKTHDR(m); > > if (!V_pf_status.running) > > Modified: head/sys/netpfil/pf/pf_if.c > ============================================================================== > --- head/sys/netpfil/pf/pf_if.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/pf_if.c Wed May > 30 07:11:33 2018 (r334375) @@ -46,7 +46,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > #include > -#include > #include > > #include > > Modified: head/sys/netpfil/pf/pf_ioctl.c > ============================================================================== > --- head/sys/netpfil/pf/pf_ioctl.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/pf_ioctl.c Wed > May 30 07:11:33 2018 (r334375) @@ -59,7 +59,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > #include > -#include > #include > #include > #include > @@ -202,7 +201,7 @@ VNET_DEFINE(int, pf_vnet_active); > int pf_end_threads; > struct proc *pf_purge_proc; > > -struct rwlock pf_rules_lock; > +struct rmlock pf_rules_lock; > struct sx pf_ioctl_lock; > struct sx pf_end_lock; > > @@ -995,6 +994,7 @@ static int > pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, > struct thread *td) { > int error = 0; > + PF_RULES_RLOCK_TRACKER; > > /* XXX keep in sync with switch() below */ > if (securelevel_gt(td->td_ucred, 2)) > @@ -3924,7 +3924,7 @@ pf_load(void) > { > int error; > > - rw_init(&pf_rules_lock, "pf rulesets"); > + rm_init(&pf_rules_lock, "pf rulesets"); > sx_init(&pf_ioctl_lock, "pf ioctl"); > sx_init(&pf_end_lock, "pf end thread"); > > @@ -3997,7 +3997,7 @@ pf_unload(void) > > pfi_cleanup(); > > - rw_destroy(&pf_rules_lock); > + rm_destroy(&pf_rules_lock); > sx_destroy(&pf_ioctl_lock); > sx_destroy(&pf_end_lock); > } > > Modified: head/sys/netpfil/pf/pf_lb.c > ============================================================================== > --- head/sys/netpfil/pf/pf_lb.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/pf_lb.c Wed May > 30 07:11:33 2018 (r334375) @@ -46,7 +46,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > #include > -#include > #include > #include > > > Modified: head/sys/netpfil/pf/pf_norm.c > ============================================================================== > --- head/sys/netpfil/pf/pf_norm.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/pf_norm.c Wed > May 30 07:11:33 2018 (r334375) @@ -41,7 +41,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > #include > -#include > #include > > #include > > Modified: head/sys/netpfil/pf/pf_osfp.c > ============================================================================== > --- head/sys/netpfil/pf/pf_osfp.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/pf_osfp.c Wed > May 30 07:11:33 2018 (r334375) @@ -27,7 +27,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > #include > -#include > #include > > #include > > Modified: head/sys/netpfil/pf/pf_table.c > ============================================================================== > --- head/sys/netpfil/pf/pf_table.c Wed May 30 06:29:22 > 2018 (r334374) +++ head/sys/netpfil/pf/pf_table.c Wed > May 30 07:11:33 2018 (r334375) @@ -44,7 +44,6 @@ > __FBSDID("$FreeBSD$"); #include > #include > #include > -#include > #include > #include > > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to > "svn-src-head-unsubscribe@freebsd.org" It seems, this commit issues an error while compiling the kernel: [...] --- all_subdir_pf --- --- pf_ruleset.o --- In file included from /usr/src/sys/netpfil/pf/pf_ruleset.c:57: In file included from /usr/src/sys/net/pfvar.h:44: In file included from /usr/src/sys/sys/rmlock.h:37: /usr/src/sys/sys/mutex.h:96:52: error: expected ')' int _mtx_trylock_flags_int(struct mtx *m, int opts LOCK_FILE_LINE_ARG_DEF); ^ /usr/src/sys/sys/mutex.h:96:27: note: to match this '(' int _mtx_trylock_flags_int(struct mtx *m, int opts LOCK_FILE_LINE_ARG_DEF); ^ /usr/src/sys/sys/mutex.h:100:5: error: 'LOCK_DEBUG' is not defined, evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0 ^ /usr/src/sys/sys/mutex.h:111:5: error: 'LOCK_DEBUG' is not defined, evaluates to 0 [-Werror,-Wundef] #if LOCK_DEBUG > 0