Re: git: c5ba872129b3 - stable/13 - tcp: tolerate missing timestamps
> On 14. Jul 2021, at 06:11, Helge Oldach wrote: > > Hi, > > Michael Tuexen wrote on Tue, 13 Jul 2021 20:27:17 +0200 (CEST): >> The branch stable/13 has been updated by tuexen: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=c5ba872129b3afee95953294fbe55e014559d408 >> >> commit c5ba872129b3afee95953294fbe55e014559d408 >> Author: Michael Tuexen >> AuthorDate: 2021-06-11 18:14:34 + >> Commit: Michael Tuexen >> CommitDate: 2021-07-13 18:24:09 + >> >>tcp: tolerate missing timestamps >> >>Some TCP stacks negotiate TS support, but do not send TS at all >>or not for keep-alive segments. Since this includes modern widely >>deployed stacks, tolerate the violation of RFC 7323 per default. >> >>Reviewed by:rgrimes, rrs, rscheff >>Differential Revision: https://reviews.freebsd.org/D30740 >>Sponsored by: Netflix, Inc. > > I assume this would fix the behaviour discussed in > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253476? Yes. Best regards Michael > > Kind regards > Helge ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: b9dc12859790 - stable/12 - tcp: tolerate missing timestamps
The branch stable/12 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=b9dc1285979058cb2751675d926a773513e83fc8 commit b9dc1285979058cb2751675d926a773513e83fc8 Author: Michael Tuexen AuthorDate: 2021-06-11 18:14:34 + Commit: Michael Tuexen CommitDate: 2021-07-14 07:43:16 + tcp: tolerate missing timestamps Some TCP stacks negotiate TS support, but do not send TS at all or not for keep-alive segments. Since this includes modern widely deployed stacks, tolerate the violation of RFC 7323 per default. Reviewed by:rgrimes, rrs, rscheff Differential Revision: https://reviews.freebsd.org/D30740 Sponsored by: Netflix, Inc. (cherry picked from commit 870af3f4dc57a6bbfc03f6a49ca0d5b7ff1b975a) --- share/man/man4/tcp.4 | 6 -- sys/netinet/tcp_subr.c | 9 - 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index e1e87afd7fd6..ad7e3f117d68 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -34,7 +34,7 @@ .\" From: @(#)tcp.48.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 14, 2021 +.Dd June 27, 2021 .Dt TCP 4 .Os .Sh NAME @@ -343,7 +343,9 @@ segments belonging to connections for which support of .Tn TCP timestamps has been negotiated. -(default is 0, i.e., the missing of timestamps is not tolerated). +As of June 2021, several TCP stacks are known to violate RFC 7323, including +modern widely deployed ones. +Therefore the default is 1, i.e., the missing of timestamps is tolerated. .It Dv TCPCTL_MSSDFLT .Pq Va mssdflt The default value used for the maximum segment size diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 5394a63c1a12..c82a5bf21a15 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -195,7 +195,14 @@ SYSCTL_INT(_net_inet_tcp, TCPCTL_DO_RFC1323, rfc1323, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_rfc1323), 0, "Enable rfc1323 (high performance TCP) extensions"); -VNET_DEFINE(int, tcp_tolerate_missing_ts) = 0; +/* + * As of June 2021, several TCP stacks violate RFC 7323 from September 2014. + * Some stacks negotiate TS, but never send them after connection setup. Some + * stacks negotiate TS, but don't send them when sending keep-alive segments. + * These include modern widely deployed TCP stacks. + * Therefore tolerating violations for now... + */ +VNET_DEFINE(int, tcp_tolerate_missing_ts) = 1; SYSCTL_INT(_net_inet_tcp, OID_AUTO, tolerate_missing_ts, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_tolerate_missing_ts), 0, "Tolerate missing TCP timestamps"); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 1fcecff2b3b5 - stable/13 - pf: rename pf_state to pf_kstate
The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1fcecff2b3b52cd799eac0d83ff7cd5f9cd07212 commit 1fcecff2b3b52cd799eac0d83ff7cd5f9cd07212 Author: Kristof Provost AuthorDate: 2021-07-06 09:42:20 + Commit: Kristof Provost CommitDate: 2021-07-14 05:55:54 + pf: rename pf_state to pf_kstate Indicate that this is a kernel-only structure, and make it easier to distinguish from others used to communicate with userspace. Reviewed by:mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31096 (cherry picked from commit 211cddf9e3a1bc0d4b1b94bea7d16a47b5a17f49) --- sys/net/pfvar.h| 56 +++--- sys/netpfil/pf/if_pfsync.c | 84 - sys/netpfil/pf/pf.c| 114 ++--- sys/netpfil/pf/pf_ioctl.c | 42 - sys/netpfil/pf/pf_norm.c | 4 +- sys/netpfil/pf/pf_nv.c | 2 +- sys/netpfil/pf/pf_nv.h | 2 +- 7 files changed, 152 insertions(+), 152 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index b63f22e84bc0..5d4860ec981a 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -491,10 +491,10 @@ struct pf_state_key { u_int8_t pad[2]; LIST_ENTRY(pf_state_key) entry; - TAILQ_HEAD(, pf_state) states[2]; + TAILQ_HEAD(, pf_kstate) states[2]; }; -/* Keep synced with struct pf_state. */ +/* Keep synced with struct pf_kstate. */ struct pf_state_cmp { u_int64_tid; u_int32_tcreatorid; @@ -511,16 +511,16 @@ struct pf_state_cmp { #definePFSTATE_SETMASK (PFSTATE_SETPRIO) #ifdef _KERNEL -struct pf_state { +struct pf_kstate { u_int64_tid; u_int32_tcreatorid; u_int8_t direction; u_int8_t pad[3]; u_intrefs; - TAILQ_ENTRY(pf_state)sync_list; - TAILQ_ENTRY(pf_state)key_list[2]; - LIST_ENTRY(pf_state) entry; + TAILQ_ENTRY(pf_kstate) sync_list; + TAILQ_ENTRY(pf_kstate) key_list[2]; + LIST_ENTRY(pf_kstate)entry; struct pf_state_peer src; struct pf_state_peer dst; union pf_krule_ptr rule; @@ -552,7 +552,7 @@ struct pf_state { /* * Size <= fits 13 objects per page on LP64. Try to not grow the struct beyond that. */ -_Static_assert(sizeof(struct pf_state) <= 312, "pf_state size crosses 312 bytes"); +_Static_assert(sizeof(struct pf_kstate) <= 312, "pf_kstate size crosses 312 bytes"); #endif /* @@ -613,11 +613,11 @@ struct pfsync_state { #ifdef _KERNEL /* pfsync */ typedef intpfsync_state_import_t(struct pfsync_state *, u_int8_t); -typedefvoidpfsync_insert_state_t(struct pf_state *); -typedefvoidpfsync_update_state_t(struct pf_state *); -typedefvoidpfsync_delete_state_t(struct pf_state *); +typedefvoidpfsync_insert_state_t(struct pf_kstate *); +typedefvoidpfsync_update_state_t(struct pf_kstate *); +typedefvoidpfsync_delete_state_t(struct pf_kstate *); typedef void pfsync_clear_states_t(u_int32_t, const char *); -typedef intpfsync_defer_t(struct pf_state *, struct mbuf *); +typedef intpfsync_defer_t(struct pf_kstate *, struct mbuf *); typedef void pfsync_detach_ifnet_t(struct ifnet *); VNET_DECLARE(pfsync_state_import_t *, pfsync_state_import_ptr); @@ -635,7 +635,7 @@ VNET_DECLARE(pfsync_defer_t *, pfsync_defer_ptr); extern pfsync_detach_ifnet_t *pfsync_detach_ifnet_ptr; void pfsync_state_export(struct pfsync_state *, - struct pf_state *); + struct pf_kstate *); /* pflog */ struct pf_kruleset; @@ -1410,7 +1410,7 @@ struct pf_keyhash { }; struct pf_idhash { - LIST_HEAD(, pf_state) states; + LIST_HEAD(, pf_kstate) states; struct mtx lock; }; @@ -1484,26 +1484,26 @@ extern void pf_unload_vnet_purge(void); extern void pf_intr(void *); extern void pf_purge_expired_src_nodes(void); -extern int pf_unlink_state(struct pf_state *, u_int); +extern int pf_unlink_state(struct pf_kstate *, u_int); #definePF_ENTER_LOCKED 0x0001 #definePF_RETURN_LOCKED0x0002 extern int pf_state_insert(struct pfi_kkif *, struct pfi_kkif *, struct pf_state_key *, struct pf_state_key *, -
git: 1adc5faa2ae0 - stable/12 - pf: rename pf_state to pf_kstate
The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1adc5faa2ae0c0128f322bae6f8ec14fa9e5feb3 commit 1adc5faa2ae0c0128f322bae6f8ec14fa9e5feb3 Author: Kristof Provost AuthorDate: 2021-07-06 09:42:20 + Commit: Kristof Provost CommitDate: 2021-07-14 10:08:39 + pf: rename pf_state to pf_kstate Indicate that this is a kernel-only structure, and make it easier to distinguish from others used to communicate with userspace. Reviewed by:mjg MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31096 (cherry picked from commit 211cddf9e3a1bc0d4b1b94bea7d16a47b5a17f49) --- sys/net/pfvar.h| 56 +++--- sys/netpfil/pf/if_pfsync.c | 84 - sys/netpfil/pf/pf.c| 114 ++--- sys/netpfil/pf/pf_ioctl.c | 42 - sys/netpfil/pf/pf_norm.c | 4 +- sys/netpfil/pf/pf_nv.c | 2 +- sys/netpfil/pf/pf_nv.h | 2 +- 7 files changed, 152 insertions(+), 152 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index c11455837072..6fbbb46b69b9 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -491,10 +491,10 @@ struct pf_state_key { u_int8_t pad[2]; LIST_ENTRY(pf_state_key) entry; - TAILQ_HEAD(, pf_state) states[2]; + TAILQ_HEAD(, pf_kstate) states[2]; }; -/* Keep synced with struct pf_state. */ +/* Keep synced with struct pf_kstate. */ struct pf_state_cmp { u_int64_tid; u_int32_tcreatorid; @@ -511,16 +511,16 @@ struct pf_state_cmp { #definePFSTATE_SETMASK (PFSTATE_SETPRIO) #ifdef _KERNEL -struct pf_state { +struct pf_kstate { u_int64_tid; u_int32_tcreatorid; u_int8_t direction; u_int8_t pad[3]; u_intrefs; - TAILQ_ENTRY(pf_state)sync_list; - TAILQ_ENTRY(pf_state)key_list[2]; - LIST_ENTRY(pf_state) entry; + TAILQ_ENTRY(pf_kstate) sync_list; + TAILQ_ENTRY(pf_kstate) key_list[2]; + LIST_ENTRY(pf_kstate)entry; struct pf_state_peer src; struct pf_state_peer dst; union pf_krule_ptr rule; @@ -552,7 +552,7 @@ struct pf_state { /* * Size <= fits 13 objects per page on LP64. Try to not grow the struct beyond that. */ -_Static_assert(sizeof(struct pf_state) <= 312, "pf_state size crosses 312 bytes"); +_Static_assert(sizeof(struct pf_kstate) <= 312, "pf_kstate size crosses 312 bytes"); #endif /* @@ -613,11 +613,11 @@ struct pfsync_state { #ifdef _KERNEL /* pfsync */ typedef intpfsync_state_import_t(struct pfsync_state *, u_int8_t); -typedefvoidpfsync_insert_state_t(struct pf_state *); -typedefvoidpfsync_update_state_t(struct pf_state *); -typedefvoidpfsync_delete_state_t(struct pf_state *); +typedefvoidpfsync_insert_state_t(struct pf_kstate *); +typedefvoidpfsync_update_state_t(struct pf_kstate *); +typedefvoidpfsync_delete_state_t(struct pf_kstate *); typedef void pfsync_clear_states_t(u_int32_t, const char *); -typedef intpfsync_defer_t(struct pf_state *, struct mbuf *); +typedef intpfsync_defer_t(struct pf_kstate *, struct mbuf *); typedef void pfsync_detach_ifnet_t(struct ifnet *); VNET_DECLARE(pfsync_state_import_t *, pfsync_state_import_ptr); @@ -635,7 +635,7 @@ VNET_DECLARE(pfsync_defer_t *, pfsync_defer_ptr); extern pfsync_detach_ifnet_t *pfsync_detach_ifnet_ptr; void pfsync_state_export(struct pfsync_state *, - struct pf_state *); + struct pf_kstate *); /* pflog */ struct pf_kruleset; @@ -1411,7 +1411,7 @@ struct pf_keyhash { }; struct pf_idhash { - LIST_HEAD(, pf_state) states; + LIST_HEAD(, pf_kstate) states; struct mtx lock; }; @@ -1485,26 +1485,26 @@ extern void pf_unload_vnet_purge(void); extern void pf_intr(void *); extern void pf_purge_expired_src_nodes(void); -extern int pf_unlink_state(struct pf_state *, u_int); +extern int pf_unlink_state(struct pf_kstate *, u_int); #definePF_ENTER_LOCKED 0x0001 #definePF_RETURN_LOCKED0x0002 extern int pf_state_insert(struct pfi_kkif *, struct pfi_kkif *, struct pf_state_key *, struct pf_state_key *, -
git: f5998d20ed80 - main - psm(4): Probe Synaptics touchpad with active multiplexing mode enabled
The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=f5998d20ed80fdc1cb3ba0c245cae5f179e22fe2 commit f5998d20ed80fdc1cb3ba0c245cae5f179e22fe2 Author: Vladimir Kondratyev AuthorDate: 2021-07-14 10:30:26 + Commit: Vladimir Kondratyev CommitDate: 2021-07-14 10:30:26 + psm(4): Probe Synaptics touchpad with active multiplexing mode enabled if it is only multiplexed device. Also enable syncbit checks for them. This fixes touchpad recognition on Panasonic Toughbook CF-MX4 laptop. Reported by:Tomasz "CeDeROM" CEDRO MFC after: 1 month PR: 253279 Differential revision: https://reviews.freebsd.org/D28502 --- sys/dev/atkbdc/psm.c | 42 -- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 43d19b5174d3..f6276ae847aa 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -466,6 +466,7 @@ struct psm_softc { /* Driver status information */ int muxtpbuttons; /* Touchpad button state */ int muxmsbuttons; /* Mouse (trackpoint) button state */ struct timeval muxmidtimeout; /* middle button supression timeout */ + int muxsinglesyna; /* Probe result of single Synaptics */ #ifdef EVDEV_SUPPORT struct evdev_dev *evdev_a; /* Absolute reporting device */ struct evdev_dev *evdev_r; /* Relative reporting device */ @@ -666,6 +667,7 @@ static probefunc_t enable_4dplus; static probefunc_t enable_mmanplus; static probefunc_t enable_synaptics; static probefunc_t enable_synaptics_mux; +static probefunc_t enable_single_synaptics_mux; static probefunc_t enable_trackpoint; static probefunc_t enable_versapad; static probefunc_t enable_elantech; @@ -686,8 +688,10 @@ static struct { * WARNING: the order of probe is very important. Don't mess it * unless you know what you are doing. */ - { MOUSE_MODEL_SYNAPTICS,/* Synaptics Touchpad on Active Mux */ + { MOUSE_MODEL_SYNAPTICS,/* Synaptics + mouse on Active Mux */ 0x00, MOUSE_PS2_PACKETSIZE, enable_synaptics_mux }, + { MOUSE_MODEL_SYNAPTICS,/* Single Synaptics on Active Mux */ + 0xc0, MOUSE_SYNAPTICS_PACKETSIZE, enable_single_synaptics_mux }, { MOUSE_MODEL_NET, /* Genius NetMouse */ 0x08, MOUSE_PS2INTELLI_PACKETSIZE, enable_gmouse }, { MOUSE_MODEL_NETSCROLL,/* Genius NetScroll */ @@ -6292,6 +6296,8 @@ enable_synaptics_mux(struct psm_softc *sc, enum probearg arg) int active_ports_count = 0; int active_ports_mask = 0; + sc->muxsinglesyna = FALSE; + if (mux_disabled == 1 || (mux_disabled == -1 && (kbdc->quirks & KBDC_QUIRK_DISABLE_MUX_PROBE) != 0)) return (FALSE); @@ -6315,18 +6321,16 @@ enable_synaptics_mux(struct psm_softc *sc, enum probearg arg) active_ports_count); /* psm has a special support for GenMouse + SynTouchpad combination */ - if (active_ports_count >= 2) { - for (port = 0; port < KBDC_AUX_MUX_NUM_PORTS; port++) { - if ((active_ports_mask & 1 << port) == 0) - continue; - VLOG(3, (LOG_DEBUG, "aux_mux: probe port %d\n", port)); - set_active_aux_mux_port(kbdc, port); - probe = enable_synaptics(sc, arg); - if (probe) { - if (arg == PROBE) - sc->muxport = port; - break; - } + for (port = 0; port < KBDC_AUX_MUX_NUM_PORTS; port++) { + if ((active_ports_mask & 1 << port) == 0) + continue; + VLOG(3, (LOG_DEBUG, "aux_mux: probe port %d\n", port)); + set_active_aux_mux_port(kbdc, port); + probe = enable_synaptics(sc, arg); + if (probe) { + if (arg == PROBE) + sc->muxport = port; + break; } } @@ -6348,7 +6352,17 @@ enable_synaptics_mux(struct psm_softc *sc, enum probearg arg) } empty_both_buffers(kbdc, 10); /* remove stray data if any */ - return (probe); + /* Don't disable syncbit checks if Synaptics is only device on MUX */ + if (active_ports_count == 1) + sc->muxsinglesyna = probe; + return (active_ports_count != 1 ? probe : FALSE); +} + +static int +enable_single_synaptics_mux(struct psm_softc *sc, enum probearg arg) +{ + /* Synaptics device is already initialized in enable_synaptics_mux */ + return (sc->muxsinglesyna); } static int ___
git: 791035c8da5e - stable/13 - libalias: fix divide by zero causing panic
The branch stable/13 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=791035c8da5e8a693b3b954db67ff50b4f8695cb commit 791035c8da5e8a693b3b954db67ff50b4f8695cb Author: Stefan Eßer AuthorDate: 2021-07-10 11:00:56 + Commit: Lutz Donnerhacke CommitDate: 2021-07-14 11:49:21 + libalias: fix divide by zero causing panic The packet_limit can fall to 0, leading to a divide by zero abort in the "packets % packet_limit". An possible solution would be to apply a lower limit of 1 after the calculation of packet_limit, but since any number modulo 1 gives 0, the more efficient solution is to skip the modulo operation for packet_limit <= 1. Reported by:Karl Denninger (cherry picked from commit 58080fbca09fda6d5f011d37059edbca8ceb4c58) --- sys/netinet/libalias/alias_db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 783a8ca3baa8..ed222c4133d4 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -1769,7 +1769,7 @@ HouseKeeping(struct libalias *la) * Reduce the amount of house keeping work substantially by * sampling over the packets. */ - if (packets % packet_limit == 0) { + if (packet_limit <= 1 || packets % packet_limit == 0) { time_t now; #ifdef _KERNEL ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 5c55ab57c818 - stable/12 - libalias: fix divide by zero causing panic
The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=5c55ab57c81885cf6b269bfb77dbb334ca0a9bde commit 5c55ab57c81885cf6b269bfb77dbb334ca0a9bde Author: Stefan Eßer AuthorDate: 2021-07-10 11:00:56 + Commit: Lutz Donnerhacke CommitDate: 2021-07-14 11:54:15 + libalias: fix divide by zero causing panic The packet_limit can fall to 0, leading to a divide by zero abort in the "packets % packet_limit". An possible solution would be to apply a lower limit of 1 after the calculation of packet_limit, but since any number modulo 1 gives 0, the more efficient solution is to skip the modulo operation for packet_limit <= 1. Reported by:Karl Denninger (cherry picked from commit 58080fbca09fda6d5f011d37059edbca8ceb4c58) --- sys/netinet/libalias/alias_db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 783a8ca3baa8..ed222c4133d4 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -1769,7 +1769,7 @@ HouseKeeping(struct libalias *la) * Reduce the amount of house keeping work substantially by * sampling over the packets. */ - if (packets % packet_limit == 0) { + if (packet_limit <= 1 || packets % packet_limit == 0) { time_t now; #ifdef _KERNEL ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 29c8295312dc - main - loader: small Makefile style change
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=29c8295312dc5eef8a0573bccdacd56167859cb2 commit 29c8295312dc5eef8a0573bccdacd56167859cb2 Author: Warner Losh AuthorDate: 2021-07-14 13:54:44 + Commit: Warner Losh CommitDate: 2021-07-14 14:33:01 + loader: small Makefile style change Move to using M.${option} and M.yes to collecting man pages to install. Sponsored by: Netflix --- stand/man/Makefile | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/stand/man/Makefile b/stand/man/Makefile index 5dbdc52183bd..d5e7ad791ffb 100644 --- a/stand/man/Makefile +++ b/stand/man/Makefile @@ -2,12 +2,10 @@ .include -.if ${MK_EFI} != "no" -MAN+= boot1.efi.8 -.endif -MAN+= loader.8 -.if ${MK_EFI} != "no" -MAN+= loader.efi.8 -.endif +M.${MK_EFI}+= boot1.efi.8 +M.yes+=loader.8 +M.${MK_EFI}+= loader.efi.8 + +MAN=${M.yes} .include ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: ce02bfa524b2 - stable/13 - pf: depessimize table handling
The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ce02bfa524b279ae0d5436b38b15353e523f5a92 commit ce02bfa524b279ae0d5436b38b15353e523f5a92 Author: Mateusz Guzik AuthorDate: 2021-07-02 11:19:56 + Commit: Mateusz Guzik CommitDate: 2021-07-14 14:50:12 + pf: depessimize table handling Creating tables and zeroing their counters induces excessive IPIs (14 per table), which in turns kills single- and multi-threaded performance. Work around the problem by extending per-CPU counters with a general counter populated on "zeroing" requests -- it stores the currently found sum. Then requests to report the current value are the sum of per-CPU counters subtracted by the saved value. Sample timings when loading a config with 100k tables on a 104-way box: stock: pfctl -f tables10.conf 0.39s user 69.37s system 99% cpu 1:09.76 total pfctl -f tables10.conf 0.40s user 68.14s system 99% cpu 1:08.54 total patched: pfctl -f tables10.conf 0.35s user 6.41s system 99% cpu 6.771 total pfctl -f tables10.conf 0.48s user 6.47s system 99% cpu 6.949 total Reviewed by:kp (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit f92c21a28cd856834249a008771b2f002e477a39) --- sys/net/pfvar.h | 62 --- sys/netpfil/pf/pf_table.c | 58 +--- 2 files changed, 85 insertions(+), 35 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 5d4860ec981a..3485592ffec7 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -814,16 +814,70 @@ struct pfr_tstats { int pfrts_refcnt[PFR_REFCNT_MAX]; }; +#ifdef _KERNEL + +struct pfr_kstate_counter { + counter_u64_t pkc_pcpu; + u_int64_t pkc_zero; +}; + +static inline int +pfr_kstate_counter_init(struct pfr_kstate_counter *pfrc, int flags) +{ + + pfrc->pkc_zero = 0; + pfrc->pkc_pcpu = counter_u64_alloc(flags); + if (pfrc->pkc_pcpu == NULL) + return (ENOMEM); + return (0); +} + +static inline void +pfr_kstate_counter_deinit(struct pfr_kstate_counter *pfrc) +{ + + counter_u64_free(pfrc->pkc_pcpu); +} + +static inline u_int64_t +pfr_kstate_counter_fetch(struct pfr_kstate_counter *pfrc) +{ + u_int64_t c; + + c = counter_u64_fetch(pfrc->pkc_pcpu); + c -= pfrc->pkc_zero; + return (c); +} + +static inline void +pfr_kstate_counter_zero(struct pfr_kstate_counter *pfrc) +{ + u_int64_t c; + + c = counter_u64_fetch(pfrc->pkc_pcpu); + pfrc->pkc_zero = c; +} + +static inline void +pfr_kstate_counter_add(struct pfr_kstate_counter *pfrc, int64_t n) +{ + + counter_u64_add(pfrc->pkc_pcpu, n); +} + struct pfr_ktstats { struct pfr_table pfrts_t; - counter_u64_tpfrkts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; - counter_u64_tpfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; - counter_u64_tpfrkts_match; - counter_u64_tpfrkts_nomatch; + struct pfr_kstate_counter pfrkts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; + struct pfr_kstate_counter pfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; + struct pfr_kstate_counterpfrkts_match; + struct pfr_kstate_counterpfrkts_nomatch; long pfrkts_tzero; int pfrkts_cnt; int pfrkts_refcnt[PFR_REFCNT_MAX]; }; + +#endif /* _KERNEL */ + #definepfrts_name pfrts_t.pfrt_name #define pfrts_flagspfrts_t.pfrt_flags diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index f643790ff620..cd7d96eacd13 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1326,15 +1326,15 @@ pfr_get_tstats(struct pfr_table *filter, struct pfr_tstats *tbl, int *size, for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { tbl->pfrts_packets[pfr_dir][pfr_op] = - counter_u64_fetch( - p->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_fetch( + &p->pfrkt_packets[pfr_dir][pfr_op]); tbl->pfrts_bytes[pfr_dir][pfr_op] = - counter_u64_fetch( - p->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_fetch( + &p->pfrkt_bytes[pfr_dir][pfr_op]); } } - tbl->pfrts_match = counter_u64_fetch(p->pfrkt_match); - tbl->pfrts_nomatch = counter_u64_fetch(p->pfrk
git: 8ef908c1d5b5 - stable/13 - pf: padalign global locks found in pf.c
The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8ef908c1d5b56f028dbedaefaa5e25f71cb198b5 commit 8ef908c1d5b56f028dbedaefaa5e25f71cb198b5 Author: Mateusz Guzik AuthorDate: 2021-07-05 09:26:29 + Commit: Mateusz Guzik CommitDate: 2021-07-14 14:50:12 + pf: padalign global locks found in pf.c Reviewed by:kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit f649cff58721f493f218a4d1fb88a12255945472) --- sys/net/pfvar.h | 4 ++-- sys/netpfil/pf/pf.c | 8 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 0e53c92fcd85..4f112c87d6d2 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -118,7 +118,7 @@ struct pfi_dynaddr { #definePF_STATE_LOCK_ASSERT(s) do {} while (0) #endif /* INVARIANTS */ -extern struct mtx pf_unlnkdrules_mtx; +extern struct mtx_padalign pf_unlnkdrules_mtx; #definePF_UNLNKDRULES_LOCK() mtx_lock(&pf_unlnkdrules_mtx) #definePF_UNLNKDRULES_UNLOCK() mtx_unlock(&pf_unlnkdrules_mtx) @@ -133,7 +133,7 @@ extern struct rmlock pf_rules_lock; #definePF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) #definePF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) -extern struct mtx pf_table_stats_lock; +extern struct mtx_padalign pf_table_stats_lock; #definePF_TABLE_STATS_LOCK() mtx_lock(&pf_table_stats_lock) #definePF_TABLE_STATS_UNLOCK() mtx_unlock(&pf_table_stats_lock) #definePF_TABLE_STATS_OWNED() mtx_owned(&pf_table_stats_lock) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index a33854a207aa..167d565d7413 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -178,7 +178,7 @@ STAILQ_HEAD(pf_send_head, pf_send_entry); VNET_DEFINE_STATIC(struct pf_send_head, pf_sendqueue); #defineV_pf_sendqueue VNET(pf_sendqueue) -static struct mtx pf_sendqueue_mtx; +static struct mtx_padalign pf_sendqueue_mtx; MTX_SYSINIT(pf_sendqueue_mtx, &pf_sendqueue_mtx, "pf send queue", MTX_DEF); #definePF_SENDQ_LOCK() mtx_lock(&pf_sendqueue_mtx) #definePF_SENDQ_UNLOCK() mtx_unlock(&pf_sendqueue_mtx) @@ -200,18 +200,18 @@ VNET_DEFINE_STATIC(struct pf_overload_head, pf_overloadqueue); VNET_DEFINE_STATIC(struct task, pf_overloadtask); #defineV_pf_overloadtask VNET(pf_overloadtask) -static struct mtx pf_overloadqueue_mtx; +static struct mtx_padalign pf_overloadqueue_mtx; MTX_SYSINIT(pf_overloadqueue_mtx, &pf_overloadqueue_mtx, "pf overload/flush queue", MTX_DEF); #definePF_OVERLOADQ_LOCK() mtx_lock(&pf_overloadqueue_mtx) #definePF_OVERLOADQ_UNLOCK() mtx_unlock(&pf_overloadqueue_mtx) VNET_DEFINE(struct pf_krulequeue, pf_unlinked_rules); -struct mtx pf_unlnkdrules_mtx; +struct mtx_padalign pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); -struct mtx pf_table_stats_lock; +struct mtx_padalign pf_table_stats_lock; MTX_SYSINIT(pf_table_stats_lock, &pf_table_stats_lock, "pf table stats", MTX_DEF); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: a65a22739870 - stable/13 - pf: allow table stats clearing and reading with ruleset rlock
The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a65a227398703c23168120723694f04c1a71737f commit a65a227398703c23168120723694f04c1a71737f Author: Mateusz Guzik AuthorDate: 2021-07-02 12:55:57 + Commit: Mateusz Guzik CommitDate: 2021-07-14 14:50:12 + pf: allow table stats clearing and reading with ruleset rlock Instead serialize against these operations with a dedicated lock. Prior to the change, When pushing 17 mln pps of traffic, calling DIOCRGETTSTATS in a loop would restrict throughput to about 7 mln. With the change there is no slowdown. Reviewed by:kp (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit dc1ab04e4c9ede3606985e0cce1200e3060ac166) --- sys/net/pfvar.h | 7 +++ sys/netpfil/pf/pf.c | 4 sys/netpfil/pf/pf_ioctl.c | 18 -- sys/netpfil/pf/pf_table.c | 2 ++ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 3485592ffec7..0e53c92fcd85 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -128,10 +128,17 @@ extern struct rmlock pf_rules_lock; #definePF_RULES_RUNLOCK() rm_runlock(&pf_rules_lock, &_pf_rules_tracker) #definePF_RULES_WLOCK()rm_wlock(&pf_rules_lock) #definePF_RULES_WUNLOCK() rm_wunlock(&pf_rules_lock) +#definePF_RULES_WOWNED() rm_wowned(&pf_rules_lock) #definePF_RULES_ASSERT() rm_assert(&pf_rules_lock, RA_LOCKED) #definePF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) #definePF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) +extern struct mtx pf_table_stats_lock; +#definePF_TABLE_STATS_LOCK() mtx_lock(&pf_table_stats_lock) +#definePF_TABLE_STATS_UNLOCK() mtx_unlock(&pf_table_stats_lock) +#definePF_TABLE_STATS_OWNED() mtx_owned(&pf_table_stats_lock) +#definePF_TABLE_STATS_ASSERT() mtx_assert(&pf_rules_lock, MA_OWNED) + extern struct sx pf_end_lock; #definePF_MODVER 1 diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 04a62535f461..a33854a207aa 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -211,6 +211,10 @@ struct mtx pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); +struct mtx pf_table_stats_lock; +MTX_SYSINIT(pf_table_stats_lock, &pf_table_stats_lock, "pf table stats", +MTX_DEF); + VNET_DEFINE_STATIC(uma_zone_t, pf_sources_z); #defineV_pf_sources_z VNET(pf_sources_z) uma_zone_t pf_mtag_z; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 4eebc8a43de8..694134c6c663 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -3726,10 +3726,12 @@ DIOCCHANGEADDR_error: error = ENODEV; break; } - PF_RULES_WLOCK(); + PF_TABLE_STATS_LOCK(); + PF_RULES_RLOCK(); n = pfr_table_count(&io->pfrio_table, io->pfrio_flags); if (n < 0) { - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); error = EINVAL; break; } @@ -3740,12 +3742,14 @@ DIOCCHANGEADDR_error: sizeof(struct pfr_tstats), M_TEMP, M_NOWAIT); if (pfrtstats == NULL) { error = ENOMEM; - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); break; } error = pfr_get_tstats(&io->pfrio_table, pfrtstats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); if (error == 0) error = copyout(pfrtstats, io->pfrio_buffer, totlen); free(pfrtstats, M_TEMP); @@ -3780,10 +3784,12 @@ DIOCCHANGEADDR_error: break; } - PF_RULES_WLOCK(); + PF_TABLE_STATS_LOCK(); + PF_RULES_RLOCK(); error = pfr_clr_tstats(pfrts, io->pfrio_size, &io->pfrio_nzero, io->pfrio_flags | PFR_FLAG_USERIOCTL); - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); free(pfrts, M_TEMP); break; } diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index cd7d96eacd13..5afc90e54d7c 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1864,6 +1864,8 @@ pfr_clstats_ktable(struct pfr_ktable *kt, long
git: cfaec275f6b4 - stable/13 - pf: add pf_find_state_all_exists
The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=cfaec275f6b4c7d463bc5acdb5a159252191f4b4 commit cfaec275f6b4c7d463bc5acdb5a159252191f4b4 Author: Mateusz Guzik AuthorDate: 2021-07-08 13:11:57 + Commit: Mateusz Guzik CommitDate: 2021-07-14 14:50:12 + pf: add pf_find_state_all_exists Reviewed by:kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 19d6e29b872232c47190344f3dfded2f73edd8ae) --- sys/net/pfvar.h| 2 ++ sys/netpfil/pf/pf.c| 9 + sys/netpfil/pf/pf_lb.c | 10 -- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 4f112c87d6d2..df86ce4f92c2 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1588,6 +1588,8 @@ pf_release_staten(struct pf_kstate *s, u_int n) extern struct pf_kstate*pf_find_state_byid(uint64_t, uint32_t); extern struct pf_kstate*pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); +extern boolpf_find_state_all_exists(struct pf_state_key_cmp *, + u_int); extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, struct pf_krule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_ksrc_node *); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 167d565d7413..ce836eb492f2 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1453,6 +1453,15 @@ second_run: return (ret); } +bool +pf_find_state_all_exists(struct pf_state_key_cmp *key, u_int dir) +{ + struct pf_kstate *s; + + s = pf_find_state_all(key, dir, NULL); + return (s != NULL); +} + /* END state table stuff */ static void diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index 5e281eccc144..000ee69d9ae9 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -244,13 +244,13 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, * (traceroute -I through nat) */ key.port[1] = sport; - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = sport; return (0); } } else if (low == high) { key.port[1] = htons(low); - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(low); return (0); } @@ -268,8 +268,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, /* low <= cut <= high */ for (tmp = cut; tmp <= high && tmp <= 0x; ++tmp) { key.port[1] = htons(tmp); - if (pf_find_state_all(&key, PF_IN, NULL) == - NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(tmp); return (0); } @@ -277,8 +276,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, tmp = cut; for (tmp -= 1; tmp >= low && tmp <= 0x; --tmp) { key.port[1] = htons(tmp); - if (pf_find_state_all(&key, PF_IN, NULL) == - NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(tmp); return (0); } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: d098fc21ee5b - stable/12 - pf: depessimize table handling
The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=d098fc21ee5bc260ffd79c53c0f7925145967041 commit d098fc21ee5bc260ffd79c53c0f7925145967041 Author: Mateusz Guzik AuthorDate: 2021-07-02 11:19:56 + Commit: Mateusz Guzik CommitDate: 2021-07-14 14:55:26 + pf: depessimize table handling Creating tables and zeroing their counters induces excessive IPIs (14 per table), which in turns kills single- and multi-threaded performance. Work around the problem by extending per-CPU counters with a general counter populated on "zeroing" requests -- it stores the currently found sum. Then requests to report the current value are the sum of per-CPU counters subtracted by the saved value. Sample timings when loading a config with 100k tables on a 104-way box: stock: pfctl -f tables10.conf 0.39s user 69.37s system 99% cpu 1:09.76 total pfctl -f tables10.conf 0.40s user 68.14s system 99% cpu 1:08.54 total patched: pfctl -f tables10.conf 0.35s user 6.41s system 99% cpu 6.771 total pfctl -f tables10.conf 0.48s user 6.47s system 99% cpu 6.949 total Reviewed by:kp (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit f92c21a28cd856834249a008771b2f002e477a39) --- sys/net/pfvar.h | 62 --- sys/netpfil/pf/pf_table.c | 58 +--- 2 files changed, 85 insertions(+), 35 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 6fbbb46b69b9..a98bdac54529 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -814,16 +814,70 @@ struct pfr_tstats { int pfrts_refcnt[PFR_REFCNT_MAX]; }; +#ifdef _KERNEL + +struct pfr_kstate_counter { + counter_u64_t pkc_pcpu; + u_int64_t pkc_zero; +}; + +static inline int +pfr_kstate_counter_init(struct pfr_kstate_counter *pfrc, int flags) +{ + + pfrc->pkc_zero = 0; + pfrc->pkc_pcpu = counter_u64_alloc(flags); + if (pfrc->pkc_pcpu == NULL) + return (ENOMEM); + return (0); +} + +static inline void +pfr_kstate_counter_deinit(struct pfr_kstate_counter *pfrc) +{ + + counter_u64_free(pfrc->pkc_pcpu); +} + +static inline u_int64_t +pfr_kstate_counter_fetch(struct pfr_kstate_counter *pfrc) +{ + u_int64_t c; + + c = counter_u64_fetch(pfrc->pkc_pcpu); + c -= pfrc->pkc_zero; + return (c); +} + +static inline void +pfr_kstate_counter_zero(struct pfr_kstate_counter *pfrc) +{ + u_int64_t c; + + c = counter_u64_fetch(pfrc->pkc_pcpu); + pfrc->pkc_zero = c; +} + +static inline void +pfr_kstate_counter_add(struct pfr_kstate_counter *pfrc, int64_t n) +{ + + counter_u64_add(pfrc->pkc_pcpu, n); +} + struct pfr_ktstats { struct pfr_table pfrts_t; - counter_u64_tpfrkts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; - counter_u64_tpfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; - counter_u64_tpfrkts_match; - counter_u64_tpfrkts_nomatch; + struct pfr_kstate_counter pfrkts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; + struct pfr_kstate_counter pfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; + struct pfr_kstate_counterpfrkts_match; + struct pfr_kstate_counterpfrkts_nomatch; long pfrkts_tzero; int pfrkts_cnt; int pfrkts_refcnt[PFR_REFCNT_MAX]; }; + +#endif /* _KERNEL */ + #definepfrts_name pfrts_t.pfrt_name #define pfrts_flagspfrts_t.pfrt_flags diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index e9fd5f133c3f..d0b91fff1656 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1327,15 +1327,15 @@ pfr_get_tstats(struct pfr_table *filter, struct pfr_tstats *tbl, int *size, for (pfr_dir = 0; pfr_dir < PFR_DIR_MAX; pfr_dir ++) { for (pfr_op = 0; pfr_op < PFR_OP_TABLE_MAX; pfr_op ++) { tbl->pfrts_packets[pfr_dir][pfr_op] = - counter_u64_fetch( - p->pfrkt_packets[pfr_dir][pfr_op]); + pfr_kstate_counter_fetch( + &p->pfrkt_packets[pfr_dir][pfr_op]); tbl->pfrts_bytes[pfr_dir][pfr_op] = - counter_u64_fetch( - p->pfrkt_bytes[pfr_dir][pfr_op]); + pfr_kstate_counter_fetch( + &p->pfrkt_bytes[pfr_dir][pfr_op]); } } - tbl->pfrts_match = counter_u64_fetch(p->pfrkt_match); - tbl->pfrts_nomatch = counter_u64_fetch(p->pfrk
git: a3b8a5841c59 - stable/12 - pf: padalign global locks found in pf.c
The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a3b8a5841c59f4cba9cd5c86d210cd525598daa4 commit a3b8a5841c59f4cba9cd5c86d210cd525598daa4 Author: Mateusz Guzik AuthorDate: 2021-07-05 09:26:29 + Commit: Mateusz Guzik CommitDate: 2021-07-14 14:55:32 + pf: padalign global locks found in pf.c Reviewed by:kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit f649cff58721f493f218a4d1fb88a12255945472) --- sys/net/pfvar.h | 4 ++-- sys/netpfil/pf/pf.c | 8 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 6c934ad47bf2..d327451d869a 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -118,7 +118,7 @@ struct pfi_dynaddr { #definePF_STATE_LOCK_ASSERT(s) do {} while (0) #endif /* INVARIANTS */ -extern struct mtx pf_unlnkdrules_mtx; +extern struct mtx_padalign pf_unlnkdrules_mtx; #definePF_UNLNKDRULES_LOCK() mtx_lock(&pf_unlnkdrules_mtx) #definePF_UNLNKDRULES_UNLOCK() mtx_unlock(&pf_unlnkdrules_mtx) @@ -133,7 +133,7 @@ extern struct rmlock pf_rules_lock; #definePF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) #definePF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) -extern struct mtx pf_table_stats_lock; +extern struct mtx_padalign pf_table_stats_lock; #definePF_TABLE_STATS_LOCK() mtx_lock(&pf_table_stats_lock) #definePF_TABLE_STATS_UNLOCK() mtx_unlock(&pf_table_stats_lock) #definePF_TABLE_STATS_OWNED() mtx_owned(&pf_table_stats_lock) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index aa7a01d50823..5f201c1228eb 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -179,7 +179,7 @@ STAILQ_HEAD(pf_send_head, pf_send_entry); VNET_DEFINE_STATIC(struct pf_send_head, pf_sendqueue); #defineV_pf_sendqueue VNET(pf_sendqueue) -static struct mtx pf_sendqueue_mtx; +static struct mtx_padalign pf_sendqueue_mtx; MTX_SYSINIT(pf_sendqueue_mtx, &pf_sendqueue_mtx, "pf send queue", MTX_DEF); #definePF_SENDQ_LOCK() mtx_lock(&pf_sendqueue_mtx) #definePF_SENDQ_UNLOCK() mtx_unlock(&pf_sendqueue_mtx) @@ -201,18 +201,18 @@ VNET_DEFINE_STATIC(struct pf_overload_head, pf_overloadqueue); VNET_DEFINE_STATIC(struct task, pf_overloadtask); #defineV_pf_overloadtask VNET(pf_overloadtask) -static struct mtx pf_overloadqueue_mtx; +static struct mtx_padalign pf_overloadqueue_mtx; MTX_SYSINIT(pf_overloadqueue_mtx, &pf_overloadqueue_mtx, "pf overload/flush queue", MTX_DEF); #definePF_OVERLOADQ_LOCK() mtx_lock(&pf_overloadqueue_mtx) #definePF_OVERLOADQ_UNLOCK() mtx_unlock(&pf_overloadqueue_mtx) VNET_DEFINE(struct pf_krulequeue, pf_unlinked_rules); -struct mtx pf_unlnkdrules_mtx; +struct mtx_padalign pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); -struct mtx pf_table_stats_lock; +struct mtx_padalign pf_table_stats_lock; MTX_SYSINIT(pf_table_stats_lock, &pf_table_stats_lock, "pf table stats", MTX_DEF); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 7267f83272b1 - stable/12 - pf: allow table stats clearing and reading with ruleset rlock
The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=7267f83272b148f8734c0ced0489ff1022c1f68d commit 7267f83272b148f8734c0ced0489ff1022c1f68d Author: Mateusz Guzik AuthorDate: 2021-07-02 12:55:57 + Commit: Mateusz Guzik CommitDate: 2021-07-14 14:55:29 + pf: allow table stats clearing and reading with ruleset rlock Instead serialize against these operations with a dedicated lock. Prior to the change, When pushing 17 mln pps of traffic, calling DIOCRGETTSTATS in a loop would restrict throughput to about 7 mln. With the change there is no slowdown. Reviewed by:kp (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit dc1ab04e4c9ede3606985e0cce1200e3060ac166) --- sys/net/pfvar.h | 7 +++ sys/netpfil/pf/pf.c | 4 sys/netpfil/pf/pf_ioctl.c | 18 -- sys/netpfil/pf/pf_table.c | 2 ++ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index a98bdac54529..6c934ad47bf2 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -128,10 +128,17 @@ extern struct rmlock pf_rules_lock; #definePF_RULES_RUNLOCK() rm_runlock(&pf_rules_lock, &_pf_rules_tracker) #definePF_RULES_WLOCK()rm_wlock(&pf_rules_lock) #definePF_RULES_WUNLOCK() rm_wunlock(&pf_rules_lock) +#definePF_RULES_WOWNED() rm_wowned(&pf_rules_lock) #definePF_RULES_ASSERT() rm_assert(&pf_rules_lock, RA_LOCKED) #definePF_RULES_RASSERT() rm_assert(&pf_rules_lock, RA_RLOCKED) #definePF_RULES_WASSERT() rm_assert(&pf_rules_lock, RA_WLOCKED) +extern struct mtx pf_table_stats_lock; +#definePF_TABLE_STATS_LOCK() mtx_lock(&pf_table_stats_lock) +#definePF_TABLE_STATS_UNLOCK() mtx_unlock(&pf_table_stats_lock) +#definePF_TABLE_STATS_OWNED() mtx_owned(&pf_table_stats_lock) +#definePF_TABLE_STATS_ASSERT() mtx_assert(&pf_rules_lock, MA_OWNED) + extern struct sx pf_end_lock; #definePF_MODVER 1 diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index cb616ef5788f..aa7a01d50823 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -212,6 +212,10 @@ struct mtx pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); +struct mtx pf_table_stats_lock; +MTX_SYSINIT(pf_table_stats_lock, &pf_table_stats_lock, "pf table stats", +MTX_DEF); + VNET_DEFINE_STATIC(uma_zone_t, pf_sources_z); #defineV_pf_sources_z VNET(pf_sources_z) uma_zone_t pf_mtag_z; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 0481e58ae1e2..eb9719886bbe 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -3740,10 +3740,12 @@ DIOCCHANGEADDR_error: error = ENODEV; break; } - PF_RULES_WLOCK(); + PF_TABLE_STATS_LOCK(); + PF_RULES_RLOCK(); n = pfr_table_count(&io->pfrio_table, io->pfrio_flags); if (n < 0) { - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); error = EINVAL; break; } @@ -3754,12 +3756,14 @@ DIOCCHANGEADDR_error: sizeof(struct pfr_tstats), M_TEMP, M_NOWAIT); if (pfrtstats == NULL) { error = ENOMEM; - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); break; } error = pfr_get_tstats(&io->pfrio_table, pfrtstats, &io->pfrio_size, io->pfrio_flags | PFR_FLAG_USERIOCTL); - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); if (error == 0) error = copyout(pfrtstats, io->pfrio_buffer, totlen); free(pfrtstats, M_TEMP); @@ -3798,10 +3802,12 @@ DIOCCHANGEADDR_error: break; } - PF_RULES_WLOCK(); + PF_TABLE_STATS_LOCK(); + PF_RULES_RLOCK(); error = pfr_clr_tstats(pfrts, io->pfrio_size, &io->pfrio_nzero, io->pfrio_flags | PFR_FLAG_USERIOCTL); - PF_RULES_WUNLOCK(); + PF_RULES_RUNLOCK(); + PF_TABLE_STATS_UNLOCK(); free(pfrts, M_TEMP); break; } diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index d0b91fff1656..8dbab5e7bbe1 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1865,6 +1865,8 @@ pfr_clstats_ktable(struct pfr_ktable *kt, long
git: db306b0b412a - stable/12 - pf: add pf_find_state_all_exists
The branch stable/12 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=db306b0b412a0d14c8a25ab5194c82106a09d0e2 commit db306b0b412a0d14c8a25ab5194c82106a09d0e2 Author: Mateusz Guzik AuthorDate: 2021-07-08 13:11:57 + Commit: Mateusz Guzik CommitDate: 2021-07-14 14:55:35 + pf: add pf_find_state_all_exists Reviewed by:kp Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 19d6e29b872232c47190344f3dfded2f73edd8ae) --- sys/net/pfvar.h| 2 ++ sys/netpfil/pf/pf.c| 9 + sys/netpfil/pf/pf_lb.c | 10 -- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index d327451d869a..b2c4231f29cc 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1589,6 +1589,8 @@ pf_release_staten(struct pf_kstate *s, u_int n) extern struct pf_kstate*pf_find_state_byid(uint64_t, uint32_t); extern struct pf_kstate*pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); +extern boolpf_find_state_all_exists(struct pf_state_key_cmp *, + u_int); extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, struct pf_krule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_ksrc_node *); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 5f201c1228eb..6cabec0fdeaa 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1453,6 +1453,15 @@ second_run: return (ret); } +bool +pf_find_state_all_exists(struct pf_state_key_cmp *key, u_int dir) +{ + struct pf_kstate *s; + + s = pf_find_state_all(key, dir, NULL); + return (s != NULL); +} + /* END state table stuff */ static void diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index 8160166edc95..b7079c47308a 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -244,13 +244,13 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, * (traceroute -I through nat) */ key.port[1] = sport; - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = sport; return (0); } } else if (low == high) { key.port[1] = htons(low); - if (pf_find_state_all(&key, PF_IN, NULL) == NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(low); return (0); } @@ -268,8 +268,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, /* low <= cut <= high */ for (tmp = cut; tmp <= high && tmp <= 0x; ++tmp) { key.port[1] = htons(tmp); - if (pf_find_state_all(&key, PF_IN, NULL) == - NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(tmp); return (0); } @@ -277,8 +276,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_krule *r, tmp = cut; for (tmp -= 1; tmp >= low && tmp <= 0x; --tmp) { key.port[1] = htons(tmp); - if (pf_find_state_all(&key, PF_IN, NULL) == - NULL) { + if (!pf_find_state_all_exists(&key, PF_IN)) { *nport = htons(tmp); return (0); } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: d379886a4170 - main - Filter out LBA formats with LBA Data Size of 0.
The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d379886a4170fa3d95a5354612a5e2c15b104841 commit d379886a4170fa3d95a5354612a5e2c15b104841 Author: Alexander Motin AuthorDate: 2021-07-14 18:01:22 + Commit: Alexander Motin CommitDate: 2021-07-14 18:05:20 + Filter out LBA formats with LBA Data Size of 0. According to the spec: "If the value reported is 0h, then LBA format is not supported / used or is not currently available". MFC after: 1 week --- sbin/nvmecontrol/identify.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/nvmecontrol/identify.c b/sbin/nvmecontrol/identify.c index 86b7369883fb..6cd7ad0fdc2d 100644 --- a/sbin/nvmecontrol/identify.c +++ b/sbin/nvmecontrol/identify.c @@ -175,6 +175,8 @@ print_namespace(struct nvme_namespace_data *nsdata) lbaf = nsdata->lbaf[i]; lbads = (lbaf >> NVME_NS_DATA_LBAF_LBADS_SHIFT) & NVME_NS_DATA_LBAF_LBADS_MASK; + if (lbads == 0) + continue; ms = (lbaf >> NVME_NS_DATA_LBAF_MS_SHIFT) & NVME_NS_DATA_LBAF_MS_MASK; rp = (lbaf >> NVME_NS_DATA_LBAF_RP_SHIFT) & ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 325ff9327459 - main - Clear the accessed bit when copying a managed superpage mapping
The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=325ff9327459bc7307130675fa19367ff8b02310 commit 325ff9327459bc7307130675fa19367ff8b02310 Author: Alan Cox AuthorDate: 2021-07-13 07:30:43 + Commit: Alan Cox CommitDate: 2021-07-14 18:06:10 + Clear the accessed bit when copying a managed superpage mapping pmap_copy() is used to speculatively create mappings, so those mappings should not have their access bit preset. Reviewed by:kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31162 --- sys/amd64/amd64/pmap.c | 17 - sys/arm64/arm64/pmap.c | 18 -- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 31681e255af1..427fbdf44830 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -7775,6 +7775,9 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, continue; if (srcptepaddr & PG_PS) { + /* +* We can only virtual copy whole superpages. +*/ if ((addr & PDRMASK) != 0 || addr + NBPDR > end_addr) continue; pde = pmap_alloc_pde(dst_pmap, addr, &dst_pdpg, NULL); @@ -7783,7 +7786,19 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, if (*pde == 0 && ((srcptepaddr & PG_MANAGED) == 0 || pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr, PMAP_ENTER_NORECLAIM, &lock))) { - *pde = srcptepaddr & ~PG_W; + /* +* We leave the dirty bit unchanged because +* managed read/write superpage mappings are +* required to be dirty. However, managed +* superpage mappings are not required to +* have their accessed bit set, so we clear +* it because we don't know if this mapping +* will be used. +*/ + srcptepaddr &= ~PG_W; + if ((srcptepaddr & PG_MANAGED) != 0) + srcptepaddr &= ~PG_A; + *pde = srcptepaddr; pmap_resident_count_adj(dst_pmap, NBPDR / PAGE_SIZE); counter_u64_add(pmap_pde_mappings, 1); diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 8ed1b86bd58c..678feae55c25 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -4557,6 +4557,9 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, if (srcptepaddr == 0) continue; if ((srcptepaddr & ATTR_DESCR_MASK) == L2_BLOCK) { + /* +* We can only virtual copy whole superpages. +*/ if ((addr & L2_OFFSET) != 0 || addr + L2_SIZE > end_addr) continue; @@ -4567,8 +4570,19 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, ((srcptepaddr & ATTR_SW_MANAGED) == 0 || pmap_pv_insert_l2(dst_pmap, addr, srcptepaddr, PMAP_ENTER_NORECLAIM, &lock))) { - mask = ATTR_SW_WIRED; - pmap_store(l2, srcptepaddr & ~mask); + /* +* We leave the dirty bit unchanged because +* managed read/write superpage mappings are +* required to be dirty. However, managed +* superpage mappings are not required to +* have their accessed bit set, so we clear +* it because we don't know if this mapping +* will be used. +*/ + srcptepaddr &= ~ATTR_SW_WIRED; + if ((srcptepaddr & ATTR_SW_MANAGED) != 0) + srcptepaddr &= ~ATTR_AF; + pmap_store(l2, srcptepaddr); pmap_resident_count_inc(dst_pmap, L2_SIZE / PAGE_SIZE); atomic_add_long(&pmap_l2_mappings, 1); _
git: dbf1dce8d6d2 - main - For ns identify/delete allow nsid of 0xffffffff.
The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=dbf1dce8d6d2d0eedac5402c1f137a80805179ca commit dbf1dce8d6d2d0eedac5402c1f137a80805179ca Author: Alexander Motin AuthorDate: 2021-07-14 18:56:34 + Commit: Alexander Motin CommitDate: 2021-07-14 19:05:56 + For ns identify/delete allow nsid of 0x. The first should report common parameters, the second should delete all namespaces. MFC after: 1 week --- sbin/nvmecontrol/ns.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sbin/nvmecontrol/ns.c b/sbin/nvmecontrol/ns.c index dd20e4e47967..1da0cf01a69f 100644 --- a/sbin/nvmecontrol/ns.c +++ b/sbin/nvmecontrol/ns.c @@ -198,7 +198,7 @@ static struct delete_options { uint32_tnsid; const char *dev; } delete_opt = { - .nsid = NONE, + .nsid = NONE - 1, .dev = NULL, }; @@ -331,7 +331,7 @@ static struct identify_options { .hex = false, .verbose = false, .dev = NULL, - .nsid = NONE, + .nsid = NONE - 1, }; static const struct opts identify_opts[] = { @@ -639,12 +639,12 @@ nsdelete(const struct cmd *f, int argc, char *argv[]) if (nsid != 0) { close(fd); open_dev(path, &fd, 1, 1); - } else if (delete_opt.nsid == NONE) { + } else if (delete_opt.nsid == NONE - 1) { close(fd); fprintf(stderr, "No NSID specified"); arg_help(argc, argv, f); } - if (delete_opt.nsid != NONE) + if (delete_opt.nsid != NONE - 1) nsid = delete_opt.nsid; free(path); if (read_controller_data(fd, &cd)) @@ -912,12 +912,12 @@ nsidentify(const struct cmd *f, int argc, char *argv[]) if (nsid != 0) { close(fd); open_dev(path, &fd, 1, 1); - } else if (identify_opt.nsid == NONE) { + } else if (identify_opt.nsid == NONE - 1) { close(fd); fprintf(stderr, "No NSID specified"); arg_help(argc, argv, f); } - if (identify_opt.nsid != NONE) + if (identify_opt.nsid != NONE - 1) nsid = identify_opt.nsid; if (read_controller_data(fd, &cd)) errx(EX_IOERR, "Identify request failed"); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: d1a0eab9fbc4 - main - Partially revert previous commit.
The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d1a0eab9fbc426ed8cbbddcd90720180c44ce36b commit d1a0eab9fbc426ed8cbbddcd90720180c44ce36b Author: Alexander Motin AuthorDate: 2021-07-14 19:46:22 + Commit: Alexander Motin CommitDate: 2021-07-14 19:46:22 + Partially revert previous commit. ns identify does not allow nsid of 0x. Only general identify allows it. MFC after: 1 week --- sbin/nvmecontrol/ns.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/nvmecontrol/ns.c b/sbin/nvmecontrol/ns.c index 1da0cf01a69f..5ec6a305b8b9 100644 --- a/sbin/nvmecontrol/ns.c +++ b/sbin/nvmecontrol/ns.c @@ -331,7 +331,7 @@ static struct identify_options { .hex = false, .verbose = false, .dev = NULL, - .nsid = NONE - 1, + .nsid = NONE, }; static const struct opts identify_opts[] = { @@ -912,12 +912,12 @@ nsidentify(const struct cmd *f, int argc, char *argv[]) if (nsid != 0) { close(fd); open_dev(path, &fd, 1, 1); - } else if (identify_opt.nsid == NONE - 1) { + } else if (identify_opt.nsid == NONE) { close(fd); fprintf(stderr, "No NSID specified"); arg_help(argc, argv, f); } - if (identify_opt.nsid != NONE - 1) + if (identify_opt.nsid != NONE) nsid = identify_opt.nsid; if (read_controller_data(fd, &cd)) errx(EX_IOERR, "Identify request failed"); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 7f5508fe78d1 - main - nfscl: Avoid KASSERT() panic in cache_enter_time()
The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=7f5508fe78d17af968fe67e00ffa7c975aa2c67d commit 7f5508fe78d17af968fe67e00ffa7c975aa2c67d Author: Rick Macklem AuthorDate: 2021-07-14 20:33:37 + Commit: Rick Macklem CommitDate: 2021-07-14 20:33:37 + nfscl: Avoid KASSERT() panic in cache_enter_time() Commit 844aa31c6d87 added cache_enter_time_flags(), specifically so that the NFS client could specify that cache enter replace any stale entry for the same name. Doing so avoids a KASSERT() panic() in cache_enter_time(), as reported by the PR. This patch uses cache_enter_time_flags() for Readdirplus, to avoid the panic(), since it is impossible for the NFS client to know if another client (or a local process on the NFS server) has replaced a file with another file of the same name. This patch only affects NFS mounts that use the "rdirplus" mount option. There may be other places in the NFS client where this needs to be done, but no panic() has been observed during testing. PR: 257043 MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clrpcops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 213399551097..acc4bc7b9f88 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -3762,11 +3762,11 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, ndp->ni_dvp != ndp->ni_vp && (newvp->v_type != VDIR || dctime.tv_sec != 0)) { - cache_enter_time(ndp->ni_dvp, + cache_enter_time_flags(ndp->ni_dvp, ndp->ni_vp, cnp, &nfsva.na_ctime, newvp->v_type != VDIR ? NULL : - &dctime); + &dctime, VFS_CACHE_DROPOLD); } if (unlocknewvp) vput(newvp); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: cd2e5ae71bb1 - stable/13 - nfscl: Improve "Consider increasing kern.ipc.maxsockbuf" message
The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=cd2e5ae71bb1f283fba1d6dfd7aa63708ff1529f commit cd2e5ae71bb1f283fba1d6dfd7aa63708ff1529f Author: Rick Macklem AuthorDate: 2021-06-30 22:15:41 + Commit: Rick Macklem CommitDate: 2021-07-14 20:45:41 + nfscl: Improve "Consider increasing kern.ipc.maxsockbuf" message When the setting of kern.ipc.maxsockbuf is less than what is desired for I/O based on vfs.maxbcachebuf and vfs.nfs.bufpackets, a console message of "Consider increasing kern.ipc.maxsockbuf". is printed. This patch modifies the message to provide a suggested value for kern.ipc.maxsockbuf. Note that the setting is only needed when the NFS rsize/wsize is set to vfs.maxbcachebuf. While here, make nfs_bufpackets global, so that it can be used by a future patch that adds a sysctl to set the NFS server's maximum I/O size. Also, remove "sizeof(u_int32_t)" from the maximum packet length, since NFS_MAXXDR is already an "overestimate" of the actual length. (cherry picked from commit c5f4772c66d2eb31b84a84a89c8a284043f03452) --- sys/fs/nfs/nfs_commonkrpc.c | 28 +--- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index 04ef04955ce0..63ff02331a0e 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -101,8 +101,8 @@ extern int nfscl_debuglevel; extern int nfsrv_lease; SVCPOOL*nfscbd_pool; +intnfs_bufpackets = 4; static int nfsrv_gsscallbackson = 0; -static int nfs_bufpackets = 4; static int nfs_reconnects; static int nfs3_jukebox_delay = 10; static int nfs_skip_wcc_data_onerr = 1; @@ -180,6 +180,7 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, struct thread *td = curthread; SVCXPRT *xprt; struct timeval timo; + uint64_t tval; /* * We need to establish the socket using the credentials of @@ -238,8 +239,21 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, do { if (error != 0 && pktscale > 2) { if (nmp != NULL && nrp->nr_sotype == SOCK_STREAM && - pktscale == pktscalesav) - printf("Consider increasing kern.ipc.maxsockbuf\n"); + pktscale == pktscalesav) { + /* +* Suggest vfs.nfs.bufpackets * maximum RPC message, +* adjusted for the sb_max->sb_max_adj conversion of +* MCLBYTES / (MSIZE + MCLBYTES) as the minimum setting +* for kern.ipc.maxsockbuf. +*/ + tval = (NFS_MAXBSIZE + NFS_MAXXDR) * nfs_bufpackets; + tval *= MSIZE + MCLBYTES; + tval += MCLBYTES - 1; /* Round up divide by MCLBYTES. */ + tval /= MCLBYTES; + printf("Consider increasing kern.ipc.maxsockbuf to a " + "minimum of %ju to support %ubyte NFS I/O\n", + (uintmax_t)tval, NFS_MAXBSIZE); + } pktscale--; } if (nrp->nr_sotype == SOCK_DGRAM) { @@ -255,10 +269,10 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq *nrp, if (nrp->nr_sotype != SOCK_STREAM) panic("nfscon sotype"); if (nmp != NULL) { - sndreserve = (NFS_MAXBSIZE + NFS_MAXXDR + - sizeof (u_int32_t)) * pktscale; - rcvreserve = (NFS_MAXBSIZE + NFS_MAXXDR + - sizeof (u_int32_t)) * pktscale; + sndreserve = (NFS_MAXBSIZE + NFS_MAXXDR) * + pktscale; + rcvreserve = (NFS_MAXBSIZE + NFS_MAXXDR) * + pktscale; } else { sndreserve = rcvreserve = 1024 * pktscale; } ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 56d33e86b74b - main - Remove incorrect __restricted labels from strcspn
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=56d33e86b74b197a36f42255824b56715c96a596 commit 56d33e86b74b197a36f42255824b56715c96a596 Author: Alfonso Gregory AuthorDate: 2021-07-14 21:48:35 + Commit: Warner Losh CommitDate: 2021-07-14 22:11:38 + Remove incorrect __restricted labels from strcspn strcspn should never have had the __restrict keywords. While both of these strings are const, it may have unindended side effects. While this is the kernel, the POSIX definition also omits restrict. Reviewed by:imp@ Pull Request: https://github.com/freebsd/freebsd-src/pull/497 --- sys/libkern/strcspn.c | 2 +- sys/sys/libkern.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/libkern/strcspn.c b/sys/libkern/strcspn.c index fce6d4b8b071..62bfcf78eeb7 100644 --- a/sys/libkern/strcspn.c +++ b/sys/libkern/strcspn.c @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #defineBIT(c) ((u_long)1 << ((u_char)(c) % LONG_BIT)) size_t -strcspn(const char * __restrict s, const char * __restrict charset) +strcspn(const char *s, const char *charset) { /* * NB: idx and bit are temporaries whose use causes gcc 3.4.2 to diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index c5bd5a07a0b9..37838c99ba0c 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -174,8 +174,8 @@ char*strchr(const char *, int); char *strchrnul(const char *, int); int strcmp(const char *, const char *); char *strcpy(char * __restrict, const char * __restrict); -size_t strcspn(const char * __restrict, const char * __restrict) __pure; char *strdup_flags(const char *__restrict, struct malloc_type *, int); +size_t strcspn(const char *, const char *) __pure; char *strdup(const char *__restrict, struct malloc_type *); char *strncat(char *, const char *, size_t); char *strndup(const char *__restrict, size_t, struct malloc_type *); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 13c98cd06b80 - main - loader(8): fix path to be correct loader.4th.
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=13c98cd06b80afd0d062211ee8f1bfeb8c6cb065 commit 13c98cd06b80afd0d062211ee8f1bfeb8c6cb065 Author: Warner Losh AuthorDate: 2021-07-14 22:34:43 + Commit: Warner Losh CommitDate: 2021-07-14 22:34:43 + loader(8): fix path to be correct loader.4th. boot.4th was a thing for only a few months around FreeBSD 3.1. The correct name has been loader.4th for a long time. MFC After: 2 days Sponsored by: Netflix --- stand/man/loader.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stand/man/loader.8 b/stand/man/loader.8 index f6e550ae9862..e658b41f8338 100644 --- a/stand/man/loader.8 +++ b/stand/man/loader.8 @@ -76,7 +76,7 @@ is set to 24. Next, .Tn FICL is initialized, the builtin words are added to its vocabulary, and -.Pa /boot/boot.4th +.Pa /boot/loader.4th is processed if it exists. No disk switching is possible while that file is being read. The inner interpreter @@ -982,7 +982,7 @@ Currently, MD is only supported in .It Pa /boot/loader .Nm itself. -.It Pa /boot/boot.4th +.It Pa /boot/loader.4th Additional .Tn FICL initialization. ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 9873c807dac1 - main - loader: Create loader_simp(8) to document simple version of loader
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9873c807dac1f8b83b9f7bc9a8d4e318ea295b55 commit 9873c807dac1f8b83b9f7bc9a8d4e318ea295b55 Author: Warner Losh AuthorDate: 2021-07-14 22:43:25 + Commit: Warner Losh CommitDate: 2021-07-14 22:59:51 + loader: Create loader_simp(8) to document simple version of loader loader_simp is a much simplified version of loader that will process a linear sequence of commands from loader.rc. It has neither Forth nor Lua built in and is much smaller. Document it. This is largely copied from loader.8 since it implements those built-in commands. Future revisions will fix this duplication. Sponsored by: Netflix --- stand/man/Makefile | 1 + stand/man/loader_simp.8 | 762 2 files changed, 763 insertions(+) diff --git a/stand/man/Makefile b/stand/man/Makefile index d5e7ad791ffb..5523908b6814 100644 --- a/stand/man/Makefile +++ b/stand/man/Makefile @@ -5,6 +5,7 @@ M.${MK_EFI}+= boot1.efi.8 M.yes+=loader.8 M.${MK_EFI}+= loader.efi.8 +M.yes+=loader_simp.8 MAN=${M.yes} diff --git a/stand/man/loader_simp.8 b/stand/man/loader_simp.8 new file mode 100644 index ..689996f244fd --- /dev/null +++ b/stand/man/loader_simp.8 @@ -0,0 +1,762 @@ +.\" Copyright (c) 1999 Daniel C. Sobral +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 14, 2021 +.Dt LOADER 8 +.Os +.Sh NAME +.Nm loader +.Nd kernel bootstrapping final stage +.Sh DESCRIPTION +The program called +.Nm +is the final stage of +.Fx Ns 's +kernel bootstrapping process. +On IA32 (i386) architectures, it is a +.Pa BTX +client. +It is linked statically to +.Xr libstand 3 +and usually located in the directory +.Pa /boot . +.Pp +It provides a scripting language that can be used to +automate tasks, do pre-configuration or assist in recovery +procedures. +This scripting language is roughly divided in +two main components. +The smaller one is a set of commands +designed for direct use by the casual user, called "builtin +commands" for historical reasons. +The main drive behind these commands is user-friendliness. +The bigger component is an +.Tn ANS +Forth compatible Forth interpreter based on FICL, by +.An John Sadler . +.Pp +During initialization, +.Nm +will probe for a console and set the +.Va console +variable, or set it to serial console +.Pq Dq Li comconsole +if the previous boot stage used that. +If multiple consoles are selected, they will be listed separated by spaces. +Then, devices are probed, +.Va currdev +and +.Va loaddev +are set, and +.Va LINES +is set to 24. +After that, +.Pa /boot/loader.rc +is processed if available. +These files are processed through the +.Ic include +command, which reads all of them into memory before processing them, +making disk changes possible. +.Pp +At this point, if an +.Ic autoboot +has not been tried, and if +.Va autoboot_delay +is not set to +.Dq Li NO +(not case sensitive), then an +.Ic autoboot +will be tried. +If the system gets past this point, +.Va prompt +will be set and +.Nm +will engage interactive mode. +Please note that historically even when +.Va autoboot_delay +is set to +.Dq Li 0 +user will be able to interrupt autoboot process by pressing some key +on the console while kernel and modules are being loaded. +In some +cases such behaviour may be undesirable, to prevent it set +.Va autoboot_delay +to +.Dq Li -1 , +in this case +.Nm +will engage interactive mode only if +.Ic autoboot +has failed. +.Sh BUILTIN COMMANDS +In +.Nm , +bui
git: 0bdb2cbf9d7c - main - procctl(PROC_ASLR_STATUS): fix vmspace leak
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0bdb2cbf9d7c4366a0668b4563c8630538a50086 commit 0bdb2cbf9d7c4366a0668b4563c8630538a50086 Author: Konstantin Belousov AuthorDate: 2021-07-14 23:40:04 + Commit: Konstantin Belousov CommitDate: 2021-07-15 00:02:50 + procctl(PROC_ASLR_STATUS): fix vmspace leak Reported by:jhb Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/kern/kern_procctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c index 4eb226c6b1b3..68fa4bc0c3ac 100644 --- a/sys/kern/kern_procctl.c +++ b/sys/kern/kern_procctl.c @@ -530,8 +530,9 @@ aslr_status(struct thread *td, struct proc *p, int *data) _PHOLD(p); PROC_UNLOCK(p); vm = vmspace_acquire_ref(p); - if (vm != NULL && (vm->vm_map.flags & MAP_ASLR) != 0) { - d |= PROC_ASLR_ACTIVE; + if (vm != NULL) { + if ((vm->vm_map.flags & MAP_ASLR) != 0) + d |= PROC_ASLR_ACTIVE; vmspace_free(vm); } PROC_LOCK(p); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: f39d9c913185 - main - libkern: import strnstr from libc
The branch main has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f39d9c91318569a1ab7507d46e15147f5fef659e commit f39d9c91318569a1ab7507d46e15147f5fef659e Author: Greg V AuthorDate: 2021-07-15 00:52:32 + Commit: Neel Chauhan CommitDate: 2021-07-15 00:55:08 + libkern: import strnstr from libc Required for drm-kmod 5.6 (amdgpu). Reviewed by:bz, hselasky, nc Differential Revision: https://reviews.freebsd.org/D31131 --- sys/conf/files| 1 + sys/sys/libkern.h | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/conf/files b/sys/conf/files index 245bbcb01374..ee1e356d9f61 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4099,6 +4099,7 @@ libkern/strncat.c standard libkern/strncmp.c standard libkern/strncpy.c standard libkern/strnlen.c standard +libkern/strnstr.c standard libkern/strrchr.c standard libkern/strsep.c standard libkern/strspn.c standard diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index 37838c99ba0c..d8d3dce1b705 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -186,6 +186,7 @@ int strncasecmp(const char *, const char *, size_t); int strncmp(const char *, const char *, size_t); char *strncpy(char * __restrict, const char * __restrict, size_t); size_t strnlen(const char *, size_t); +char *strnstr(const char *, const char *, size_t); char *strrchr(const char *, int); char *strsep(char **, const char *delim); size_t strspn(const char *, const char *); ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 4211457e40e0 - main - Add missing libkern/strnstr.c file
The branch main has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4211457e40e07f6f820c4171c7db81f028fd23af commit 4211457e40e07f6f820c4171c7db81f028fd23af Author: Greg V AuthorDate: 2021-07-15 00:56:03 + Commit: Neel Chauhan CommitDate: 2021-07-15 00:56:03 + Add missing libkern/strnstr.c file Apparently it wasn't picked up by git. Reviewed by:bz, hselasky, nc Differential Revision: https://reviews.freebsd.org/D31131 --- sys/libkern/strnstr.c | 64 +++ 1 file changed, 64 insertions(+) diff --git a/sys/libkern/strnstr.c b/sys/libkern/strnstr.c new file mode 100644 index ..9183e2a7017d --- /dev/null +++ b/sys/libkern/strnstr.c @@ -0,0 +1,64 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2001 Mike Barcroft + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + *may be used to endorse or promote products derived from this software + *without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include + +/* + * Find the first occurrence of find in s, where the search is limited to the + * first slen characters of s. + */ +char * +strnstr(const char *s, const char *find, size_t slen) +{ + char c, sc; + size_t len; + + if ((c = *find++) != '\0') { + len = strlen(find); + do { + do { + if (slen-- < 1 || (sc = *s++) == '\0') + return (NULL); + } while (sc != c); + if (len > slen) + return (NULL); + } while (strncmp(s, find, len) != 0); + s--; + } + return (__DECONST(char *, s)); +} ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
Re: git: 4211457e40e0 - main - Add missing libkern/strnstr.c file
On Thu, Jul 15, 2021 at 12:56:35AM +, Neel Chauhan wrote: > commit 4211457e40e07f6f820c4171c7db81f028fd23af > > Add missing libkern/strnstr.c file > > Apparently it wasn't picked up by git. That's why you first commit, then "git show HEAD" to see that commit is correct, and only then "git push freebsd". ./danfe ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"
git: 7a0c0ff7ee25 - main - loader: make sure CPUTYPE is ignored when building
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7a0c0ff7ee25ff1efa3dbedcb20d2c80178639cc commit 7a0c0ff7ee25ff1efa3dbedcb20d2c80178639cc Author: Warner Losh AuthorDate: 2021-07-15 03:06:08 + Commit: Warner Losh CommitDate: 2021-07-15 03:06:19 + loader: make sure CPUTYPE is ignored when building CPUTYPE?=native causes -march=native to be added to the command line. When the host machine is haswell, this causes some versions of clang to generate code that can't execute in the efi boot loader environment. Set _CPUCFLAGS= to undo what's done bsd.cpu.mk. bsd.cpu.mk is included too early to control with NO_CPU_CFLAGS here. The only other option is to put that in all the Makefiles, and this is less tedious and error prone. PR: 194641 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31187 MFC After: 1 week --- stand/defs.mk | 8 1 file changed, 8 insertions(+) diff --git a/stand/defs.mk b/stand/defs.mk index 54b7a7250c48..d50c89879613 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -15,6 +15,14 @@ MAN= NO_PIC= INTERNALLIB= .endif +# Should be NO_CPU_FLAGS, but bsd.cpu.mk is included too early in bsd.init.mk +# via the early include of bsd.opts.mk. Moving Makefile.inc include earlier in +# that file causes weirdness, so this is the next best thing. We need to do this +# because the loader needs very specific flags to work right, and things like +# CPUTYPE?=native prevent that, and introduce an endless game of whack-a-mole +# to disable more and more features. Boot loader performance is never improved +# enough to make that hassle worth chasing. +_CPUCFLAGS= .include .include ___ dev-commits-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all To unsubscribe, send any mail to "dev-commits-src-all-unsubscr...@freebsd.org"