From owner-svn-src-head@freebsd.org Sun Oct 18 00:27:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F869445ED5; Sun, 18 Oct 2020 00:27:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDLLf1RJ3z3XTX; Sun, 18 Oct 2020 00:27:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DF0A9FD3; Sun, 18 Oct 2020 00:27:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09I0RLvQ043604; Sun, 18 Oct 2020 00:27:21 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09I0RKPL043599; Sun, 18 Oct 2020 00:27:20 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202010180027.09I0RKPL043599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 18 Oct 2020 00:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366800 - in head: sbin/ifconfig sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head: sbin/ifconfig sys/net80211 X-SVN-Commit-Revision: 366800 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 00:27:22 -0000 Author: bz Date: Sun Oct 18 00:27:20 2020 New Revision: 366800 URL: https://svnweb.freebsd.org/changeset/base/366800 Log: net80211: update for (more) VHT160 support Implement two macros IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ() and its 80+80 counter part to check in vhtcaps for appropriate levels of support and use the macros throughout the code. Add vht160_chan_ranges/is_vht160_valid_freq and handle analogue to vht80 in various parts of the code. Add ieee80211_add_channel_cbw() which also takes the CBW flag fields and make the former ieee80211_add_channel() a wrapper to it. With the CBW flags we can add HT/VHT channels passing them to getflags() for the 2/5ghz functions. In ifconfig(8) add the regdomain_addchans() support for VHT160 and VHT80P80. With this (+ regdoain.xml updates) VHT160 channels can be configured, listed, and pass regdomain where appropriate. Tested with: iwlwifi Reviewed by: adrian MFC after: 10 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26712 Modified: head/sbin/ifconfig/ifieee80211.c head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211.h head/sys/net80211/ieee80211_regdomain.c head/sys/net80211/ieee80211_var.h head/sys/net80211/ieee80211_vht.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Sat Oct 17 23:42:33 2020 (r366799) +++ head/sbin/ifconfig/ifieee80211.c Sun Oct 18 00:27:20 2020 (r366800) @@ -2405,7 +2405,31 @@ regdomain_makechannels( &dc->dc_chaninfo); } - /* XXX TODO: VHT80P80, VHT160 */ + /* VHT160 */ + if (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ( + dc->dc_vhtcaps)) { + regdomain_addchans(ci, &rd->bands_11ac, reg, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U | + IEEE80211_CHAN_VHT160, + &dc->dc_chaninfo); + regdomain_addchans(ci, &rd->bands_11ac, reg, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D | + IEEE80211_CHAN_VHT160, + &dc->dc_chaninfo); + } + + /* VHT80P80 */ + if (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160_80P80MHZ( + dc->dc_vhtcaps)) { + regdomain_addchans(ci, &rd->bands_11ac, reg, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U | + IEEE80211_CHAN_VHT80P80, + &dc->dc_chaninfo); + regdomain_addchans(ci, &rd->bands_11ac, reg, + IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D | + IEEE80211_CHAN_VHT80P80, + &dc->dc_chaninfo); + } } if (!LIST_EMPTY(&rd->bands_11ng) && dc->dc_htcaps != 0) { Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Sat Oct 17 23:42:33 2020 (r366799) +++ head/sys/net80211/ieee80211.c Sun Oct 18 00:27:20 2020 (r366800) @@ -1163,6 +1163,12 @@ struct vht_chan_range vht80_chan_ranges[] = { { 0, 0 } }; +struct vht_chan_range vht160_chan_ranges[] = { + { 5170, 5330 }, + { 5490, 5650 }, + { 0, 0 } +}; + static int set_vht_extchan(struct ieee80211_channel *c) { @@ -1177,8 +1183,24 @@ set_vht_extchan(struct ieee80211_channel *c) } if (IEEE80211_IS_CHAN_VHT160(c)) { - printf("%s: TODO VHT160 channel (ieee=%d, flags=0x%08x)\n", - __func__, c->ic_ieee, c->ic_flags); + for (i = 0; vht160_chan_ranges[i].freq_start != 0; i++) { + if (c->ic_freq >= vht160_chan_ranges[i].freq_start && + c->ic_freq < vht160_chan_ranges[i].freq_end) { + int midpoint; + + midpoint = vht160_chan_ranges[i].freq_start + 80; + c->ic_vht_ch_freq1 = + ieee80211_mhz2ieee(midpoint, c->ic_flags); + c->ic_vht_ch_freq2 = 0; +#if 0 + printf("%s: %d, freq=%d, midpoint=%d, freq1=%d, freq2=%d\n", + __func__, c->ic_ieee, c->ic_freq, midpoint, + c->ic_vht_ch_freq1, c->ic_vht_ch_freq2); +#endif + return (1); + } + } + return (0); } if (IEEE80211_IS_CHAN_VHT80(c)) { @@ -1225,11 +1247,24 @@ set_vht_extchan(struct ieee80211_channel *c) /* * Return whether the current channel could possibly be a part of - * a VHT80 channel. + * a VHT80/VHT160 channel. * * This doesn't check that the whole range is in the allowed list * according to regulatory. */ +static bool +is_vht160_valid_freq(uint16_t freq) +{ + int i; + + for (i = 0; vht160_chan_ranges[i].freq_start != 0; i++) { + if (freq >= vht160_chan_ranges[i].freq_start && + freq < vht160_chan_ranges[i].freq_end) + return (true); + } + return (false); +} + static int is_vht80_valid_freq(uint16_t freq) { @@ -1410,18 +1445,17 @@ getflags(const uint8_t bands[], uint32_t flags[], int * Add one 20 MHz channel into specified channel list. * You MUST NOT mix bands when calling this. It will not add 5ghz * channels if you have any B/G/N band bit set. - * This also does not support 40/80/160/80+80. + * The _cbw() variant does also support HT40/VHT80/160/80+80. */ -/* XXX VHT */ int -ieee80211_add_channel(struct ieee80211_channel chans[], int maxchans, +ieee80211_add_channel_cbw(struct ieee80211_channel chans[], int maxchans, int *nchans, uint8_t ieee, uint16_t freq, int8_t maxregpower, - uint32_t chan_flags, const uint8_t bands[]) + uint32_t chan_flags, const uint8_t bands[], int cbw_flags) { uint32_t flags[IEEE80211_MODE_MAX]; int i, error; - getflags(bands, flags, 0); + getflags(bands, flags, cbw_flags); KASSERT(flags[0] != 0, ("%s: no correct mode provided\n", __func__)); error = addchan(chans, maxchans, nchans, ieee, freq, maxregpower, @@ -1434,6 +1468,16 @@ ieee80211_add_channel(struct ieee80211_channel chans[] return (error); } +int +ieee80211_add_channel(struct ieee80211_channel chans[], int maxchans, + int *nchans, uint8_t ieee, uint16_t freq, int8_t maxregpower, + uint32_t chan_flags, const uint8_t bands[]) +{ + + return (ieee80211_add_channel_cbw(chans, maxchans, nchans, ieee, freq, + maxregpower, chan_flags, bands, 0)); +} + static struct ieee80211_channel * findchannel(struct ieee80211_channel chans[], int nchans, uint16_t freq, uint32_t flags) @@ -1573,7 +1617,11 @@ add_chanlist(struct ieee80211_channel chans[], int max is_vht = !! (flags[j] & IEEE80211_CHAN_VHT); /* XXX TODO FIXME VHT80P80. */ - /* XXX TODO FIXME VHT160. */ + + /* Test for VHT160 analogue to the VHT80 below. */ + if (is_vht && flags[j] & IEEE80211_CHAN_VHT160) + if (! is_vht160_valid_freq(freq)) + continue; /* * Test for VHT80. Modified: head/sys/net80211/ieee80211.h ============================================================================== --- head/sys/net80211/ieee80211.h Sat Oct 17 23:42:33 2020 (r366799) +++ head/sys/net80211/ieee80211.h Sun Oct 18 00:27:20 2020 (r366800) @@ -815,6 +815,13 @@ struct ieee80211_ie_vht_operation { #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ 2 #define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_RESERVED 3 +#define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ(_vhtcaps) \ + (_IEEE80211_MASKSHIFT(_vhtcaps, IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) >= \ + IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ) +#define IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160_80P80MHZ(_vhtcaps) \ + (_IEEE80211_MASKSHIFT(_vhtcaps, IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) == \ + IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ) + #define IEEE80211_VHTCAP_RXLDPC 0x00000010 #define IEEE80211_VHTCAP_RXLDPC_S 4 Modified: head/sys/net80211/ieee80211_regdomain.c ============================================================================== --- head/sys/net80211/ieee80211_regdomain.c Sat Oct 17 23:42:33 2020 (r366799) +++ head/sys/net80211/ieee80211_regdomain.c Sun Oct 18 00:27:20 2020 (r366800) @@ -151,11 +151,10 @@ ieee80211_init_channels(struct ieee80211com *ic, if (isset(bands, IEEE80211_MODE_VHT_5GHZ)) { cbw_flags |= NET80211_CBW_FLAG_HT40; /* Make sure this is set; or assert? */ cbw_flags |= NET80211_CBW_FLAG_VHT80; - if (_IEEE80211_MASKSHIFT(ic->ic_vhtcaps, - IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) >= 1) + if (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ(ic->ic_vhtcaps)) cbw_flags |= NET80211_CBW_FLAG_VHT160; - if (_IEEE80211_MASKSHIFT(ic->ic_vhtcaps, - IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) == 2) + if (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160_80P80MHZ( + ic->ic_vhtcaps)) cbw_flags |= NET80211_CBW_FLAG_VHT80P80; ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX, nchans, def_chan_5ghz_band1, nitems(def_chan_5ghz_band1), Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sat Oct 17 23:42:33 2020 (r366799) +++ head/sys/net80211/ieee80211_var.h Sun Oct 18 00:27:20 2020 (r366800) @@ -772,6 +772,8 @@ int ieee80211_mhz2ieee(u_int, u_int); int ieee80211_chan2ieee(struct ieee80211com *, const struct ieee80211_channel *); u_int ieee80211_ieee2mhz(u_int, u_int); +int ieee80211_add_channel_cbw(struct ieee80211_channel[], int, int *, + uint8_t, uint16_t, int8_t, uint32_t, const uint8_t[], int); int ieee80211_add_channel(struct ieee80211_channel[], int, int *, uint8_t, uint16_t, int8_t, uint32_t, const uint8_t[]); int ieee80211_add_channel_ht40(struct ieee80211_channel[], int, int *, Modified: head/sys/net80211/ieee80211_vht.c ============================================================================== --- head/sys/net80211/ieee80211_vht.c Sat Oct 17 23:42:33 2020 (r366799) +++ head/sys/net80211/ieee80211_vht.c Sun Oct 18 00:27:20 2020 (r366800) @@ -153,13 +153,10 @@ ieee80211_vht_vattach(struct ieee80211vap *vap) IEEE80211_FVHT_VHT | IEEE80211_FVHT_USEVHT40 | IEEE80211_FVHT_USEVHT80; -#if 0 - /* XXX TODO: enable VHT80+80, VHT160 capabilities */ - if (XXX TODO FIXME) + if (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ(vap->iv_vhtcaps)) vap->iv_flags_vht |= IEEE80211_FVHT_USEVHT160; - if (XXX TODO FIXME) + if (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160_80P80MHZ(vap->iv_vhtcaps)) vap->iv_flags_vht |= IEEE80211_FVHT_USEVHT80P80; -#endif memcpy(&vap->iv_vht_mcsinfo, &ic->ic_vht_mcsinfo, sizeof(struct ieee80211_vht_mcs_info)); @@ -202,15 +199,11 @@ ieee80211_vht_announce(struct ieee80211com *ic) return; /* Channel width */ - ic_printf(ic, "[VHT] Channel Widths: 20MHz, 40MHz, 80MHz"); - if (_IEEE80211_MASKSHIFT(ic->ic_vhtcaps, - IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) >= 1) - printf(" 160MHz"); - if (_IEEE80211_MASKSHIFT(ic->ic_vhtcaps, - IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) == 2) - printf(" 80+80MHz"); - printf("\n"); - + ic_printf(ic, "[VHT] Channel Widths: 20MHz, 40MHz, 80MHz%s%s\n", + (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ(ic->ic_vhtcaps)) ? + ", 160MHz" : "", + (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160_80P80MHZ(ic->ic_vhtcaps)) ? + ", 80+80MHz" : ""); /* Features */ ic_printf(ic, "[VHT] Features: %b\n", ic->ic_vhtcaps, IEEE80211_VHTCAP_BITS); From owner-svn-src-head@freebsd.org Sun Oct 18 03:01:27 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F12F44BDDC; Sun, 18 Oct 2020 03:01:27 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDPmR0TMyz3yps; Sun, 18 Oct 2020 03:01:27 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9299C01C; Sun, 18 Oct 2020 03:01:26 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09I31Qae039876; Sun, 18 Oct 2020 03:01:26 GMT (envelope-from grog@FreeBSD.org) Received: (from grog@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09I31QDX039875; Sun, 18 Oct 2020 03:01:26 GMT (envelope-from grog@FreeBSD.org) Message-Id: <202010180301.09I31QDX039875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grog set sender to grog@FreeBSD.org using -f From: Greg Lehey Date: Sun, 18 Oct 2020 03:01:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366805 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: grog X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 366805 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 03:01:27 -0000 Author: grog Date: Sun Oct 18 03:01:26 2020 New Revision: 366805 URL: https://svnweb.freebsd.org/changeset/base/366805 Log: Correct location and date of the Boston Shoemakers' organization, which significantly predated the USA. Reference: http://www.famousdaily.com/history/boston-shoemakers-form-first-us-labor-organization.html Modified: head/usr.bin/calendar/calendars/calendar.history Modified: head/usr.bin/calendar/calendars/calendar.history ============================================================================== --- head/usr.bin/calendar/calendars/calendar.history Sun Oct 18 01:57:49 2020 (r366804) +++ head/usr.bin/calendar/calendars/calendar.history Sun Oct 18 03:01:26 2020 (r366805) @@ -582,9 +582,9 @@ 10/16 The Walt Disney Company is founded by Walt Disney and his brother, Roy Disney, 1923 10/17 Al Capone convicted of income tax evasion, 1931 -10/18 Boston Shoemakers form first US labor org., 1648 10/18 Soviets announce their probe took photos of the Moon's far side, 1959 10/18 The Grand Ole Opry opens its doors, 1925 +10/19 Boston Shoemakers form first American labor organization, 1648 10/19 Mao Tse-tung establishes the People's Republic of China, 1949 10/19 Napoleon's beaten army begins the long retreat from Moscow, 1812 10/20 "Saturday Night Massacre", 1973 From owner-svn-src-head@freebsd.org Sun Oct 18 08:58:15 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52AC942B6A1; Sun, 18 Oct 2020 08:58:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDYh71Xdnz4GHQ; Sun, 18 Oct 2020 08:58:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1937E10226; Sun, 18 Oct 2020 08:58:15 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09I8wELT056575; Sun, 18 Oct 2020 08:58:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09I8wEOh056573; Sun, 18 Oct 2020 08:58:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010180858.09I8wEOh056573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 18 Oct 2020 08:58:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366806 - in head/sys/dev/usb: . quirk X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/usb: . quirk X-SVN-Commit-Revision: 366806 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 08:58:15 -0000 Author: hselasky Date: Sun Oct 18 08:58:14 2020 New Revision: 366806 URL: https://svnweb.freebsd.org/changeset/base/366806 Log: Add new USB quirk. PR: 250422 Submitted by: vidwer+fbsdbugs@gmail.com MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Sun Oct 18 03:01:26 2020 (r366805) +++ head/sys/dev/usb/quirk/usb_quirk.c Sun Oct 18 08:58:14 2020 (r366806) @@ -224,6 +224,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1), USB_QUIRK(CYPRESS, XX6830XX, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK(EMTEC, DANEELEC4GB, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(DESKNOTE, UCR_61S2B, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(DMI, CFSM_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI, Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sun Oct 18 03:01:26 2020 (r366805) +++ head/sys/dev/usb/usbdevs Sun Oct 18 08:58:14 2020 (r366806) @@ -1880,6 +1880,7 @@ product ELV USBI2C 0xe00f USB-I2C interface product EMS DUAL_SHOOTER 0x0003 PSX gun controller converter /* Emtec products */ +product EMTEC DANEELEC4GB 0x1e20 USB DISK Pro PMAP product EMTEC RUF2PS 0x2240 Flash Drive /* Encore products */ From owner-svn-src-head@freebsd.org Sun Oct 18 12:03:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A3B84303A7; Sun, 18 Oct 2020 12:03:37 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDdp12z9yz4Q1N; Sun, 18 Oct 2020 12:03:37 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4966F121C0; Sun, 18 Oct 2020 12:03:37 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09IC3bgl072963; Sun, 18 Oct 2020 12:03:37 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09IC3bYM072962; Sun, 18 Oct 2020 12:03:37 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202010181203.09IC3bYM072962@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 18 Oct 2020 12:03:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366807 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 366807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 12:03:37 -0000 Author: melifaro Date: Sun Oct 18 12:03:36 2020 New Revision: 366807 URL: https://svnweb.freebsd.org/changeset/base/366807 Log: Simplify NET_EPOCH_EXIT in inp_join_group(). Suggested by: kib Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Sun Oct 18 08:58:14 2020 (r366806) +++ head/sys/netinet/in_mcast.c Sun Oct 18 12:03:36 2020 (r366807) @@ -2009,6 +2009,7 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt else ifp = inp_lookup_mcast_ifp(inp, &gsa->sin, mreqn.imr_address); + NET_EPOCH_EXIT(et); break; } case IP_ADD_SOURCE_MEMBERSHIP: { @@ -2032,6 +2033,7 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt NET_EPOCH_ENTER(et); ifp = inp_lookup_mcast_ifp(inp, &gsa->sin, mreqs.imr_interface); + NET_EPOCH_EXIT(et); CTR3(KTR_IGMPV3, "%s: imr_interface = 0x%08x, ifp = %p", __func__, ntohl(mreqs.imr_interface.s_addr), ifp); break; @@ -2074,6 +2076,7 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt return (EADDRNOTAVAIL); NET_EPOCH_ENTER(et); ifp = ifnet_byindex_ref(gsr.gsr_interface); + NET_EPOCH_EXIT(et); break; default: @@ -2082,7 +2085,6 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt return (EOPNOTSUPP); break; } - NET_EPOCH_EXIT(et); if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) { if (ifp != NULL) From owner-svn-src-head@freebsd.org Sun Oct 18 15:56:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D587435F2C; Sun, 18 Oct 2020 15:56:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDkz36YvLz4fZJ; Sun, 18 Oct 2020 15:56:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C066A15106; Sun, 18 Oct 2020 15:56:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09IFul3f018179; Sun, 18 Oct 2020 15:56:47 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09IFulwC018178; Sun, 18 Oct 2020 15:56:47 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010181556.09IFulwC018178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 18 Oct 2020 15:56:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366808 - head/sys/amd64/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/amd64/linux X-SVN-Commit-Revision: 366808 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 15:56:48 -0000 Author: trasz Date: Sun Oct 18 15:56:47 2020 New Revision: 366808 URL: https://svnweb.freebsd.org/changeset/base/366808 Log: Slightly tweak linux ptrace(2) debug message; no functional changes. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26815 Modified: head/sys/amd64/linux/linux_ptrace.c Modified: head/sys/amd64/linux/linux_ptrace.c ============================================================================== --- head/sys/amd64/linux/linux_ptrace.c Sun Oct 18 12:03:36 2020 (r366807) +++ head/sys/amd64/linux/linux_ptrace.c Sun Oct 18 15:56:47 2020 (r366808) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #define LINUX_PTRACE_GETSIGINFO 0x4202 #define LINUX_PTRACE_GETREGSET 0x4204 #define LINUX_PTRACE_SEIZE 0x4206 +#define LINUX_PTRACE_GET_SYSCALL_INFO 0x420e #define LINUX_PTRACE_EVENT_EXIT 6 @@ -557,6 +558,14 @@ linux_ptrace_seize(struct thread *td, pid_t pid, l_ulo return (EINVAL); } +static int +linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, l_ulong addr, l_ulong data) +{ + + linux_msg(td, "PTRACE_GET_SYSCALL_INFO not implemented; returning EINVAL"); + return (EINVAL); +} + int linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) { @@ -641,6 +650,9 @@ linux_ptrace(struct thread *td, struct linux_ptrace_ar break; case LINUX_PTRACE_SEIZE: error = linux_ptrace_seize(td, pid, uap->addr, uap->data); + break; + case LINUX_PTRACE_GET_SYSCALL_INFO: + error = linux_ptrace_get_syscall_info(td, pid, uap->addr, uap->data); break; default: linux_msg(td, "ptrace(%ld, ...) not implemented; " From owner-svn-src-head@freebsd.org Sun Oct 18 15:58:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0E05435FAA; Sun, 18 Oct 2020 15:58:17 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDl0n44VZz4fqt; Sun, 18 Oct 2020 15:58:17 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F3BB14CBD; Sun, 18 Oct 2020 15:58:17 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09IFwHDT018291; Sun, 18 Oct 2020 15:58:17 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09IFwGJZ018288; Sun, 18 Oct 2020 15:58:16 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010181558.09IFwGJZ018288@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 18 Oct 2020 15:58:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366809 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 366809 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 15:58:17 -0000 Author: trasz Date: Sun Oct 18 15:58:16 2020 New Revision: 366809 URL: https://svnweb.freebsd.org/changeset/base/366809 Log: Add compat.linux.dummy_rlimits, and disable by default. Turns out the dummy rlimits fix prlimit(1), but break su(8) (login-1:4.5-1ubuntu2) - although not sudo(8), for some reason. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26814 Modified: head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_mib.h head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_mib.c ============================================================================== --- head/sys/compat/linux/linux_mib.c Sun Oct 18 15:56:47 2020 (r366808) +++ head/sys/compat/linux/linux_mib.c Sun Oct 18 15:58:16 2020 (r366809) @@ -77,6 +77,11 @@ SYSCTL_INT(_compat_linux, OID_AUTO, default_stacksize, &linux_default_stacksize, 0, "Default soft stack size resource limit, or -1 for unlimited"); +int linux_dummy_rlimits = 0; +SYSCTL_INT(_compat_linux, OID_AUTO, dummy_rlimits, CTLFLAG_RWTUN, + &linux_dummy_rlimits, 0, + "Return dummy values for unsupported Linux-specific rlimits"); + int linux_ignore_ip_recverr = 1; SYSCTL_INT(_compat_linux, OID_AUTO, ignore_ip_recverr, CTLFLAG_RWTUN, &linux_ignore_ip_recverr, 0, "Ignore enabling IP_RECVERR"); Modified: head/sys/compat/linux/linux_mib.h ============================================================================== --- head/sys/compat/linux/linux_mib.h Sun Oct 18 15:56:47 2020 (r366808) +++ head/sys/compat/linux/linux_mib.h Sun Oct 18 15:58:16 2020 (r366809) @@ -65,6 +65,7 @@ int linux_kernver(struct thread *td); extern int linux_debug; extern int linux_default_openfiles; extern int linux_default_stacksize; +extern int linux_dummy_rlimits; extern int linux_ignore_ip_recverr; extern int linux_preserve_vstatus; extern bool linux_map_sched_prio; Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sun Oct 18 15:56:47 2020 (r366808) +++ head/sys/compat/linux/linux_misc.c Sun Oct 18 15:58:16 2020 (r366809) @@ -1377,6 +1377,9 @@ static bool linux_get_dummy_limit(l_uint resource, struct rlimit *rlim) { + if (linux_dummy_rlimits == 0) + return (false); + switch (resource) { case LINUX_RLIMIT_LOCKS: case LINUX_RLIMIT_SIGPENDING: From owner-svn-src-head@freebsd.org Sun Oct 18 16:16:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4315443607C; Sun, 18 Oct 2020 16:16:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDlPg12Z6z4gYL; Sun, 18 Oct 2020 16:16:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 083321551F; Sun, 18 Oct 2020 16:16:23 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09IGGMZt030566; Sun, 18 Oct 2020 16:16:22 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09IGGMnk030565; Sun, 18 Oct 2020 16:16:22 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010181616.09IGGMnk030565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 18 Oct 2020 16:16:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366810 - head/sys/amd64/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/amd64/linux X-SVN-Commit-Revision: 366810 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 16:16:23 -0000 Author: trasz Date: Sun Oct 18 16:16:22 2020 New Revision: 366810 URL: https://svnweb.freebsd.org/changeset/base/366810 Log: Stop calling set_syscall_retval() from linux_set_syscall_retval(). The former clobbers some registers that shouldn't be touched. Reviewed by: kib (earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26406 Modified: head/sys/amd64/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Sun Oct 18 15:58:16 2020 (r366809) +++ head/sys/amd64/linux/linux_sysvec.c Sun Oct 18 16:16:22 2020 (r366810) @@ -206,24 +206,45 @@ linux_fetch_syscall_args(struct thread *td) static void linux_set_syscall_retval(struct thread *td, int error) { - struct trapframe *frame = td->td_frame; + struct trapframe *frame; - /* - * On Linux only %rcx and %r11 values are not preserved across - * the syscall. So, do not clobber %rdx and %r10. - */ - td->td_retval[1] = frame->tf_rdx; - if (error != EJUSTRETURN) - frame->tf_r10 = frame->tf_rcx; + frame = td->td_frame; - cpu_set_syscall_retval(td, error); + switch (error) { + case 0: + frame->tf_rax = td->td_retval[0]; + frame->tf_r10 = frame->tf_rcx; + break; - if (__predict_false(error != 0)) { - if (error != ERESTART && error != EJUSTRETURN) - frame->tf_rax = linux_to_bsd_errno(error); + case ERESTART: + /* + * Reconstruct pc, we know that 'syscall' is 2 bytes, + * lcall $X,y is 7 bytes, int 0x80 is 2 bytes. + * We saved this in tf_err. + * + */ + frame->tf_rip -= frame->tf_err; + frame->tf_r10 = frame->tf_rcx; + break; + + case EJUSTRETURN: + break; + + default: + frame->tf_rax = linux_to_bsd_errno(error); + frame->tf_r10 = frame->tf_rcx; + break; } - /* Restore all registers. */ + /* + * Differently from FreeBSD native ABI, on Linux only %rcx + * and %r11 values are not preserved across the syscall. + * Require full context restore to get all registers except + * those two restored at return to usermode. + * + * XXX: Would be great to be able to avoid PCB_FULL_IRET + * for the error == 0 case. + */ set_pcb_flags(td->td_pcb, PCB_FULL_IRET); } From owner-svn-src-head@freebsd.org Sun Oct 18 16:24:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43E0D436907; Sun, 18 Oct 2020 16:24:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDlZh1HQvz4ggk; Sun, 18 Oct 2020 16:24:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FCB415682; Sun, 18 Oct 2020 16:24:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09IGOBV9036661; Sun, 18 Oct 2020 16:24:11 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09IGO88U036637; Sun, 18 Oct 2020 16:24:08 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010181624.09IGO88U036637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 18 Oct 2020 16:24:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366811 - in head: share/man/man9 sys/geom sys/geom/bde sys/geom/cache sys/geom/concat sys/geom/journal sys/geom/label sys/geom/linux_lvm sys/geom/mirror sys/geom/mountver sys/geom/mult... X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: share/man/man9 sys/geom sys/geom/bde sys/geom/cache sys/geom/concat sys/geom/journal sys/geom/label sys/geom/linux_lvm sys/geom/mirror sys/geom/mountver sys/geom/multipath sys/geom/raid sys/g... X-SVN-Commit-Revision: 366811 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 16:24:12 -0000 Author: trasz Date: Sun Oct 18 16:24:08 2020 New Revision: 366811 URL: https://svnweb.freebsd.org/changeset/base/366811 Log: Make g_attach() return ENXIO for orphaned providers; update various classes to add missing error checking. Reviewed by: imp MFC after: 2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26658 Modified: head/share/man/man9/g_attach.9 head/sys/geom/bde/g_bde.c head/sys/geom/cache/g_cache.c head/sys/geom/concat/g_concat.c head/sys/geom/geom_dev.c head/sys/geom/geom_subr.c head/sys/geom/geom_vfs.c head/sys/geom/journal/g_journal.c head/sys/geom/label/g_label.c head/sys/geom/linux_lvm/g_linux_lvm.c head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror_ctl.c head/sys/geom/mountver/g_mountver.c head/sys/geom/multipath/g_multipath.c head/sys/geom/raid/g_raid.c head/sys/geom/raid3/g_raid3.c head/sys/geom/shsec/g_shsec.c head/sys/geom/stripe/g_stripe.c head/sys/geom/virstor/g_virstor.c Modified: head/share/man/man9/g_attach.9 ============================================================================== --- head/share/man/man9/g_attach.9 Sun Oct 18 16:16:22 2020 (r366810) +++ head/share/man/man9/g_attach.9 Sun Oct 18 16:24:08 2020 (r366811) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 16, 2004 +.Dd October 10, 2020 .Dt G_ATTACH 9 .Os .Sh NAME @@ -122,6 +122,8 @@ Possible errors: .Bl -tag -width Er .It Bq Er ELOOP The operation creates a topology loop. +.It Bq Er ENXIO +Provider got orphaned. .El .Sh SEE ALSO .Xr geom 4 , Modified: head/sys/geom/bde/g_bde.c ============================================================================== --- head/sys/geom/bde/g_bde.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/bde/g_bde.c Sun Oct 18 16:24:08 2020 (r366811) @@ -131,7 +131,13 @@ g_bde_create_geom(struct gctl_req *req, struct g_class gp = g_new_geomf(mp, "%s.bde", pp->name); cp = g_new_consumer(gp); - g_attach(cp, pp); + error = g_attach(cp, pp); + if (error != 0) { + g_destroy_consumer(cp); + g_destroy_geom(gp); + gctl_error(req, "could not attach consumer"); + return; + } error = g_access(cp, 1, 1, 1); if (error) { g_detach(cp); Modified: head/sys/geom/cache/g_cache.c ============================================================================== --- head/sys/geom/cache/g_cache.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/cache/g_cache.c Sun Oct 18 16:24:08 2020 (r366811) @@ -673,9 +673,11 @@ g_cache_taste(struct g_class *mp, struct g_provider *p gp->orphan = g_cache_orphan; gp->access = g_cache_access; cp = g_new_consumer(gp); - g_attach(cp, pp); - error = g_cache_read_metadata(cp, &md); - g_detach(cp); + error = g_attach(cp, pp); + if (error == 0) { + error = g_cache_read_metadata(cp, &md); + g_detach(cp); + } g_destroy_consumer(cp); g_destroy_geom(gp); if (error != 0) Modified: head/sys/geom/concat/g_concat.c ============================================================================== --- head/sys/geom/concat/g_concat.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/concat/g_concat.c Sun Oct 18 16:24:08 2020 (r366811) @@ -718,9 +718,11 @@ g_concat_taste(struct g_class *mp, struct g_provider * gp->access = g_concat_access; gp->orphan = g_concat_orphan; cp = g_new_consumer(gp); - g_attach(cp, pp); - error = g_concat_read_metadata(cp, &md); - g_detach(cp); + error = g_attach(cp, pp); + if (error == 0) { + error = g_concat_read_metadata(cp, &md); + g_detach(cp); + } g_destroy_consumer(cp); g_destroy_geom(gp); if (error != 0) Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/geom_dev.c Sun Oct 18 16:24:08 2020 (r366811) @@ -346,7 +346,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, cp->private = sc; cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); - KASSERT(error == 0, + KASSERT(error == 0 || error == ENXIO, ("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error)); make_dev_args_init(&args); Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/geom_subr.c Sun Oct 18 16:24:08 2020 (r366811) @@ -896,6 +896,8 @@ g_attach(struct g_consumer *cp, struct g_provider *pp) G_VALID_PROVIDER(pp); g_trace(G_T_TOPOLOGY, "g_attach(%p, %p)", cp, pp); KASSERT(cp->provider == NULL, ("attach but attached")); + if ((pp->flags & (G_PF_ORPHAN | G_PF_WITHER)) != 0) + return (ENXIO); cp->provider = pp; cp->flags &= ~G_CF_ORPHAN; LIST_INSERT_HEAD(&pp->consumers, cp, consumers); Modified: head/sys/geom/geom_vfs.c ============================================================================== --- head/sys/geom/geom_vfs.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/geom_vfs.c Sun Oct 18 16:24:08 2020 (r366811) @@ -260,7 +260,11 @@ g_vfs_open(struct vnode *vp, struct g_consumer **cpp, sc->sc_bo = bo; gp->softc = sc; cp = g_new_consumer(gp); - g_attach(cp, pp); + error = g_attach(cp, pp); + if (error) { + g_wither_geom(gp, ENXIO); + return (error); + } error = g_access(cp, 1, wr, wr); if (error) { g_wither_geom(gp, ENXIO); Modified: head/sys/geom/journal/g_journal.c ============================================================================== --- head/sys/geom/journal/g_journal.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/journal/g_journal.c Sun Oct 18 16:24:08 2020 (r366811) @@ -2483,9 +2483,11 @@ g_journal_taste(struct g_class *mp, struct g_provider /* This orphan function should be never called. */ gp->orphan = g_journal_taste_orphan; cp = g_new_consumer(gp); - g_attach(cp, pp); - error = g_journal_metadata_read(cp, &md); - g_detach(cp); + error = g_attach(cp, pp); + if (error == 0) { + error = g_journal_metadata_read(cp, &md); + g_detach(cp); + } g_destroy_consumer(cp); g_destroy_geom(gp); if (error != 0) Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/label/g_label.c Sun Oct 18 16:24:08 2020 (r366811) @@ -400,7 +400,8 @@ g_label_taste(struct g_class *mp, struct g_provider *p gp->access = g_label_access_taste; gp->orphan = g_label_orphan_taste; cp = g_new_consumer(gp); - g_attach(cp, pp); + if (g_attach(cp, pp) != 0) + goto end2; if (g_access(cp, 1, 0, 0) != 0) goto end; for (i = 0; g_labels[i] != NULL; i++) { @@ -425,6 +426,7 @@ g_label_taste(struct g_class *mp, struct g_provider *p g_access(cp, -1, 0, 0); end: g_detach(cp); +end2: g_destroy_consumer(cp); g_destroy_geom(gp); return (NULL); Modified: head/sys/geom/linux_lvm/g_linux_lvm.c ============================================================================== --- head/sys/geom/linux_lvm/g_linux_lvm.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/linux_lvm/g_linux_lvm.c Sun Oct 18 16:24:08 2020 (r366811) @@ -543,11 +543,13 @@ g_llvm_taste(struct g_class *mp, struct g_provider *pp /* This orphan function should be never called. */ gp->orphan = g_llvm_taste_orphan; cp = g_new_consumer(gp); - g_attach(cp, pp); - error = g_llvm_read_label(cp, &ll); - if (!error) - error = g_llvm_read_md(cp, &md, &ll); - g_detach(cp); + error = g_attach(cp, pp); + if (error == 0) { + error = g_llvm_read_label(cp, &ll); + if (error == 0) + error = g_llvm_read_md(cp, &md, &ll); + g_detach(cp); + } g_destroy_consumer(cp); g_destroy_geom(gp); if (error != 0) Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/mirror/g_mirror.c Sun Oct 18 16:24:08 2020 (r366811) @@ -3241,9 +3241,11 @@ g_mirror_taste(struct g_class *mp, struct g_provider * */ gp->orphan = g_mirror_taste_orphan; cp = g_new_consumer(gp); - g_attach(cp, pp); - error = g_mirror_read_metadata(cp, &md); - g_detach(cp); + error = g_attach(cp, pp); + if (error == 0) { + error = g_mirror_read_metadata(cp, &md); + g_detach(cp); + } g_destroy_consumer(cp); g_destroy_geom(gp); if (error != 0) Modified: head/sys/geom/mirror/g_mirror_ctl.c ============================================================================== --- head/sys/geom/mirror/g_mirror_ctl.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/mirror/g_mirror_ctl.c Sun Oct 18 16:24:08 2020 (r366811) @@ -449,7 +449,11 @@ err: g_topology_unlock(); return; } - g_attach(cp, pp); + if (g_attach(cp, pp) != 0) { + G_MIRROR_DEBUG(1, "Can't attach disk %s.", pp->name); + gctl_error(req, "Can't attach disk %s.", pp->name); + goto err; + } if (g_access(cp, 1, 0, 0) != 0) { G_MIRROR_DEBUG(1, "Can't open disk %s.", pp->name); gctl_error(req, "Can't open disk %s.", pp->name); Modified: head/sys/geom/mountver/g_mountver.c ============================================================================== --- head/sys/geom/mountver/g_mountver.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/mountver/g_mountver.c Sun Oct 18 16:24:08 2020 (r366811) @@ -586,7 +586,12 @@ g_mountver_taste(struct g_class *mp, struct g_provider return (NULL); cp = LIST_FIRST(&gp->consumer); - g_attach(cp, pp); + error = g_attach(cp, pp); + if (error != 0) { + G_MOUNTVER_DEBUG(0, "Cannot attach to %s; error = %d.", pp->name, error); + return (NULL); + } + error = g_mountver_ident_matches(gp); if (error != 0) { g_detach(cp); Modified: head/sys/geom/multipath/g_multipath.c ============================================================================== --- head/sys/geom/multipath/g_multipath.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/multipath/g_multipath.c Sun Oct 18 16:24:08 2020 (r366811) @@ -823,9 +823,11 @@ g_multipath_taste(struct g_class *mp, struct g_provide gp->access = g_multipath_access; gp->orphan = g_multipath_orphan; cp = g_new_consumer(gp); - g_attach(cp, pp); - error = g_multipath_read_metadata(cp, &md); - g_detach(cp); + error = g_attach(cp, pp); + if (error == 0) { + error = g_multipath_read_metadata(cp, &md); + g_detach(cp); + } g_destroy_consumer(cp); g_destroy_geom(gp); if (error != 0) Modified: head/sys/geom/raid/g_raid.c ============================================================================== --- head/sys/geom/raid/g_raid.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/raid/g_raid.c Sun Oct 18 16:24:08 2020 (r366811) @@ -2228,7 +2228,8 @@ g_raid_taste(struct g_class *mp, struct g_provider *pp gp->orphan = g_raid_taste_orphan; cp = g_new_consumer(gp); cp->flags |= G_CF_DIRECT_RECEIVE; - g_attach(cp, pp); + if (g_attach(cp, pp) != 0) + goto ofail2; if (g_access(cp, 1, 0, 0) != 0) goto ofail; @@ -2251,6 +2252,7 @@ g_raid_taste(struct g_class *mp, struct g_provider *pp (void)g_access(cp, -1, 0, 0); ofail: g_detach(cp); +ofail2: g_destroy_consumer(cp); g_destroy_geom(gp); G_RAID_DEBUG(2, "Tasting provider %s done.", pp->name); Modified: head/sys/geom/raid3/g_raid3.c ============================================================================== --- head/sys/geom/raid3/g_raid3.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/raid3/g_raid3.c Sun Oct 18 16:24:08 2020 (r366811) @@ -3315,9 +3315,11 @@ g_raid3_taste(struct g_class *mp, struct g_provider *p /* This orphan function should be never called. */ gp->orphan = g_raid3_taste_orphan; cp = g_new_consumer(gp); - g_attach(cp, pp); - error = g_raid3_read_metadata(cp, &md); - g_detach(cp); + error = g_attach(cp, pp); + if (error == 0) { + error = g_raid3_read_metadata(cp, &md); + g_detach(cp); + } g_destroy_consumer(cp); g_destroy_geom(gp); if (error != 0) Modified: head/sys/geom/shsec/g_shsec.c ============================================================================== --- head/sys/geom/shsec/g_shsec.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/shsec/g_shsec.c Sun Oct 18 16:24:08 2020 (r366811) @@ -646,9 +646,11 @@ g_shsec_taste(struct g_class *mp, struct g_provider *p gp->access = g_shsec_access; gp->orphan = g_shsec_orphan; cp = g_new_consumer(gp); - g_attach(cp, pp); - error = g_shsec_read_metadata(cp, &md); - g_detach(cp); + error = g_attach(cp, pp); + if (error == 0) { + error = g_shsec_read_metadata(cp, &md); + g_detach(cp); + } g_destroy_consumer(cp); g_destroy_geom(gp); if (error != 0) Modified: head/sys/geom/stripe/g_stripe.c ============================================================================== --- head/sys/geom/stripe/g_stripe.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/stripe/g_stripe.c Sun Oct 18 16:24:08 2020 (r366811) @@ -963,9 +963,11 @@ g_stripe_taste(struct g_class *mp, struct g_provider * gp->access = g_stripe_access; gp->orphan = g_stripe_orphan; cp = g_new_consumer(gp); - g_attach(cp, pp); - error = g_stripe_read_metadata(cp, &md); - g_detach(cp); + error = g_attach(cp, pp); + if (error == 0) { + error = g_stripe_read_metadata(cp, &md); + g_detach(cp); + } g_destroy_consumer(cp); g_destroy_geom(gp); if (error != 0) Modified: head/sys/geom/virstor/g_virstor.c ============================================================================== --- head/sys/geom/virstor/g_virstor.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/virstor/g_virstor.c Sun Oct 18 16:24:08 2020 (r366811) @@ -780,9 +780,11 @@ g_virstor_taste(struct g_class *mp, struct g_provider gp->orphan = (void *)invalid_call; /* I really want these to fail. */ cp = g_new_consumer(gp); - g_attach(cp, pp); - error = read_metadata(cp, &md); - g_detach(cp); + error = g_attach(cp, pp); + if (error == 0) { + error = read_metadata(cp, &md); + g_detach(cp); + } g_destroy_consumer(cp); g_destroy_geom(gp); From owner-svn-src-head@freebsd.org Sun Oct 18 16:30:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2127436A49; Sun, 18 Oct 2020 16:30:50 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDlkL3rqfz4hNv; Sun, 18 Oct 2020 16:30:50 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 691771568E; Sun, 18 Oct 2020 16:30:50 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09IGUoM7037024; Sun, 18 Oct 2020 16:30:50 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09IGUoOY037023; Sun, 18 Oct 2020 16:30:50 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010181630.09IGUoOY037023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 18 Oct 2020 16:30:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366812 - head/sys/dev/iscsi X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/dev/iscsi X-SVN-Commit-Revision: 366812 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 16:30:50 -0000 Author: trasz Date: Sun Oct 18 16:30:49 2020 New Revision: 366812 URL: https://svnweb.freebsd.org/changeset/base/366812 Log: If the SIM freezes the queue at exactly the wrong moment, after another thread has started to send in a CCB and already checked the queue wasn't frozen, we would end up with iscsi_action() being called despite the queue is now frozen. Add a check to make sure this doesn't happen . Perhaps this should be fixed at the CAM level instead, but given how the send queue and SIM are governed by two separate mutexes, it is somewhat hard to do. Reviewed by: imp, mav MFC after: 2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26750 Modified: head/sys/dev/iscsi/iscsi.c Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Sun Oct 18 16:24:08 2020 (r366811) +++ head/sys/dev/iscsi/iscsi.c Sun Oct 18 16:30:49 2020 (r366812) @@ -367,8 +367,8 @@ iscsi_session_cleanup(struct iscsi_session *is, bool d xpt_async(AC_LOST_DEVICE, is->is_path, NULL); if (is->is_simq_frozen) { - xpt_release_simq(is->is_sim, 1); is->is_simq_frozen = false; + xpt_release_simq(is->is_sim, 1); } xpt_free_path(is->is_path); @@ -1479,8 +1479,8 @@ iscsi_ioctl_daemon_handoff(struct iscsi_softc *sc, KASSERT(is->is_simq_frozen, ("reconnect without frozen simq")); ISCSI_SESSION_LOCK(is); ISCSI_SESSION_DEBUG(is, "releasing"); - xpt_release_simq(is->is_sim, 1); is->is_simq_frozen = false; + xpt_release_simq(is->is_sim, 1); ISCSI_SESSION_UNLOCK(is); } else { @@ -2351,6 +2351,17 @@ iscsi_action(struct cam_sim *sim, union ccb *ccb) if (is->is_terminating || (is->is_connected == false && fail_on_disconnection)) { ccb->ccb_h.status = CAM_DEV_NOT_THERE; + xpt_done(ccb); + return; + } + + /* + * Make sure CAM doesn't sneak in a CCB just after freezing the queue. + */ + if (is->is_simq_frozen == true) { + ccb->ccb_h.status &= ~(CAM_SIM_QUEUED | CAM_STATUS_MASK); + ccb->ccb_h.status |= CAM_REQUEUE_REQ; + /* Don't freeze the devq - the SIM queue is already frozen. */ xpt_done(ccb); return; } From owner-svn-src-head@freebsd.org Sun Oct 18 17:15:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C982B4377BB; Sun, 18 Oct 2020 17:15:52 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDmkJ5CY8z4jqd; Sun, 18 Oct 2020 17:15:52 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 781B015FD5; Sun, 18 Oct 2020 17:15:52 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09IHFqPe067146; Sun, 18 Oct 2020 17:15:52 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09IHFmMW067126; Sun, 18 Oct 2020 17:15:48 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202010181715.09IHFmMW067126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 18 Oct 2020 17:15:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366813 - in head/sys: conf net net/route netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: conf net net/route netinet netinet6 X-SVN-Commit-Revision: 366813 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 17:15:52 -0000 Author: melifaro Date: Sun Oct 18 17:15:47 2020 New Revision: 366813 URL: https://svnweb.freebsd.org/changeset/base/366813 Log: Implement flowid calculation for outbound connections to balance connections over multiple paths. Multipath routing relies on mbuf flowid data for both transit and outbound traffic. Current code fills mbuf flowid from inp_flowid for connection-oriented sockets. However, inp_flowid is currently not calculated for outbound connections. This change creates simple hashing functions and starts calculating hashes for TCP,UDP/UDP-Lite and raw IP if multipath routes are present in the system. Reviewed by: glebius (previous version),ae Differential Revision: https://reviews.freebsd.org/D26523 Modified: head/sys/conf/files head/sys/net/radix.c head/sys/net/route.h head/sys/net/route/mpath_ctl.c head/sys/net/route/route_var.h head/sys/netinet/in_fib.c head/sys/netinet/in_fib.h head/sys/netinet/in_pcb.c head/sys/netinet/in_rss.c head/sys/netinet/in_rss.h head/sys/netinet/raw_ip.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/in6_fib.c head/sys/netinet6/in6_fib.h head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_rss.c head/sys/netinet6/in6_rss.h head/sys/netinet6/ip6_output.c head/sys/netinet6/raw_ip6.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/conf/files Sun Oct 18 17:15:47 2020 (r366813) @@ -4180,7 +4180,7 @@ net/rss_config.c optional inet rss | inet6 rss net/rtsock.c standard net/slcompress.c optional netgraph_vjc | sppp | \ netgraph_sppp -net/toeplitz.c optional inet rss | inet6 rss +net/toeplitz.c optional inet rss | inet6 rss | route_mpath net/vnet.c optional vimage net80211/ieee80211.c optional wlan net80211/ieee80211_acl.c optional wlan wlan_acl Modified: head/sys/net/radix.c ============================================================================== --- head/sys/net/radix.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/net/radix.c Sun Oct 18 17:15:47 2020 (r366813) @@ -624,21 +624,6 @@ rn_addroute(void *v_arg, void *n_arg, struct radix_hea saved_tt = tt = rn_insert(v, head, &keyduplicated, treenodes); if (keyduplicated) { for (t = tt; tt; t = tt, tt = tt->rn_dupedkey) { -#ifdef RADIX_MPATH - /* permit multipath, if enabled for the family */ - if (rn_mpath_capable(head) && netmask == tt->rn_mask) { - /* - * go down to the end of multipaths, so that - * new entry goes into the end of rn_dupedkey - * chain. - */ - do { - t = tt; - tt = tt->rn_dupedkey; - } while (tt && t->rn_mask == tt->rn_mask); - break; - } -#endif if (tt->rn_mask == netmask) return (0); if (netmask == 0 || @@ -744,10 +729,8 @@ on2: if (m->rm_flags & RNF_NORMAL) { mmask = m->rm_leaf->rn_mask; if (tt->rn_flags & RNF_NORMAL) { -#if !defined(RADIX_MPATH) log(LOG_ERR, "Non-unique normal route, mask not entered\n"); -#endif return (tt); } } else Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/net/route.h Sun Oct 18 17:15:47 2020 (r366813) @@ -125,7 +125,41 @@ VNET_DECLARE(uint32_t, _rt_numfibs); /* number of exis #define rt_numfibs V_rt_numfibs VNET_DECLARE(u_int, rt_add_addr_allfibs); /* Announce interfaces to all fibs */ #define V_rt_add_addr_allfibs VNET(rt_add_addr_allfibs) + +/* Calculate flowid for locally-originated packets */ +#define V_fib_hash_outbound VNET(fib_hash_outbound) +VNET_DECLARE(u_int, fib_hash_outbound); + +/* Outbound flowid generation rules */ +#ifdef RSS + +#define fib4_calc_packet_hash xps_proto_software_hash_v4 +#define fib6_calc_packet_hash xps_proto_software_hash_v6 +#define CALC_FLOWID_OUTBOUND_SENDTO true + +#ifdef ROUTE_MPATH +#define CALC_FLOWID_OUTBOUND V_fib_hash_outbound +#else +#define CALC_FLOWID_OUTBOUND false #endif + +#else /* !RSS */ + +#define fib4_calc_packet_hash fib4_calc_software_hash +#define fib6_calc_packet_hash fib6_calc_software_hash + +#ifdef ROUTE_MPATH +#define CALC_FLOWID_OUTBOUND_SENDTO V_fib_hash_outbound +#define CALC_FLOWID_OUTBOUND V_fib_hash_outbound +#else +#define CALC_FLOWID_OUTBOUND_SENDTO false +#define CALC_FLOWID_OUTBOUND false +#endif + +#endif /* RSS */ + + +#endif /* _KERNEL */ /* * We distinguish between routes to hosts and routes to networks, Modified: head/sys/net/route/mpath_ctl.c ============================================================================== --- head/sys/net/route/mpath_ctl.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/net/route/mpath_ctl.c Sun Oct 18 17:15:47 2020 (r366813) @@ -64,7 +64,21 @@ */ SYSCTL_DECL(_net_route); +VNET_DEFINE(u_int, fib_hash_outbound) = 0; +SYSCTL_UINT(_net_route, OID_AUTO, hash_outbound, CTLFLAG_RD | CTLFLAG_VNET, + &VNET_NAME(fib_hash_outbound), 0, + "Compute flowid for locally-originated packets"); +/* Default entropy to add to the hash calculation for the outbound connections*/ +uint8_t mpath_entropy_key[MPATH_ENTROPY_KEY_LEN] = { + 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, + 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, + 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, + 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, + 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa, +}; + + /* * Tries to add @rnd_add nhop to the existing set of nhops (@nh_orig) for the * prefix specified by @rt. @@ -113,6 +127,17 @@ add_route_mpath(struct rib_head *rnh, struct rt_addrin if (error != EAGAIN) break; RTSTAT_INC(rts_add_retry); + } + + if (V_fib_hash_outbound == 0 && error == 0 && + NH_IS_NHGRP(rc->rc_nh_new)) { + /* + * First multipath route got installed. Enable local + * outbound connections hashing. + */ + if (bootverbose) + printf("FIB: enabled flowid calculation for locally-originated packets\n"); + V_fib_hash_outbound = 1; } return (error); Modified: head/sys/net/route/route_var.h ============================================================================== --- head/sys/net/route/route_var.h Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/net/route/route_var.h Sun Oct 18 17:15:47 2020 (r366813) @@ -307,4 +307,8 @@ int nhgrp_get_addition_group(struct rib_head *rnh, void nhgrp_free(struct nhgrp_object *nhg); +/* Entropy data used for outbound hashing */ +#define MPATH_ENTROPY_KEY_LEN 40 +extern uint8_t mpath_entropy_key[MPATH_ENTROPY_KEY_LEN]; + #endif Modified: head/sys/netinet/in_fib.c ============================================================================== --- head/sys/netinet/in_fib.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet/in_fib.c Sun Oct 18 17:15:47 2020 (r366813) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -61,6 +62,40 @@ __FBSDID("$FreeBSD$"); /* Verify struct route compatiblity */ /* Assert 'struct route_in' is compatible with 'struct route' */ CHK_STRUCT_ROUTE_COMPAT(struct route_in, ro_dst4); + +#ifdef ROUTE_MPATH +struct _hash_5tuple_ipv4 { + struct in_addr src; + struct in_addr dst; + unsigned short src_port; + unsigned short dst_port; + char proto; + char spare[3]; +}; +_Static_assert(sizeof(struct _hash_5tuple_ipv4) == 16, + "_hash_5tuple_ipv4 size is wrong"); + + +uint32_t +fib4_calc_software_hash(struct in_addr src, struct in_addr dst, + unsigned short src_port, unsigned short dst_port, char proto, + uint32_t *phashtype) +{ + struct _hash_5tuple_ipv4 data; + + data.src = src; + data.dst = dst; + data.src_port = src_port; + data.dst_port = dst_port; + data.proto = proto; + data.spare[0] = data.spare[1] = data.spare[2] = 0; + + *phashtype = M_HASHTYPE_OPAQUE; + + return (toeplitz_hash(MPATH_ENTROPY_KEY_LEN, mpath_entropy_key, + sizeof(data), (uint8_t *)&data)); +} +#endif /* * Looks up path in fib @fibnum specified by @dst. Modified: head/sys/netinet/in_fib.h ============================================================================== --- head/sys/netinet/in_fib.h Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet/in_fib.h Sun Oct 18 17:15:47 2020 (r366813) @@ -51,4 +51,7 @@ int fib4_check_urpf(uint32_t fibnum, struct in_addr ds uint32_t flags, const struct ifnet *src_if); struct nhop_object *fib4_lookup_debugnet(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, uint32_t flags); +uint32_t fib4_calc_software_hash(struct in_addr src, struct in_addr dst, + unsigned short src_port, unsigned short dst_port, char proto, + uint32_t *phashtype); #endif Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet/in_pcb.c Sun Oct 18 17:15:47 2020 (r366813) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_ratelimit.h" #include "opt_pcbgroup.h" +#include "opt_route.h" #include "opt_rss.h" #include @@ -1327,7 +1328,17 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr lport = *lportp; faddr = sin->sin_addr; fport = sin->sin_port; +#ifdef ROUTE_MPATH + if (CALC_FLOWID_OUTBOUND) { + uint32_t hash_val, hash_type; + hash_val = fib4_calc_software_hash(laddr, faddr, 0, fport, + inp->inp_socket->so_proto->pr_protocol, &hash_type); + + inp->inp_flowid = hash_val; + inp->inp_flowtype = hash_type; + } +#endif if (!CK_STAILQ_EMPTY(&V_in_ifaddrhead)) { /* * If the destination address is INADDR_ANY, Modified: head/sys/netinet/in_rss.c ============================================================================== --- head/sys/netinet/in_rss.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet/in_rss.c Sun Oct 18 17:15:47 2020 (r366813) @@ -152,6 +152,48 @@ rss_proto_software_hash_v4(struct in_addr s, struct in } /* + * Calculate an appropriate ipv4 2-tuple or 4-tuple given the given + * IPv4 source/destination address, UDP or TCP source/destination ports + * and the protocol type. + * + * The protocol code may wish to do a software hash of the given + * tuple. This depends upon the currently configured RSS hash types. + * + * It assumes the packet source/destination address + * are in "outgoing" packet order (ie, destination is "far" address.) + */ +uint32_t +xps_proto_software_hash_v4(struct in_addr s, struct in_addr d, + u_short sp, u_short dp, int proto, uint32_t *hashtype) +{ + uint32_t hash; + + /* + * Next, choose the hash type depending upon the protocol + * identifier. + */ + if ((proto == IPPROTO_TCP) && + (rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV4)) { + hash = rss_hash_ip4_4tuple(d, dp, s, sp); + *hashtype = M_HASHTYPE_RSS_TCP_IPV4; + return (hash); + } else if ((proto == IPPROTO_UDP) && + (rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV4)) { + hash = rss_hash_ip4_4tuple(d, dp, s, sp); + *hashtype = M_HASHTYPE_RSS_UDP_IPV4; + return (hash); + } else if (rss_gethashconfig() & RSS_HASHTYPE_RSS_IPV4) { + /* RSS doesn't hash on other protocols like SCTP; so 2-tuple */ + hash = rss_hash_ip4_2tuple(d, s); + *hashtype = M_HASHTYPE_RSS_IPV4; + return (hash); + } + + *hashtype = M_HASHTYPE_NONE; + return (0); +} + +/* * Do a software calculation of the RSS for the given mbuf. * * This is typically used by the input path to recalculate the RSS after Modified: head/sys/netinet/in_rss.h ============================================================================== --- head/sys/netinet/in_rss.h Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet/in_rss.h Sun Oct 18 17:15:47 2020 (r366813) @@ -53,5 +53,7 @@ int rss_proto_software_hash_v4(struct in_addr src, uint32_t *hashtype); struct mbuf * rss_soft_m2cpuid_v4(struct mbuf *m, uintptr_t source, u_int *cpuid); +uint32_t xps_proto_software_hash_v4(struct in_addr s, struct in_addr d, + u_short sp, u_short dp, int proto, uint32_t *hashtype); #endif /* !_NETINET_IN_RSS_H_ */ Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet/raw_ip.c Sun Oct 18 17:15:47 2020 (r366813) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" +#include "opt_route.h" #include #include @@ -67,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -484,6 +486,17 @@ rip_output(struct mbuf *m, struct socket *so, ...) ip->ip_len = htons(m->m_pkthdr.len); ip->ip_src = inp->inp_laddr; ip->ip_dst.s_addr = dst; +#ifdef ROUTE_MPATH + if (CALC_FLOWID_OUTBOUND) { + uint32_t hash_type, hash_val; + + hash_val = fib4_calc_software_hash(ip->ip_src, + ip->ip_dst, 0, 0, ip->ip_p, &hash_type); + m->m_pkthdr.flowid = hash_val; + M_HASHTYPE_SET(m, hash_type); + flags |= IP_NODEFAULTFLOWID; + } +#endif if (jailed(inp->inp_cred)) { /* * prison_local_ip4() would be good enough but would @@ -519,7 +532,17 @@ rip_output(struct mbuf *m, struct socket *so, ...) return (EINVAL); ip = mtod(m, struct ip *); } +#ifdef ROUTE_MPATH + if (CALC_FLOWID_OUTBOUND) { + uint32_t hash_type, hash_val; + hash_val = fib4_calc_software_hash(ip->ip_dst, + ip->ip_src, 0, 0, ip->ip_p, &hash_type); + m->m_pkthdr.flowid = hash_val; + M_HASHTYPE_SET(m, hash_type); + flags |= IP_NODEFAULTFLOWID; + } +#endif INP_RLOCK(inp); /* * Don't allow both user specified and setsockopt options, Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet/udp_usrreq.c Sun Oct 18 17:15:47 2020 (r366813) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" +#include "opt_route.h" #include "opt_rss.h" #include @@ -76,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1483,30 +1485,14 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s m->m_pkthdr.flowid = flowid; M_HASHTYPE_SET(m, flowtype); } -#ifdef RSS - else { +#if defined(ROUTE_MPATH) || defined(RSS) + else if (CALC_FLOWID_OUTBOUND_SENDTO) { uint32_t hash_val, hash_type; - /* - * Calculate an appropriate RSS hash for UDP and - * UDP Lite. - * - * The called function will take care of figuring out - * whether a 2-tuple or 4-tuple hash is required based - * on the currently configured scheme. - * - * Later later on connected socket values should be - * cached in the inpcb and reused, rather than constantly - * re-calculating it. - * - * UDP Lite is a different protocol number and will - * likely end up being hashed as a 2-tuple until - * RSS / NICs grow UDP Lite protocol awareness. - */ - if (rss_proto_software_hash_v4(faddr, laddr, fport, lport, - pr, &hash_val, &hash_type) == 0) { - m->m_pkthdr.flowid = hash_val; - M_HASHTYPE_SET(m, hash_type); - } + + hash_val = fib4_calc_packet_hash(laddr, faddr, + lport, fport, pr, &hash_type); + m->m_pkthdr.flowid = hash_val; + M_HASHTYPE_SET(m, hash_type); } /* Modified: head/sys/netinet6/in6_fib.c ============================================================================== --- head/sys/netinet6/in6_fib.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet6/in6_fib.c Sun Oct 18 17:15:47 2020 (r366813) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -67,6 +68,39 @@ __FBSDID("$FreeBSD$"); #ifdef INET6 CHK_STRUCT_ROUTE_COMPAT(struct route_in6, ro_dst); + +#ifdef ROUTE_MPATH +struct _hash_5tuple_ipv6 { + struct in6_addr src; + struct in6_addr dst; + unsigned short src_port; + unsigned short dst_port; + char proto; + char spare[3]; +}; +_Static_assert(sizeof(struct _hash_5tuple_ipv6) == 40, + "_hash_5tuple_ipv6 size is wrong"); + +uint32_t +fib6_calc_software_hash(const struct in6_addr *src, const struct in6_addr *dst, + unsigned short src_port, unsigned short dst_port, char proto, + uint32_t *phashtype) +{ + struct _hash_5tuple_ipv6 data; + + data.src = *src; + data.dst = *dst; + data.src_port = src_port; + data.dst_port = dst_port; + data.proto = proto; + data.spare[0] = data.spare[1] = data.spare[2] = 0; + + *phashtype = M_HASHTYPE_OPAQUE_HASH; + + return (toeplitz_hash(MPATH_ENTROPY_KEY_LEN, mpath_entropy_key, + sizeof(data), (uint8_t *)&data)); +} +#endif /* * Looks up path in fib @fibnum specified by @dst. Modified: head/sys/netinet6/in6_fib.h ============================================================================== --- head/sys/netinet6/in6_fib.h Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet6/in6_fib.h Sun Oct 18 17:15:47 2020 (r366813) @@ -39,4 +39,7 @@ int fib6_check_urpf(uint32_t fibnum, const struct in6_ uint32_t scopeid, uint32_t flags, const struct ifnet *src_if); struct nhop_object *fib6_lookup_debugnet(uint32_t fibnum, const struct in6_addr *dst6, uint32_t scopeid, uint32_t flags); +uint32_t fib6_calc_software_hash(const struct in6_addr *src, + const struct in6_addr *dst, unsigned short src_port, unsigned short dst_port, + char proto, uint32_t *phashtype); #endif Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet6/in6_pcb.c Sun Oct 18 17:15:47 2020 (r366813) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_ipsec.h" #include "opt_pcbgroup.h" +#include "opt_route.h" #include "opt_rss.h" #include @@ -423,6 +424,17 @@ in6_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(pcbinfo); +#ifdef ROUTE_MPATH + if (CALC_FLOWID_OUTBOUND) { + uint32_t hash_type, hash_val; + + hash_val = fib6_calc_software_hash(&inp->in6p_laddr, + &sin6->sin6_addr, 0, sin6->sin6_port, + inp->inp_socket->so_proto->pr_protocol, &hash_type); + inp->inp_flowid = hash_val; + inp->inp_flowtype = hash_type; + } +#endif /* * Call inner routine, to assign local interface address. * in6_pcbladdr() may automatically fill in sin6_scope_id. Modified: head/sys/netinet6/in6_rss.c ============================================================================== --- head/sys/netinet6/in6_rss.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet6/in6_rss.c Sun Oct 18 17:15:47 2020 (r366813) @@ -153,6 +153,50 @@ rss_proto_software_hash_v6(const struct in6_addr *s, c } /* + * Calculate an appropriate ipv6 2-tuple or 4-tuple given the given + * IPv6 source/destination address, UDP or TCP source/destination ports + * and the protocol type. + * + * The protocol code may wish to do a software hash of the given + * tuple. This depends upon the currently configured RSS hash types. + * + * It assumes the packet source/destination address + * are in "outgoin" packet order (ie, destination is "far" address.) + */ +uint32_t +xps_proto_software_hash_v6(const struct in6_addr *s, const struct in6_addr *d, + u_short sp, u_short dp, int proto, uint32_t *hashtype) +{ + + uint32_t hash; + + /* + * Next, choose the hash type depending upon the protocol + * identifier. + */ + if ((proto == IPPROTO_TCP) && + (rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV6)) { + hash = rss_hash_ip6_4tuple(d, dp, s, sp); + *hashtype = M_HASHTYPE_RSS_TCP_IPV6; + return (hash); + } else if ((proto == IPPROTO_UDP) && + (rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV6)) { + hash = rss_hash_ip6_4tuple(d, dp, s, sp); + *hashtype = M_HASHTYPE_RSS_UDP_IPV6; + return (hash); + } else if (rss_gethashconfig() & RSS_HASHTYPE_RSS_IPV6) { + /* RSS doesn't hash on other protocols like SCTP; so 2-tuple */ + hash = rss_hash_ip6_2tuple(d, s); + *hashtype = M_HASHTYPE_RSS_IPV6; + return (hash); + } + + *hashtype = M_HASHTYPE_NONE; + return (0); +} + + +/* * Do a software calculation of the RSS for the given mbuf. * * This is typically used by the input path to recalculate the RSS after Modified: head/sys/netinet6/in6_rss.h ============================================================================== --- head/sys/netinet6/in6_rss.h Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet6/in6_rss.h Sun Oct 18 17:15:47 2020 (r366813) @@ -54,5 +54,8 @@ int rss_proto_software_hash_v6(const struct in6_addr uint32_t *hashtype); struct mbuf * rss_soft_m2cpuid_v6(struct mbuf *m, uintptr_t source, u_int *cpuid); +uint32_t xps_proto_software_hash_v6(const struct in6_addr *s, + const struct in6_addr *d, u_short sp, u_short dp, + int proto, uint32_t *hashtype); #endif /* !_NETINET6_IN6_RSS_H_ */ Modified: head/sys/netinet6/ip6_output.c ============================================================================== --- head/sys/netinet6/ip6_output.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet6/ip6_output.c Sun Oct 18 17:15:47 2020 (r366813) @@ -419,9 +419,6 @@ done: * * ifpp - XXX: just for statistics */ -/* - * XXX TODO: no flowid is assigned for outbound flows? - */ int ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, struct route_in6 *ro, int flags, struct ip6_moptions *im6o, @@ -775,7 +772,8 @@ again: } } - nh = fib6_lookup(fibnum, &kdst, scopeid, NHR_NONE, 0); + nh = fib6_lookup(fibnum, &kdst, scopeid, NHR_NONE, + m->m_pkthdr.flowid); if (nh == NULL) { IP6STAT_INC(ip6s_noroute); /* No ifp in6_ifstat_inc(ifp, ifs6_out_discard); */ Modified: head/sys/netinet6/raw_ip6.c ============================================================================== --- head/sys/netinet6/raw_ip6.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet6/raw_ip6.c Sun Oct 18 17:15:47 2020 (r366813) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ipsec.h" #include "opt_inet6.h" +#include "opt_route.h" #include #include @@ -103,6 +104,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -462,6 +464,17 @@ rip6_output(struct mbuf *m, struct socket *so, ...) } ip6 = mtod(m, struct ip6_hdr *); +#ifdef ROUTE_MPATH + if (CALC_FLOWID_OUTBOUND) { + uint32_t hash_type, hash_val; + + hash_val = fib6_calc_software_hash(&inp->in6p_laddr, + &dstsock->sin6_addr, 0, 0, so->so_proto->pr_protocol, + &hash_type); + inp->inp_flowid = hash_val; + inp->inp_flowtype = hash_type; + } +#endif /* * Source address selection. */ Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Sun Oct 18 16:30:49 2020 (r366812) +++ head/sys/netinet6/udp6_usrreq.c Sun Oct 18 17:15:47 2020 (r366813) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" #include "opt_ipsec.h" +#include "opt_route.h" #include "opt_rss.h" #include @@ -115,6 +116,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -954,42 +956,20 @@ udp6_output(struct socket *so, int flags_arg, struct m } flags = 0; -#ifdef RSS - { - uint32_t hash_val, hash_type; +#if defined(ROUTE_MPATH) || defined(RSS) + if (CALC_FLOWID_OUTBOUND_SENDTO) { + uint32_t hash_type, hash_val; uint8_t pr; pr = inp->inp_socket->so_proto->pr_protocol; - /* - * Calculate an appropriate RSS hash for UDP and - * UDP Lite. - * - * The called function will take care of figuring out - * whether a 2-tuple or 4-tuple hash is required based - * on the currently configured scheme. - * - * Later later on connected socket values should be - * cached in the inpcb and reused, rather than constantly - * re-calculating it. - * - * UDP Lite is a different protocol number and will - * likely end up being hashed as a 2-tuple until - * RSS / NICs grow UDP Lite protocol awareness. - */ - if (rss_proto_software_hash_v6(faddr, laddr, fport, - inp->inp_lport, pr, &hash_val, &hash_type) == 0) { - m->m_pkthdr.flowid = hash_val; - M_HASHTYPE_SET(m, hash_type); - } - /* - * Don't override with the inp cached flowid. - * - * Until the whole UDP path is vetted, it may actually - * be incorrect. - */ - flags |= IP_NODEFAULTFLOWID; + hash_val = fib6_calc_packet_hash(laddr, faddr, + inp->inp_lport, fport, pr, &hash_type); + m->m_pkthdr.flowid = hash_val; + M_HASHTYPE_SET(m, hash_type); } + /* do not use inp flowid */ + flags |= IP_NODEFAULTFLOWID; #endif UDPSTAT_INC(udps_opackets); From owner-svn-src-head@freebsd.org Sun Oct 18 17:31:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 960E14379CE; Sun, 18 Oct 2020 17:31:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDn3z3SSjz4krw; Sun, 18 Oct 2020 17:31:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B400160C8; Sun, 18 Oct 2020 17:31:11 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09IHVBju074596; Sun, 18 Oct 2020 17:31:11 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09IHVB5Y074595; Sun, 18 Oct 2020 17:31:11 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202010181731.09IHVB5Y074595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 18 Oct 2020 17:31:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366814 - head/contrib/llvm-project/libcxx/include X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/contrib/llvm-project/libcxx/include X-SVN-Commit-Revision: 366814 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 17:31:11 -0000 Author: adrian Date: Sun Oct 18 17:31:10 2020 New Revision: 366814 URL: https://svnweb.freebsd.org/changeset/base/366814 Log: [libcxx] Fix atomic type for mips32 on gcc to work w/out needing libatomic When compiling this for mips32 on gcc-6.x, we'd hit issues where we don't have 64 bit atomics on mips32. gcc implements this using libatomic, which we don't currently include in our freebsd-gcc compiler packages. So for now add this work around so mips32 works. It's also fine for mips64. We can fix this later once we get libatomic included. Approved by: dim Differential Revision: https://reviews.freebsd.org/D26774 Modified: head/contrib/llvm-project/libcxx/include/atomic Modified: head/contrib/llvm-project/libcxx/include/atomic ============================================================================== --- head/contrib/llvm-project/libcxx/include/atomic Sun Oct 18 17:15:47 2020 (r366813) +++ head/contrib/llvm-project/libcxx/include/atomic Sun Oct 18 17:31:10 2020 (r366814) @@ -1480,11 +1480,11 @@ struct __cxx_atomic_impl : public _Base { : _Base(value) {} }; -#ifdef __linux__ +#if defined(__linux__) || (defined(__FreeBSD__) && defined(__mips__)) using __cxx_contention_t = int32_t; #else using __cxx_contention_t = int64_t; -#endif //__linux__ +#endif #if _LIBCPP_STD_VER >= 11 From owner-svn-src-head@freebsd.org Sun Oct 18 18:35:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F6B8438CAF; Sun, 18 Oct 2020 18:35:24 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDpV42sM0z4nNV; Sun, 18 Oct 2020 18:35:24 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4173516DD0; Sun, 18 Oct 2020 18:35:24 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09IIZOTv016584; Sun, 18 Oct 2020 18:35:24 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09IIZNe5016580; Sun, 18 Oct 2020 18:35:23 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202010181835.09IIZNe5016580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Sun, 18 Oct 2020 18:35:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366815 - in head: . usr.bin/mkimg/tests X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: in head: . usr.bin/mkimg/tests X-SVN-Commit-Revision: 366815 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 18:35:24 -0000 Author: arichardson Date: Sun Oct 18 18:35:23 2020 New Revision: 366815 URL: https://svnweb.freebsd.org/changeset/base/366815 Log: Significantly speed up mkimg_test It turns out that the majority of the test time for the mkimg tests isn't mkimg itself but rather the use of jot and hexdump which can be quite slow on emulated platforms such as QEMU. On QEMU-RISC-V this reduces the time for `kyua test mkimg_test` from 655 seconds to 200. And for CheriBSD on QEMU-CHERI this saves 4-5 hours (25% of the time for the entire testsuite!) since jot ends up triggering slow functions inside the QEMU emulation a lot. Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D26796 Modified: head/Makefile.inc1 head/usr.bin/mkimg/tests/Makefile head/usr.bin/mkimg/tests/mkimg_test.sh Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sun Oct 18 17:31:10 2020 (r366814) +++ head/Makefile.inc1 Sun Oct 18 18:35:23 2020 (r366815) @@ -2342,6 +2342,8 @@ _other_bootstrap_tools+=tools/build/cross-build/fake_c .endif # mkfifo is used by sys/conf/newvers.sh _basic_bootstrap_tools+=usr.bin/mkfifo +# jot is needed for the mkimg tests +_basic_bootstrap_tools+=usr.bin/jot .if ${MK_BOOT} != "no" # md5 is used by boot/beri (and possibly others) Modified: head/usr.bin/mkimg/tests/Makefile ============================================================================== --- head/usr.bin/mkimg/tests/Makefile Sun Oct 18 17:31:10 2020 (r366814) +++ head/usr.bin/mkimg/tests/Makefile Sun Oct 18 18:35:23 2020 (r366815) @@ -15,9 +15,25 @@ $f: $f.hex sed -e '/^#.*/D' < ${.ALLSRC} > ${.TARGET} .endfor +# Note: Pre-generating this test file saves a lot of time when building on +# emulated platforms such as QEMU. It can take about 2-5 seconds to generate +# the test file using jot (depending on the emulated architecture) and this +# is done for each of the 168 test configurations. +# The effect is even more pronounced on CHERI-RISCV QEMU (emulating CHERI inside +# QEMU adds additional run-time overhead): Running the apm_1x1_512_raw without +# the pre-generated file takes about 108 seconds of which 102 seconds (over 95%) +# were spent running jot -b. It's even worse on CHERI-MIPS QEMU: 187 seconds +# for jot -b P 2097152 > /dev/null. By using a pre-generated 4MB file, the +# slowest test variant (vtoc8_63x255_4096_vhdx) now only takes 29 seconds (of +# which 26s are spent in hexdump -C) instead of previously 2min30s. +${PACKAGE}FILES+= partition_data_4M.bin +partition_data_4M.bin: Makefile + jot -b P 2097152 > ${.TARGET} || rm -f ${.TARGET} + CLEANFILES+= ${${PACKAGE}FILES}} -rebase: .PHONY - (cd ${.CURDIR}; /usr/libexec/atf-sh ${_REBASE_SCRIPT}.sh rebase) +rebase: partition_data_4M.bin ${_REBASE_SCRIPT} .PHONY + cd ${.CURDIR}; PATH=${.OBJDIR}/..:$${PATH}:/usr/bin:/bin \ + /usr/libexec/atf-sh ${.OBJDIR}/${_REBASE_SCRIPT} -s ${.OBJDIR} rebase .include Modified: head/usr.bin/mkimg/tests/mkimg_test.sh ============================================================================== --- head/usr.bin/mkimg/tests/mkimg_test.sh Sun Oct 18 17:31:10 2020 (r366814) +++ head/usr.bin/mkimg/tests/mkimg_test.sh Sun Oct 18 18:35:23 2020 (r366815) @@ -56,7 +56,7 @@ makeimage() if test -z "$partarg"; then local swap ufs swap="-p freebsd-swap::128K" - ufs="-p freebsd-ufs:=`mkcontents P 4194304`" + ufs="-p freebsd-ufs:=$(atf_get_srcdir)/partition_data_4M.bin" partarg="$ufs $swap" fi From owner-svn-src-head@freebsd.org Sun Oct 18 19:51:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 780A143A095; Sun, 18 Oct 2020 19:51:44 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "anubis.delphij.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDrB70ln0z4qym; Sun, 18 Oct 2020 19:51:42 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from p51.home.us.delphij.net (unknown [IPv6:2601:646:8601:f4a:e670:b8ff:fe5c:4e69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by anubis.delphij.net (Postfix) with ESMTPSA id 884DC47915; Sun, 18 Oct 2020 12:51:36 -0700 (PDT) Reply-To: d@delphij.net Subject: Re: svn commit: r366781 - in head: include lib/libc/stdlib To: Konstantin Belousov , Xin LI Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202010170414.09H4EdBF097521@repo.freebsd.org> <20201017065326.GY2643@kib.kiev.ua> From: Xin Li Organization: The FreeBSD Project Message-ID: <592395b1-3985-5416-a06a-44335321799f@delphij.net> Date: Sun, 18 Oct 2020 12:51:35 -0700 MIME-Version: 1.0 In-Reply-To: <20201017065326.GY2643@kib.kiev.ua> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4CDrB70ln0z4qym X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.38 / 15.00]; HAS_REPLYTO(0.00)[d@delphij.net]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; RCPT_COUNT_FIVE(0.00)[5]; HAS_ORG_HEADER(0.00)[]; DKIM_TRACE(0.00)[delphij.net:+]; DMARC_POLICY_ALLOW(-0.50)[delphij.net,reject]; NEURAL_HAM_SHORT(-0.47)[-0.474]; FREEMAIL_TO(0.00)[gmail.com,freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:64.62.128.0/18, country:US]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.93)[-0.933]; R_DKIM_ALLOW(-0.20)[delphij.net:s=m7e2]; FREEFALL_USER(0.00)[delphij]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.97)[-0.973]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_DOM_EQ_FROM_DOM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 19:51:44 -0000 Hi, Thanks very much for the feedback. I have created a new change for review at https://reviews.freebsd.org/D26845 , could you please take a look and let me know if it's satisfactory? On 10/16/20 11:53 PM, Konstantin Belousov wrote: [...]>> +int ptsname_r(int, char *, size_t); > This declaration appears in the __XSI_VISIBLE block, but I do not see the > function description in the IEEE Std 1003.1â„¢-2017 text (base issue 7). > > Review mentioned that the function is scheduled for issue 8, but shouldn't > it put under BSD_VISIBLE until specification is finalized ? Good point, fixed in the proposed change. [...] >> Modified: head/lib/libc/stdlib/Symbol.map >> ============================================================================== >> --- head/lib/libc/stdlib/Symbol.map Sat Oct 17 01:06:04 2020 (r366780) >> +++ head/lib/libc/stdlib/Symbol.map Sat Oct 17 04:14:38 2020 (r366781) >> @@ -125,6 +125,7 @@ FBSD_1.6 { >> qsort_s; >> rand; >> srand; >> + ptsname_r; > This is unsorted now. Fixed in the proposed change. [...] >> +{ >> + static char pt_slave[sizeof _PATH_DEV + SPECNAMELEN]; > We usually write sizeof(_PATH_DEV). This was from previous code so I leave it as-is, but fixed in the proposed change. >> + >> + if (ptsname_r(fildes, pt_slave, sizeof(pt_slave)) == 0) > Since ptsname_r is non-standard and exported, userspace is allowed to > interpose the symbol, which would break ptsname(). Thanks for pointing it out -- I should have paid more attention here. Fixed in the proposed change. >> + return (pt_slave); >> + else > 'else' is redundand. Removed else and used a straight return instead. Cheers, From owner-svn-src-head@freebsd.org Sun Oct 18 21:34:05 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4576143D205; Sun, 18 Oct 2020 21:34:05 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDtSF13MQz3W3P; Sun, 18 Oct 2020 21:34:05 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0882619033; Sun, 18 Oct 2020 21:34:05 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09ILY4xf028987; Sun, 18 Oct 2020 21:34:04 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09ILY4Jx028985; Sun, 18 Oct 2020 21:34:04 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202010182134.09ILY4Jx028985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 18 Oct 2020 21:34:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366817 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 366817 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 21:34:05 -0000 Author: bz Date: Sun Oct 18 21:34:04 2020 New Revision: 366817 URL: https://svnweb.freebsd.org/changeset/base/366817 Log: net80211: factor out the priv(9) checks into OS specifc code. Factor out the priv(9) checks into OS specifc code so other OSes can equally implement them. This sorts out those XXX in the net80211 code. We provide 3 arguments (cmd, vap, ifp) where available to the functions, in order to allow other OSes to use that data but also in case we'd add auditing to these check to have the information available. For now the arguments are marked __unused. PR: 249403 Reported by: martin(NetBSD) Reviewed by: adrian, martin(NetBSD) MFC after: 10 days Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate") Differential Revision: https://reviews.freebsd.org/D26541 Modified: head/sys/net80211/ieee80211_freebsd.c head/sys/net80211/ieee80211_freebsd.h head/sys/net80211/ieee80211_ioctl.c Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Sun Oct 18 20:54:15 2020 (r366816) +++ head/sys/net80211/ieee80211_freebsd.c Sun Oct 18 21:34:04 2020 (r366817) @@ -75,6 +75,42 @@ SYSCTL_INT(_net_wlan, OID_AUTO, debug, CTLFLAG_RW, &ie static const char wlanname[] = "wlan"; static struct if_clone *wlan_cloner; +/* + * priv(9) NET80211 checks. + * Return 0 if operation is allowed, E* (usually EPERM) otherwise. + */ +int +ieee80211_priv_check_vap_getkey(u_long cmd __unused, + struct ieee80211vap *vap __unused, struct ifnet *ifp __unused) +{ + + return (priv_check(curthread, PRIV_NET80211_VAP_GETKEY)); +} + +int +ieee80211_priv_check_vap_manage(u_long cmd __unused, + struct ieee80211vap *vap __unused, struct ifnet *ifp __unused) +{ + + return (priv_check(curthread, PRIV_NET80211_VAP_MANAGE)); +} + +int +ieee80211_priv_check_vap_setmac(u_long cmd __unused, + struct ieee80211vap *vap __unused, struct ifnet *ifp __unused) +{ + + return (priv_check(curthread, PRIV_NET80211_VAP_SETMAC)); +} + +int +ieee80211_priv_check_create_vap(u_long cmd __unused, + struct ieee80211vap *vap __unused, struct ifnet *ifp __unused) +{ + + return (priv_check(curthread, PRIV_NET80211_CREATE_VAP)); +} + static int wlan_clone_create(struct if_clone *ifc, int unit, caddr_t params) { @@ -83,7 +119,7 @@ wlan_clone_create(struct if_clone *ifc, int unit, cadd struct ieee80211com *ic; int error; - error = priv_check(curthread, PRIV_NET80211_CREATE_VAP); + error = ieee80211_priv_check_create_vap(0, NULL, NULL); if (error) return error; Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Sun Oct 18 20:54:15 2020 (r366816) +++ head/sys/net80211/ieee80211_freebsd.h Sun Oct 18 21:34:04 2020 (r366817) @@ -43,6 +43,19 @@ #include /* + * priv(9) NET80211 checks. + */ +struct ieee80211vap; +int ieee80211_priv_check_vap_getkey(u_long, struct ieee80211vap *, + struct ifnet *); +int ieee80211_priv_check_vap_manage(u_long, struct ieee80211vap *, + struct ifnet *); +int ieee80211_priv_check_vap_setmac(u_long, struct ieee80211vap *, + struct ifnet *); +int ieee80211_priv_check_create_vap(u_long, struct ieee80211vap *, + struct ifnet *); + +/* * Common state locking definitions. */ typedef struct { Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Sun Oct 18 20:54:15 2020 (r366816) +++ head/sys/net80211/ieee80211_ioctl.c Sun Oct 18 21:34:04 2020 (r366817) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -72,7 +71,8 @@ static int ieee80211_scanreq(struct ieee80211vap *, struct ieee80211_scan_req *); static int -ieee80211_ioctl_getkey(struct ieee80211vap *vap, struct ieee80211req *ireq) +ieee80211_ioctl_getkey(u_long cmd, struct ieee80211vap *vap, + struct ieee80211req *ireq) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node *ni; @@ -106,8 +106,7 @@ ieee80211_ioctl_getkey(struct ieee80211vap *vap, struc ik.ik_flags = wk->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV); if (wk->wk_keyix == vap->iv_def_txkey) ik.ik_flags |= IEEE80211_KEY_DEFAULT; - /* XXX TODO: move priv check to ieee80211_freebsd.c */ - if (priv_check(curthread, PRIV_NET80211_VAP_GETKEY) == 0) { + if (ieee80211_priv_check_vap_getkey(cmd, vap, NULL) == 0) { /* NB: only root can read key data */ ik.ik_keyrsc = wk->wk_keyrsc[IEEE80211_NONQOS_TID]; ik.ik_keytsc = wk->wk_keytsc; @@ -822,8 +821,7 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_l return EINVAL; len = (u_int) vap->iv_nw_keys[kid].wk_keylen; /* NB: only root can read WEP keys */ - /* XXX TODO: move priv check to ieee80211_freebsd.c */ - if (priv_check(curthread, PRIV_NET80211_VAP_GETKEY) == 0) { + if (ieee80211_priv_check_vap_getkey(cmd, vap, NULL) == 0) { bcopy(vap->iv_nw_keys[kid].wk_key, tmpkey, len); } else { bzero(tmpkey, len); @@ -916,7 +914,7 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_l ireq->i_val = (vap->iv_flags & IEEE80211_F_NOBRIDGE) == 0; break; case IEEE80211_IOC_WPAKEY: - error = ieee80211_ioctl_getkey(vap, ireq); + error = ieee80211_ioctl_getkey(cmd, vap, ireq); break; case IEEE80211_IOC_CHANINFO: error = ieee80211_ioctl_getchaninfo(vap, ireq); @@ -3630,8 +3628,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t (struct ieee80211req *) data); break; case SIOCS80211: - /* XXX TODO: move priv check to ieee80211_freebsd.c */ - error = priv_check(curthread, PRIV_NET80211_VAP_MANAGE); + error = ieee80211_priv_check_vap_manage(cmd, vap, ifp); if (error == 0) error = ieee80211_ioctl_set80211(vap, cmd, (struct ieee80211req *) data); @@ -3677,8 +3674,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t } break; case SIOCSIFLLADDR: - /* XXX TODO: move priv check to ieee80211_freebsd.c */ - error = priv_check(curthread, PRIV_NET80211_VAP_SETMAC); + error = ieee80211_priv_check_vap_setmac(cmd, vap, ifp); if (error == 0) break; /* Fallthrough */ From owner-svn-src-head@freebsd.org Sun Oct 18 22:37:58 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB40543E25C; Sun, 18 Oct 2020 22:37:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDvsy5T17z3Xxp; Sun, 18 Oct 2020 22:37:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9EE5C19BBA; Sun, 18 Oct 2020 22:37:58 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09IMbwsF065912; Sun, 18 Oct 2020 22:37:58 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09IMbwGb065911; Sun, 18 Oct 2020 22:37:58 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202010182237.09IMbwGb065911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 18 Oct 2020 22:37:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366818 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 366818 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 22:37:58 -0000 Author: adrian Date: Sun Oct 18 22:37:58 2020 New Revision: 366818 URL: https://svnweb.freebsd.org/changeset/base/366818 Log: [zfs] Remove a non-existent directory in the build infra This directory doesn't exist and causes gcc-6.4 to complain about a non-existent include directory Approved by: kevans, imp Differential Revision: https://reviews.freebsd.org/D26846 Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Sun Oct 18 21:34:04 2020 (r366817) +++ head/sys/conf/kmod.mk Sun Oct 18 22:37:58 2020 (r366818) @@ -540,7 +540,6 @@ OPENZFS_CFLAGS= \ -nostdinc \ -DSMP \ -I${ZINCDIR} \ - -I${ZINCDIR}/spl \ -I${ZINCDIR}/os/freebsd \ -I${ZINCDIR}/os/freebsd/spl \ -I${ZINCDIR}/os/freebsd/zfs \ From owner-svn-src-head@freebsd.org Sun Oct 18 23:32:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B93B43ED74; Sun, 18 Oct 2020 23:32:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDx5D38YNz3b8n; Sun, 18 Oct 2020 23:32:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5019D1A7F0; Sun, 18 Oct 2020 23:32:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09INWmt4002563; Sun, 18 Oct 2020 23:32:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09INWluw002559; Sun, 18 Oct 2020 23:32:47 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202010182332.09INWluw002559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 18 Oct 2020 23:32:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366819 - head/lib/libbe X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libbe X-SVN-Commit-Revision: 366819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 23:32:48 -0000 Author: kevans Date: Sun Oct 18 23:32:47 2020 New Revision: 366819 URL: https://svnweb.freebsd.org/changeset/base/366819 Log: libbe(3): const'ify a couple arguments libbe will never need to mutate these as we either process them into a local buffer or we just don't touch them and write to a separate out argument. MFC after: 1 week Modified: head/lib/libbe/be.h head/lib/libbe/be_access.c head/lib/libbe/be_info.c head/lib/libbe/libbe.3 Modified: head/lib/libbe/be.h ============================================================================== --- head/lib/libbe/be.h Sun Oct 18 22:37:58 2020 (r366818) +++ head/lib/libbe/be.h Sun Oct 18 23:32:47 2020 (r366819) @@ -112,8 +112,8 @@ typedef enum { BE_MNT_DEEP = 1 << 1, } be_mount_opt_t; -int be_mount(libbe_handle_t *, char *, char *, int, char *); -int be_unmount(libbe_handle_t *, char *, int); +int be_mount(libbe_handle_t *, const char *, const char *, int, char *); +int be_unmount(libbe_handle_t *, const char *, int); int be_mounted_at(libbe_handle_t *, const char *path, nvlist_t *); /* Error related functions: be_error.c */ @@ -125,7 +125,7 @@ void libbe_print_on_error(libbe_handle_t *, bool); int be_root_concat(libbe_handle_t *, const char *, char *); int be_validate_name(libbe_handle_t * __unused, const char *); int be_validate_snap(libbe_handle_t *, const char *); -int be_exists(libbe_handle_t *, char *); +int be_exists(libbe_handle_t *, const char *); int be_export(libbe_handle_t *, const char *, int fd); int be_import(libbe_handle_t *, const char *, int fd); Modified: head/lib/libbe/be_access.c ============================================================================== --- head/lib/libbe/be_access.c Sun Oct 18 22:37:58 2020 (r366818) +++ head/lib/libbe/be_access.c Sun Oct 18 23:32:47 2020 (r366819) @@ -232,8 +232,8 @@ be_mounted_at(libbe_handle_t *lbh, const char *path, n * usage */ int -be_mount(libbe_handle_t *lbh, char *bootenv, char *mountpoint, int flags, - char *result_loc) +be_mount(libbe_handle_t *lbh, const char *bootenv, const char *mountpoint, + int flags, char *result_loc) { char be[BE_MAXPATHLEN]; char mnt_temp[BE_MAXPATHLEN]; @@ -288,7 +288,7 @@ be_mount(libbe_handle_t *lbh, char *bootenv, char *mou * usage */ int -be_unmount(libbe_handle_t *lbh, char *bootenv, int flags) +be_unmount(libbe_handle_t *lbh, const char *bootenv, int flags) { int err; char be[BE_MAXPATHLEN]; Modified: head/lib/libbe/be_info.c ============================================================================== --- head/lib/libbe/be_info.c Sun Oct 18 22:37:58 2020 (r366818) +++ head/lib/libbe/be_info.c Sun Oct 18 23:32:47 2020 (r366819) @@ -305,7 +305,7 @@ be_prop_list_free(nvlist_t *be_list) * Usage */ int -be_exists(libbe_handle_t *lbh, char *be) +be_exists(libbe_handle_t *lbh, const char *be) { char buf[BE_MAXPATHLEN]; Modified: head/lib/libbe/libbe.3 ============================================================================== --- head/lib/libbe/libbe.3 Sun Oct 18 22:37:58 2020 (r366818) +++ head/lib/libbe/libbe.3 Sun Oct 18 23:32:47 2020 (r366819) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 22, 2020 +.Dd August 18, 2020 .Dt LIBBE 3 .Os .Sh NAME @@ -94,13 +94,13 @@ .\" BE_MNT_DEEP = 1 << 1, .\" } be_mount_opt_t .Ft int -.Fn be_mount "libbe_handle_t *hdl" "char *be_name" "char *mntpoint" "int flags" "char *result" +.Fn be_mount "libbe_handle_t *hdl" "const char *be_name" "const char *mntpoint" "int flags" "char *result" .Pp .Ft int .Fn be_mounted_at "libbe_handle_t *hdl" "const char *path" "nvlist_t *details" .Pp .Ft int -.Fn be_unmount "libbe_handle_t *hdl" "char *be_name" "int flags" +.Fn be_unmount "libbe_handle_t *hdl" "const char *be_name" "int flags" .Pp .Ft int .Fn libbe_errno "libbe_handle_t *hdl" @@ -121,7 +121,7 @@ .Fn be_validate_snap "libbe_handle_t *hdl" "const char *snap" .Pp .Ft int -.Fn be_exists "libbe_handle_t *hdl" "char *be_name" +.Fn be_exists "libbe_handle_t *hdl" "const char *be_name" .Pp .Ft int .Fn be_export "libbe_handle_t *hdl" "const char *be_name" "int fd" From owner-svn-src-head@freebsd.org Sun Oct 18 23:42:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32FBE43F317; Sun, 18 Oct 2020 23:42:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDxHs0cnfz3bNm; Sun, 18 Oct 2020 23:42:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECD091AC00; Sun, 18 Oct 2020 23:42:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09INg06g007801; Sun, 18 Oct 2020 23:42:00 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09INg0CX007800; Sun, 18 Oct 2020 23:42:00 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202010182342.09INg0CX007800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 18 Oct 2020 23:42:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366820 - head/lib/libbe X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libbe X-SVN-Commit-Revision: 366820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 23:42:01 -0000 Author: kevans Date: Sun Oct 18 23:42:00 2020 New Revision: 366820 URL: https://svnweb.freebsd.org/changeset/base/366820 Log: libbe(3): document be_snapshot() While toying around with lua bindings for libbe(3), I discovered that I apparently never documented this, despite having documented be_is_auto_snapshot_name that references it. MFC after: 1 week Modified: head/lib/libbe/libbe.3 Modified: head/lib/libbe/libbe.3 ============================================================================== --- head/lib/libbe/libbe.3 Sun Oct 18 23:32:47 2020 (r366819) +++ head/lib/libbe/libbe.3 Sun Oct 18 23:42:00 2020 (r366820) @@ -58,6 +58,9 @@ .Ft const char * Ns .Fn be_root_path "libbe_handle_t *hdl" .Pp +.Ft int Ns +.Fn be_snapshot "libbe_handle_t *hdl" "const char *be_name" "const char *snap_name" "bool recursive" "char *result" +.Pp .Ft bool Ns .Fn be_is_auto_snapshot_name "libbe_handle_t *hdl" "const char *snap" .Pp @@ -218,6 +221,30 @@ active on reboot. The .Fn be_root_path function returns the boot environment root path. +.Pp +The +.Fn be_snapshot +function creates a snapshot of +.Fa be_name +named +.Fa snap_name . +A +.Dv NULL +.Fa snap_name +may be used, indicating that +.Fn be_snaphot +should derive the snapshot name from the current date and time. +If +.Fa recursive +is set, then +.Fn be_snapshot +will recursively snapshot the dataset. +If +.Fa result +is not +.Dv NULL , +then it will be populated with the final +.Dq Fa be_name Ns @ Ns Fa snap_name . .Pp The .Fn be_is_auto_snapshot_name From owner-svn-src-head@freebsd.org Sun Oct 18 23:58:41 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 216E043F2F4; Sun, 18 Oct 2020 23:58:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDxg46zZvz3bqy; Sun, 18 Oct 2020 23:58:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEEC11ABBA; Sun, 18 Oct 2020 23:58:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09INwePi014826; Sun, 18 Oct 2020 23:58:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09INwepp014824; Sun, 18 Oct 2020 23:58:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202010182358.09INwepp014824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 18 Oct 2020 23:58:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366821 - in head: lib/libbe tools/build/mk X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: lib/libbe tools/build/mk X-SVN-Commit-Revision: 366821 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 18 Oct 2020 23:58:41 -0000 Author: kevans Date: Sun Oct 18 23:58:40 2020 New Revision: 366821 URL: https://svnweb.freebsd.org/changeset/base/366821 Log: libbe(3): install MLINKS for all of the functions provided MFC after: 1 week Modified: head/lib/libbe/Makefile head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/lib/libbe/Makefile ============================================================================== --- head/lib/libbe/Makefile Sun Oct 18 23:42:00 2020 (r366820) +++ head/lib/libbe/Makefile Sun Oct 18 23:58:40 2020 (r366821) @@ -11,6 +11,41 @@ SHLIB_MINOR= 0 SRCS= be.c be_access.c be_error.c be_info.c INCS= be.h MAN= libbe.3 +MLINKS+= libbe.3 be_activate.3 +MLINKS+= libbe.3 be_active_name.3 +MLINKS+= libbe.3 be_active_path.3 +MLINKS+= libbe.3 be_create_depth.3 +MLINKS+= libbe.3 be_create_from_existing_snap.3 +MLINKS+= libbe.3 be_create_from_existing.3 +MLINKS+= libbe.3 be_create.3 +MLINKS+= libbe.3 be_deactivate.3 +MLINKS+= libbe.3 be_destroy.3 +MLINKS+= libbe.3 be_exists.3 +MLINKS+= libbe.3 be_export.3 +MLINKS+= libbe.3 be_get_bootenv_props.3 +MLINKS+= libbe.3 be_get_dataset_props.3 +MLINKS+= libbe.3 be_get_dataset_snapshots.3 +MLINKS+= libbe.3 be_import.3 +MLINKS+= libbe.3 be_is_auto_snapshot_name.3 +MLINKS+= libbe.3 be_mount.3 +MLINKS+= libbe.3 be_mounted_at.3 +MLINKS+= libbe.3 be_nextboot_name.3 +MLINKS+= libbe.3 be_nextboot_path.3 +MLINKS+= libbe.3 be_nicenum.3 +MLINKS+= libbe.3 be_prop_list_alloc.3 +MLINKS+= libbe.3 be_prop_list_free.3 +MLINKS+= libbe.3 be_rename.3 +MLINKS+= libbe.3 be_root_concat.3 +MLINKS+= libbe.3 be_root_path.3 +MLINKS+= libbe.3 be_snapshot.3 +MLINKS+= libbe.3 be_unmount.3 +MLINKS+= libbe.3 be_validate_name.3 +MLINKS+= libbe.3 be_validate_snap.3 +MLINKS+= libbe.3 libbe_close.3 +MLINKS+= libbe.3 libbe_errno.3 +MLINKS+= libbe.3 libbe_error_description.3 +MLINKS+= libbe.3 libbe_init.3 +MLINKS+= libbe.3 libbe_print_on_error.3 LIBADD+= zfs LIBADD+= nvpair Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Sun Oct 18 23:42:00 2020 (r366820) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sun Oct 18 23:58:40 2020 (r366821) @@ -1172,6 +1172,41 @@ OLD_LIBS+=usr/lib32/libzpool.so.2 OLD_FILES+=usr/sbin/zfsd OLD_FILES+=usr/sbin/zhack OLD_FILES+=usr/sbin/zdb +OLD_FILES+=usr/share/man/man3/be_activate.3.gz +OLD_FILES+=usr/share/man/man3/be_active_name.3.gz +OLD_FILES+=usr/share/man/man3/be_active_path.3.gz +OLD_FILES+=usr/share/man/man3/be_create_depth.3.gz +OLD_FILES+=usr/share/man/man3/be_create_from_existing_snap.3.gz +OLD_FILES+=usr/share/man/man3/be_create_from_existing.3.gz +OLD_FILES+=usr/share/man/man3/be_create.3.gz +OLD_FILES+=usr/share/man/man3/be_deactivate.3.gz +OLD_FILES+=usr/share/man/man3/be_destroy.3.gz +OLD_FILES+=usr/share/man/man3/be_exists.3.gz +OLD_FILES+=usr/share/man/man3/be_export.3.gz +OLD_FILES+=usr/share/man/man3/be_get_bootenv_props.3.gz +OLD_FILES+=usr/share/man/man3/be_get_dataset_props.3.gz +OLD_FILES+=usr/share/man/man3/be_get_dataset_snapshots.3.gz +OLD_FILES+=usr/share/man/man3/be_import.3.gz +OLD_FILES+=usr/share/man/man3/be_is_auto_snapshot_name.3.gz +OLD_FILES+=usr/share/man/man3/be_mount.3.gz +OLD_FILES+=usr/share/man/man3/be_mounted_at.3.gz +OLD_FILES+=usr/share/man/man3/be_nextboot_name.3.gz +OLD_FILES+=usr/share/man/man3/be_nextboot_path.3.gz +OLD_FILES+=usr/share/man/man3/be_nicenum.3.gz +OLD_FILES+=usr/share/man/man3/be_prop_list_alloc.3.gz +OLD_FILES+=usr/share/man/man3/be_prop_list_free.3.gz +OLD_FILES+=usr/share/man/man3/be_rename.3.gz +OLD_FILES+=usr/share/man/man3/be_root_concat.3.gz +OLD_FILES+=usr/share/man/man3/be_root_path.3.gz +OLD_FILES+=usr/share/man/man3/be_snapshot.3.gz +OLD_FILES+=usr/share/man/man3/be_unmount.3.gz +OLD_FILES+=usr/share/man/man3/be_validate_name.3.gz +OLD_FILES+=usr/share/man/man3/be_validate_snap.3.gz +OLD_FILES+=usr/share/man/man3/libbe_close.3.gz +OLD_FILES+=usr/share/man/man3/libbe_errno.3.gz +OLD_FILES+=usr/share/man/man3/libbe_error_description.3.gz +OLD_FILES+=usr/share/man/man3/libbe_init.3.gz +OLD_FILES+=usr/share/man/man3/libbe_print_on_error.3.gz OLD_FILES+=usr/share/man/man3/libbe.3.gz OLD_FILES+=usr/share/man/man5/zpool-features.5.gz OLD_FILES+=usr/share/man/man8/bectl.8.gz From owner-svn-src-head@freebsd.org Mon Oct 19 01:16:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 927E5440BBF; Mon, 19 Oct 2020 01:16:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDzP43JnQz3fdG; Mon, 19 Oct 2020 01:16:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 550D71BA22; Mon, 19 Oct 2020 01:16:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09J1Ge6V063354; Mon, 19 Oct 2020 01:16:40 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09J1GeNt063353; Mon, 19 Oct 2020 01:16:40 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202010190116.09J1GeNt063353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 19 Oct 2020 01:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366822 - in head: share/man/man5 usr.bin/login X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: share/man/man5 usr.bin/login X-SVN-Commit-Revision: 366822 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 01:16:40 -0000 Author: imp Date: Mon Oct 19 01:16:39 2020 New Revision: 366822 URL: https://svnweb.freebsd.org/changeset/base/366822 Log: Add more explicit instructions about updating motd Not that you can regenerate the motd by editing motd.template and running 'service motd restart' rather than rebooting. Small wordsmithing by me, and updated the example from FreeBSD 2.1.6.1 release to 12.1 release. Submitted by: Dan Mack Modified: head/share/man/man5/motd.5 head/usr.bin/login/motd.template Modified: head/share/man/man5/motd.5 ============================================================================== --- head/share/man/man5/motd.5 Sun Oct 18 23:58:40 2020 (r366821) +++ head/share/man/man5/motd.5 Mon Oct 19 01:16:39 2020 (r366822) @@ -3,7 +3,7 @@ .\" This file is in the public domain. .\" $FreeBSD$ .\" -.Dd July 20, 2019 +.Dd October 18, 2020 .Dt MOTD 5 .Os .Sh NAME @@ -22,6 +22,14 @@ prepended to and the contents are written to .Pa /var/run/motd . .Pp +.Pa /var/run/motd +can be updated without a system reboot by manually restarting the +motd service after updating +.Pa /etc/motd.template: +.Bd -literal -offset -ident -compact +service motd restart +.Ed +.Pp Individual users may suppress the display of this file by creating a file named .Dq Pa .hushlogin @@ -39,7 +47,7 @@ Suppresses output of .El .Sh EXAMPLES .Bd -literal -FreeBSD 2.1.6.1-RELEASE (GENERIC) #0: Sun Dec 29 03:08:31 PST 1996 +FreeBSD 12.1-RELEASE (GENERIC) #0: Sun Dec 29 03:08:31 PST 2019 /home is full. Please cleanup your directories. .Ed Modified: head/usr.bin/login/motd.template ============================================================================== --- head/usr.bin/login/motd.template Sun Oct 18 23:58:40 2020 (r366821) +++ head/usr.bin/login/motd.template Mon Oct 19 01:16:39 2020 (r366822) @@ -17,4 +17,4 @@ Please include that output and any error messages when Introduction to manual pages: man man FreeBSD directory layout: man hier -Edit /etc/motd.template to change this login announcement. +To change this login announcement, see motd(5). From owner-svn-src-head@freebsd.org Mon Oct 19 07:26:42 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCC6A447B27; Mon, 19 Oct 2020 07:26:42 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CF7c251rbz4Dn1; Mon, 19 Oct 2020 07:26:42 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9080420168; Mon, 19 Oct 2020 07:26:42 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09J7QgPw090965; Mon, 19 Oct 2020 07:26:42 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09J7Qg6m090964; Mon, 19 Oct 2020 07:26:42 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <202010190726.09J7Qg6m090964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 19 Oct 2020 07:26:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366828 - head/usr.sbin/pkg X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/usr.sbin/pkg X-SVN-Commit-Revision: 366828 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 07:26:42 -0000 Author: bapt Date: Mon Oct 19 07:26:42 2020 New Revision: 366828 URL: https://svnweb.freebsd.org/changeset/base/366828 Log: Use asprintf instead of sbuf Modified: head/usr.sbin/pkg/config.c Modified: head/usr.sbin/pkg/config.c ============================================================================== --- head/usr.sbin/pkg/config.c Mon Oct 19 07:03:04 2020 (r366827) +++ head/usr.sbin/pkg/config.c Mon Oct 19 07:26:42 2020 (r366828) @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include @@ -168,7 +168,7 @@ pkg_get_myabi(char *dest, size_t sz) static void subst_packagesite(const char *abi) { - struct sbuf *newval; + char *newval; const char *variable_string; const char *oldval; @@ -180,14 +180,14 @@ subst_packagesite(const char *abi) if ((variable_string = strstr(oldval, "${ABI}")) == NULL) return; - newval = sbuf_new_auto(); - sbuf_bcat(newval, oldval, variable_string - oldval); - sbuf_cat(newval, abi); - sbuf_cat(newval, variable_string + strlen("${ABI}")); - sbuf_finish(newval); + asprintf(&newval, "%.*s%s%s", + (int)(variable_string - oldval), oldval, abi, + variable_string + strlen("${ABI}")); + if (newval == NULL) + errx(EXIT_FAILURE, "asprintf"); free(c[PACKAGESITE].value); - c[PACKAGESITE].value = strdup(sbuf_data(newval)); + c[PACKAGESITE].value = newval; } static int From owner-svn-src-head@freebsd.org Mon Oct 19 09:52:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 496AF44AE9C; Mon, 19 Oct 2020 09:52:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFBrj1Fx7z4N8w; Mon, 19 Oct 2020 09:52:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E79221D19; Mon, 19 Oct 2020 09:52:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09J9qqrD083268; Mon, 19 Oct 2020 09:52:52 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09J9qqFi083267; Mon, 19 Oct 2020 09:52:52 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010190952.09J9qqFi083267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 19 Oct 2020 09:52:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366829 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 09:52:53 -0000 Author: mjg Date: Mon Oct 19 09:52:52 2020 New Revision: 366829 URL: https://svnweb.freebsd.org/changeset/base/366829 Log: cache: refactor negative promotion/demotion handling This will simplify policy changes. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Oct 19 07:26:42 2020 (r366828) +++ head/sys/kern/vfs_cache.c Mon Oct 19 09:52:52 2020 (r366829) @@ -908,11 +908,37 @@ cache_neg_init(struct namecache *ncp) counter_u64_add(neg_created, 1); } +static bool +cache_neg_hit_prep(struct namecache *ncp) +{ + struct negstate *ns; + + ns = NCP2NEGSTATE(ncp); + if ((ns->neg_flag & NEG_HOT) != 0) + return (true); + return (false); +} + /* + * Nothing to do here but it is provided for completeness as some + * cache_neg_hit_prep callers may end up returning without even + * trying to promote. + */ +#define cache_neg_hit_abort(ncp) do { } while (0) + +static void +cache_neg_hit_finish(struct namecache *ncp) +{ + + SDT_PROBE2(vfs, namecache, lookup, hit__negative, ncp->nc_dvp, ncp->nc_name); + counter_u64_add(numneghits, 1); +} + +/* * Move a negative entry to the hot list. */ static void -cache_neg_promote(struct namecache *ncp) +cache_neg_promote_locked(struct namecache *ncp) { struct neglist *nl; struct negstate *ns; @@ -929,6 +955,25 @@ cache_neg_promote(struct namecache *ncp) } /* + * Move a hot negative entry to the cold list. + */ +static void +cache_neg_demote_locked(struct namecache *ncp) +{ + struct neglist *nl; + struct negstate *ns; + + ns = NCP2NEGSTATE(ncp); + nl = NCP2NEGLIST(ncp); + mtx_assert(&nl->nl_lock, MA_OWNED); + MPASS(ns->neg_flag & NEG_HOT); + TAILQ_REMOVE(&nl->nl_hotlist, ncp, nc_dst); + TAILQ_INSERT_TAIL(&nl->nl_list, ncp, nc_dst); + nl->nl_hotnum--; + ns->neg_flag &= ~NEG_HOT; +} + +/* * Move a negative entry to the hot list if it matches the lookup. * * We have to take locks, but they may be contended and in the worst @@ -996,10 +1041,8 @@ cache_neg_promote_cond(struct vnode *dvp, struct compo goto out_abort; } - cache_neg_promote(ncp); - - SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, ncp->nc_name); - counter_u64_add(numneghits, 1); + cache_neg_promote_locked(ncp); + cache_neg_hit_finish(ncp); vfs_smr_exit(); mtx_unlock(&nl->nl_lock); return (true); @@ -1010,17 +1053,13 @@ out_abort: } static void -cache_neg_hit(struct namecache *ncp) +cache_neg_promote(struct namecache *ncp) { struct neglist *nl; - struct negstate *ns; - ns = NCP2NEGSTATE(ncp); - if ((ns->neg_flag & NEG_HOT) != 0) - return; nl = NCP2NEGLIST(ncp); mtx_lock(&nl->nl_lock); - cache_neg_promote(ncp); + cache_neg_promote_locked(ncp); mtx_unlock(&nl->nl_lock); } @@ -1094,11 +1133,7 @@ cache_neg_evict(void) mtx_lock(&nl->nl_lock); ncp = TAILQ_FIRST(&nl->nl_hotlist); if (ncp != NULL) { - ns = NCP2NEGSTATE(ncp); - TAILQ_REMOVE(&nl->nl_hotlist, ncp, nc_dst); - TAILQ_INSERT_TAIL(&nl->nl_list, ncp, nc_dst); - nl->nl_hotnum--; - ns->neg_flag &= ~NEG_HOT; + cache_neg_demote_locked(ncp); } ncp = TAILQ_FIRST(&nl->nl_list); if (ncp == NULL) { @@ -1542,11 +1577,12 @@ negative_success: } } - SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, ncp->nc_name); - cache_out_ts(ncp, tsp, ticksp); - counter_u64_add(numneghits, 1); whiteout = (ncp->nc_flag & NCF_WHITE); - cache_neg_hit(ncp); + cache_out_ts(ncp, tsp, ticksp); + if (cache_neg_hit_prep(ncp)) + cache_neg_promote(ncp); + else + cache_neg_hit_finish(ncp); mtx_unlock(dvlp); if (whiteout) cnp->cn_flags |= ISWHITEOUT; @@ -1653,11 +1689,12 @@ negative_success: } } - SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, ncp->nc_name); - cache_out_ts(ncp, tsp, ticksp); - counter_u64_add(numneghits, 1); whiteout = (ncp->nc_flag & NCF_WHITE); - cache_neg_hit(ncp); + cache_out_ts(ncp, tsp, ticksp); + if (cache_neg_hit_prep(ncp)) + cache_neg_promote(ncp); + else + cache_neg_hit_finish(ncp); mtx_unlock(blp); if (whiteout) cnp->cn_flags |= ISWHITEOUT; @@ -1669,11 +1706,10 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, st struct timespec *tsp, int *ticksp) { struct namecache *ncp; - struct negstate *ns; uint32_t hash; enum vgetstate vs; int error; - bool whiteout, neg_hot; + bool whiteout, neg_promote; u_short nc_flag; MPASS((tsp == NULL && ticksp == NULL) || (tsp != NULL && ticksp != NULL)); @@ -1752,19 +1788,18 @@ negative_success: cache_out_ts(ncp, tsp, ticksp); whiteout = (ncp->nc_flag & NCF_WHITE); - ns = NCP2NEGSTATE(ncp); - neg_hot = ((ns->neg_flag & NEG_HOT) != 0); + neg_promote = cache_neg_hit_prep(ncp); if (__predict_false(!cache_ncp_canuse(ncp))) { + cache_neg_hit_abort(ncp); vfs_smr_exit(); goto out_fallback; } - if (!neg_hot) { + if (neg_promote) { vfs_smr_exit(); if (!cache_neg_promote_cond(dvp, cnp, ncp, hash)) goto out_fallback; } else { - SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, ncp->nc_name); - counter_u64_add(numneghits, 1); + cache_neg_hit_finish(ncp); vfs_smr_exit(); } if (whiteout) @@ -3917,12 +3952,9 @@ cache_fplookup_dotdot(struct cache_fpl *fpl) static int __noinline cache_fplookup_neg(struct cache_fpl *fpl, struct namecache *ncp, uint32_t hash) { - struct negstate *ns; - struct vnode *dvp; u_char nc_flag; - bool neg_hot; + bool neg_promote; - dvp = fpl->dvp; nc_flag = atomic_load_char(&ncp->nc_flag); MPASS((nc_flag & NCF_NEGATIVE) != 0); /* @@ -3936,19 +3968,19 @@ cache_fplookup_neg(struct cache_fpl *fpl, struct namec */ return (cache_fpl_partial(fpl)); } - ns = NCP2NEGSTATE(ncp); - neg_hot = ((ns->neg_flag & NEG_HOT) != 0); + neg_promote = cache_neg_hit_prep(ncp); if (__predict_false(!cache_ncp_canuse(ncp))) { + cache_neg_hit_abort(ncp); return (cache_fpl_partial(fpl)); } if (__predict_false((nc_flag & NCF_WHITE) != 0)) { + cache_neg_hit_abort(ncp); return (cache_fpl_partial(fpl)); } - if (!neg_hot) { + if (neg_promote) { return (cache_fplookup_negative_promote(fpl, ncp, hash)); } - SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, ncp->nc_name); - counter_u64_add(numneghits, 1); + cache_neg_hit_finish(ncp); cache_fpl_smr_exit(fpl); return (cache_fpl_handled(fpl, ENOENT)); } From owner-svn-src-head@freebsd.org Mon Oct 19 10:38:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C038744B9AA; Mon, 19 Oct 2020 10:38:40 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFCsX4jNVz4QBq; Mon, 19 Oct 2020 10:38:40 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80A2B22465; Mon, 19 Oct 2020 10:38:40 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JAce1t008376; Mon, 19 Oct 2020 10:38:40 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JAcepX008375; Mon, 19 Oct 2020 10:38:40 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202010191038.09JAcepX008375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Mon, 19 Oct 2020 10:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366830 - head/usr.sbin/efibootmgr X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: head/usr.sbin/efibootmgr X-SVN-Commit-Revision: 366830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 10:38:40 -0000 Author: freqlabs Date: Mon Oct 19 10:38:40 2020 New Revision: 366830 URL: https://svnweb.freebsd.org/changeset/base/366830 Log: efibootmgr: Use returned error code for error message, not errno efivar_unix_path_to_device_path returns the error code, it does not set errno. Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26852 Modified: head/usr.sbin/efibootmgr/efibootmgr.c Modified: head/usr.sbin/efibootmgr/efibootmgr.c ============================================================================== --- head/usr.sbin/efibootmgr/efibootmgr.c Mon Oct 19 09:52:52 2020 (r366829) +++ head/usr.sbin/efibootmgr/efibootmgr.c Mon Oct 19 10:38:40 2020 (r366830) @@ -674,11 +674,16 @@ make_boot_var(const char *label, const char *loader, c err(1, "bootvar creation"); if (loader == NULL) errx(1, "Must specify boot loader"); - if (efivar_unix_path_to_device_path(loader, &loaderdp) != 0) - err(1, "Cannot translate unix loader path '%s' to UEFI", loader); + ret = efivar_unix_path_to_device_path(loader, &loaderdp); + if (ret != 0) + errc(1, ret, "Cannot translate unix loader path '%s' to UEFI", + loader); if (kernel != NULL) { - if (efivar_unix_path_to_device_path(kernel, &kerneldp) != 0) - err(1, "Cannot translate unix kernel path '%s' to UEFI", kernel); + ret = efivar_unix_path_to_device_path(kernel, &kerneldp); + if (ret != 0) + errc(1, ret, + "Cannot translate unix kernel path '%s' to UEFI", + kernel); } else { kerneldp = NULL; } From owner-svn-src-head@freebsd.org Mon Oct 19 12:06:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 726E844E40C; Mon, 19 Oct 2020 12:06:17 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFFpd27w8z4Wcg; Mon, 19 Oct 2020 12:06:17 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C9C1231F0; Mon, 19 Oct 2020 12:06:17 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JC6HYL063684; Mon, 19 Oct 2020 12:06:17 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JC6Gi0063682; Mon, 19 Oct 2020 12:06:16 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202010191206.09JC6Gi0063682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 19 Oct 2020 12:06:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366831 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 366831 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 12:06:17 -0000 Author: andrew Date: Mon Oct 19 12:06:16 2020 New Revision: 366831 URL: https://svnweb.freebsd.org/changeset/base/366831 Log: Move the arm64 userspace access checks to macros In the functions that copy between userspace and kernel space we check the user space address is valid before performing the copy. These are mostly identical within each type of function so create two macros to perform the check. Obtained from: CheriBSD Sponsored by: Innovate UK Modified: head/sys/arm64/arm64/copyinout.S head/sys/arm64/arm64/support.S Modified: head/sys/arm64/arm64/copyinout.S ============================================================================== --- head/sys/arm64/arm64/copyinout.S Mon Oct 19 10:38:40 2020 (r366830) +++ head/sys/arm64/arm64/copyinout.S Mon Oct 19 12:06:16 2020 (r366831) @@ -37,6 +37,14 @@ __FBSDID("$FreeBSD$"); #include "assym.inc" +.macro check_user_access user_arg, size_arg, bad_access_func + adds x6, x\user_arg, x\size_arg + b.cs \bad_access_func + ldr x7, =VM_MAXUSER_ADDRESS + cmp x6, x7 + b.hi \bad_access_func +.endm + /* * Fault handler for the copy{in,out} functions below. */ @@ -55,11 +63,7 @@ END(copyio_fault) */ ENTRY(copyout) cbz x2, 1f - adds x3, x1, x2 - b.cs copyio_fault_nopcb - ldr x4, =VM_MAXUSER_ADDRESS - cmp x3, x4 - b.hi copyio_fault_nopcb + check_user_access 1, 2, copyio_fault_nopcb b copycommon @@ -75,11 +79,7 @@ END(copyout) */ ENTRY(copyin) cbz x2, 1f - adds x3, x0, x2 - b.cs copyio_fault_nopcb - ldr x4, =VM_MAXUSER_ADDRESS - cmp x3, x4 - b.hi copyio_fault_nopcb + check_user_access 0, 2, copyio_fault_nopcb b copycommon Modified: head/sys/arm64/arm64/support.S ============================================================================== --- head/sys/arm64/arm64/support.S Mon Oct 19 10:38:40 2020 (r366830) +++ head/sys/arm64/arm64/support.S Mon Oct 19 12:06:16 2020 (r366831) @@ -38,6 +38,12 @@ __FBSDID("$FreeBSD$"); #include "assym.inc" +.macro check_user_access user_arg, limit, bad_addr_func + ldr x7, =(\limit) + cmp x\user_arg, x7 + b.cs \bad_addr_func +.endm + /* * One of the fu* or su* functions failed, return -1. */ @@ -53,9 +59,7 @@ END(fsu_fault) * int casueword32(volatile uint32_t *, uint32_t, uint32_t *, uint32_t) */ ENTRY(casueword32) - ldr x4, =(VM_MAXUSER_ADDRESS-3) - cmp x0, x4 - b.cs fsu_fault_nopcb + check_user_access 0, (VM_MAXUSER_ADDRESS-3), fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ mov w5, #1 SET_FAULT_HANDLER(x6, x4) /* And set it */ @@ -75,9 +79,7 @@ END(casueword32) * int casueword(volatile u_long *, u_long, u_long *, u_long) */ ENTRY(casueword) - ldr x4, =(VM_MAXUSER_ADDRESS-7) - cmp x0, x4 - b.cs fsu_fault_nopcb + check_user_access 0, (VM_MAXUSER_ADDRESS-7), fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ mov w5, #1 SET_FAULT_HANDLER(x6, x4) /* And set it */ @@ -97,9 +99,7 @@ END(casueword) * int fubyte(volatile const void *) */ ENTRY(fubyte) - ldr x1, =VM_MAXUSER_ADDRESS - cmp x0, x1 - b.cs fsu_fault_nopcb + check_user_access 0, (VM_MAXUSER_ADDRESS), fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(x6, x1) /* And set it */ ldtrb w0, [x0] /* Try loading the data */ @@ -111,9 +111,7 @@ END(fubyte) * int fuword(volatile const void *) */ ENTRY(fuword16) - ldr x1, =(VM_MAXUSER_ADDRESS-1) - cmp x0, x1 - b.cs fsu_fault_nopcb + check_user_access 0, (VM_MAXUSER_ADDRESS-1), fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(x6, x1) /* And set it */ ldtrh w0, [x0] /* Try loading the data */ @@ -125,9 +123,7 @@ END(fuword16) * int32_t fueword32(volatile const void *, int32_t *) */ ENTRY(fueword32) - ldr x2, =(VM_MAXUSER_ADDRESS-3) - cmp x0, x2 - b.cs fsu_fault_nopcb + check_user_access 0, (VM_MAXUSER_ADDRESS-3), fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(x6, x2) /* And set it */ ldtr w0, [x0] /* Try loading the data */ @@ -143,9 +139,7 @@ END(fueword32) */ ENTRY(fueword) EENTRY(fueword64) - ldr x2, =(VM_MAXUSER_ADDRESS-7) - cmp x0, x2 - b.cs fsu_fault_nopcb + check_user_access 0, (VM_MAXUSER_ADDRESS-7), fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(x6, x2) /* And set it */ ldtr x0, [x0] /* Try loading the data */ @@ -160,9 +154,7 @@ END(fueword) * int subyte(volatile void *, int) */ ENTRY(subyte) - ldr x2, =VM_MAXUSER_ADDRESS - cmp x0, x2 - b.cs fsu_fault_nopcb + check_user_access 0, (VM_MAXUSER_ADDRESS), fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(x6, x2) /* And set it */ sttrb w1, [x0] /* Try storing the data */ @@ -175,9 +167,7 @@ END(subyte) * int suword16(volatile void *, int) */ ENTRY(suword16) - ldr x2, =(VM_MAXUSER_ADDRESS-1) - cmp x0, x2 - b.cs fsu_fault_nopcb + check_user_access 0, (VM_MAXUSER_ADDRESS-1), fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(x6, x2) /* And set it */ sttrh w1, [x0] /* Try storing the data */ @@ -190,9 +180,7 @@ END(suword16) * int suword32(volatile void *, int) */ ENTRY(suword32) - ldr x2, =(VM_MAXUSER_ADDRESS-3) - cmp x0, x2 - b.cs fsu_fault_nopcb + check_user_access 0, (VM_MAXUSER_ADDRESS-3), fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(x6, x2) /* And set it */ sttr w1, [x0] /* Try storing the data */ @@ -206,9 +194,7 @@ END(suword32) */ ENTRY(suword) EENTRY(suword64) - ldr x2, =(VM_MAXUSER_ADDRESS-7) - cmp x0, x2 - b.cs fsu_fault_nopcb + check_user_access 0, (VM_MAXUSER_ADDRESS-7), fsu_fault_nopcb adr x6, fsu_fault /* Load the fault handler */ SET_FAULT_HANDLER(x6, x2) /* And set it */ sttr x1, [x0] /* Try storing the data */ From owner-svn-src-head@freebsd.org Mon Oct 19 12:46:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6346E44EF69; Mon, 19 Oct 2020 12:46:04 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFGhX1xD2z4YRL; Mon, 19 Oct 2020 12:46:04 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25AD023D31; Mon, 19 Oct 2020 12:46:04 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JCk4YV088269; Mon, 19 Oct 2020 12:46:04 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JCk4YY088268; Mon, 19 Oct 2020 12:46:04 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202010191246.09JCk4YY088268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 19 Oct 2020 12:46:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366832 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 366832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 12:46:04 -0000 Author: andrew Date: Mon Oct 19 12:46:03 2020 New Revision: 366832 URL: https://svnweb.freebsd.org/changeset/base/366832 Log: Split the common arm64 fu* and su* asm to a macro As these are mostly identical split out the common code to a macro. Sponsored by: Innovate UK Modified: head/sys/arm64/arm64/support.S Modified: head/sys/arm64/arm64/support.S ============================================================================== --- head/sys/arm64/arm64/support.S Mon Oct 19 12:06:16 2020 (r366831) +++ head/sys/arm64/arm64/support.S Mon Oct 19 12:46:03 2020 (r366832) @@ -95,15 +95,19 @@ ENTRY(casueword) ret /* Return */ END(casueword) +.macro fsudata insn, ret_reg, user_arg + adr x7, fsu_fault /* Load the fault handler */ + SET_FAULT_HANDLER(x7, x6) /* And set it */ + \insn \ret_reg, [x\user_arg] /* Try accessing the data */ + SET_FAULT_HANDLER(xzr, x6) /* Reset the fault handler */ +.endm + /* * int fubyte(volatile const void *) */ ENTRY(fubyte) check_user_access 0, (VM_MAXUSER_ADDRESS), fsu_fault_nopcb - adr x6, fsu_fault /* Load the fault handler */ - SET_FAULT_HANDLER(x6, x1) /* And set it */ - ldtrb w0, [x0] /* Try loading the data */ - SET_FAULT_HANDLER(xzr, x1) /* Reset the fault handler */ + fsudata ldtrb, w0, 0 ret /* Return */ END(fubyte) @@ -112,10 +116,7 @@ END(fubyte) */ ENTRY(fuword16) check_user_access 0, (VM_MAXUSER_ADDRESS-1), fsu_fault_nopcb - adr x6, fsu_fault /* Load the fault handler */ - SET_FAULT_HANDLER(x6, x1) /* And set it */ - ldtrh w0, [x0] /* Try loading the data */ - SET_FAULT_HANDLER(xzr, x1) /* Reset the fault handler */ + fsudata ldtrh, w0, 0 ret /* Return */ END(fuword16) @@ -124,10 +125,7 @@ END(fuword16) */ ENTRY(fueword32) check_user_access 0, (VM_MAXUSER_ADDRESS-3), fsu_fault_nopcb - adr x6, fsu_fault /* Load the fault handler */ - SET_FAULT_HANDLER(x6, x2) /* And set it */ - ldtr w0, [x0] /* Try loading the data */ - SET_FAULT_HANDLER(xzr, x2) /* Reset the fault handler */ + fsudata ldtr, w0, 0 str w0, [x1] /* Save the data in kernel space */ mov w0, #0 /* Success */ ret /* Return */ @@ -140,10 +138,7 @@ END(fueword32) ENTRY(fueword) EENTRY(fueword64) check_user_access 0, (VM_MAXUSER_ADDRESS-7), fsu_fault_nopcb - adr x6, fsu_fault /* Load the fault handler */ - SET_FAULT_HANDLER(x6, x2) /* And set it */ - ldtr x0, [x0] /* Try loading the data */ - SET_FAULT_HANDLER(xzr, x2) /* Reset the fault handler */ + fsudata ldtr, x0, 0 str x0, [x1] /* Save the data in kernel space */ mov x0, #0 /* Success */ ret /* Return */ @@ -155,10 +150,7 @@ END(fueword) */ ENTRY(subyte) check_user_access 0, (VM_MAXUSER_ADDRESS), fsu_fault_nopcb - adr x6, fsu_fault /* Load the fault handler */ - SET_FAULT_HANDLER(x6, x2) /* And set it */ - sttrb w1, [x0] /* Try storing the data */ - SET_FAULT_HANDLER(xzr, x2) /* Reset the fault handler */ + fsudata sttrb, w1, 0 mov x0, #0 /* Success */ ret /* Return */ END(subyte) @@ -168,10 +160,7 @@ END(subyte) */ ENTRY(suword16) check_user_access 0, (VM_MAXUSER_ADDRESS-1), fsu_fault_nopcb - adr x6, fsu_fault /* Load the fault handler */ - SET_FAULT_HANDLER(x6, x2) /* And set it */ - sttrh w1, [x0] /* Try storing the data */ - SET_FAULT_HANDLER(xzr, x2) /* Reset the fault handler */ + fsudata sttrh, w1, 0 mov x0, #0 /* Success */ ret /* Return */ END(suword16) @@ -181,10 +170,7 @@ END(suword16) */ ENTRY(suword32) check_user_access 0, (VM_MAXUSER_ADDRESS-3), fsu_fault_nopcb - adr x6, fsu_fault /* Load the fault handler */ - SET_FAULT_HANDLER(x6, x2) /* And set it */ - sttr w1, [x0] /* Try storing the data */ - SET_FAULT_HANDLER(xzr, x2) /* Reset the fault handler */ + fsudata sttr, w1, 0 mov x0, #0 /* Success */ ret /* Return */ END(suword32) @@ -195,10 +181,7 @@ END(suword32) ENTRY(suword) EENTRY(suword64) check_user_access 0, (VM_MAXUSER_ADDRESS-7), fsu_fault_nopcb - adr x6, fsu_fault /* Load the fault handler */ - SET_FAULT_HANDLER(x6, x2) /* And set it */ - sttr x1, [x0] /* Try storing the data */ - SET_FAULT_HANDLER(xzr, x2) /* Reset the fault handler */ + fsudata sttr, x1, 0 mov x0, #0 /* Success */ ret /* Return */ EEND(suword64) From owner-svn-src-head@freebsd.org Mon Oct 19 13:10:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CE3944FA2D; Mon, 19 Oct 2020 13:10:23 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFHDb0LXGz4Zmw; Mon, 19 Oct 2020 13:10:23 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4850240C8; Mon, 19 Oct 2020 13:10:22 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JDAMQb000959; Mon, 19 Oct 2020 13:10:22 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JDALHp000954; Mon, 19 Oct 2020 13:10:21 GMT (envelope-from br@FreeBSD.org) Message-Id: <202010191310.09JDALHp000954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 19 Oct 2020 13:10:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366833 - in head/sys: dev/iommu kern sys X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: dev/iommu kern sys X-SVN-Commit-Revision: 366833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 13:10:23 -0000 Author: br Date: Mon Oct 19 13:10:21 2020 New Revision: 366833 URL: https://svnweb.freebsd.org/changeset/base/366833 Log: Manage MSI iommu pages. This allows the interrupt controller driver only need a small change to create a map for the page the device will write to raise an interrupt. Submitted by: andrew Reviewed by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26705 Added: head/sys/dev/iommu/iommu_msi.h (contents, props changed) Modified: head/sys/dev/iommu/iommu.h head/sys/dev/iommu/iommu_gas.c head/sys/kern/msi_if.m head/sys/kern/subr_intr.c head/sys/sys/intr.h Modified: head/sys/dev/iommu/iommu.h ============================================================================== --- head/sys/dev/iommu/iommu.h Mon Oct 19 12:46:03 2020 (r366832) +++ head/sys/dev/iommu/iommu.h Mon Oct 19 13:10:21 2020 (r366833) @@ -111,6 +111,9 @@ struct iommu_domain { iommu_gaddr_t end; /* (c) Highest address + 1 in the guest AS */ struct iommu_map_entry *first_place, *last_place; /* (d) */ + struct iommu_map_entry *msi_entry; /* (d) Arch-specific */ + iommu_gaddr_t msi_base; /* (d) Arch-specific */ + vm_paddr_t msi_phys; /* (d) Arch-specific */ u_int flags; /* (u) */ }; Modified: head/sys/dev/iommu/iommu_gas.c ============================================================================== --- head/sys/dev/iommu/iommu_gas.c Mon Oct 19 12:46:03 2020 (r366832) +++ head/sys/dev/iommu/iommu_gas.c Mon Oct 19 13:10:21 2020 (r366833) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -722,6 +723,69 @@ iommu_map(struct iommu_domain *domain, ma, res); return (error); +} + +int +iommu_map_msi(struct iommu_ctx *ctx, iommu_gaddr_t size, int offset, + u_int eflags, u_int flags, vm_page_t *ma) +{ + struct iommu_domain *domain; + struct iommu_map_entry *entry; + int error; + + error = 0; + domain = ctx->domain; + + /* Check if there is already an MSI page allocated */ + IOMMU_DOMAIN_LOCK(domain); + entry = domain->msi_entry; + IOMMU_DOMAIN_UNLOCK(domain); + + if (entry == NULL) { + error = iommu_gas_map(domain, &ctx->tag->common, size, offset, + eflags, flags, ma, &entry); + IOMMU_DOMAIN_LOCK(domain); + if (error == 0) { + if (domain->msi_entry == NULL) { + MPASS(domain->msi_base == 0); + MPASS(domain->msi_phys == 0); + + domain->msi_entry = entry; + domain->msi_base = entry->start; + domain->msi_phys = VM_PAGE_TO_PHYS(ma[0]); + } else { + /* + * We lost the race and already have an + * MSI page allocated. Free the unneeded entry. + */ + iommu_gas_free_entry(domain, entry); + } + } else if (domain->msi_entry != NULL) { + /* + * The allocation failed, but another succeeded. + * Return success as there is a valid MSI page. + */ + error = 0; + } + IOMMU_DOMAIN_UNLOCK(domain); + } + + return (error); +} + +void +iommu_translate_msi(struct iommu_domain *domain, uint64_t *addr) +{ + + *addr = (*addr - domain->msi_phys) + domain->msi_base; + + KASSERT(*addr >= domain->msi_entry->start, + ("%s: Address is below the MSI entry start address (%jx < %jx)", + __func__, (uintmax_t)*addr, (uintmax_t)domain->msi_entry->start)); + + KASSERT(*addr + sizeof(*addr) <= domain->msi_entry->end, + ("%s: Address is above the MSI entry end address (%jx < %jx)", + __func__, (uintmax_t)*addr, (uintmax_t)domain->msi_entry->end)); } int Added: head/sys/dev/iommu/iommu_msi.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iommu/iommu_msi.h Mon Oct 19 13:10:21 2020 (r366833) @@ -0,0 +1,46 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Andrew Turner + * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * + * 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$ + */ + +#ifndef _DEV_IOMMU_IOMMU_MSI_H_ +#define _DEV_IOMMU_IOMMU_MSI_H_ + +#include + +struct iommu_unit; +struct iommu_domain; +struct iommu_ctx; + +void iommu_translate_msi(struct iommu_domain *domain, uint64_t *addr); +int iommu_map_msi(struct iommu_ctx *ctx, iommu_gaddr_t size, int offset, + u_int eflags, u_int flags, vm_page_t *ma); + +#endif /* !_DEV_IOMMU_IOMMU_MSI_H_ */ Modified: head/sys/kern/msi_if.m ============================================================================== --- head/sys/kern/msi_if.m Mon Oct 19 12:46:03 2020 (r366832) +++ head/sys/kern/msi_if.m Mon Oct 19 13:10:21 2020 (r366833) @@ -32,6 +32,9 @@ INTERFACE msi; HEADER { + #include + #include + struct intr_irqsrc; }; @@ -72,3 +75,8 @@ METHOD int map_msi { uint32_t *data; }; +METHOD int iommu_init { + device_t dev; + device_t child; + struct iommu_domain **domain; +}; Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Mon Oct 19 12:46:03 2020 (r366832) +++ head/sys/kern/subr_intr.c Mon Oct 19 13:10:21 2020 (r366833) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_hwpmc_hooks.h" +#include "opt_iommu.h" #include #include @@ -50,6 +51,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -70,6 +73,10 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef IOMMU +#include +#endif + #include "pic_if.h" #include "msi_if.h" @@ -1290,6 +1297,9 @@ int intr_alloc_msi(device_t pci, device_t child, intptr_t xref, int count, int maxcount, int *irqs) { +#ifdef IOMMU + struct iommu_domain *domain; +#endif struct intr_irqsrc **isrc; struct intr_pic *pic; device_t pdev; @@ -1304,6 +1314,16 @@ intr_alloc_msi(device_t pci, device_t child, intptr_t ("%s: Found a non-MSI controller: %s", __func__, device_get_name(pic->pic_dev))); +#ifdef IOMMU + /* + * If this is the first time we have used this context ask the + * interrupt controller to map memory the msi source will need. + */ + err = MSI_IOMMU_INIT(pic->pic_dev, child, &domain); + if (err != 0) + return (err); +#endif + isrc = malloc(sizeof(*isrc) * count, M_INTRNG, M_WAITOK); err = MSI_ALLOC_MSI(pic->pic_dev, child, count, maxcount, &pdev, isrc); if (err != 0) { @@ -1312,9 +1332,13 @@ intr_alloc_msi(device_t pci, device_t child, intptr_t } for (i = 0; i < count; i++) { +#ifdef IOMMU + isrc[i]->isrc_iommu = domain; +#endif msi = (struct intr_map_data_msi *)intr_alloc_map_data( INTR_MAP_DATA_MSI, sizeof(*msi), M_WAITOK | M_ZERO); msi-> isrc = isrc[i]; + irqs[i] = intr_map_irq(pic->pic_dev, xref, (struct intr_map_data *)msi); } @@ -1365,6 +1389,9 @@ intr_release_msi(device_t pci, device_t child, intptr_ int intr_alloc_msix(device_t pci, device_t child, intptr_t xref, int *irq) { +#ifdef IOMMU + struct iommu_domain *domain; +#endif struct intr_irqsrc *isrc; struct intr_pic *pic; device_t pdev; @@ -1379,10 +1406,23 @@ intr_alloc_msix(device_t pci, device_t child, intptr_t ("%s: Found a non-MSI controller: %s", __func__, device_get_name(pic->pic_dev))); +#ifdef IOMMU + /* + * If this is the first time we have used this context ask the + * interrupt controller to map memory the msi source will need. + */ + err = MSI_IOMMU_INIT(pic->pic_dev, child, &domain); + if (err != 0) + return (err); +#endif + err = MSI_ALLOC_MSIX(pic->pic_dev, child, &pdev, &isrc); if (err != 0) return (err); +#ifdef IOMMU + isrc->isrc_iommu = domain; +#endif msi = (struct intr_map_data_msi *)intr_alloc_map_data( INTR_MAP_DATA_MSI, sizeof(*msi), M_WAITOK | M_ZERO); msi->isrc = isrc; @@ -1444,6 +1484,12 @@ intr_map_msi(device_t pci, device_t child, intptr_t xr return (EINVAL); err = MSI_MAP_MSI(pic->pic_dev, child, isrc, addr, data); + +#ifdef IOMMU + if (isrc->isrc_iommu != NULL) + iommu_translate_msi(isrc->isrc_iommu, addr); +#endif + return (err); } Modified: head/sys/sys/intr.h ============================================================================== --- head/sys/sys/intr.h Mon Oct 19 12:46:03 2020 (r366832) +++ head/sys/sys/intr.h Mon Oct 19 13:10:21 2020 (r366833) @@ -94,6 +94,8 @@ struct intr_irqsrc { intr_irq_filter_t * isrc_filter; void * isrc_arg; #endif + /* Used by MSI interrupts to store the iommu details */ + void * isrc_iommu; }; /* Intr interface for PIC. */ From owner-svn-src-head@freebsd.org Mon Oct 19 14:08:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1486442908D for ; Mon, 19 Oct 2020 14:08:37 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFJWm2CK1z4dW2 for ; Mon, 19 Oct 2020 14:08:36 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f48.google.com with SMTP id k21so92518wmi.1 for ; Mon, 19 Oct 2020 07:08:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=5R5pdH4R32/0k5o0GwSTPn6c4ahM8/mwab1+6Sr2TEg=; b=VjZ0F8l32gq62/RKjX4TQdXSS0H32K4CksdXcl4+Pc6j2ZXluc+lW6+YrEtYXHRK2I sErefoPRvsJrmjPbuONNLmAotOxe3DJDQQutJg/Xd6FzyuLvdD/hKcnBIjLjrBv4u5pm bZqv6yqgRySDGEEibIC9dPlRHawFn1FsQTp0jR8O3DmOIjeT7ASkOv0EUcmPHI01V3+D LDAhwMH8tDEz6ZoP86Rbi5A1RM38Cb0M1PY+cu+7BmbaxFhBYRkZGRbkcHGNiE531Ga4 t49ffQkUmy6im5fss5mlzmPkmcVexnBHL7CwgE3tpimrq41zynjJNfu4OLMQ+qiCGZQv NhXA== X-Gm-Message-State: AOAM53239bNsl9yVYP/zn20mN0kPRhVjeKSyPQhzIHlfaJw6Qk+CTME7 jFhwrX84vbfKud8IPcLlSTaarg== X-Google-Smtp-Source: ABdhPJw5edk7YKfNUtfB17P7Hxyex+v7PYB/rG5Ol7+SVnOzLn0NGs03BrUzNlKtvcg+ES+f6ONw5Q== X-Received: by 2002:a1c:7c09:: with SMTP id x9mr18455009wmc.181.1603116514494; Mon, 19 Oct 2020 07:08:34 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id j17sm17323727wrw.68.2020.10.19.07.08.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2020 07:08:33 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: svn commit: r366833 - in head/sys: dev/iommu kern sys From: Jessica Clarke In-Reply-To: <202010191310.09JDALHp000954@repo.freebsd.org> Date: Mon, 19 Oct 2020 15:08:32 +0100 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <917B04A7-C9CA-439B-8334-C602F1E68005@freebsd.org> References: <202010191310.09JDALHp000954@repo.freebsd.org> To: Ruslan Bukin X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4CFJWm2CK1z4dW2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.128.48 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.01 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.54)[-0.544]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.01)[-1.013]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-0.95)[-0.953]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.128.48:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.48:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 14:08:37 -0000 On 19 Oct 2020, at 14:10, Ruslan Bukin wrote: > > +#ifndef _DEV_IOMMU_IOMMU_MSI_H_ > +#define _DEV_IOMMU_IOMMU_MSI_H_ > + > +#include > + > +struct iommu_unit; This seems unused, perhaps left from a previous patch version? Jess From owner-svn-src-head@freebsd.org Mon Oct 19 15:24:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 679C342B971; Mon, 19 Oct 2020 15:24:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFLCT254Yz3VkW; Mon, 19 Oct 2020 15:24:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1142725C00; Mon, 19 Oct 2020 15:24:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JFOaa2086508; Mon, 19 Oct 2020 15:24:36 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JFOaDT086504; Mon, 19 Oct 2020 15:24:36 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202010191524.09JFOaDT086504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 19 Oct 2020 15:24:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366834 - head/sys/amd64/vmm/intel X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/amd64/vmm/intel X-SVN-Commit-Revision: 366834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 15:24:37 -0000 Author: markj Date: Mon Oct 19 15:24:35 2020 New Revision: 366834 URL: https://svnweb.freebsd.org/changeset/base/366834 Log: vmx: Implement pmap (de)activation in C Rewrite the code that maintains pm_active and invalidates EPTP-tagged TLB entries in C. Previously this work was done in vmx_enter_guest(), in assembly, but there is no good reason for that and it makes the TLB invalidation algorithm for nested page tables harder to review. No functional change intended. Now, an error from the invept instruction results in a kernel panic rather than a vmexit. Such errors should occur only as a result of VMM bugs. Reviewed by: grehan, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26830 Modified: head/sys/amd64/vmm/intel/vmx.c head/sys/amd64/vmm/intel/vmx.h head/sys/amd64/vmm/intel/vmx_genassym.c head/sys/amd64/vmm/intel/vmx_support.S Modified: head/sys/amd64/vmm/intel/vmx.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx.c Mon Oct 19 13:10:21 2020 (r366833) +++ head/sys/amd64/vmm/intel/vmx.c Mon Oct 19 15:24:35 2020 (r366834) @@ -2835,7 +2835,6 @@ vmx_exit_inst_error(struct vmxctx *vmxctx, int rc, str switch (rc) { case VMX_VMRESUME_ERROR: case VMX_VMLAUNCH_ERROR: - case VMX_INVEPT_ERROR: vmexit->u.vmx.inst_type = rc; break; default: @@ -2940,6 +2939,29 @@ vmx_dr_leave_guest(struct vmxctx *vmxctx) write_rflags(read_rflags() | vmxctx->host_tf); } +static __inline void +vmx_pmap_activate(struct vmx *vmx, pmap_t pmap) +{ + long eptgen; + int cpu; + + cpu = curcpu; + + CPU_SET_ATOMIC(cpu, &pmap->pm_active); + eptgen = atomic_load_long(&pmap->pm_eptgen); + if (eptgen != vmx->eptgen[cpu]) { + vmx->eptgen[cpu] = eptgen; + invept(INVEPT_TYPE_SINGLE_CONTEXT, + (struct invept_desc){ .eptp = vmx->eptp, ._res = 0 }); + } +} + +static __inline void +vmx_pmap_deactivate(struct vmx *vmx, pmap_t pmap) +{ + CPU_CLR_ATOMIC(curcpu, &pmap->pm_active); +} + static int vmx_run(void *arg, int vcpu, register_t rip, pmap_t pmap, struct vm_eventinfo *evinfo) @@ -3088,11 +3110,19 @@ vmx_run(void *arg, int vcpu, register_t rip, pmap_t pm */ vmx_msr_guest_enter_tsc_aux(vmx, vcpu); - vmx_run_trace(vmx, vcpu); vmx_dr_enter_guest(vmxctx); + + /* + * Mark the EPT as active on this host CPU and invalidate + * EPTP-tagged TLB entries if required. + */ + vmx_pmap_activate(vmx, pmap); + + vmx_run_trace(vmx, vcpu); rc = vmx_enter_guest(vmxctx, vmx, launched); - vmx_dr_leave_guest(vmxctx); + vmx_pmap_deactivate(vmx, pmap); + vmx_dr_leave_guest(vmxctx); vmx_msr_guest_exit_tsc_aux(vmx, vcpu); bare_lgdt(&gdtr); Modified: head/sys/amd64/vmm/intel/vmx.h ============================================================================== --- head/sys/amd64/vmm/intel/vmx.h Mon Oct 19 13:10:21 2020 (r366833) +++ head/sys/amd64/vmm/intel/vmx.h Mon Oct 19 15:24:35 2020 (r366834) @@ -142,7 +142,6 @@ CTASSERT((offsetof(struct vmx, pir_desc[0]) & 63) == 0 #define VMX_GUEST_VMEXIT 0 #define VMX_VMRESUME_ERROR 1 #define VMX_VMLAUNCH_ERROR 2 -#define VMX_INVEPT_ERROR 3 int vmx_enter_guest(struct vmxctx *ctx, struct vmx *vmx, int launched); void vmx_call_isr(uintptr_t entry); Modified: head/sys/amd64/vmm/intel/vmx_genassym.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx_genassym.c Mon Oct 19 13:10:21 2020 (r366833) +++ head/sys/amd64/vmm/intel/vmx_genassym.c Mon Oct 19 15:24:35 2020 (r366834) @@ -70,17 +70,12 @@ ASSYM(VMXCTX_HOST_RSP, offsetof(struct vmxctx, host_rs ASSYM(VMXCTX_HOST_RBX, offsetof(struct vmxctx, host_rbx)); ASSYM(VMXCTX_INST_FAIL_STATUS, offsetof(struct vmxctx, inst_fail_status)); -ASSYM(VMXCTX_PMAP, offsetof(struct vmxctx, pmap)); -ASSYM(VMX_EPTGEN, offsetof(struct vmx, eptgen)); -ASSYM(VMX_EPTP, offsetof(struct vmx, eptp)); - ASSYM(VM_FAIL_INVALID, VM_FAIL_INVALID); ASSYM(VM_FAIL_VALID, VM_FAIL_VALID); ASSYM(VMX_GUEST_VMEXIT, VMX_GUEST_VMEXIT); ASSYM(VMX_VMRESUME_ERROR, VMX_VMRESUME_ERROR); ASSYM(VMX_VMLAUNCH_ERROR, VMX_VMLAUNCH_ERROR); -ASSYM(VMX_INVEPT_ERROR, VMX_INVEPT_ERROR); ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); Modified: head/sys/amd64/vmm/intel/vmx_support.S ============================================================================== --- head/sys/amd64/vmm/intel/vmx_support.S Mon Oct 19 13:10:21 2020 (r366833) +++ head/sys/amd64/vmm/intel/vmx_support.S Mon Oct 19 15:24:35 2020 (r366834) @@ -148,33 +148,6 @@ ENTRY(vmx_enter_guest) */ VMX_HOST_SAVE - /* - * Activate guest pmap on this cpu. - */ - movq VMXCTX_PMAP(%rdi), %r11 - movl PCPU(CPUID), %eax - LK btsl %eax, PM_ACTIVE(%r11) - - /* - * If 'vmx->eptgen[curcpu]' is not identical to 'pmap->pm_eptgen' - * then we must invalidate all mappings associated with this EPTP. - */ - movq PM_EPTGEN(%r11), %r10 - cmpq %r10, VMX_EPTGEN(%rsi, %rax, 8) - je guest_restore - - /* Refresh 'vmx->eptgen[curcpu]' */ - movq %r10, VMX_EPTGEN(%rsi, %rax, 8) - - /* Setup the invept descriptor on the host stack */ - mov %rsp, %r11 - movq VMX_EPTP(%rsi), %rax - movq %rax, -16(%r11) - movq $0x0, -8(%r11) - mov $0x1, %eax /* Single context invalidate */ - invept -16(%r11), %rax - jbe invept_error /* Check invept instruction error */ - guest_restore: movl %edx, %r8d cmpb $0, guest_l1d_flush_sw(%rip) @@ -208,10 +181,6 @@ do_launch: movl $VMX_VMLAUNCH_ERROR, %eax jmp decode_inst_error -invept_error: - movl $VMX_INVEPT_ERROR, %eax - jmp decode_inst_error - decode_inst_error: movl $VM_FAIL_VALID, %r11d jz inst_error @@ -224,13 +193,6 @@ inst_error: * it as a scratch register beyond this point. */ - /* - * Deactivate guest pmap from this cpu. - */ - movq VMXCTX_PMAP(%rdi), %r11 - movl PCPU(CPUID), %r10d - LK btrl %r10d, PM_ACTIVE(%r11) - VMX_HOST_RESTORE VLEAVE ret @@ -248,13 +210,6 @@ vmx_exit_guest_flush_rsb: */ VMX_GUEST_SAVE - /* - * Deactivate guest pmap from this cpu. - */ - movq VMXCTX_PMAP(%rdi), %r11 - movl PCPU(CPUID), %r10d - LK btrl %r10d, PM_ACTIVE(%r11) - VMX_HOST_RESTORE VMX_GUEST_CLOBBER @@ -290,13 +245,6 @@ vmx_exit_guest: * Save guest state that is not automatically saved in the vmcs. */ VMX_GUEST_SAVE - - /* - * Deactivate guest pmap from this cpu. - */ - movq VMXCTX_PMAP(%rdi), %r11 - movl PCPU(CPUID), %r10d - LK btrl %r10d, PM_ACTIVE(%r11) VMX_HOST_RESTORE From owner-svn-src-head@freebsd.org Mon Oct 19 15:50:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6AC842C379; Mon, 19 Oct 2020 15:50:59 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFLnv5D0pz3Wt1; Mon, 19 Oct 2020 15:50:59 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9728525C56; Mon, 19 Oct 2020 15:50:59 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JFoxMZ000226; Mon, 19 Oct 2020 15:50:59 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JFoxph000223; Mon, 19 Oct 2020 15:50:59 GMT (envelope-from br@FreeBSD.org) Message-Id: <202010191550.09JFoxph000223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 19 Oct 2020 15:50:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366835 - in head/sys: dev/iommu x86/iommu X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: dev/iommu x86/iommu X-SVN-Commit-Revision: 366835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 15:50:59 -0000 Author: br Date: Mon Oct 19 15:50:58 2020 New Revision: 366835 URL: https://svnweb.freebsd.org/changeset/base/366835 Log: Assign the reserved apic region (GAS entry) to the iommu domain msi_entry. Requested by: kib Reviewed by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26859 Modified: head/sys/dev/iommu/iommu.h head/sys/dev/iommu/iommu_gas.c head/sys/x86/iommu/intel_ctx.c Modified: head/sys/dev/iommu/iommu.h ============================================================================== --- head/sys/dev/iommu/iommu.h Mon Oct 19 15:24:35 2020 (r366834) +++ head/sys/dev/iommu/iommu.h Mon Oct 19 15:50:58 2020 (r366835) @@ -197,7 +197,7 @@ void iommu_gas_free_region(struct iommu_domain *domain int iommu_gas_map_region(struct iommu_domain *domain, struct iommu_map_entry *entry, u_int eflags, u_int flags, vm_page_t *ma); int iommu_gas_reserve_region(struct iommu_domain *domain, iommu_gaddr_t start, - iommu_gaddr_t end); + iommu_gaddr_t end, struct iommu_map_entry **entry0); void iommu_set_buswide_ctx(struct iommu_unit *unit, u_int busno); bool iommu_is_buswide_ctx(struct iommu_unit *unit, u_int busno); Modified: head/sys/dev/iommu/iommu_gas.c ============================================================================== --- head/sys/dev/iommu/iommu_gas.c Mon Oct 19 15:24:35 2020 (r366834) +++ head/sys/dev/iommu/iommu_gas.c Mon Oct 19 15:50:58 2020 (r366835) @@ -677,7 +677,7 @@ iommu_gas_map_region(struct iommu_domain *domain, stru int iommu_gas_reserve_region(struct iommu_domain *domain, iommu_gaddr_t start, - iommu_gaddr_t end) + iommu_gaddr_t end, struct iommu_map_entry **entry0) { struct iommu_map_entry *entry; int error; @@ -692,6 +692,8 @@ iommu_gas_reserve_region(struct iommu_domain *domain, IOMMU_DOMAIN_UNLOCK(domain); if (error != 0) iommu_gas_free_entry(domain, entry); + else if (entry0 != NULL) + *entry0 = entry; return (error); } Modified: head/sys/x86/iommu/intel_ctx.c ============================================================================== --- head/sys/x86/iommu/intel_ctx.c Mon Oct 19 15:24:35 2020 (r366834) +++ head/sys/x86/iommu/intel_ctx.c Mon Oct 19 15:50:58 2020 (r366835) @@ -366,7 +366,7 @@ dmar_domain_alloc(struct dmar_unit *dmar, bool id_mapp goto fail; /* Disable local apic region access */ error = iommu_gas_reserve_region(iodom, 0xfee00000, - 0xfeefffff + 1); + 0xfeefffff + 1, &iodom->msi_entry); if (error != 0) goto fail; } From owner-svn-src-head@freebsd.org Mon Oct 19 15:52:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4D1C42CBCA; Mon, 19 Oct 2020 15:52:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFLqx1zy1z3XWV; Mon, 19 Oct 2020 15:52:44 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0170125BD2; Mon, 19 Oct 2020 15:52:42 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JFqgx4005300; Mon, 19 Oct 2020 15:52:42 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JFqgLl005299; Mon, 19 Oct 2020 15:52:42 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202010191552.09JFqgLl005299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 19 Oct 2020 15:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366836 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 366836 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 15:52:45 -0000 Author: andrew Date: Mon Oct 19 15:52:42 2020 New Revision: 366836 URL: https://svnweb.freebsd.org/changeset/base/366836 Log: Remove unused labels from the arm64 casueword* These are unused so can be removed. While here renumber the remaining label to be 1. Sponsored by: Innovate UK Modified: head/sys/arm64/arm64/support.S Modified: head/sys/arm64/arm64/support.S ============================================================================== --- head/sys/arm64/arm64/support.S Mon Oct 19 15:50:58 2020 (r366835) +++ head/sys/arm64/arm64/support.S Mon Oct 19 15:52:42 2020 (r366836) @@ -64,11 +64,11 @@ ENTRY(casueword32) mov w5, #1 SET_FAULT_HANDLER(x6, x4) /* And set it */ ENTER_USER_ACCESS(w6, x4) -1: ldxr w4, [x0] /* Load-exclusive the data */ + ldxr w4, [x0] /* Load-exclusive the data */ cmp w4, w1 /* Compare */ - b.ne 2f /* Not equal, exit */ + b.ne 1f /* Not equal, exit */ stxr w5, w3, [x0] /* Store the new data */ -2: EXIT_USER_ACCESS(w6) +1: EXIT_USER_ACCESS(w6) SET_FAULT_HANDLER(xzr, x6) /* Reset the fault handler */ str w4, [x2] /* Store the read data */ mov w0, w5 /* Result same as store status */ @@ -84,11 +84,11 @@ ENTRY(casueword) mov w5, #1 SET_FAULT_HANDLER(x6, x4) /* And set it */ ENTER_USER_ACCESS(w6, x4) -1: ldxr x4, [x0] /* Load-exclusive the data */ + ldxr x4, [x0] /* Load-exclusive the data */ cmp x4, x1 /* Compare */ - b.ne 2f /* Not equal, exit */ + b.ne 1f /* Not equal, exit */ stxr w5, x3, [x0] /* Store the new data */ -2: EXIT_USER_ACCESS(w6) +1: EXIT_USER_ACCESS(w6) SET_FAULT_HANDLER(xzr, x6) /* Reset the fault handler */ str x4, [x2] /* Store the read data */ mov w0, w5 /* Result same as store status */ From owner-svn-src-head@freebsd.org Mon Oct 19 16:52:27 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB8BE42E333; Mon, 19 Oct 2020 16:52:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFN8q4ZlPz3bks; Mon, 19 Oct 2020 16:52:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8092826AF5; Mon, 19 Oct 2020 16:52:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JGqRFx042045; Mon, 19 Oct 2020 16:52:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JGqRg5042044; Mon, 19 Oct 2020 16:52:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202010191652.09JGqRg5042044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 19 Oct 2020 16:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366837 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366837 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 16:52:27 -0000 Author: markj Date: Mon Oct 19 16:52:27 2020 New Revision: 366837 URL: https://svnweb.freebsd.org/changeset/base/366837 Log: vmem: Simplify bt_fill() callers a bit No functional change intended. Reviewed by: alc, kib, rlibby MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26769 Modified: head/sys/kern/subr_vmem.c Modified: head/sys/kern/subr_vmem.c ============================================================================== --- head/sys/kern/subr_vmem.c Mon Oct 19 15:52:42 2020 (r366836) +++ head/sys/kern/subr_vmem.c Mon Oct 19 16:52:27 2020 (r366837) @@ -266,8 +266,8 @@ bt_isfree(bt_t *bt) * allocation will not fail once bt_fill() passes. To do so we cache * at least the maximum possible tag allocations in the arena. */ -static int -bt_fill(vmem_t *vm, int flags) +static __noinline int +_bt_fill(vmem_t *vm, int flags) { bt_t *bt; @@ -307,6 +307,14 @@ bt_fill(vmem_t *vm, int flags) return 0; } +static inline int +bt_fill(vmem_t *vm, int flags) +{ + if (vm->vm_nfreetags >= BT_MAXALLOC) + return (0); + return (_bt_fill(vm, flags)); +} + /* * Pop a tag off of the freetag stack. */ @@ -1104,7 +1112,7 @@ retry: /* * Make sure we have enough tags to complete the operation. */ - if (vm->vm_nfreetags < BT_MAXALLOC && bt_fill(vm, flags) != 0) + if (bt_fill(vm, flags) != 0) goto out; /* @@ -1387,11 +1395,9 @@ vmem_xalloc(vmem_t *vm, const vmem_size_t size0, vmem_ * Make sure we have enough tags to complete the * operation. */ - if (vm->vm_nfreetags < BT_MAXALLOC && - bt_fill(vm, flags) != 0) { - error = ENOMEM; + error = bt_fill(vm, flags); + if (error != 0) break; - } /* * Scan freelists looking for a tag that satisfies the @@ -1510,13 +1516,12 @@ vmem_add(vmem_t *vm, vmem_addr_t addr, vmem_size_t siz { int error; - error = 0; flags &= VMEM_FLAGS; + VMEM_LOCK(vm); - if (vm->vm_nfreetags >= BT_MAXALLOC || bt_fill(vm, flags) == 0) + error = bt_fill(vm, flags); + if (error == 0) vmem_add1(vm, addr, size, BT_TYPE_SPAN_STATIC); - else - error = ENOMEM; VMEM_UNLOCK(vm); return (error); From owner-svn-src-head@freebsd.org Mon Oct 19 16:54:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53C2942E5B1; Mon, 19 Oct 2020 16:54:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFNBl1XpBz3bwX; Mon, 19 Oct 2020 16:54:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 181CE269C2; Mon, 19 Oct 2020 16:54:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JGs6tJ042166; Mon, 19 Oct 2020 16:54:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JGs63o042165; Mon, 19 Oct 2020 16:54:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202010191654.09JGs63o042165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 19 Oct 2020 16:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366838 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366838 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 16:54:07 -0000 Author: markj Date: Mon Oct 19 16:54:06 2020 New Revision: 366838 URL: https://svnweb.freebsd.org/changeset/base/366838 Log: vmem: Allocate btags before looping in vmem_xalloc() BT_MAXALLOC (4) is the number of boundary tags required to complete an allocation in the worst case: two to clip a free segment, and two to import from a parent arena. vmem_xalloc() preallocates four boundary tags before attempting a search to simplify the segment allocation code. It implements a loop that: 1) ensures that BT_MAXALLOC boundary tags are available, 2) attempts to find and clip a free segment satisfying the allocation constraints, and failing that, 3) attempts to import a segment. On !UMA_MD_SMALL_ALLOC platforms the btag zone has to handle recusion: it needs boundary tags to allocate boundary tags. Thus we reserve 2 * BT_MAXALLOC * mp_ncpus tags for use when recursing: the factor of 2 is because there are two layers of vmem arenas, the per-domain arena and global arena. For a single thread, 2 * BT_MAXALLOC tags should be sufficient. Because of the way the loop is structured, BT_MAXALLOC tags are not sufficient. The first bt_fill() call may allocate BT_MAXALLOC tags, then import a segment (consuming two tags), then attempt to top up the preallocation before carving into the imported free segment, thus requiring up to six tags in the worst case. Because we don't preallocate that many, this bug can cause deadlocks in rare scenarios. Fix the problem by moving the preallocation out the loop. This assumes that only a single import is ever required to satisfy an allocation request. Thanks to manu, emaste and lwhsu for helping test debug patches. Reported by: Jenkins (hardware CI lab) Reviewed by: alc, kib, rlibby MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26770 Modified: head/sys/kern/subr_vmem.c Modified: head/sys/kern/subr_vmem.c ============================================================================== --- head/sys/kern/subr_vmem.c Mon Oct 19 16:52:27 2020 (r366837) +++ head/sys/kern/subr_vmem.c Mon Oct 19 16:54:06 2020 (r366838) @@ -368,6 +368,24 @@ bt_free(vmem_t *vm, bt_t *bt) } /* + * Hide MAXALLOC tags before dropping the arena lock to ensure that a + * concurrent allocation attempt does not grab them. + */ +static void +bt_save(vmem_t *vm) +{ + KASSERT(vm->vm_nfreetags >= BT_MAXALLOC, + ("%s: insufficient free tags %d", __func__, vm->vm_nfreetags)); + vm->vm_nfreetags -= BT_MAXALLOC; +} + +static void +bt_restore(vmem_t *vm) +{ + vm->vm_nfreetags += BT_MAXALLOC; +} + +/* * freelist[0] ... [1, 1] * freelist[1] ... [2, 2] * : @@ -911,16 +929,11 @@ vmem_import(vmem_t *vm, vmem_size_t size, vmem_size_t if (vm->vm_limit != 0 && vm->vm_limit < vm->vm_size + size) return (ENOMEM); - /* - * Hide MAXALLOC tags so we're guaranteed to be able to add this - * span and the tag we want to allocate from it. - */ - MPASS(vm->vm_nfreetags >= BT_MAXALLOC); - vm->vm_nfreetags -= BT_MAXALLOC; + bt_save(vm); VMEM_UNLOCK(vm); error = (vm->vm_importfn)(vm->vm_arg, size, flags, &addr); VMEM_LOCK(vm); - vm->vm_nfreetags += BT_MAXALLOC; + bt_restore(vm); if (error) return (ENOMEM); @@ -1048,19 +1061,23 @@ vmem_try_fetch(vmem_t *vm, const vmem_size_t size, vme */ if (vm->vm_qcache_max != 0 || vm->vm_reclaimfn != NULL) { avail = vm->vm_size - vm->vm_inuse; + bt_save(vm); VMEM_UNLOCK(vm); if (vm->vm_qcache_max != 0) qc_drain(vm); if (vm->vm_reclaimfn != NULL) vm->vm_reclaimfn(vm, flags); VMEM_LOCK(vm); + bt_restore(vm); /* If we were successful retry even NOWAIT. */ if (vm->vm_size - vm->vm_inuse > avail) return (1); } if ((flags & M_NOWAIT) != 0) return (0); + bt_save(vm); VMEM_CONDVAR_WAIT(vm); + bt_restore(vm); return (1); } @@ -1108,13 +1125,14 @@ vmem_xalloc_nextfit(vmem_t *vm, const vmem_size_t size error = ENOMEM; VMEM_LOCK(vm); -retry: + /* * Make sure we have enough tags to complete the operation. */ if (bt_fill(vm, flags) != 0) goto out; +retry: /* * Find the next free tag meeting our constraints. If one is found, * perform the allocation. @@ -1390,15 +1408,14 @@ vmem_xalloc(vmem_t *vm, const vmem_size_t size0, vmem_ */ first = bt_freehead_toalloc(vm, size, strat); VMEM_LOCK(vm); - for (;;) { - /* - * Make sure we have enough tags to complete the - * operation. - */ - error = bt_fill(vm, flags); - if (error != 0) - break; + /* + * Make sure we have enough tags to complete the operation. + */ + error = bt_fill(vm, flags); + if (error != 0) + goto out; + for (;;) { /* * Scan freelists looking for a tag that satisfies the * allocation. If we're doing BESTFIT we may encounter From owner-svn-src-head@freebsd.org Mon Oct 19 16:55:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DB9A42E2E1; Mon, 19 Oct 2020 16:55:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFNCr0wm9z3c58; Mon, 19 Oct 2020 16:55:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 030D726D7D; Mon, 19 Oct 2020 16:55:04 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JGt3Ba042306; Mon, 19 Oct 2020 16:55:03 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JGt36s042305; Mon, 19 Oct 2020 16:55:03 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202010191655.09JGt36s042305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 19 Oct 2020 16:55:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366839 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 366839 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 16:55:04 -0000 Author: markj Date: Mon Oct 19 16:55:03 2020 New Revision: 366839 URL: https://svnweb.freebsd.org/changeset/base/366839 Log: uma: Avoid depleting keg reserves when filling a bucket zone_import() fetches a free or partially free slab from the keg and then uses its items to populate an array, typically filling a bucket. If a single allocation causes the keg to drop below its minimum reserve, the inner loop ends. However, if the bucket is still not full and M_USE_RESERVE is specified, the outer loop will continue to fetch items from the keg. If M_USE_RESERVE is specified and the number of free items is below the reserved limit, we should return only a single item. Otherwise, if the bucket size is larger than the reserve, all of the reserved items may end up in a single per-CPU bucket, invisible to other CPUs. Reviewed by: rlibby MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26771 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Mon Oct 19 16:54:06 2020 (r366838) +++ head/sys/vm/uma_core.c Mon Oct 19 16:55:03 2020 (r366839) @@ -3734,10 +3734,17 @@ zone_import(void *arg, void **bucket, int max, int dom stripe = howmany(max, vm_ndomains); #endif dom = &keg->uk_domain[slab->us_domain]; - while (slab->us_freecount && i < max) { + do { bucket[i++] = slab_alloc_item(keg, slab); - if (dom->ud_free_items <= keg->uk_reserve) - break; + if (dom->ud_free_items <= keg->uk_reserve) { + /* + * Avoid depleting the reserve after a + * successful item allocation, even if + * M_USE_RESERVE is specified. + */ + KEG_UNLOCK(keg, slab->us_domain); + goto out; + } #ifdef NUMA /* * If the zone is striped we pick a new slab for every @@ -3751,13 +3758,14 @@ zone_import(void *arg, void **bucket, int max, int dom vm_ndomains > 1 && --stripe == 0) break; #endif - } + } while (slab->us_freecount != 0 && i < max); KEG_UNLOCK(keg, slab->us_domain); + /* Don't block if we allocated any successfully. */ flags &= ~M_WAITOK; flags |= M_NOWAIT; } - +out: return i; } From owner-svn-src-head@freebsd.org Mon Oct 19 16:57:41 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 472E342E8A0; Mon, 19 Oct 2020 16:57:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFNGs1Gbcz3c8N; Mon, 19 Oct 2020 16:57:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1031E26B99; Mon, 19 Oct 2020 16:57:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JGve7q042473; Mon, 19 Oct 2020 16:57:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JGveiu042472; Mon, 19 Oct 2020 16:57:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202010191657.09JGveiu042472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 19 Oct 2020 16:57:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366840 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 366840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 16:57:41 -0000 Author: markj Date: Mon Oct 19 16:57:40 2020 New Revision: 366840 URL: https://svnweb.freebsd.org/changeset/base/366840 Log: uma: Respect uk_reserve in keg_drain() When a reserve of free items is configured for a zone, the reserve must not be reclaimed under memory pressure. Modify keg_drain() to simply respect the reserved pool. While here remove an always-false uk_freef == NULL check (kegs that shouldn't be drained should set _NOFREE instead), and make sure that the keg_drain() KTR statement does not reference an uninitialized variable. Reviewed by: alc, rlibby Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26772 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Mon Oct 19 16:55:03 2020 (r366839) +++ head/sys/vm/uma_core.c Mon Oct 19 16:57:40 2020 (r366840) @@ -1415,47 +1415,81 @@ keg_free_slab(uma_keg_t keg, uma_slab_t slab, int star uma_total_dec(PAGE_SIZE * keg->uk_ppera); } -/* - * Frees pages from a keg back to the system. This is done on demand from - * the pageout daemon. - * - * Returns nothing. - */ static void -keg_drain(uma_keg_t keg) +keg_drain_domain(uma_keg_t keg, int domain) { struct slabhead freeslabs; uma_domain_t dom; uma_slab_t slab, tmp; - int i, n; + uint32_t i, stofree, stokeep, partial; - if (keg->uk_flags & UMA_ZONE_NOFREE || keg->uk_freef == NULL) - return; + dom = &keg->uk_domain[domain]; + LIST_INIT(&freeslabs); - for (i = 0; i < vm_ndomains; i++) { - CTR4(KTR_UMA, "keg_drain %s(%p) domain %d free items: %u", - keg->uk_name, keg, i, dom->ud_free_items); - dom = &keg->uk_domain[i]; - LIST_INIT(&freeslabs); + CTR4(KTR_UMA, "keg_drain %s(%p) domain %d free items: %u", + keg->uk_name, keg, i, dom->ud_free_items); - KEG_LOCK(keg, i); - if ((keg->uk_flags & UMA_ZFLAG_HASH) != 0) { - LIST_FOREACH(slab, &dom->ud_free_slab, us_link) - UMA_HASH_REMOVE(&keg->uk_hash, slab); - } - n = dom->ud_free_slabs; + KEG_LOCK(keg, domain); + + /* + * Are the free items in partially allocated slabs sufficient to meet + * the reserve? If not, compute the number of fully free slabs that must + * be kept. + */ + partial = dom->ud_free_items - dom->ud_free_slabs * keg->uk_ipers; + if (partial < keg->uk_reserve) { + stokeep = min(dom->ud_free_slabs, + howmany(keg->uk_reserve - partial, keg->uk_ipers)); + } else { + stokeep = 0; + } + stofree = dom->ud_free_slabs - stokeep; + + /* + * Partition the free slabs into two sets: those that must be kept in + * order to maintain the reserve, and those that may be released back to + * the system. Since one set may be much larger than the other, + * populate the smaller of the two sets and swap them if necessary. + */ + for (i = min(stofree, stokeep); i > 0; i--) { + slab = LIST_FIRST(&dom->ud_free_slab); + LIST_REMOVE(slab, us_link); + LIST_INSERT_HEAD(&freeslabs, slab, us_link); + } + if (stofree > stokeep) LIST_SWAP(&freeslabs, &dom->ud_free_slab, uma_slab, us_link); - dom->ud_free_slabs = 0; - dom->ud_free_items -= n * keg->uk_ipers; - dom->ud_pages -= n * keg->uk_ppera; - KEG_UNLOCK(keg, i); - LIST_FOREACH_SAFE(slab, &freeslabs, us_link, tmp) - keg_free_slab(keg, slab, keg->uk_ipers); + if ((keg->uk_flags & UMA_ZFLAG_HASH) != 0) { + LIST_FOREACH(slab, &freeslabs, us_link) + UMA_HASH_REMOVE(&keg->uk_hash, slab); } + dom->ud_free_items -= stofree * keg->uk_ipers; + dom->ud_free_slabs -= stofree; + dom->ud_pages -= stofree * keg->uk_ppera; + KEG_UNLOCK(keg, domain); + + LIST_FOREACH_SAFE(slab, &freeslabs, us_link, tmp) + keg_free_slab(keg, slab, keg->uk_ipers); } +/* + * Frees pages from a keg back to the system. This is done on demand from + * the pageout daemon. + * + * Returns nothing. + */ static void +keg_drain(uma_keg_t keg) +{ + int i; + + if ((keg->uk_flags & UMA_ZONE_NOFREE) != 0) + return; + for (i = 0; i < vm_ndomains; i++) + keg_drain_domain(keg, i); +} + +static void zone_reclaim(uma_zone_t zone, int waitok, bool drain) { @@ -2411,6 +2445,9 @@ zone_alloc_sysctl(uma_zone_t zone, void *unused) SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "align", CTLFLAG_RD, &keg->uk_align, 0, "item alignment mask"); + SYSCTL_ADD_U32(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, + "reserve", CTLFLAG_RD, &keg->uk_reserve, 0, + "number of reserved items"); SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, "efficiency", CTLFLAG_RD | CTLTYPE_INT | CTLFLAG_MPSAFE, keg, 0, sysctl_handle_uma_slab_efficiency, "I", From owner-svn-src-head@freebsd.org Mon Oct 19 16:58:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5EEE342E73D; Mon, 19 Oct 2020 16:58:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFNHD1w3Tz3cWZ; Mon, 19 Oct 2020 16:58:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24C53269C7; Mon, 19 Oct 2020 16:58:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JGw0ZX042531; Mon, 19 Oct 2020 16:58:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JGw0vI042526; Mon, 19 Oct 2020 16:58:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202010191658.09JGw0vI042526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 19 Oct 2020 16:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366841 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 16:58:00 -0000 Author: markj Date: Mon Oct 19 16:57:59 2020 New Revision: 366841 URL: https://svnweb.freebsd.org/changeset/base/366841 Log: link_elf_obj: Colour VM objects This will cause the VM to back sufficiently large .text sections, such as those in zfs.ko or amdgpu.ko on amd64, with superpage mappings when possible. Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26802 Modified: head/sys/kern/link_elf_obj.c Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Mon Oct 19 16:57:40 2020 (r366840) +++ head/sys/kern/link_elf_obj.c Mon Oct 19 16:57:59 2020 (r366841) @@ -914,6 +914,9 @@ link_elf_load_file(linker_class_t cls, const char *fil error = ENOMEM; goto out; } +#if VM_NRESERVLEVEL > 0 + vm_object_color(ef->object, 0); +#endif /* * In order to satisfy amd64's architectural requirements on the From owner-svn-src-head@freebsd.org Mon Oct 19 17:07:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60B0942F036; Mon, 19 Oct 2020 17:07:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFNV11tf1z3dVH; Mon, 19 Oct 2020 17:07:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23BAD26C51; Mon, 19 Oct 2020 17:07:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JH7LXd049022; Mon, 19 Oct 2020 17:07:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JH7KYw049017; Mon, 19 Oct 2020 17:07:20 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202010191707.09JH7KYw049017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 19 Oct 2020 17:07:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366842 - in head: sys/netinet sys/netinet6 usr.bin/netstat X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: sys/netinet sys/netinet6 usr.bin/netstat X-SVN-Commit-Revision: 366842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 17:07:21 -0000 Author: markj Date: Mon Oct 19 17:07:19 2020 New Revision: 366842 URL: https://svnweb.freebsd.org/changeset/base/366842 Log: icmp6: Count packets dropped due to an invalid hop limit Pad the icmp6stat structure so that we can add more counters in the future without breaking compatibility again, last done in r358620. Annotate the rarely executed error paths with __predict_false while here. Reviewed by: bz, melifaro Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26578 Modified: head/sys/netinet/icmp6.h head/sys/netinet6/icmp6.c head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c head/usr.bin/netstat/inet6.c Modified: head/sys/netinet/icmp6.h ============================================================================== --- head/sys/netinet/icmp6.h Mon Oct 19 16:57:59 2020 (r366841) +++ head/sys/netinet/icmp6.h Mon Oct 19 17:07:19 2020 (r366842) @@ -639,6 +639,8 @@ struct icmp6stat { uint64_t icp6s_overflowprfx; /* Too many prefixes. */ uint64_t icp6s_overflownndp; /* Too many neighbour entries. */ uint64_t icp6s_overflowredirect;/* Too many redirects. */ + uint64_t icp6s_invlhlim; /* Invalid hop limit. */ + uint64_t icp6s_spare[32]; }; #ifdef _KERNEL Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Mon Oct 19 16:57:59 2020 (r366841) +++ head/sys/netinet6/icmp6.c Mon Oct 19 17:07:19 2020 (r366842) @@ -2261,7 +2261,8 @@ icmp6_redirect_input(struct mbuf *m, int off) ip6_sprintf(ip6buf, &src6))); goto bad; } - if (ip6->ip6_hlim != 255) { + if (__predict_false(ip6->ip6_hlim != 255)) { + ICMP6STAT_INC(icp6s_invlhlim); nd6log((LOG_ERR, "ICMP6 redirect sent from %s rejected; " "hlim=%d (must be 255)\n", Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Mon Oct 19 16:57:59 2020 (r366841) +++ head/sys/netinet6/nd6_nbr.c Mon Oct 19 17:07:19 2020 (r366842) @@ -136,7 +136,8 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) ifp = m->m_pkthdr.rcvif; ip6 = mtod(m, struct ip6_hdr *); - if (ip6->ip6_hlim != 255) { + if (__predict_false(ip6->ip6_hlim != 255)) { + ICMP6STAT_INC(icp6s_invlhlim); nd6log((LOG_ERR, "nd6_ns_input: invalid hlim (%d) from %s to %s on %s\n", ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src), @@ -641,7 +642,8 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) ifp = m->m_pkthdr.rcvif; ip6 = mtod(m, struct ip6_hdr *); - if (ip6->ip6_hlim != 255) { + if (__predict_false(ip6->ip6_hlim != 255)) { + ICMP6STAT_INC(icp6s_invlhlim); nd6log((LOG_ERR, "nd6_na_input: invalid hlim (%d) from %s to %s on %s\n", ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src), Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Mon Oct 19 16:57:59 2020 (r366841) +++ head/sys/netinet6/nd6_rtr.c Mon Oct 19 17:07:19 2020 (r366842) @@ -177,7 +177,8 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) /* Sanity checks */ ip6 = mtod(m, struct ip6_hdr *); - if (ip6->ip6_hlim != 255) { + if (__predict_false(ip6->ip6_hlim != 255)) { + ICMP6STAT_INC(icp6s_invlhlim); nd6log((LOG_ERR, "%s: invalid hlim (%d) from %s to %s on %s\n", __func__, ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src), @@ -376,7 +377,8 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) goto freeit; ip6 = mtod(m, struct ip6_hdr *); - if (ip6->ip6_hlim != 255) { + if (__predict_false(ip6->ip6_hlim != 255)) { + ICMP6STAT_INC(icp6s_invlhlim); nd6log((LOG_ERR, "%s: invalid hlim (%d) from %s to %s on %s\n", __func__, ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src), Modified: head/usr.bin/netstat/inet6.c ============================================================================== --- head/usr.bin/netstat/inet6.c Mon Oct 19 16:57:59 2020 (r366841) +++ head/usr.bin/netstat/inet6.c Mon Oct 19 17:07:19 2020 (r366842) @@ -1063,6 +1063,8 @@ icmp6_stats(u_long off, const char *name, int af1 __un "{N:/neighbour entries overflow%s}\n"); p(icp6s_overflowredirect, "\t{:redirect-overflows/%ju} " "{N:/redirect overflow%s}\n"); + p(icp6s_invlhlim, "\t{:dropped-invalid-hop-limit/%ju} " + "{N:/message%s with invalid hop limit}\n"); xo_close_container("errors"); p(icp6s_pmtuchg, "\t{:path-mtu-changes/%ju} {N:/path MTU change%s}\n"); #undef p From owner-svn-src-head@freebsd.org Mon Oct 19 17:35:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CD3D42F871; Mon, 19 Oct 2020 17:35:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFP6p3916z3fqg; Mon, 19 Oct 2020 17:35:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 502D227533; Mon, 19 Oct 2020 17:35:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JHZkx9067068; Mon, 19 Oct 2020 17:35:46 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JHZkqr067067; Mon, 19 Oct 2020 17:35:46 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202010191735.09JHZkqr067067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 19 Oct 2020 17:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366843 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 366843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 17:35:46 -0000 Author: jhb Date: Mon Oct 19 17:35:45 2020 New Revision: 366843 URL: https://svnweb.freebsd.org/changeset/base/366843 Log: Properly clear PCB_KERNNPX in fpu_kern_leave(). PR: 250423 Reported by: CI Tested by: lwhsu Modified: head/sys/i386/i386/npx.c Modified: head/sys/i386/i386/npx.c ============================================================================== --- head/sys/i386/i386/npx.c Mon Oct 19 17:07:19 2020 (r366842) +++ head/sys/i386/i386/npx.c Mon Oct 19 17:35:45 2020 (r366843) @@ -1475,7 +1475,7 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx if ((pcb->pcb_flags & PCB_NPXUSERINITDONE) != 0) { pcb->pcb_flags |= PCB_NPXINITDONE; if ((pcb->pcb_flags & PCB_KERNNPX_THR) == 0) - pcb->pcb_flags |= ~PCB_KERNNPX; + pcb->pcb_flags &= ~PCB_KERNNPX; } else if ((pcb->pcb_flags & PCB_KERNNPX_THR) == 0) pcb->pcb_flags &= ~(PCB_NPXINITDONE | PCB_KERNNPX); } else { From owner-svn-src-head@freebsd.org Mon Oct 19 18:12:35 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E7BD4304E4; Mon, 19 Oct 2020 18:12:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFPxG44DNz3yWv; Mon, 19 Oct 2020 18:12:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 09JICQUO047985 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 19 Oct 2020 21:12:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 09JICQUO047985 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 09JICQG9047984; Mon, 19 Oct 2020 21:12:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 19 Oct 2020 21:12:26 +0300 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366843 - head/sys/i386/i386 Message-ID: <20201019181226.GF2643@kib.kiev.ua> References: <202010191735.09JHZkqr067067@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202010191735.09JHZkqr067067@repo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CFPxG44DNz3yWv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 18:12:35 -0000 On Mon, Oct 19, 2020 at 05:35:46PM +0000, John Baldwin wrote: > Author: jhb > Date: Mon Oct 19 17:35:45 2020 > New Revision: 366843 > URL: https://svnweb.freebsd.org/changeset/base/366843 > > Log: > Properly clear PCB_KERNNPX in fpu_kern_leave(). > > PR: 250423 > Reported by: CI > Tested by: lwhsu > > Modified: > head/sys/i386/i386/npx.c > > Modified: head/sys/i386/i386/npx.c > ============================================================================== > --- head/sys/i386/i386/npx.c Mon Oct 19 17:07:19 2020 (r366842) > +++ head/sys/i386/i386/npx.c Mon Oct 19 17:35:45 2020 (r366843) > @@ -1475,7 +1475,7 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx > if ((pcb->pcb_flags & PCB_NPXUSERINITDONE) != 0) { > pcb->pcb_flags |= PCB_NPXINITDONE; > if ((pcb->pcb_flags & PCB_KERNNPX_THR) == 0) > - pcb->pcb_flags |= ~PCB_KERNNPX; > + pcb->pcb_flags &= ~PCB_KERNNPX; > } else if ((pcb->pcb_flags & PCB_KERNNPX_THR) == 0) > pcb->pcb_flags &= ~(PCB_NPXINITDONE | PCB_KERNNPX); > } else { My bad, thank you for fixing this. From owner-svn-src-head@freebsd.org Mon Oct 19 18:21:42 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD401430C3D; Mon, 19 Oct 2020 18:21:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFQ7p5ZrGz4075; Mon, 19 Oct 2020 18:21:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A401327BB5; Mon, 19 Oct 2020 18:21:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JILgLc094348; Mon, 19 Oct 2020 18:21:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JILgdU094346; Mon, 19 Oct 2020 18:21:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202010191821.09JILgdU094346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 19 Oct 2020 18:21:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366844 - in head: share/man/man4 sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: share/man/man4 sys/opencrypto X-SVN-Commit-Revision: 366844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 18:21:42 -0000 Author: jhb Date: Mon Oct 19 18:21:41 2020 New Revision: 366844 URL: https://svnweb.freebsd.org/changeset/base/366844 Log: Mark asymmetric cryptography via OCF deprecated for 14.0. Only one MIPS-specific driver implements support for one of the asymmetric operations. There are no in-kernel users besides /dev/crypto. The only known user of the /dev/crypto interface was the engine in OpenSSL releases before 1.1.0. 1.1.0 includes a rewritten engine that does not use the asymmetric operations due to lack of documentation. Reviewed by: cem, markj MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D26810 Modified: head/share/man/man4/crypto.4 head/sys/opencrypto/crypto.c head/sys/opencrypto/cryptodev.c Modified: head/share/man/man4/crypto.4 ============================================================================== --- head/share/man/man4/crypto.4 Mon Oct 19 17:35:45 2020 (r366843) +++ head/share/man/man4/crypto.4 Mon Oct 19 18:21:41 2020 (r366844) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 11, 2020 +.Dd October 19, 2020 .Dt CRYPTO 4 .Os .Sh NAME @@ -108,6 +108,11 @@ both asymmetric-key (public-key/private-key) requests modular arithmetic (for Diffie-Hellman key exchange and other cryptographic protocols). The two modes are described separately below. +.Sh DEPRECATION NOTICE +The asymmetric-key operations supported by this interface will not be +present in +.Fx 14.0 +and later. .Sh THEORY OF OPERATION Regardless of whether symmetric-key or asymmetric-key operations are to be performed, use of the device requires a basic series of steps: Modified: head/sys/opencrypto/crypto.c ============================================================================== --- head/sys/opencrypto/crypto.c Mon Oct 19 17:35:45 2020 (r366843) +++ head/sys/opencrypto/crypto.c Mon Oct 19 18:21:41 2020 (r366844) @@ -1142,6 +1142,7 @@ crypto_kregister(u_int32_t driverid, int kalg, u_int32 , kalg , flags ); + gone_in_dev(cap->cc_dev, 14, "asymmetric crypto"); err = 0; } else err = EINVAL; Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Mon Oct 19 17:35:45 2020 (r366843) +++ head/sys/opencrypto/cryptodev.c Mon Oct 19 18:21:41 2020 (r366844) @@ -346,6 +346,11 @@ SYSCTL_BOOL(_kern_crypto, OID_AUTO, cryptodev_separate &use_separate_aad, 0, "Use separate AAD buffer for /dev/crypto requests."); +static struct timeval warninterval = { .tv_sec = 60, .tv_usec = 0 }; +SYSCTL_TIMEVAL_SEC(_kern, OID_AUTO, cryptodev_warn_interval, CTLFLAG_RW, + &warninterval, + "Delay in seconds between warnings of deprecated /dev/crypto algorithms"); + static int cryptof_ioctl(struct file *, u_long, void *, struct ucred *, struct thread *); static int cryptof_stat(struct file *, struct stat *, @@ -419,6 +424,7 @@ cryptof_ioctl( struct ucred *active_cred, struct thread *td) { + static struct timeval keywarn, featwarn; struct crypto_session_params csp; struct fcrypt *fcr = fp->f_data; struct csession *cse; @@ -818,6 +824,10 @@ bail: break; case CIOCKEY: case CIOCKEY2: + if (ratecheck(&keywarn, &warninterval)) + gone_in(14, + "Asymmetric crypto operations via /dev/crypto"); + if (!crypto_userasymcrypto) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EPERM); /* XXX compat? */ @@ -833,6 +843,10 @@ bail: mtx_unlock(&Giant); break; case CIOCASYMFEAT: + if (ratecheck(&featwarn, &warninterval)) + gone_in(14, + "Asymmetric crypto features via /dev/crypto"); + if (!crypto_userasymcrypto) { /* * NB: if user asym crypto operations are From owner-svn-src-head@freebsd.org Mon Oct 19 18:24:06 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE06A430E20; Mon, 19 Oct 2020 18:24:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFQBZ56mRz403n; Mon, 19 Oct 2020 18:24:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9447B27BC1; Mon, 19 Oct 2020 18:24:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JIO60V097801; Mon, 19 Oct 2020 18:24:06 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JIO66a097800; Mon, 19 Oct 2020 18:24:06 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202010191824.09JIO66a097800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 19 Oct 2020 18:24:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366845 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 18:24:06 -0000 Author: jhb Date: Mon Oct 19 18:24:06 2020 New Revision: 366845 URL: https://svnweb.freebsd.org/changeset/base/366845 Log: Check TF_TOE not the tod pointer to determine if TOE is active. The TF_TOE flag is the check used in the rest of the network stack to determine if TOE is active on a socket. There is at least one path in the cxgbe(4) TOE driver that can leave the tod pointer non-NULL on a socket not using TOE. Reported by: Sony Arpita Das Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D26803 Modified: head/sys/kern/uipc_ktls.c Modified: head/sys/kern/uipc_ktls.c ============================================================================== --- head/sys/kern/uipc_ktls.c Mon Oct 19 18:21:41 2020 (r366844) +++ head/sys/kern/uipc_ktls.c Mon Oct 19 18:24:06 2020 (r366845) @@ -734,7 +734,7 @@ ktls_try_toe(struct socket *so, struct ktls_session *t return (ECONNRESET); } tp = intotcpcb(inp); - if (tp->tod == NULL) { + if (!(tp->t_flags & TF_TOE)) { INP_WUNLOCK(inp); return (EOPNOTSUPP); } From owner-svn-src-head@freebsd.org Mon Oct 19 18:51:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA1E9431557; Mon, 19 Oct 2020 18:51:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFQpb53w4z41lk; Mon, 19 Oct 2020 18:51:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91542850C; Mon, 19 Oct 2020 18:51:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JIppSW016436; Mon, 19 Oct 2020 18:51:51 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JIpp1G016435; Mon, 19 Oct 2020 18:51:51 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010191851.09JIpp1G016435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 19 Oct 2020 18:51:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366846 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 18:51:51 -0000 Author: mjg Date: Mon Oct 19 18:51:51 2020 New Revision: 366846 URL: https://svnweb.freebsd.org/changeset/base/366846 Log: cache: promote negative entries based on more than one hit During tinderbox and similar workloads negative entries get at least one hit before they get evicted. In the current scheme this avoidably promotes them. Be conservative and stick to 2 hits for now. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Mon Oct 19 18:24:06 2020 (r366845) +++ head/sys/kern/vfs_cache.c Mon Oct 19 18:51:51 2020 (r366846) @@ -129,6 +129,7 @@ SDT_PROBE_DECLARE(vfs, namei, lookup, return); */ struct negstate { u_char neg_flag; + u_char neg_hit; }; _Static_assert(sizeof(struct negstate) <= sizeof(struct vnode *), "the state must fit in a union with a pointer without growing it"); @@ -905,18 +906,27 @@ cache_neg_init(struct namecache *ncp) ncp->nc_flag |= NCF_NEGATIVE; ns = NCP2NEGSTATE(ncp); ns->neg_flag = 0; + ns->neg_hit = 0; counter_u64_add(neg_created, 1); } +#define CACHE_NEG_PROMOTION_THRESH 2 + static bool cache_neg_hit_prep(struct namecache *ncp) { struct negstate *ns; + u_char n; ns = NCP2NEGSTATE(ncp); - if ((ns->neg_flag & NEG_HOT) != 0) - return (true); - return (false); + n = atomic_load_char(&ns->neg_hit); + for (;;) { + if (n >= CACHE_NEG_PROMOTION_THRESH) + return (false); + if (atomic_fcmpset_8(&ns->neg_hit, &n, n + 1)) + break; + } + return (n + 1 == CACHE_NEG_PROMOTION_THRESH); } /* @@ -971,6 +981,7 @@ cache_neg_demote_locked(struct namecache *ncp) TAILQ_INSERT_TAIL(&nl->nl_list, ncp, nc_dst); nl->nl_hotnum--; ns->neg_flag &= ~NEG_HOT; + atomic_store_char(&ns->neg_hit, 0); } /* @@ -1098,7 +1109,7 @@ cache_neg_remove(struct namecache *ncp) } static struct neglist * -cache_neg_evict_select(void) +cache_neg_evict_select_list(void) { struct neglist *nl; u_int c; @@ -1112,6 +1123,33 @@ cache_neg_evict_select(void) return (nl); } +static struct namecache * +cache_neg_evict_select_entry(struct neglist *nl) +{ + struct namecache *ncp, *lncp; + struct negstate *ns, *lns; + int i; + + mtx_assert(&nl->nl_evict_lock, MA_OWNED); + mtx_assert(&nl->nl_lock, MA_OWNED); + ncp = TAILQ_FIRST(&nl->nl_list); + if (ncp == NULL) + return (NULL); + lncp = ncp; + lns = NCP2NEGSTATE(lncp); + for (i = 1; i < 4; i++) { + ncp = TAILQ_NEXT(ncp, nc_dst); + if (ncp == NULL) + break; + ns = NCP2NEGSTATE(ncp); + if (ns->neg_hit < lns->neg_hit) { + lncp = ncp; + lns = ns; + } + } + return (lncp); +} + static bool cache_neg_evict(void) { @@ -1125,7 +1163,7 @@ cache_neg_evict(void) u_char nlen; bool evicted; - nl = cache_neg_evict_select(); + nl = cache_neg_evict_select_list(); if (nl == NULL) { return (false); } @@ -1135,7 +1173,7 @@ cache_neg_evict(void) if (ncp != NULL) { cache_neg_demote_locked(ncp); } - ncp = TAILQ_FIRST(&nl->nl_list); + ncp = cache_neg_evict_select_entry(nl); if (ncp == NULL) { counter_u64_add(neg_evict_skipped_empty, 1); mtx_unlock(&nl->nl_lock); From owner-svn-src-head@freebsd.org Mon Oct 19 18:54:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD28E43156A; Mon, 19 Oct 2020 18:54:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFQsx48kHz41y0; Mon, 19 Oct 2020 18:54:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71F4F8783; Mon, 19 Oct 2020 18:54:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JIsjmv016631; Mon, 19 Oct 2020 18:54:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JIsjti016630; Mon, 19 Oct 2020 18:54:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202010191854.09JIsjti016630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Oct 2020 18:54:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366847 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 366847 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 18:54:45 -0000 Author: emaste Date: Mon Oct 19 18:54:44 2020 New Revision: 366847 URL: https://svnweb.freebsd.org/changeset/base/366847 Log: uma: fix KTR message after r366840 Reported by: bz Sponsored by: The FreeBSD Foundation Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Mon Oct 19 18:51:51 2020 (r366846) +++ head/sys/vm/uma_core.c Mon Oct 19 18:54:44 2020 (r366847) @@ -1427,7 +1427,7 @@ keg_drain_domain(uma_keg_t keg, int domain) LIST_INIT(&freeslabs); CTR4(KTR_UMA, "keg_drain %s(%p) domain %d free items: %u", - keg->uk_name, keg, i, dom->ud_free_items); + keg->uk_name, keg, domain, dom->ud_free_items); KEG_LOCK(keg, domain); From owner-svn-src-head@freebsd.org Mon Oct 19 19:20:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78F7B43211F; Mon, 19 Oct 2020 19:20:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFRRX2g4Nz43Gm; Mon, 19 Oct 2020 19:20:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37D848746; Mon, 19 Oct 2020 19:20:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JJKOe0029899; Mon, 19 Oct 2020 19:20:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JJKOva029898; Mon, 19 Oct 2020 19:20:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202010191920.09JJKOva029898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 19 Oct 2020 19:20:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366848 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 19:20:24 -0000 Author: kib Date: Mon Oct 19 19:20:23 2020 New Revision: 366848 URL: https://svnweb.freebsd.org/changeset/base/366848 Log: vgonel(): avoid recursing into VOP_INACTIVE(). It is a common pattern for filesystems' VOP_INACTIVE() implementation to forcibly reclaim the vnode when its state is final. For instance, UFS vnode with zero link count is removed, and since it is inactivated, the last open reference on it is dropped. On the other hand, vnode might get spurious usecount reference for many reasons. If the spurious reference exists while vgonel() checks for active state of the vnode, it would recurse into VOP_INACTIVE(). Fix it by checking and not doing inactivation when vgone() was called from inactive VOP. Reported and tested by: pho Discussed with: mjg Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Oct 19 18:54:44 2020 (r366847) +++ head/sys/kern/vfs_subr.c Mon Oct 19 19:20:23 2020 (r366848) @@ -1794,6 +1794,8 @@ freevnode(struct vnode *vp) VNASSERT(vp->v_cache_dd == NULL, vp, ("vp has namecache for ..")); VNASSERT(TAILQ_EMPTY(&vp->v_rl.rl_waiters), vp, ("Dangling rangelock waiters")); + VNASSERT((vp->v_iflag & (VI_DOINGINACT | VI_OWEINACT)) == 0, vp, + ("Leaked inactivation")); VI_UNLOCK(vp); #ifdef MAC mac_vnode_destroy(vp); @@ -3803,7 +3805,7 @@ vgonel(struct vnode *vp) struct thread *td; struct mount *mp; vm_object_t object; - bool active, oweinact; + bool active, doinginact, oweinact; ASSERT_VOP_ELOCKED(vp, "vgonel"); ASSERT_VI_LOCKED(vp, "vgonel"); @@ -3825,11 +3827,17 @@ vgonel(struct vnode *vp) vp->v_irflag |= VIRF_DOOMED; /* - * Check to see if the vnode is in use. If so, we have to call - * VOP_CLOSE() and VOP_INACTIVE(). + * Check to see if the vnode is in use. If so, we have to + * call VOP_CLOSE() and VOP_INACTIVE(). + * + * It could be that VOP_INACTIVE() requested reclamation, in + * which case we should avoid recursion, so check + * VI_DOINGINACT. This is not precise but good enough. */ active = vp->v_usecount > 0; oweinact = (vp->v_iflag & VI_OWEINACT) != 0; + doinginact = (vp->v_iflag & VI_DOINGINACT) != 0; + /* * If we need to do inactive VI_OWEINACT will be set. */ @@ -3850,7 +3858,7 @@ vgonel(struct vnode *vp) */ if (active) VOP_CLOSE(vp, FNONBLOCK, NOCRED, td); - if (oweinact || active) { + if ((oweinact || active) && !doinginact) { VI_LOCK(vp); vinactivef(vp); VI_UNLOCK(vp); From owner-svn-src-head@freebsd.org Mon Oct 19 19:23:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC50A4323C9; Mon, 19 Oct 2020 19:23:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFRVy4YM7z43RW; Mon, 19 Oct 2020 19:23:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F88586FC; Mon, 19 Oct 2020 19:23:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JJNMhY035420; Mon, 19 Oct 2020 19:23:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JJNMaV035419; Mon, 19 Oct 2020 19:23:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202010191923.09JJNMaV035419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 19 Oct 2020 19:23:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366849 - head/sys/fs/nullfs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/fs/nullfs X-SVN-Commit-Revision: 366849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 19:23:22 -0000 Author: kib Date: Mon Oct 19 19:23:22 2020 New Revision: 366849 URL: https://svnweb.freebsd.org/changeset/base/366849 Log: nullfs: ensure correct lock is taken after bypass. If lower VOP relocked the lower vnode, it is possible that nullfs vnode was reclaimed meantime. In this case nullfs vnode no longer shares lock with lower vnode, which breaks locking protocol. Check for the condition and acquire nullfs vnode lock if detected. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Mon Oct 19 19:20:23 2020 (r366848) +++ head/sys/fs/nullfs/null_vnops.c Mon Oct 19 19:23:22 2020 (r366849) @@ -227,6 +227,7 @@ null_bypass(struct vop_generic_args *ap) struct vnode *old_vps[VDESC_MAX_VPS]; struct vnode **vps_p[VDESC_MAX_VPS]; struct vnode ***vppp; + struct vnode *lvp; struct vnodeop_desc *descp = ap->a_desc; int reles, i; @@ -295,6 +296,23 @@ null_bypass(struct vop_generic_args *ap) if (descp->vdesc_vp_offsets[i] == VDESC_NO_OFFSET) break; /* bail out at end of list */ if (old_vps[i]) { + lvp = *(vps_p[i]); + + /* + * If lowervp was unlocked during VOP + * operation, nullfs upper vnode could have + * been reclaimed, which changes its v_vnlock + * back to private v_lock. In this case we + * must move lock ownership from lower to + * upper (reclaimed) vnode. + */ + if (lvp != NULLVP && + VOP_ISLOCKED(lvp) == LK_EXCLUSIVE && + old_vps[i]->v_vnlock != lvp->v_vnlock) { + VOP_UNLOCK(lvp); + VOP_LOCK(old_vps[i], LK_EXCLUSIVE | LK_RETRY); + } + *(vps_p[i]) = old_vps[i]; #if 0 if (reles & VDESC_VP0_WILLUNLOCK) From owner-svn-src-head@freebsd.org Mon Oct 19 19:50:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5F16432D66; Mon, 19 Oct 2020 19:50:59 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFS6q5stjz44dR; Mon, 19 Oct 2020 19:50:59 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACB2C9104; Mon, 19 Oct 2020 19:50:59 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JJoxQT048363; Mon, 19 Oct 2020 19:50:59 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JJovqR048351; Mon, 19 Oct 2020 19:50:57 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202010191950.09JJovqR048351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Mon, 19 Oct 2020 19:50:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366850 - in head/lib/googletest: gmock gmock/tests gmock_main gmock_main/tests gtest gtest/tests gtest_main gtest_main/tests tests tests/gmock tests/gmock_main tests/gtest tests/gtest_... X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: in head/lib/googletest: gmock gmock/tests gmock_main gmock_main/tests gtest gtest/tests gtest_main gtest_main/tests tests tests/gmock tests/gmock_main tests/gtest tests/gtest_main X-SVN-Commit-Revision: 366850 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 19:51:00 -0000 Author: arichardson Date: Mon Oct 19 19:50:57 2020 New Revision: 366850 URL: https://svnweb.freebsd.org/changeset/base/366850 Log: Major improvement to build parallelism for googletest internal tests Currently the googletest internal tests build after the matching library. However, each of these is serialized at the top level makefile. Additionally some of the tests (e.g. the gmock-matches-test) take up to 90 seconds to build with clang -O2. Having to wait for this test to complete before continuing to the next directory seriously slows down the parllelism of a -j32 build. Before this change running `make -C lib/googletest -j32 -s` in buildenv took 202 seconds, now it's 153 due to improved parallelism. Reviewed By: emaste (no objection) Differential Revision: https://reviews.freebsd.org/D26748 Added: head/lib/googletest/tests/Makefile.inc (contents, props changed) head/lib/googletest/tests/gmock/ head/lib/googletest/tests/gmock/Makefile (contents, props changed) - copied, changed from r366849, head/lib/googletest/gmock/tests/Makefile head/lib/googletest/tests/gmock_main/ head/lib/googletest/tests/gmock_main/Makefile (contents, props changed) - copied, changed from r366849, head/lib/googletest/gmock_main/tests/Makefile head/lib/googletest/tests/gtest/ head/lib/googletest/tests/gtest/Makefile (contents, props changed) - copied, changed from r366849, head/lib/googletest/gtest/tests/Makefile head/lib/googletest/tests/gtest_main/ head/lib/googletest/tests/gtest_main/Makefile (contents, props changed) - copied, changed from r366849, head/lib/googletest/gtest_main/tests/Makefile Deleted: head/lib/googletest/gmock/tests/Makefile head/lib/googletest/gmock_main/tests/Makefile head/lib/googletest/gtest/tests/Makefile head/lib/googletest/gtest_main/tests/Makefile Modified: head/lib/googletest/gmock/Makefile head/lib/googletest/gmock_main/Makefile head/lib/googletest/gtest/Makefile head/lib/googletest/gtest_main/Makefile head/lib/googletest/tests/Makefile Modified: head/lib/googletest/gmock/Makefile ============================================================================== --- head/lib/googletest/gmock/Makefile Mon Oct 19 19:23:22 2020 (r366849) +++ head/lib/googletest/gmock/Makefile Mon Oct 19 19:50:57 2020 (r366850) @@ -42,7 +42,4 @@ INTERNAL_CUSTOM_INCS+= gmock/internal/custom/gmock-gen SRCS+= gmock-all.cc -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests - .include Modified: head/lib/googletest/gmock_main/Makefile ============================================================================== --- head/lib/googletest/gmock_main/Makefile Mon Oct 19 19:23:22 2020 (r366849) +++ head/lib/googletest/gmock_main/Makefile Mon Oct 19 19:50:57 2020 (r366850) @@ -19,7 +19,4 @@ LDFLAGS+= -L${LIBGMOCKDIR} SRCS+= gmock_main.cc -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests - .include Modified: head/lib/googletest/gtest/Makefile ============================================================================== --- head/lib/googletest/gtest/Makefile Mon Oct 19 19:23:22 2020 (r366849) +++ head/lib/googletest/gtest/Makefile Mon Oct 19 19:50:57 2020 (r366850) @@ -47,7 +47,4 @@ SRCS+= gtest-all.cc LIBADD+= pthread regex -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests - .include Modified: head/lib/googletest/gtest_main/Makefile ============================================================================== --- head/lib/googletest/gtest_main/Makefile Mon Oct 19 19:23:22 2020 (r366849) +++ head/lib/googletest/gtest_main/Makefile Mon Oct 19 19:50:57 2020 (r366850) @@ -17,7 +17,4 @@ LDFLAGS+= -L${LIBGTESTDIR} SRCS+= gtest_main.cc -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests - .include Modified: head/lib/googletest/tests/Makefile ============================================================================== --- head/lib/googletest/tests/Makefile Mon Oct 19 19:23:22 2020 (r366849) +++ head/lib/googletest/tests/Makefile Mon Oct 19 19:50:57 2020 (r366850) @@ -3,4 +3,10 @@ .PATH: ${SRCTOP}/tests KYUAFILE= yes +# Note: we start the gmock_main and gmock tests first since those take up to +# 60 seconds to build, so starting them late seriously reduces build parallism. +SUBDIR= gmock_main gmock gtest_main gtest + +SUBDIR_PARALLEL= + .include Added: head/lib/googletest/tests/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/googletest/tests/Makefile.inc Mon Oct 19 19:50:57 2020 (r366850) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +# Keep the existing tests directory structure (with subdirs per component) +# rather than installing all of them to /usr/tests/lib/googletest +TESTSDIR= ${TESTSBASE}/lib/googletest/${.CURDIR:T} Copied and modified: head/lib/googletest/tests/gmock/Makefile (from r366849, head/lib/googletest/gmock/tests/Makefile) ============================================================================== Copied and modified: head/lib/googletest/tests/gmock_main/Makefile (from r366849, head/lib/googletest/gmock_main/tests/Makefile) ============================================================================== Copied and modified: head/lib/googletest/tests/gtest/Makefile (from r366849, head/lib/googletest/gtest/tests/Makefile) ============================================================================== Copied and modified: head/lib/googletest/tests/gtest_main/Makefile (from r366849, head/lib/googletest/gtest_main/tests/Makefile) ============================================================================== From owner-svn-src-head@freebsd.org Mon Oct 19 19:51:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB5F3432D6F; Mon, 19 Oct 2020 19:51:04 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFS6w4nc1z44yQ; Mon, 19 Oct 2020 19:51:04 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F3298F9D; Mon, 19 Oct 2020 19:51:04 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JJp4rj048420; Mon, 19 Oct 2020 19:51:04 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JJp4LG048419; Mon, 19 Oct 2020 19:51:04 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202010191951.09JJp4LG048419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Mon, 19 Oct 2020 19:51:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366851 - head/lib/googletest X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/lib/googletest X-SVN-Commit-Revision: 366851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 19:51:05 -0000 Author: arichardson Date: Mon Oct 19 19:51:03 2020 New Revision: 366851 URL: https://svnweb.freebsd.org/changeset/base/366851 Log: Enable SUBDIR_PARALLEL for lib/googletest This saves a few seconds in a parallel build since we can build the gtest_main and gmock subdirectories in parallel. Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D26760 Modified: head/lib/googletest/Makefile Modified: head/lib/googletest/Makefile ============================================================================== --- head/lib/googletest/Makefile Mon Oct 19 19:50:57 2020 (r366850) +++ head/lib/googletest/Makefile Mon Oct 19 19:51:03 2020 (r366851) @@ -3,12 +3,16 @@ .include SUBDIR+= gtest -SUBDIR+= .WAIT SUBDIR+= gmock -SUBDIR+= .WAIT SUBDIR+= gmock_main SUBDIR+= gtest_main SUBDIR.${MK_TESTS}+= tests + +SUBDIR_DEPEND_gtest_main= gtest +SUBDIR_DEPEND_gmock= gtest +SUBDIR_DEPEND_gmock_main= gmock +SUBDIR_DEPEND_tests= gmock_main +SUBDIR_PARALLEL= .include From owner-svn-src-head@freebsd.org Mon Oct 19 20:04:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EB57432DFD; Mon, 19 Oct 2020 20:04:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFSPv6k5Qz45nf; Mon, 19 Oct 2020 20:04:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA06F926C; Mon, 19 Oct 2020 20:04:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JK43c4060056; Mon, 19 Oct 2020 20:04:03 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JK43Rt060055; Mon, 19 Oct 2020 20:04:03 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202010192004.09JK43Rt060055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 19 Oct 2020 20:04:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366852 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 366852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 20:04:04 -0000 Author: jhb Date: Mon Oct 19 20:04:03 2020 New Revision: 366852 URL: https://svnweb.freebsd.org/changeset/base/366852 Log: Fix a couple of bugs for asym crypto introduced in r359374. - Check for null pointers in the crypto_drivers[] array when checking for empty slots in crypto_select_kdriver(). - Handle the case where crypto_kdone() is invoked on a request where krq_cap is NULL due to not finding a matching driver. Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D26811 Modified: head/sys/opencrypto/crypto.c Modified: head/sys/opencrypto/crypto.c ============================================================================== --- head/sys/opencrypto/crypto.c Mon Oct 19 19:51:03 2020 (r366851) +++ head/sys/opencrypto/crypto.c Mon Oct 19 20:04:03 2020 (r366852) @@ -1540,7 +1540,7 @@ again: * match), then skip. */ cap = crypto_drivers[hid]; - if (cap->cc_dev == NULL || + if (cap == NULL || (cap->cc_flags & match) == 0) continue; @@ -1880,15 +1880,18 @@ crypto_kdone(struct cryptkop *krp) if (krp->krp_status != 0) CRYPTOSTAT_INC(cs_kerrs); - CRYPTO_DRIVER_LOCK(); cap = krp->krp_cap; - KASSERT(cap->cc_koperations > 0, ("cc_koperations == 0")); - cap->cc_koperations--; - if (cap->cc_koperations == 0 && cap->cc_flags & CRYPTOCAP_F_CLEANUP) - wakeup(cap); - CRYPTO_DRIVER_UNLOCK(); - krp->krp_cap = NULL; - cap_rele(cap); + if (cap != NULL) { + CRYPTO_DRIVER_LOCK(); + KASSERT(cap->cc_koperations > 0, ("cc_koperations == 0")); + cap->cc_koperations--; + if (cap->cc_koperations == 0 && + cap->cc_flags & CRYPTOCAP_F_CLEANUP) + wakeup(cap); + CRYPTO_DRIVER_UNLOCK(); + krp->krp_cap = NULL; + cap_rele(cap); + } ret_worker = CRYPTO_RETW(0); From owner-svn-src-head@freebsd.org Mon Oct 19 20:08:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80D1A433702; Mon, 19 Oct 2020 20:08:48 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFSWN2shMz45vd; Mon, 19 Oct 2020 20:08:48 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45AA78FD2; Mon, 19 Oct 2020 20:08:48 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JK8m17060338; Mon, 19 Oct 2020 20:08:48 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JK8mni060337; Mon, 19 Oct 2020 20:08:48 GMT (envelope-from np@FreeBSD.org) Message-Id: <202010192008.09JK8mni060337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 19 Oct 2020 20:08:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366853 - head/sys/dev/cxgbe/common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/common X-SVN-Commit-Revision: 366853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 20:08:48 -0000 Author: np Date: Mon Oct 19 20:08:47 2020 New Revision: 366853 URL: https://svnweb.freebsd.org/changeset/base/366853 Log: cxgbe(4): Fix page fault in t4_get_lb_stats with 2 port T5 cards. PR: 250449 Reported by: freqlabs@ MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_hw.c Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Mon Oct 19 20:04:03 2020 (r366852) +++ head/sys/dev/cxgbe/common/t4_hw.c Mon Oct 19 20:08:47 2020 (r366853) @@ -6957,7 +6957,6 @@ void t4_get_port_stats(struct adapter *adap, int idx, */ void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p) { - u32 bgmap = adap2pinfo(adap, idx)->mps_bg_map; #define GET_STAT(name) \ t4_read_reg64(adap, \ @@ -6982,14 +6981,18 @@ void t4_get_lb_stats(struct adapter *adap, int idx, st p->frames_1519_max = GET_STAT(1519B_MAX); p->drop = GET_STAT(DROP_FRAMES); - p->ovflow0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_DROP_FRAME) : 0; - p->ovflow1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_DROP_FRAME) : 0; - p->ovflow2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_DROP_FRAME) : 0; - p->ovflow3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_DROP_FRAME) : 0; - p->trunc0 = (bgmap & 1) ? GET_STAT_COM(RX_BG_0_LB_TRUNC_FRAME) : 0; - p->trunc1 = (bgmap & 2) ? GET_STAT_COM(RX_BG_1_LB_TRUNC_FRAME) : 0; - p->trunc2 = (bgmap & 4) ? GET_STAT_COM(RX_BG_2_LB_TRUNC_FRAME) : 0; - p->trunc3 = (bgmap & 8) ? GET_STAT_COM(RX_BG_3_LB_TRUNC_FRAME) : 0; + if (idx < adap->params.nports) { + u32 bg = adap2pinfo(adap, idx)->mps_bg_map; + + p->ovflow0 = (bg & 1) ? GET_STAT_COM(RX_BG_0_LB_DROP_FRAME) : 0; + p->ovflow1 = (bg & 2) ? GET_STAT_COM(RX_BG_1_LB_DROP_FRAME) : 0; + p->ovflow2 = (bg & 4) ? GET_STAT_COM(RX_BG_2_LB_DROP_FRAME) : 0; + p->ovflow3 = (bg & 8) ? GET_STAT_COM(RX_BG_3_LB_DROP_FRAME) : 0; + p->trunc0 = (bg & 1) ? GET_STAT_COM(RX_BG_0_LB_TRUNC_FRAME) : 0; + p->trunc1 = (bg & 2) ? GET_STAT_COM(RX_BG_1_LB_TRUNC_FRAME) : 0; + p->trunc2 = (bg & 4) ? GET_STAT_COM(RX_BG_2_LB_TRUNC_FRAME) : 0; + p->trunc3 = (bg & 8) ? GET_STAT_COM(RX_BG_3_LB_TRUNC_FRAME) : 0; + } #undef GET_STAT #undef GET_STAT_COM From owner-svn-src-head@freebsd.org Mon Oct 19 20:08:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 021064332C6; Mon, 19 Oct 2020 20:08:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFSWR6MmMz463s; Mon, 19 Oct 2020 20:08:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE37592AA; Mon, 19 Oct 2020 20:08:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JK8pxg060404; Mon, 19 Oct 2020 20:08:51 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JK8oLZ060398; Mon, 19 Oct 2020 20:08:50 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202010192008.09JK8oLZ060398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 19 Oct 2020 20:08:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366854 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 366854 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 20:08:52 -0000 Author: jhb Date: Mon Oct 19 20:08:50 2020 New Revision: 366854 URL: https://svnweb.freebsd.org/changeset/base/366854 Log: Re-enable receive flow control for TOE TLS sockets. Flow control was disabled during initial TOE TLS development to workaround a hang (and to match the Linux TOE TLS support for T6). The rest of the TOE TLS code maintained credits as if flow control was enabled which was inherited from before the workaround was added with the exception that the receive window was allowed to go negative. This negative receive window handling (rcv_over) was because I hadn't realized the full implications of disabling flow control. To clean this up, re-enable flow control on TOE TLS sockets. The existing TPF_FORCE_CREDITS workaround is sufficient for the original hang. Now that flow control is enabled, remove the rcv_over workaround and instead assert that the receive window never goes negative matching plain TCP TOE sockets. Reviewed by: np MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D26799 Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_tls.c head/sys/dev/cxgbe/tom/t4_tls.h head/sys/dev/cxgbe/tom/t4_tom.c Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Mon Oct 19 20:08:47 2020 (r366853) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Mon Oct 19 20:08:50 2020 (r366854) @@ -446,16 +446,6 @@ t4_rcvd_locked(struct toedev *tod, struct tcpcb *tp) SOCKBUF_LOCK_ASSERT(sb); rx_credits = sbspace(sb) > tp->rcv_wnd ? sbspace(sb) - tp->rcv_wnd : 0; - if (ulp_mode(toep) == ULP_MODE_TLS) { - if (toep->tls.rcv_over >= rx_credits) { - toep->tls.rcv_over -= rx_credits; - rx_credits = 0; - } else { - rx_credits -= toep->tls.rcv_over; - toep->tls.rcv_over = 0; - } - } - if (rx_credits > 0 && (tp->rcv_wnd <= 32 * 1024 || rx_credits >= 64 * 1024 || (rx_credits >= 16 * 1024 && tp->rcv_wnd <= 128 * 1024) || Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Mon Oct 19 20:08:47 2020 (r366853) +++ head/sys/dev/cxgbe/tom/t4_tls.c Mon Oct 19 20:08:50 2020 (r366854) @@ -2045,11 +2045,9 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_head #endif tp->rcv_nxt += pdu_length; - if (tp->rcv_wnd < pdu_length) { - toep->tls.rcv_over += pdu_length - tp->rcv_wnd; - tp->rcv_wnd = 0; - } else - tp->rcv_wnd -= pdu_length; + KASSERT(tp->rcv_wnd >= pdu_length, + ("%s: negative window size", __func__)); + tp->rcv_wnd -= pdu_length; /* XXX: Not sure what to do about urgent data. */ Modified: head/sys/dev/cxgbe/tom/t4_tls.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.h Mon Oct 19 20:08:47 2020 (r366853) +++ head/sys/dev/cxgbe/tom/t4_tls.h Mon Oct 19 20:08:50 2020 (r366854) @@ -276,7 +276,6 @@ struct tls_ofld_info { enum tls_mode mode; struct callout handshake_timer; u_int sb_off; - u_int rcv_over; }; struct tls_key_req { Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Mon Oct 19 20:08:47 2020 (r366853) +++ head/sys/dev/cxgbe/tom/t4_tom.c Mon Oct 19 20:08:50 2020 (r366854) @@ -1036,8 +1036,6 @@ calc_options2(struct vi_info *vi, struct conn_params * if (cp->ulp_mode == ULP_MODE_TCPDDP) opt2 |= F_RX_FC_DDP; #endif - if (cp->ulp_mode == ULP_MODE_TLS) - opt2 |= F_RX_FC_DISABLE; return (htobe32(opt2)); } From owner-svn-src-head@freebsd.org Mon Oct 19 20:26:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38E4F43366F; Mon, 19 Oct 2020 20:26:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFSvy0l31z46bg; Mon, 19 Oct 2020 20:26:38 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0DED9634; Mon, 19 Oct 2020 20:26:37 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JKQbJU072756; Mon, 19 Oct 2020 20:26:37 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JKQbvQ072753; Mon, 19 Oct 2020 20:26:37 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010192026.09JKQbvQ072753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 19 Oct 2020 20:26:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366855 - in head/sys/geom: . uzip X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys/geom: . uzip X-SVN-Commit-Revision: 366855 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 20:26:38 -0000 Author: trasz Date: Mon Oct 19 20:26:37 2020 New Revision: 366855 URL: https://svnweb.freebsd.org/changeset/base/366855 Log: Fix fallout from r366811. PR: 250442 Reported by: lwhsu Reviewed by: mav MFC after: 2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26855 Modified: head/sys/geom/geom_dev.c head/sys/geom/uzip/g_uzip.c Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Mon Oct 19 20:08:50 2020 (r366854) +++ head/sys/geom/geom_dev.c Mon Oct 19 20:26:37 2020 (r366855) @@ -346,9 +346,15 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, cp->private = sc; cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); - KASSERT(error == 0 || error == ENXIO, - ("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error)); - + if (error != 0) { + printf("%s: g_dev_taste(%s) failed to g_attach, error=%d\n", + __func__, pp->name, error); + g_destroy_consumer(cp); + g_destroy_geom(gp); + mtx_destroy(&sc->sc_mtx); + g_free(sc); + return (NULL); + } make_dev_args_init(&args); args.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_WAITOK; args.mda_devsw = &g_dev_cdevsw; Modified: head/sys/geom/uzip/g_uzip.c ============================================================================== --- head/sys/geom/uzip/g_uzip.c Mon Oct 19 20:08:50 2020 (r366854) +++ head/sys/geom/uzip/g_uzip.c Mon Oct 19 20:26:37 2020 (r366855) @@ -707,11 +707,11 @@ g_uzip_taste(struct g_class *mp, struct g_provider *pp gp = g_new_geomf(mp, GUZ_DEV_NAME("%s"), pp->name); cp = g_new_consumer(gp); error = g_attach(cp, pp); - if (error == 0) - error = g_access(cp, 1, 0, 0); - if (error) { + if (error != 0) + goto e0; + error = g_access(cp, 1, 0, 0); + if (error) goto e1; - } g_topology_unlock(); /* @@ -942,6 +942,7 @@ e2: g_access(cp, -1, 0, 0); e1: g_detach(cp); +e0: g_destroy_consumer(cp); g_destroy_geom(gp); From owner-svn-src-head@freebsd.org Mon Oct 19 20:37:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CC99434206; Mon, 19 Oct 2020 20:37:39 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFT8g1bQQz47rX; Mon, 19 Oct 2020 20:37:39 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3BFD97E3; Mon, 19 Oct 2020 20:37:38 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JKbcvN079309; Mon, 19 Oct 2020 20:37:38 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JKbcAY079308; Mon, 19 Oct 2020 20:37:38 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202010192037.09JKbcAY079308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 19 Oct 2020 20:37:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366857 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 366857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 20:37:39 -0000 Author: cy Date: Mon Oct 19 20:37:38 2020 New Revision: 366857 URL: https://svnweb.freebsd.org/changeset/base/366857 Log: Destroy cloned interfaces at netif stop, netif restart and shutdown. This is especially important during shutdown because a child interface of lagg with WOL enabled will not enable WOL at interface shutdown and thus no WOL to wake up the device (and machine). PR: 158734, 109980 Reported by: Antonio Huete Jimenez Marat N.Afanasyev reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26797 Modified: head/libexec/rc/rc.d/netif Modified: head/libexec/rc/rc.d/netif ============================================================================== --- head/libexec/rc/rc.d/netif Mon Oct 19 20:37:04 2020 (r366856) +++ head/libexec/rc/rc.d/netif Mon Oct 19 20:37:38 2020 (r366857) @@ -28,7 +28,7 @@ # PROVIDE: netif # REQUIRE: FILESYSTEMS iovctl serial sppp sysctl # REQUIRE: hostid ipfs -# KEYWORD: nojailvnet +# KEYWORD: nojailvnet shutdown . /etc/rc.subr . /etc/network.subr From owner-svn-src-head@freebsd.org Mon Oct 19 20:43:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96CE943490E; Mon, 19 Oct 2020 20:43:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFTHQ3SXLz49SL; Mon, 19 Oct 2020 20:43:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A7099C80; Mon, 19 Oct 2020 20:43:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JKhUFJ085359; Mon, 19 Oct 2020 20:43:30 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JKhTr4085357; Mon, 19 Oct 2020 20:43:29 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202010192043.09JKhTr4085357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 19 Oct 2020 20:43:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366861 - in head/sys/modules: . vmware X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys/modules: . vmware X-SVN-Commit-Revision: 366861 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 20:43:30 -0000 Author: emaste Date: Mon Oct 19 20:43:29 2020 New Revision: 366861 URL: https://svnweb.freebsd.org/changeset/base/366861 Log: build vmware modules on arm64 pvscsi and vmxnet3 build and work. Exclude vmci for now as it contains x86-specific assembly. Reported by: Vincent Milum Jr MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/modules/Makefile head/sys/modules/vmware/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Mon Oct 19 20:42:01 2020 (r366860) +++ head/sys/modules/Makefile Mon Oct 19 20:43:29 2020 (r366861) @@ -511,6 +511,7 @@ _mthca= mthca _mlx4ib= mlx4ib _mlx5ib= mlx5ib .endif +_vmware= vmware .endif .if ${MK_NETGRAPH} != "no" || defined(ALL_MODULES) @@ -633,7 +634,6 @@ _safe= safe _speaker= speaker _splash= splash _sppp= sppp -_vmware= vmware _wbwd= wbwd _wi= wi Modified: head/sys/modules/vmware/Makefile ============================================================================== --- head/sys/modules/vmware/Makefile Mon Oct 19 20:42:01 2020 (r366860) +++ head/sys/modules/vmware/Makefile Mon Oct 19 20:43:29 2020 (r366861) @@ -23,6 +23,8 @@ # SUCH DAMAGE. # -SUBDIR= pvscsi vmci vmxnet3 - +SUBDIR= pvscsi vmxnet3 +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +SUBDIR+= vmci +.endif .include From owner-svn-src-head@freebsd.org Mon Oct 19 21:11:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D364435184; Mon, 19 Oct 2020 21:11:50 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFTw572B2z4DFB; Mon, 19 Oct 2020 21:11:49 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D31289ACB; Mon, 19 Oct 2020 21:11:49 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JLBnDr000785; Mon, 19 Oct 2020 21:11:49 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JLBnTg000784; Mon, 19 Oct 2020 21:11:49 GMT (envelope-from np@FreeBSD.org) Message-Id: <202010192111.09JLBnTg000784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 19 Oct 2020 21:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366862 - in head: share/man/man4 sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/cxgbe X-SVN-Commit-Revision: 366862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 21:11:50 -0000 Author: np Date: Mon Oct 19 21:11:49 2020 New Revision: 366862 URL: https://svnweb.freebsd.org/changeset/base/366862 Log: cxgbe(4): Updates to the drop features from r366532. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/share/man/man4/cxgbe.4 head/sys/dev/cxgbe/t4_main.c Modified: head/share/man/man4/cxgbe.4 ============================================================================== --- head/share/man/man4/cxgbe.4 Mon Oct 19 20:43:29 2020 (r366861) +++ head/share/man/man4/cxgbe.4 Mon Oct 19 21:11:49 2020 (r366862) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 8, 2020 +.Dd October 19, 2020 .Dt CXGBE 4 .Os .Sh NAME @@ -369,6 +369,7 @@ The attack filter will drop an incoming frame if any o true: src ip/ip6 == dst ip/ip6; tcp and src/dst ip is not unicast; src/dst ip is loopback (127.x.y.z); src ip6 is not unicast; src/dst ip6 is loopback (::1/128) or unspecified (::/128); tcp and src/dst ip6 is mcast (ff00::/8). +This facility is available on T4 and T5 based cards only. .It Va hw.cxgbe.drop_ip_fragments Set to 1 to drop all incoming IP fragments. Default is 0. @@ -378,9 +379,11 @@ Set to 1 to drop incoming frames with Layer 2 length o Default is 1. .It Va hw.cxgbe.drop_pkts_with_l3_errors Set to 1 to drop incoming frames with IP version, length, or checksum errors. +The IP checksum is validated for TCP or UDP packets only. Default is 0. .It Va hw.cxgbe.drop_pkts_with_l4_errors -Set to 1 to drop incoming frames with Layer 4 length, checksum, or other errors. +Set to 1 to drop incoming frames with Layer 4 (TCP or UDP) length, +checksum, or other errors. Default is 0. .El .Sh SUPPORT Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Mon Oct 19 20:43:29 2020 (r366861) +++ head/sys/dev/cxgbe/t4_main.c Mon Oct 19 21:11:49 2020 (r366862) @@ -4823,7 +4823,7 @@ set_params__post_init(struct adapter *sc) F_DROPERRORIPHDRLEN | F_DROPERRORTCPHDRLEN | F_DROPERRORPKTLEN | F_DROPERRORTCPOPT | F_DROPERRORCSUMIP | F_DROPERRORCSUM; val = 0; - if (t4_attack_filter != 0) { + if (chip_id(sc) < CHELSIO_T6 && t4_attack_filter != 0) { t4_set_reg_field(sc, A_TP_GLOBAL_CONFIG, F_ATTACKFILTERENABLE, F_ATTACKFILTERENABLE); val |= F_DROPERRORATTACK; From owner-svn-src-head@freebsd.org Mon Oct 19 21:27:28 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A34C8435815; Mon, 19 Oct 2020 21:27:28 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFVG83tSDz4Df4; Mon, 19 Oct 2020 21:27:28 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65183A31D; Mon, 19 Oct 2020 21:27:28 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JLRScj011200; Mon, 19 Oct 2020 21:27:28 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JLRS6Q011198; Mon, 19 Oct 2020 21:27:28 GMT (envelope-from br@FreeBSD.org) Message-Id: <202010192127.09JLRS6Q011198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 19 Oct 2020 21:27:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366863 - head/sys/dev/ahci X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/dev/ahci X-SVN-Commit-Revision: 366863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 21:27:28 -0000 Author: br Date: Mon Oct 19 21:27:27 2020 New Revision: 366863 URL: https://svnweb.freebsd.org/changeset/base/366863 Log: Add IOMMU_BUSWIDE ahci quirk. Some controllers use PCI function 1 as the requester ID for DMA transfers, but the controllers are not PCI multifunction. Set the iommu buswide flag for them. This should instruct an IOMMU driver to use the same translation rule for all the devices and functions of a bus. This was discovered on the ARM Neoverse N1 System Development Platform (ARM N1SDP). Bug reference: https://bugzilla.kernel.org/show_bug.cgi?id=42679 Reported by: andrew Reviewed by: kib, mav Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26857 Modified: head/sys/dev/ahci/ahci.h head/sys/dev/ahci/ahci_pci.c Modified: head/sys/dev/ahci/ahci.h ============================================================================== --- head/sys/dev/ahci/ahci.h Mon Oct 19 21:11:49 2020 (r366862) +++ head/sys/dev/ahci/ahci.h Mon Oct 19 21:27:27 2020 (r366863) @@ -624,6 +624,7 @@ enum ahci_err_type { #define AHCI_Q_MRVL_SR_DEL 0x00200000 #define AHCI_Q_NOCCS 0x00400000 #define AHCI_Q_NOAUX 0x00800000 +#define AHCI_Q_IOMMU_BUSWIDE 0x01000000 #define AHCI_Q_BIT_STRING \ "\020" \ @@ -650,7 +651,8 @@ enum ahci_err_type { "\025NOMSIX" \ "\026MRVL_SR_DEL" \ "\027NOCCS" \ - "\030NOAUX" + "\030NOAUX" \ + "\031IOMMU_BUSWIDE" int ahci_attach(device_t dev); int ahci_detach(device_t dev); Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Mon Oct 19 21:11:49 2020 (r366862) +++ head/sys/dev/ahci/ahci_pci.c Mon Oct 19 21:27:27 2020 (r366863) @@ -37,12 +37,16 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#include #include #include #include #include #include #include +#include #include "ahci.h" static int force_ahci = 1; @@ -248,7 +252,10 @@ static const struct { {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, {0x2366197b, 0x00, "JMicron JMB366", AHCI_Q_NOFORCE}, {0x2368197b, 0x00, "JMicron JMB368", AHCI_Q_NOFORCE}, + {0x2392197b, 0x00, "JMicron JMB388", AHCI_Q_IOMMU_BUSWIDE}, {0x0585197b, 0x00, "JMicron JMB58x", 0}, + {0x01221c28, 0x00, "Lite-On Plextor M6E (Marvell 88SS9183)", + AHCI_Q_IOMMU_BUSWIDE}, {0x611111ab, 0x00, "Marvell 88SE6111", AHCI_Q_NOFORCE | AHCI_Q_NOPMP | AHCI_Q_1CH | AHCI_Q_EDGEIS}, {0x612111ab, 0x00, "Marvell 88SE6121", AHCI_Q_NOFORCE | AHCI_Q_NOPMP | @@ -257,19 +264,28 @@ static const struct { AHCI_Q_4CH | AHCI_Q_EDGEIS | AHCI_Q_NONCQ | AHCI_Q_NOCOUNT}, {0x614511ab, 0x00, "Marvell 88SE6145", AHCI_Q_NOFORCE | AHCI_Q_NOPMP | AHCI_Q_4CH | AHCI_Q_EDGEIS | AHCI_Q_NONCQ | AHCI_Q_NOCOUNT}, - {0x91201b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS}, - {0x91231b4b, 0x11, "Marvell 88SE912x", AHCI_Q_ALTSIG}, - {0x91231b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS|AHCI_Q_SATA2}, + {0x91201b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS | + AHCI_Q_IOMMU_BUSWIDE}, + {0x91231b4b, 0x11, "Marvell 88SE912x", AHCI_Q_ALTSIG | + AHCI_Q_IOMMU_BUSWIDE}, + {0x91231b4b, 0x00, "Marvell 88SE912x", AHCI_Q_EDGEIS | AHCI_Q_SATA2 | + AHCI_Q_IOMMU_BUSWIDE}, {0x91251b4b, 0x00, "Marvell 88SE9125", 0}, - {0x91281b4b, 0x00, "Marvell 88SE9128", AHCI_Q_ALTSIG}, - {0x91301b4b, 0x00, "Marvell 88SE9130", AHCI_Q_ALTSIG}, - {0x91721b4b, 0x00, "Marvell 88SE9172", 0}, - {0x91821b4b, 0x00, "Marvell 88SE9182", 0}, - {0x91831b4b, 0x00, "Marvell 88SS9183", 0}, - {0x91a01b4b, 0x00, "Marvell 88SE91Ax", 0}, + {0x91281b4b, 0x00, "Marvell 88SE9128", AHCI_Q_ALTSIG | + AHCI_Q_IOMMU_BUSWIDE}, + {0x91301b4b, 0x00, "Marvell 88SE9130", AHCI_Q_ALTSIG | + AHCI_Q_IOMMU_BUSWIDE}, + {0x91701b4b, 0x00, "Marvell 88SE9170", AHCI_Q_IOMMU_BUSWIDE}, + {0x91721b4b, 0x00, "Marvell 88SE9172", AHCI_Q_IOMMU_BUSWIDE}, + {0x917a1b4b, 0x00, "Marvell 88SE917A", AHCI_Q_IOMMU_BUSWIDE}, + {0x91821b4b, 0x00, "Marvell 88SE9182", AHCI_Q_IOMMU_BUSWIDE}, + {0x91831b4b, 0x00, "Marvell 88SS9183", AHCI_Q_IOMMU_BUSWIDE}, + {0x91a01b4b, 0x00, "Marvell 88SE91Ax", AHCI_Q_IOMMU_BUSWIDE}, {0x92151b4b, 0x00, "Marvell 88SE9215", 0}, - {0x92201b4b, 0x00, "Marvell 88SE9220", AHCI_Q_ALTSIG}, - {0x92301b4b, 0x00, "Marvell 88SE9230", AHCI_Q_ALTSIG}, + {0x92201b4b, 0x00, "Marvell 88SE9220", AHCI_Q_ALTSIG | + AHCI_Q_IOMMU_BUSWIDE}, + {0x92301b4b, 0x00, "Marvell 88SE9230", AHCI_Q_ALTSIG | + AHCI_Q_IOMMU_BUSWIDE}, {0x92351b4b, 0x00, "Marvell 88SE9235", 0}, {0x06201103, 0x00, "HighPoint RocketRAID 620", 0}, {0x06201b4b, 0x00, "HighPoint RocketRAID 620", 0}, @@ -280,8 +296,8 @@ static const struct { {0x06441103, 0x00, "HighPoint RocketRAID 644", 0}, {0x06441b4b, 0x00, "HighPoint RocketRAID 644", 0}, {0x06411103, 0x00, "HighPoint RocketRAID 640L", 0}, - {0x06421103, 0x00, "HighPoint RocketRAID 642L", 0}, - {0x06451103, 0x00, "HighPoint RocketRAID 644L", 0}, + {0x06421103, 0x00, "HighPoint RocketRAID 642L", AHCI_Q_IOMMU_BUSWIDE}, + {0x06451103, 0x00, "HighPoint RocketRAID 644L", AHCI_Q_IOMMU_BUSWIDE}, {0x044c10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, {0x044d10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, {0x044e10de, 0x00, "NVIDIA MCP65", AHCI_Q_NOAA}, @@ -482,6 +498,16 @@ ahci_pci_attach(device_t dev) ahci_ids[i].rev > revid)) i++; ctlr->quirks = ahci_ids[i].quirks; + + if (ctlr->quirks & AHCI_Q_IOMMU_BUSWIDE) { + /* + * The controller issues DMA requests from PCI function 1, + * but the device is not multifunction. + * Ref: https://bugzilla.kernel.org/show_bug.cgi?id=42679 + */ + bus_dma_iommu_set_buswide(dev); + } + /* Limit speed for my onboard JMicron external port. * It is not eSATA really, limit to SATA 1 */ if (pci_get_devid(dev) == 0x2363197b && From owner-svn-src-head@freebsd.org Mon Oct 19 21:45:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FB37435518; Mon, 19 Oct 2020 21:45:37 +0000 (UTC) (envelope-from br@bsdpad.com) Received: from sc1.bsdpad.com (sc1.bsdpad.com [163.172.212.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFVg45TJpz4Ftr; Mon, 19 Oct 2020 21:45:36 +0000 (UTC) (envelope-from br@bsdpad.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bsdpad.com; s=20190317; h=Subject:To:From; bh=eDaH8jQczThHkIZtvtXIoz/DDope4JdU/4WqJtLwoYc=; b=QaRxz+mGwxaOKlh+2YMtJxjzec 61QK4l8V+rnapz9caCES8KuVeaysv78hFe5p+jutJmE0qUitTs2GZtUx04Top4Hm/YStbnCwQ9x+/ qDrf5rophHOapCoqyYf9CzdtJB7GsY15xev3ycimLJf2hE/rXg7Ivim3ZIpZlLpctyotZ+ztY2nR9 7CzQkOdMpezgtY6SmSU41WDQ0aB8+0b0GFTLdcA+/A6V/tsIP9EIgdUM+OdzKpg9jLF0OArxbtHoE GNqEBGJ7xb2D1cUzBcIMsfhVMKs2yODkiltJ4ma6V3Q+yL6IUJ1bE2hyxjYpw1EMiVldbP8P5Uu3y //rXsFGw==; Received: from localhost ([127.0.0.1] helo=bsdpad.com) by sc1.bsdpad.com with smtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1kUctw-0007cx-Cx; Mon, 19 Oct 2020 22:41:08 +0100 Received: by bsdpad.com (nbSMTP-1.00) for uid 1001 br@bsdpad.com; Mon, 19 Oct 2020 22:41:08 +0100 (BST) Date: Mon, 19 Oct 2020 22:41:08 +0100 From: Ruslan Bukin To: Jessica Clarke Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366833 - in head/sys: dev/iommu kern sys Message-ID: <20201019214108.GA29097@bsdpad.com> References: <202010191310.09JDALHp000954@repo.freebsd.org> <917B04A7-C9CA-439B-8334-C602F1E68005@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <917B04A7-C9CA-439B-8334-C602F1E68005@freebsd.org> X-Rspamd-Queue-Id: 4CFVg45TJpz4Ftr X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:12876, ipnet:163.172.208.0/20, country:FR] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 21:45:37 -0000 On Mon, Oct 19, 2020 at 03:08:32PM +0100, Jessica Clarke wrote: > On 19 Oct 2020, at 14:10, Ruslan Bukin wrote: > > > > +#ifndef _DEV_IOMMU_IOMMU_MSI_H_ > > +#define _DEV_IOMMU_IOMMU_MSI_H_ > > + > > +#include > > + > > +struct iommu_unit; > > This seems unused, perhaps left from a previous patch version? > The forward declaration is not needed here, indeed. Thanks. Ruslan From owner-svn-src-head@freebsd.org Mon Oct 19 22:32:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00540436E90; Mon, 19 Oct 2020 22:32:37 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFWjJ6G8rz4Htk; Mon, 19 Oct 2020 22:32:36 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA39AAE48; Mon, 19 Oct 2020 22:32:36 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09JMWalI053935; Mon, 19 Oct 2020 22:32:36 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09JMWavp053934; Mon, 19 Oct 2020 22:32:36 GMT (envelope-from br@FreeBSD.org) Message-Id: <202010192232.09JMWavp053934@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 19 Oct 2020 22:32:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366865 - head/sys/dev/ahci X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/dev/ahci X-SVN-Commit-Revision: 366865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Mon, 19 Oct 2020 22:32:37 -0000 Author: br Date: Mon Oct 19 22:32:36 2020 New Revision: 366865 URL: https://svnweb.freebsd.org/changeset/base/366865 Log: Fix build: only set iommu buswide flag if IOMMU code is included. Sponsored by: Innovate DSbD Modified: head/sys/dev/ahci/ahci_pci.c Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Mon Oct 19 22:27:21 2020 (r366864) +++ head/sys/dev/ahci/ahci_pci.c Mon Oct 19 22:32:36 2020 (r366865) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_iommu.h" + #include #include #include @@ -499,6 +501,7 @@ ahci_pci_attach(device_t dev) i++; ctlr->quirks = ahci_ids[i].quirks; +#ifdef IOMMU if (ctlr->quirks & AHCI_Q_IOMMU_BUSWIDE) { /* * The controller issues DMA requests from PCI function 1, @@ -507,6 +510,7 @@ ahci_pci_attach(device_t dev) */ bus_dma_iommu_set_buswide(dev); } +#endif /* Limit speed for my onboard JMicron external port. * It is not eSATA really, limit to SATA 1 */ From owner-svn-src-head@freebsd.org Tue Oct 20 01:29:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50A3E43C3AF; Tue, 20 Oct 2020 01:29:46 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFbdk19yFz4Sx2; Tue, 20 Oct 2020 01:29:46 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BED6D0D7; Tue, 20 Oct 2020 01:29:46 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09K1TjTE058696; Tue, 20 Oct 2020 01:29:45 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09K1Tj91058693; Tue, 20 Oct 2020 01:29:45 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202010200129.09K1Tj91058693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 20 Oct 2020 01:29:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366866 - in head: include lib/libc/stdlib X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in head: include lib/libc/stdlib X-SVN-Commit-Revision: 366866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 01:29:46 -0000 Author: delphij Date: Tue Oct 20 01:29:45 2020 New Revision: 366866 URL: https://svnweb.freebsd.org/changeset/base/366866 Log: Further refinements of ptsname_r(3) interface: - Hide ptsname_r under __BSD_VISIBLE for now as the specification is not finalized at this time. - Keep Symbol.map sorted. - Avoid the interposing of ptsname_r(3) from an user application from breaking ptsname(3) by making the implementation a static method and call the static function from ptsname(3) instead. Reported by: kib Reviewed by: kib, jilles MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26845 Modified: head/include/stdlib.h head/lib/libc/stdlib/Symbol.map head/lib/libc/stdlib/ptsname.c Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Mon Oct 19 22:32:36 2020 (r366865) +++ head/include/stdlib.h Tue Oct 20 01:29:45 2020 (r366866) @@ -211,7 +211,6 @@ double drand48(void); double erand48(unsigned short[3]); /* char *fcvt(double, int, int * __restrict, int * __restrict); */ /* char *gcvt(double, int, int * __restrict, int * __restrict); */ -int grantpt(int); char *initstate(unsigned int, char *, size_t); long jrand48(unsigned short[3]); char *l64a(long); @@ -223,9 +222,6 @@ char *mktemp(char *); #endif long mrand48(void); long nrand48(unsigned short[3]); -int posix_openpt(int); -char *ptsname(int); -int ptsname_r(int, char *, size_t); int putenv(char *); long random(void); unsigned short @@ -233,8 +229,18 @@ unsigned short char *setstate(/* const */ char *); void srand48(long); void srandom(unsigned int); +#endif /* __XSI_VISIBLE */ + +#if __XSI_VISIBLE +int grantpt(int); +int posix_openpt(int); +char *ptsname(int); int unlockpt(int); #endif /* __XSI_VISIBLE */ +#if __BSD_VISIBLE +/* ptsname_r will be included in POSIX issue 8 */ +int ptsname_r(int, char *, size_t); +#endif #if __BSD_VISIBLE extern const char *malloc_conf; Modified: head/lib/libc/stdlib/Symbol.map ============================================================================== --- head/lib/libc/stdlib/Symbol.map Mon Oct 19 22:32:36 2020 (r366865) +++ head/lib/libc/stdlib/Symbol.map Tue Oct 20 01:29:45 2020 (r366866) @@ -122,10 +122,10 @@ FBSD_1.5 { }; FBSD_1.6 { + ptsname_r; qsort_s; rand; srand; - ptsname_r; }; FBSDprivate_1.0 { Modified: head/lib/libc/stdlib/ptsname.c ============================================================================== --- head/lib/libc/stdlib/ptsname.c Mon Oct 19 22:32:36 2020 (r366865) +++ head/lib/libc/stdlib/ptsname.c Tue Oct 20 01:29:45 2020 (r366866) @@ -76,7 +76,7 @@ __strong_reference(__isptmaster, unlockpt); * associated with the specified master. */ int -ptsname_r(int fildes, char *buffer, size_t buflen) +__ptsname_r(int fildes, char *buffer, size_t buflen) { if (buflen <= sizeof(_PATH_DEV)) { @@ -101,6 +101,8 @@ ptsname_r(int fildes, char *buffer, size_t buflen) return (0); } +__strong_reference(__ptsname_r, ptsname_r); + /* * ptsname(): return the pathname of the slave pseudo-terminal device * associated with the specified master. @@ -108,10 +110,10 @@ ptsname_r(int fildes, char *buffer, size_t buflen) char * ptsname(int fildes) { - static char pt_slave[sizeof _PATH_DEV + SPECNAMELEN]; + static char pt_slave[sizeof(_PATH_DEV) + SPECNAMELEN]; - if (ptsname_r(fildes, pt_slave, sizeof(pt_slave)) == 0) + if (__ptsname_r(fildes, pt_slave, sizeof(pt_slave)) == 0) return (pt_slave); - else - return (NULL); + + return (NULL); } From owner-svn-src-head@freebsd.org Tue Oct 20 07:18:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0961447F17; Tue, 20 Oct 2020 07:18:30 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFlN62qqWz3d5H; Tue, 20 Oct 2020 07:18:29 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6B3F10F75; Tue, 20 Oct 2020 07:18:28 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09K7ISTV074765; Tue, 20 Oct 2020 07:18:28 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09K7IRiP074758; Tue, 20 Oct 2020 07:18:27 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010200718.09K7IRiP074758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 20 Oct 2020 07:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366869 - in head/sys: contrib/openzfs/module/os/freebsd/zfs fs/nullfs kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: contrib/openzfs/module/os/freebsd/zfs fs/nullfs kern sys X-SVN-Commit-Revision: 366869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 07:18:30 -0000 Author: mjg Date: Tue Oct 20 07:18:27 2020 New Revision: 366869 URL: https://svnweb.freebsd.org/changeset/base/366869 Log: vfs: drop spurious cred argument from VOP_VPTOCNP Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c head/sys/fs/nullfs/null_vnops.c head/sys/kern/vfs_cache.c head/sys/kern/vfs_default.c head/sys/kern/vnode_if.src head/sys/sys/vnode.h Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Tue Oct 20 02:32:40 2020 (r366868) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Tue Oct 20 07:18:27 2020 (r366869) @@ -6507,8 +6507,7 @@ zfs_vptocnp(struct vop_vptocnp_args *ap) error = vget(covered_vp, LK_SHARED | LK_VNHELD, curthread); #endif if (error == 0) { - error = VOP_VPTOCNP(covered_vp, ap->a_vpp, ap->a_cred, - ap->a_buf, ap->a_buflen); + error = VOP_VPTOCNP(covered_vp, ap->a_vpp, ap->a_buf, ap->a_buflen); vput(covered_vp); } vn_lock(vp, ltype | LK_RETRY); Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Tue Oct 20 02:32:40 2020 (r366868) +++ head/sys/fs/nullfs/null_vnops.c Tue Oct 20 07:18:27 2020 (r366869) @@ -909,7 +909,6 @@ null_vptocnp(struct vop_vptocnp_args *ap) struct vnode *vp = ap->a_vp; struct vnode **dvp = ap->a_vpp; struct vnode *lvp, *ldvp; - struct ucred *cred = ap->a_cred; struct mount *mp; int error, locked; @@ -921,7 +920,7 @@ null_vptocnp(struct vop_vptocnp_args *ap) VOP_UNLOCK(vp); /* vp is held by vn_vptocnp_locked that called us */ ldvp = lvp; vref(lvp); - error = vn_vptocnp(&ldvp, cred, ap->a_buf, ap->a_buflen); + error = vn_vptocnp(&ldvp, ap->a_buf, ap->a_buflen); vdrop(lvp); if (error != 0) { vn_lock(vp, locked | LK_RETRY); Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Tue Oct 20 02:32:40 2020 (r366868) +++ head/sys/kern/vfs_cache.c Tue Oct 20 07:18:27 2020 (r366869) @@ -2811,7 +2811,7 @@ vn_dd_from_dst(struct vnode *vp) } int -vn_vptocnp(struct vnode **vp, struct ucred *cred, char *buf, size_t *buflen) +vn_vptocnp(struct vnode **vp, char *buf, size_t *buflen) { struct vnode *dvp; struct namecache *ncp; @@ -2853,7 +2853,7 @@ vn_vptocnp(struct vnode **vp, struct ucred *cred, char mtx_unlock(vlp); vn_lock(*vp, LK_SHARED | LK_RETRY); - error = VOP_VPTOCNP(*vp, &dvp, cred, buf, buflen); + error = VOP_VPTOCNP(*vp, &dvp, buf, buflen); vput(*vp); if (error) { counter_u64_add(numfullpathfail2, 1); @@ -2952,7 +2952,7 @@ vn_fullpath_dir(struct vnode *vp, struct vnode *rdir, error, vp, NULL); break; } - error = vn_vptocnp(&vp, curthread->td_ucred, buf, &buflen); + error = vn_vptocnp(&vp, buf, &buflen); if (error) break; if (buflen == 0) { @@ -3151,7 +3151,7 @@ vn_fullpath_any(struct vnode *vp, struct vnode *rdir, if (vp->v_type != VDIR) { *buflen -= 1; buf[*buflen] = '\0'; - error = vn_vptocnp(&vp, curthread->td_ucred, buf, buflen); + error = vn_vptocnp(&vp, buf, buflen); if (error) return (error); if (*buflen == 0) { Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Tue Oct 20 02:32:40 2020 (r366868) +++ head/sys/kern/vfs_default.c Tue Oct 20 07:18:27 2020 (r366869) @@ -819,7 +819,7 @@ vop_stdvptocnp(struct vop_vptocnp_args *ap) { struct vnode *vp = ap->a_vp; struct vnode **dvp = ap->a_vpp; - struct ucred *cred = ap->a_cred; + struct ucred *cred; char *buf = ap->a_buf; size_t *buflen = ap->a_buflen; char *dirbuf, *cpos; @@ -836,6 +836,7 @@ vop_stdvptocnp(struct vop_vptocnp_args *ap) error = 0; covered = 0; td = curthread; + cred = td->td_ucred; if (vp->v_type != VDIR) return (ENOENT); Modified: head/sys/kern/vnode_if.src ============================================================================== --- head/sys/kern/vnode_if.src Tue Oct 20 02:32:40 2020 (r366868) +++ head/sys/kern/vnode_if.src Tue Oct 20 07:18:27 2020 (r366869) @@ -682,7 +682,6 @@ vop_vptofh { vop_vptocnp { IN struct vnode *vp; OUT struct vnode **vpp; - IN struct ucred *cred; INOUT char *buf; INOUT size_t *buflen; }; Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Tue Oct 20 02:32:40 2020 (r366868) +++ head/sys/sys/vnode.h Tue Oct 20 07:18:27 2020 (r366869) @@ -657,8 +657,7 @@ int insmntque1(struct vnode *vp, struct mount *mp, int insmntque(struct vnode *vp, struct mount *mp); u_quad_t init_va_filerev(void); int speedup_syncer(void); -int vn_vptocnp(struct vnode **vp, struct ucred *cred, char *buf, - size_t *buflen); +int vn_vptocnp(struct vnode **vp, char *buf, size_t *buflen); int vn_getcwd(char *buf, char **retbuf, size_t *buflen); int vn_fullpath(struct vnode *vp, char **retbuf, char **freebuf); int vn_fullpath_global(struct vnode *vp, char **retbuf, char **freebuf); From owner-svn-src-head@freebsd.org Tue Oct 20 07:19:05 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82565447D45; Tue, 20 Oct 2020 07:19:05 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFlNn2xpRz3dPS; Tue, 20 Oct 2020 07:19:05 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46D33111E5; Tue, 20 Oct 2020 07:19:05 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09K7J5lf074879; Tue, 20 Oct 2020 07:19:05 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09K7J39n074871; Tue, 20 Oct 2020 07:19:03 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010200719.09K7J39n074871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 20 Oct 2020 07:19:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366870 - in head/sys: contrib/openzfs/module/os/freebsd/zfs fs/cd9660 fs/ext2fs fs/fuse fs/nfsclient fs/smbfs kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: contrib/openzfs/module/os/freebsd/zfs fs/cd9660 fs/ext2fs fs/fuse fs/nfsclient fs/smbfs kern X-SVN-Commit-Revision: 366870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 07:19:05 -0000 Author: mjg Date: Tue Oct 20 07:19:03 2020 New Revision: 366870 URL: https://svnweb.freebsd.org/changeset/base/366870 Log: vfs: drop the de facto curthread argument from VOP_INACTIVE Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c head/sys/fs/cd9660/cd9660_node.c head/sys/fs/ext2fs/ext2_inode.c head/sys/fs/fuse/fuse_vnops.c head/sys/fs/nfsclient/nfs_clnode.c head/sys/fs/smbfs/smbfs_node.c head/sys/kern/vfs_subr.c head/sys/kern/vnode_if.src Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Tue Oct 20 07:18:27 2020 (r366869) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Tue Oct 20 07:19:03 2020 (r366870) @@ -5821,7 +5821,7 @@ zfs_freebsd_inactive(struct vop_inactive_args *ap) { vnode_t *vp = ap->a_vp; - zfs_inactive(vp, ap->a_td->td_ucred, NULL); + zfs_inactive(vp, curthread->td_ucred, NULL); return (0); } @@ -5829,7 +5829,6 @@ zfs_freebsd_inactive(struct vop_inactive_args *ap) #ifndef _SYS_SYSPROTO_H_ struct vop_need_inactive_args { struct vnode *a_vp; - struct thread *a_td; }; #endif Modified: head/sys/fs/cd9660/cd9660_node.c ============================================================================== --- head/sys/fs/cd9660/cd9660_node.c Tue Oct 20 07:18:27 2020 (r366869) +++ head/sys/fs/cd9660/cd9660_node.c Tue Oct 20 07:19:03 2020 (r366870) @@ -63,7 +63,6 @@ int cd9660_inactive(ap) struct vop_inactive_args /* { struct vnode *a_vp; - struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; Modified: head/sys/fs/ext2fs/ext2_inode.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode.c Tue Oct 20 07:18:27 2020 (r366869) +++ head/sys/fs/ext2fs/ext2_inode.c Tue Oct 20 07:19:03 2020 (r366870) @@ -593,7 +593,7 @@ ext2_inactive(struct vop_inactive_args *ap) { struct vnode *vp = ap->a_vp; struct inode *ip = VTOI(vp); - struct thread *td = ap->a_td; + struct thread *td = curthread; int mode, error = 0; /* Modified: head/sys/fs/fuse/fuse_vnops.c ============================================================================== --- head/sys/fs/fuse/fuse_vnops.c Tue Oct 20 07:18:27 2020 (r366869) +++ head/sys/fs/fuse/fuse_vnops.c Tue Oct 20 07:19:03 2020 (r366870) @@ -850,14 +850,13 @@ fake: /* struct vnop_inactive_args { struct vnode *a_vp; - struct thread *a_td; }; */ static int fuse_vnop_inactive(struct vop_inactive_args *ap) { struct vnode *vp = ap->a_vp; - struct thread *td = ap->a_td; + struct thread *td = curthread; struct fuse_vnode_data *fvdat = VTOFUD(vp); struct fuse_filehandle *fufh, *fufh_tmp; Modified: head/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clnode.c Tue Oct 20 07:18:27 2020 (r366869) +++ head/sys/fs/nfsclient/nfs_clnode.c Tue Oct 20 07:19:03 2020 (r366870) @@ -239,8 +239,10 @@ ncl_inactive(struct vop_inactive_args *ap) { struct vnode *vp = ap->a_vp; struct nfsnode *np; + struct thread *td; boolean_t retv; + td = curthread; if (NFS_ISV4(vp) && vp->v_type == VREG) { /* * Since mmap()'d files do I/O after VOP_CLOSE(), the NFSv4 @@ -256,14 +258,14 @@ ncl_inactive(struct vop_inactive_args *ap) } else retv = TRUE; if (retv == TRUE) { - (void)ncl_flush(vp, MNT_WAIT, ap->a_td, 1, 0); - (void)nfsrpc_close(vp, 1, ap->a_td); + (void)ncl_flush(vp, MNT_WAIT, td, 1, 0); + (void)nfsrpc_close(vp, 1, td); } } np = VTONFS(vp); NFSLOCKNODE(np); - ncl_releasesillyrename(vp, ap->a_td); + ncl_releasesillyrename(vp, td); /* * NMODIFIED means that there might be dirty/stale buffers Modified: head/sys/fs/smbfs/smbfs_node.c ============================================================================== --- head/sys/fs/smbfs/smbfs_node.c Tue Oct 20 07:18:27 2020 (r366869) +++ head/sys/fs/smbfs/smbfs_node.c Tue Oct 20 07:19:03 2020 (r366870) @@ -299,10 +299,9 @@ int smbfs_inactive(ap) struct vop_inactive_args /* { struct vnode *a_vp; - struct thread *a_td; } */ *ap; { - struct thread *td = ap->a_td; + struct thread *td = curthread; struct ucred *cred = td->td_ucred; struct vnode *vp = ap->a_vp; struct smbnode *np = VTOSMB(vp); Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Tue Oct 20 07:18:27 2020 (r366869) +++ head/sys/kern/vfs_subr.c Tue Oct 20 07:19:03 2020 (r366870) @@ -3524,7 +3524,7 @@ vinactivef(struct vnode *vp) vm_object_page_clean(obj, 0, 0, 0); VM_OBJECT_WUNLOCK(obj); } - VOP_INACTIVE(vp, curthread); + VOP_INACTIVE(vp); VI_LOCK(vp); VNASSERT(vp->v_iflag & VI_DOINGINACT, vp, ("vinactive: lost VI_DOINGINACT")); Modified: head/sys/kern/vnode_if.src ============================================================================== --- head/sys/kern/vnode_if.src Tue Oct 20 07:18:27 2020 (r366869) +++ head/sys/kern/vnode_if.src Tue Oct 20 07:19:03 2020 (r366870) @@ -397,7 +397,6 @@ vop_readlink { vop_inactive { IN struct vnode *vp; - IN struct thread *td; }; %! need_inactive debugpre vop_need_inactive_debugpre From owner-svn-src-head@freebsd.org Tue Oct 20 07:19:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36DA7428093; Tue, 20 Oct 2020 07:19:45 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFlPY0grzz3dbV; Tue, 20 Oct 2020 07:19:45 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEC4710F76; Tue, 20 Oct 2020 07:19:44 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09K7Jicl074951; Tue, 20 Oct 2020 07:19:44 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09K7JiY0074950; Tue, 20 Oct 2020 07:19:44 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010200719.09K7JiY0074950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 20 Oct 2020 07:19:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366871 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 366871 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 07:19:45 -0000 Author: mjg Date: Tue Oct 20 07:19:44 2020 New Revision: 366871 URL: https://svnweb.freebsd.org/changeset/base/366871 Log: Bump __FreeBSD_version after VOP VPTOCNP and INACTIVE changes Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Oct 20 07:19:03 2020 (r366870) +++ head/sys/sys/param.h Tue Oct 20 07:19:44 2020 (r366871) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300122 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300123 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Tue Oct 20 09:46:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39FC042BA56; Tue, 20 Oct 2020 09:46:21 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFpfj0tF8z457J; Tue, 20 Oct 2020 09:46:21 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F181E132AB; Tue, 20 Oct 2020 09:46:20 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09K9kKl0067579; Tue, 20 Oct 2020 09:46:20 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09K9kKxS067577; Tue, 20 Oct 2020 09:46:20 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010200946.09K9kKxS067577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 20 Oct 2020 09:46:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366890 - head/sys/ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/ufs/ufs X-SVN-Commit-Revision: 366890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 09:46:21 -0000 Author: mjg Date: Tue Oct 20 09:46:20 2020 New Revision: 366890 URL: https://svnweb.freebsd.org/changeset/base/366890 Log: ufs: catch up with removal of thread argument from VOP_INACTIVE Modified: head/sys/ufs/ufs/extattr.h head/sys/ufs/ufs/ufs_extattr.c head/sys/ufs/ufs/ufs_inode.c Modified: head/sys/ufs/ufs/extattr.h ============================================================================== --- head/sys/ufs/ufs/extattr.h Tue Oct 20 08:40:39 2020 (r366889) +++ head/sys/ufs/ufs/extattr.h Tue Oct 20 09:46:20 2020 (r366890) @@ -140,7 +140,7 @@ int ufs_extattrctl(struct mount *mp, int cmd, struct v int ufs_getextattr(struct vop_getextattr_args *ap); int ufs_deleteextattr(struct vop_deleteextattr_args *ap); int ufs_setextattr(struct vop_setextattr_args *ap); -void ufs_extattr_vnode_inactive(struct vnode *vp, struct thread *td); +void ufs_extattr_vnode_inactive(struct vnode *vp); #endif /* !_KERNEL */ Modified: head/sys/ufs/ufs/ufs_extattr.c ============================================================================== --- head/sys/ufs/ufs/ufs_extattr.c Tue Oct 20 08:40:39 2020 (r366889) +++ head/sys/ufs/ufs/ufs_extattr.c Tue Oct 20 09:46:20 2020 (r366890) @@ -1276,7 +1276,7 @@ vopunlock_exit: * attributes stripped. */ void -ufs_extattr_vnode_inactive(struct vnode *vp, struct thread *td) +ufs_extattr_vnode_inactive(struct vnode *vp) { struct ufs_extattr_list_entry *uele; struct mount *mp = vp->v_mount; @@ -1299,7 +1299,7 @@ ufs_extattr_vnode_inactive(struct vnode *vp, struct th LIST_FOREACH(uele, &ump->um_extattr.uepm_list, uele_entries) ufs_extattr_rm(vp, uele->uele_attrnamespace, - uele->uele_attrname, NULL, td); + uele->uele_attrname, NULL, curthread); ufs_extattr_uepm_unlock(ump); } Modified: head/sys/ufs/ufs/ufs_inode.c ============================================================================== --- head/sys/ufs/ufs/ufs_inode.c Tue Oct 20 08:40:39 2020 (r366889) +++ head/sys/ufs/ufs/ufs_inode.c Tue Oct 20 09:46:20 2020 (r366890) @@ -106,7 +106,6 @@ int ufs_inactive(ap) struct vop_inactive_args /* { struct vnode *a_vp; - struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -173,7 +172,7 @@ ufs_inactive(ap) (void)chkiq(ip, -1, NOCRED, FORCE); #endif #ifdef UFS_EXTATTR - ufs_extattr_vnode_inactive(vp, ap->a_td); + ufs_extattr_vnode_inactive(vp); #endif /* * Setting the mode to zero needs to wait for the inode From owner-svn-src-head@freebsd.org Tue Oct 20 10:37:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B0F742D191; Tue, 20 Oct 2020 10:37:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFqnt5XBbz47fc; Tue, 20 Oct 2020 10:37:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 09KAbNNt079774 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 20 Oct 2020 13:37:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 09KAbNNt079774 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 09KAbMss079773; Tue, 20 Oct 2020 13:37:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 20 Oct 2020 13:37:22 +0300 From: Konstantin Belousov To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366865 - head/sys/dev/ahci Message-ID: <20201020103722.GG2643@kib.kiev.ua> References: <202010192232.09JMWavp053934@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202010192232.09JMWavp053934@repo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CFqnt5XBbz47fc X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 10:37:39 -0000 On Mon, Oct 19, 2020 at 10:32:36PM +0000, Ruslan Bukin wrote: > Author: br > Date: Mon Oct 19 22:32:36 2020 > New Revision: 366865 > URL: https://svnweb.freebsd.org/changeset/base/366865 > > Log: > Fix build: only set iommu buswide flag if IOMMU code is included. > > Sponsored by: Innovate DSbD > > Modified: > head/sys/dev/ahci/ahci_pci.c > > Modified: head/sys/dev/ahci/ahci_pci.c > ============================================================================== > --- head/sys/dev/ahci/ahci_pci.c Mon Oct 19 22:27:21 2020 (r366864) > +++ head/sys/dev/ahci/ahci_pci.c Mon Oct 19 22:32:36 2020 (r366865) > @@ -27,6 +27,8 @@ > #include > __FBSDID("$FreeBSD$"); > > +#include "opt_iommu.h" > + > #include > #include > #include > @@ -499,6 +501,7 @@ ahci_pci_attach(device_t dev) > i++; > ctlr->quirks = ahci_ids[i].quirks; > > +#ifdef IOMMU > if (ctlr->quirks & AHCI_Q_IOMMU_BUSWIDE) { > /* > * The controller issues DMA requests from PCI function 1, > @@ -507,6 +510,7 @@ ahci_pci_attach(device_t dev) > */ > bus_dma_iommu_set_buswide(dev); > } > +#endif > > /* Limit speed for my onboard JMicron external port. > * It is not eSATA really, limit to SATA 1 */ I would prefer that bus_dma_iommu_set_buswide() was available unconditionally, i.e. do to other arches what is done on x86. From owner-svn-src-head@freebsd.org Tue Oct 20 13:05:25 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6875430DED; Tue, 20 Oct 2020 13:05:25 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFv4P4PT5z4JKN; Tue, 20 Oct 2020 13:05:25 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A3A3157AA; Tue, 20 Oct 2020 13:05:25 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09KD5PgP090306; Tue, 20 Oct 2020 13:05:25 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09KD5PH6090305; Tue, 20 Oct 2020 13:05:25 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202010201305.09KD5PH6090305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Tue, 20 Oct 2020 13:05:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366895 - head/usr.bin/compress X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/usr.bin/compress X-SVN-Commit-Revision: 366895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 13:05:25 -0000 Author: fernape (ports committer) Date: Tue Oct 20 13:05:25 2020 New Revision: 366895 URL: https://svnweb.freebsd.org/changeset/base/366895 Log: compress(1): Add EXAMPLES section Add 5 examples showing basic usage. Approved by: manpages (gbe@) Differential Revision: https://reviews.freebsd.org/D26865 Modified: head/usr.bin/compress/compress.1 Modified: head/usr.bin/compress/compress.1 ============================================================================== --- head/usr.bin/compress/compress.1 Tue Oct 20 11:49:19 2020 (r366894) +++ head/usr.bin/compress/compress.1 Tue Oct 20 13:05:25 2020 (r366895) @@ -32,7 +32,7 @@ .\" @(#)compress.1 8.2 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd May 17, 2002 +.Dd October 20, 2020 .Dt COMPRESS 1 .Os .Sh NAME @@ -186,6 +186,40 @@ utility exits 2 if attempting to compress a file would and the .Fl f option was not specified and if no other error occurs. +.Sh EXAMPLES +Create a file +.Pa test_file +with a single line of text: +.Bd -literal -offset indent +echo "This is a test" > test_file +.Ed +.Pp +Try to reduce the size of the file using a 10-bit code and show the exit status: +.Bd -literal -offset indent +$ compress -b 10 test_file +$ echo $? +2 +.Ed +.Pp +Try to compress the file and show compression percentage: +.Bd -literal -offset indent +$ compress -v test_file +test_file: file would grow; left unmodified +.Ed +.Pp +Same as above but forcing compression: +.Bd -literal -offset indent +$ compress -f -v test_file +test_file.Z: 79% expansion +.Ed +.Pp +Compress and uncompress the string +.Ql hello +on the fly: +.Bd -literal -offset indent +$ echo "hello" | compress | uncompress +hello +.Ed .Sh SEE ALSO .Xr gunzip 1 , .Xr gzexe 1 , From owner-svn-src-head@freebsd.org Tue Oct 20 13:15:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E027A431142; Tue, 20 Oct 2020 13:15:26 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFvHy5h81z4Jyx; Tue, 20 Oct 2020 13:15:26 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A768E1589D; Tue, 20 Oct 2020 13:15:26 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09KDFQpj096503; Tue, 20 Oct 2020 13:15:26 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09KDFQkL096502; Tue, 20 Oct 2020 13:15:26 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202010201315.09KDFQkL096502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Tue, 20 Oct 2020 13:15:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366896 - head/bin/realpath X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/bin/realpath X-SVN-Commit-Revision: 366896 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 13:15:26 -0000 Author: fernape (ports committer) Date: Tue Oct 20 13:15:26 2020 New Revision: 366896 URL: https://svnweb.freebsd.org/changeset/base/366896 Log: realpath(1): Add EXAMPLES section. Add a small example for this simple command. Approved by: manpages (gbe@) Differential Revision: https://reviews.freebsd.org/D26863 Modified: head/bin/realpath/realpath.1 Modified: head/bin/realpath/realpath.1 ============================================================================== --- head/bin/realpath/realpath.1 Tue Oct 20 13:05:25 2020 (r366895) +++ head/bin/realpath/realpath.1 Tue Oct 20 13:15:26 2020 (r366896) @@ -69,6 +69,14 @@ is specified, warnings will not be printed when fails. .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Show the physical path of the +.Pa /dev/log +directory silencing warnings if any: +.Bd -literal -offset indent +$ realpath -q /dev/log +/var/run/log +.Ed .Sh SEE ALSO .Xr realpath 3 .Sh HISTORY From owner-svn-src-head@freebsd.org Tue Oct 20 16:48:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA841435D2B; Tue, 20 Oct 2020 16:48:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CG0264YZnz4W88; Tue, 20 Oct 2020 16:48:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80CBC17FBB; Tue, 20 Oct 2020 16:48:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09KGmktL026238; Tue, 20 Oct 2020 16:48:46 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09KGmjpo026236; Tue, 20 Oct 2020 16:48:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202010201648.09KGmjpo026236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 20 Oct 2020 16:48:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366897 - in head/sys: conf dev/md X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: conf dev/md X-SVN-Commit-Revision: 366897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 16:48:46 -0000 Author: jhb Date: Tue Oct 20 16:48:45 2020 New Revision: 366897 URL: https://svnweb.freebsd.org/changeset/base/366897 Log: Use a template assembly file to generate the embedded MFS. This uses the .incbin directive to pull in the MFS image contents. Using assembly directly ensures that symbols can be defined with the name and properties (such as .size) desired without having to rename symbols, etc. via a second objcopy invocation. Since it is compiled by the C compiler driver, it also avoids the need for all of the EMBEDFS* make variables. Suggested by: jrtc27 Reviewed by: kib, markj Obtained from: CheriBSD MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26781 Added: head/sys/dev/md/embedfs.S (contents, props changed) Modified: head/sys/conf/kern.post.mk head/sys/conf/kern.pre.mk Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Tue Oct 20 13:15:26 2020 (r366896) +++ head/sys/conf/kern.post.mk Tue Oct 20 16:48:45 2020 (r366897) @@ -457,24 +457,9 @@ vnode_if_typedef.h: .if ${MFS_IMAGE:Uno} != "no" .if empty(MD_ROOT_SIZE_CONFIGURED) -# Generate an object file from the file system image to embed in the kernel -# via linking. Make sure the contents are in the mfs section and rename the -# start/end/size variables to __start_mfs, __stop_mfs, and mfs_size, -# respectively. -embedfs_${MFS_IMAGE:T:R}.o: ${MFS_IMAGE} - ${OBJCOPY} --input-target binary \ - --output-target ${EMBEDFS_FORMAT.${MACHINE_ARCH}} \ - --binary-architecture ${EMBEDFS_ARCH.${MACHINE_ARCH}} \ - ${MFS_IMAGE} ${.TARGET} - ${OBJCOPY} \ - --rename-section .data=mfs,contents,alloc,load,readonly,data \ - --redefine-sym \ - _binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_size=__mfs_root_size \ - --redefine-sym \ - _binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_start=mfs_root \ - --redefine-sym \ - _binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_end=mfs_root_end \ - ${.TARGET} +embedfs_${MFS_IMAGE:T:R}.o: ${MFS_IMAGE} $S/dev/md/embedfs.S + ${CC} ${CFLAGS} ${ACFLAGS} -DMFS_IMAGE="${MFS_IMAGE}" -c \ + $S/dev/md/embedfs.S -o ${.TARGET} .endif .endif Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Tue Oct 20 13:15:26 2020 (r366896) +++ head/sys/conf/kern.pre.mk Tue Oct 20 16:48:45 2020 (r366897) @@ -358,37 +358,6 @@ MKMODULESENV+= DEBUG_FLAGS="${DEBUG}" MKMODULESENV+= __MPATH="${__MPATH}" .endif -# Architecture and output format arguments for objcopy to convert image to -# object file - -.if ${MFS_IMAGE:Uno} != "no" -.if empty(MD_ROOT_SIZE_CONFIGURED) -.if !defined(EMBEDFS_FORMAT.${MACHINE_ARCH}) -EMBEDFS_FORMAT.${MACHINE_ARCH}!= awk -F'"' '/OUTPUT_FORMAT/ {print $$2}' ${LDSCRIPT} -.if empty(EMBEDFS_FORMAT.${MACHINE_ARCH}) -.undef EMBEDFS_FORMAT.${MACHINE_ARCH} -.endif -.endif - -.if !defined(EMBEDFS_ARCH.${MACHINE_ARCH}) -EMBEDFS_ARCH.${MACHINE_ARCH}!= sed -n '/OUTPUT_ARCH/s/.*(\(.*\)).*/\1/p' ${LDSCRIPT} -.if empty(EMBEDFS_ARCH.${MACHINE_ARCH}) -.undef EMBEDFS_ARCH.${MACHINE_ARCH} -.endif -.endif - -EMBEDFS_FORMAT.arm?= elf32-littlearm -EMBEDFS_FORMAT.armv6?= elf32-littlearm -EMBEDFS_FORMAT.armv7?= elf32-littlearm -EMBEDFS_FORMAT.aarch64?= elf64-littleaarch64 -EMBEDFS_FORMAT.mips?= elf32-tradbigmips -EMBEDFS_FORMAT.mipsel?= elf32-tradlittlemips -EMBEDFS_FORMAT.mips64?= elf64-tradbigmips -EMBEDFS_FORMAT.mips64el?= elf64-tradlittlemips -EMBEDFS_FORMAT.riscv64?= elf64-littleriscv -.endif -.endif - # Detect kernel config options that force stack frames to be turned on. DDB_ENABLED!= grep DDB opt_ddb.h || true ; echo DTR_ENABLED!= grep KDTRACE_FRAME opt_kdtrace.h || true ; echo Added: head/sys/dev/md/embedfs.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/md/embedfs.S Tue Oct 20 16:48:45 2020 (r366897) @@ -0,0 +1,46 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 John Baldwin + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * 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$ + */ + +#include + + .section mfs, "a", %progbits + .globl mfs_root + .type mfs_root, %object +mfs_root: + .incbin __XSTRING(MFS_IMAGE) + .size mfs_root, . - mfs_root + .globl mfs_root_end + .type mfs_root_end, %object +mfs_root_end: + .size mfs_root_end, . - mfs_root_end From owner-svn-src-head@freebsd.org Tue Oct 20 17:00:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35108435EC0; Tue, 20 Oct 2020 17:00:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CG0Hw0d4wz4WYk; Tue, 20 Oct 2020 17:00:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDE9D17F52; Tue, 20 Oct 2020 17:00:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09KH0hqS032665; Tue, 20 Oct 2020 17:00:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09KH0huo032663; Tue, 20 Oct 2020 17:00:43 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202010201700.09KH0huo032663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 20 Oct 2020 17:00:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366898 - in head: secure/lib/libcrypto secure/lib/libcrypto/aarch64 secure/lib/libcrypto/amd64 secure/lib/libcrypto/arm secure/lib/libcrypto/engines/padlock secure/lib/libcrypto/i386 s... X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: secure/lib/libcrypto secure/lib/libcrypto/aarch64 secure/lib/libcrypto/amd64 secure/lib/libcrypto/arm secure/lib/libcrypto/engines/padlock secure/lib/libcrypto/i386 sys/crypto/openssl sys/cry... X-SVN-Commit-Revision: 366898 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 17:00:44 -0000 Author: jhb Date: Tue Oct 20 17:00:43 2020 New Revision: 366898 URL: https://svnweb.freebsd.org/changeset/base/366898 Log: Move generated OpenSSL assembly routines into the kernel sources. Sponsored by: Netflix Added: head/sys/crypto/openssl/ head/sys/crypto/openssl/aarch64/ - copied from r366897, head/secure/lib/libcrypto/aarch64/ head/sys/crypto/openssl/amd64/ - copied from r366897, head/secure/lib/libcrypto/amd64/ head/sys/crypto/openssl/arm/ - copied from r366897, head/secure/lib/libcrypto/arm/ head/sys/crypto/openssl/i386/ - copied from r366897, head/secure/lib/libcrypto/i386/ Deleted: head/secure/lib/libcrypto/aarch64/ head/secure/lib/libcrypto/amd64/ head/secure/lib/libcrypto/arm/ head/secure/lib/libcrypto/i386/ Modified: head/secure/lib/libcrypto/Makefile head/secure/lib/libcrypto/engines/padlock/Makefile Modified: head/secure/lib/libcrypto/Makefile ============================================================================== --- head/secure/lib/libcrypto/Makefile Tue Oct 20 16:48:45 2020 (r366897) +++ head/secure/lib/libcrypto/Makefile Tue Oct 20 17:00:43 2020 (r366898) @@ -459,7 +459,7 @@ opensslconf.h: opensslconf.h.in PICFLAG+= -DOPENSSL_PIC .if defined(ASM_${MACHINE_CPUARCH}) -.PATH: ${.CURDIR}/${MACHINE_CPUARCH} +.PATH: ${SRCTOP}/sys/crypto/openssl/${MACHINE_CPUARCH} .if defined(ASM_amd64) .PATH: ${LCRYPTO_SRC}/crypto/bn/asm .endif Modified: head/secure/lib/libcrypto/engines/padlock/Makefile ============================================================================== --- head/secure/lib/libcrypto/engines/padlock/Makefile Tue Oct 20 16:48:45 2020 (r366897) +++ head/secure/lib/libcrypto/engines/padlock/Makefile Tue Oct 20 17:00:43 2020 (r366898) @@ -11,4 +11,4 @@ SRCS+= e_padlock-x86.S .include -.PATH: ${.CURDIR:H:H}/${MACHINE_CPUARCH} +.PATH: ${SRCTOP}/sys/crypto/openssl/${MACHINE_CPUARCH} From owner-svn-src-head@freebsd.org Tue Oct 20 17:19:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8200E435F7E; Tue, 20 Oct 2020 17:19:11 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CG0jC2sWSz4XNF; Tue, 20 Oct 2020 17:19:11 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4135C18788; Tue, 20 Oct 2020 17:19:11 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09KHJBbh044985; Tue, 20 Oct 2020 17:19:11 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09KHJA4L044981; Tue, 20 Oct 2020 17:19:10 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010201719.09KHJA4L044981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 20 Oct 2020 17:19:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366899 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 366899 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 17:19:11 -0000 Author: trasz Date: Tue Oct 20 17:19:10 2020 New Revision: 366899 URL: https://svnweb.freebsd.org/changeset/base/366899 Log: Fix potential race condition in linux stat(2). Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25618 Modified: head/sys/compat/linux/linux_stats.c head/sys/compat/linux/linux_util.c head/sys/compat/linux/linux_util.h Modified: head/sys/compat/linux/linux_stats.c ============================================================================== --- head/sys/compat/linux/linux_stats.c Tue Oct 20 17:00:43 2020 (r366898) +++ head/sys/compat/linux/linux_stats.c Tue Oct 20 17:19:10 2020 (r366899) @@ -80,11 +80,8 @@ translate_vnhook_major_minor(struct vnode *vp, struct if (rootdevmp != NULL && vp->v_mount->mnt_vfc == rootdevmp->mnt_vfc) sb->st_dev = rootdevmp->mnt_stat.f_fsid.val[0]; - if (vp->v_type == VCHR && vp->v_rdev != NULL && - linux_driver_get_major_minor(devtoname(vp->v_rdev), - &major, &minor) == 0) { + if (linux_vn_get_major_minor(vp, &major, &minor) == 0) sb->st_rdev = (major << 8 | minor); - } } static int @@ -140,9 +137,7 @@ translate_fd_major_minor(struct thread *td, int fd, st if (mp != NULL && mp->mnt_vfc == rootdevmp->mnt_vfc) buf->st_dev = rootdevmp->mnt_stat.f_fsid.val[0]; } - if (vp != NULL && vp->v_rdev != NULL && - linux_driver_get_major_minor(devtoname(vp->v_rdev), - &major, &minor) == 0) { + if (linux_vn_get_major_minor(vp, &major, &minor) == 0) { buf->st_rdev = (major << 8 | minor); } else if (fp->f_type == DTYPE_PTS) { struct tty *tp = fp->f_data; Modified: head/sys/compat/linux/linux_util.c ============================================================================== --- head/sys/compat/linux/linux_util.c Tue Oct 20 17:00:43 2020 (r366898) +++ head/sys/compat/linux/linux_util.c Tue Oct 20 17:19:10 2020 (r366899) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -193,6 +194,24 @@ linux_driver_get_major_minor(const char *node, int *ma } return (1); +} + +int +linux_vn_get_major_minor(const struct vnode *vp, int *major, int *minor) +{ + int error; + + if (vp->v_type != VCHR) + return (ENOTBLK); + dev_lock(); + if (vp->v_rdev == NULL) { + dev_unlock(); + return (ENXIO); + } + error = linux_driver_get_major_minor(devtoname(vp->v_rdev), + major, minor); + dev_unlock(); + return (error); } char * Modified: head/sys/compat/linux/linux_util.h ============================================================================== --- head/sys/compat/linux/linux_util.h Tue Oct 20 17:00:43 2020 (r366898) +++ head/sys/compat/linux/linux_util.h Tue Oct 20 17:19:10 2020 (r366899) @@ -123,6 +123,7 @@ int linux_device_register_handler(struct linux_device_ int linux_device_unregister_handler(struct linux_device_handler *h); char *linux_driver_get_name_dev(device_t dev); int linux_driver_get_major_minor(const char *node, int *major, int *minor); +int linux_vn_get_major_minor(const struct vnode *vn, int *major, int *minor); char *linux_get_char_devices(void); void linux_free_get_char_devices(char *string); From owner-svn-src-head@freebsd.org Tue Oct 20 17:24:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C56674368D4; Tue, 20 Oct 2020 17:24:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CG0qL48ZXz4Xbg; Tue, 20 Oct 2020 17:24:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DF13185CD; Tue, 20 Oct 2020 17:24:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09KHOUL0050726; Tue, 20 Oct 2020 17:24:30 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09KHOUQV050725; Tue, 20 Oct 2020 17:24:30 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010201724.09KHOUQV050725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 20 Oct 2020 17:24:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366900 - head/sys/compat/linprocfs X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linprocfs X-SVN-Commit-Revision: 366900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 17:24:30 -0000 Author: trasz Date: Tue Oct 20 17:24:29 2020 New Revision: 366900 URL: https://svnweb.freebsd.org/changeset/base/366900 Log: Fix linprocfs(4) /proc/self/mem semantics to more closely match Linux. Steam's Anti-Cheat might depend on it. PR: 248223 Analyzed by: Alex S Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26816 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Tue Oct 20 17:19:10 2020 (r366899) +++ head/sys/compat/linprocfs/linprocfs.c Tue Oct 20 17:24:29 2020 (r366900) @@ -1276,6 +1276,27 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) } /* + * Filler function for proc/pid/mem + */ +static int +linprocfs_doprocmem(PFS_FILL_ARGS) +{ + ssize_t resid; + int error; + + resid = uio->uio_resid; + error = procfs_doprocmem(PFS_FILL_ARGNAMES); + + if (uio->uio_rw == UIO_READ && resid != uio->uio_resid) + return (0); + + if (error == EFAULT) + error = EIO; + + return (error); +} + +/* * Criteria for interface name translation */ #define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER) @@ -1853,7 +1874,7 @@ linprocfs_init(PFS_INIT_ARGS) NULL, &procfs_notsystem, NULL, 0); pfs_create_file(dir, "maps", &linprocfs_doprocmaps, NULL, NULL, NULL, PFS_RD); - pfs_create_file(dir, "mem", &procfs_doprocmem, + pfs_create_file(dir, "mem", &linprocfs_doprocmem, procfs_attr_rw, &procfs_candebug, NULL, PFS_RDWR | PFS_RAW); pfs_create_file(dir, "mounts", &linprocfs_domtab, NULL, NULL, NULL, PFS_RD); From owner-svn-src-head@freebsd.org Tue Oct 20 17:50:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3089F4370A8; Tue, 20 Oct 2020 17:50:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CG1P90pzMz4Z10; Tue, 20 Oct 2020 17:50:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F320918AA5; Tue, 20 Oct 2020 17:50:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09KHoKru063805; Tue, 20 Oct 2020 17:50:20 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09KHoIS9063793; Tue, 20 Oct 2020 17:50:18 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202010201750.09KHoIS9063793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 20 Oct 2020 17:50:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366901 - in head: share/man/man4 sys/amd64/conf sys/conf sys/crypto/openssl sys/i386/conf sys/modules sys/modules/ossl X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: share/man/man4 sys/amd64/conf sys/conf sys/crypto/openssl sys/i386/conf sys/modules sys/modules/ossl X-SVN-Commit-Revision: 366901 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 17:50:21 -0000 Author: jhb Date: Tue Oct 20 17:50:18 2020 New Revision: 366901 URL: https://svnweb.freebsd.org/changeset/base/366901 Log: Add a kernel crypto driver using assembly routines from OpenSSL. Currently, this supports SHA1 and SHA2-{224,256,384,512} both as plain hashes and in HMAC mode on both amd64 and i386. It uses the SHA intrinsics when present similar to aesni(4), but uses SSE/AVX instructions when they are not. Note that some files from OpenSSL that normally wrap the assembly routines have been adapted to export methods usable by 'struct auth_xform' as is used by existing software crypto routines. Reviewed by: gallatin, jkim, delphij, gnn Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D26821 Added: head/share/man/man4/ossl.4 (contents, props changed) head/sys/crypto/openssl/ossl.c (contents, props changed) head/sys/crypto/openssl/ossl.h (contents, props changed) head/sys/crypto/openssl/ossl_hash.h (contents, props changed) - copied, changed from r366898, head/crypto/openssl/include/crypto/md32_common.h head/sys/crypto/openssl/ossl_sha.h - copied, changed from r366898, head/crypto/openssl/include/openssl/sha.h head/sys/crypto/openssl/ossl_sha1.c (contents, props changed) - copied, changed from r366898, head/crypto/openssl/crypto/sha/sha_local.h head/sys/crypto/openssl/ossl_sha256.c (contents, props changed) - copied, changed from r366898, head/crypto/openssl/crypto/sha/sha256.c head/sys/crypto/openssl/ossl_sha512.c (contents, props changed) - copied, changed from r366898, head/crypto/openssl/crypto/sha/sha512.c head/sys/modules/ossl/ head/sys/modules/ossl/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/amd64/conf/NOTES head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/files.x86 head/sys/i386/conf/NOTES head/sys/modules/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Tue Oct 20 17:24:29 2020 (r366900) +++ head/share/man/man4/Makefile Tue Oct 20 17:50:18 2020 (r366901) @@ -398,6 +398,7 @@ MAN= aac.4 \ ocs_fc.4\ ohci.4 \ orm.4 \ + ${_ossl.4} \ ow.4 \ ow_temp.4 \ owc.4 \ @@ -819,6 +820,7 @@ _ntb_transport.4=ntb_transport.4 _nvd.4= nvd.4 _nvme.4= nvme.4 _nvram.4= nvram.4 +_ossl.4= ossl.4 _padlock.4= padlock.4 _pchtherm.4= pchtherm.4 _rr232x.4= rr232x.4 Added: head/share/man/man4/ossl.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ossl.4 Tue Oct 20 17:50:18 2020 (r366901) @@ -0,0 +1,105 @@ +.\" Copyright (c) 2020 Netflix, Inc +.\" +.\" 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, +.\" without modification. +.\" 2. Redistributions in binary form must reproduce at minimum a disclaimer +.\" similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any +.\" redistribution must be conditioned upon including a substantially +.\" similar Disclaimer requirement for further binary redistribution. +.\" +.\" NO WARRANTY +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY +.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +.\" THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. +.\" +.\" $FreeBSD$ +.\" +.Dd October 19, 2020 +.Dt OSSL 4 +.Os +.Sh NAME +.Nm ossl +.Nd "driver using OpenSSL assembly routines on x86 CPUs" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device crypto" +.Cd "device cryptodev" +.Cd "device ossl" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +ossl_load="YES" +.Ed +.Sh DESCRIPTION +The OpenSSL distribution includes architecture-specific +implementations for some commonly used cryptographic algorithms. +This driver adds a wrapper around these routines permitting them to be +used by in-kernel cryptography consumers such as kernel TLS and IPsec. +.Pp +The +.Nm +driver includes architecture-specific implementations for the following +architectures: +.Pp +.Bl -bullet -compact +.It +amd64 +.It +i386 +.El +.Pp +The +.Nm +driver includes support for the following algorithms: +.Pp +.Bl -bullet -compact +.It +SHA1 +.It +SHA1-HMAC +.It +SHA2-224 +.It +SHA2-224-HMAC +.It +SHA2-256 +.It +SHA2-256-HMAC +.It +SHA2-384 +.It +SHA2-384-HMAC +.It +SHA2-512 +.It +SHA2-512-HMAC +.El +.Sh SEE ALSO +.Xr crypto 4 , +.Xr intro 4 , +.Xr ipsec 4 , +.Xr crypto 7 , +.Xr crypto 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0 . Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Tue Oct 20 17:24:29 2020 (r366900) +++ head/sys/amd64/conf/NOTES Tue Oct 20 17:50:18 2020 (r366901) @@ -533,6 +533,7 @@ device tpm device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG device aesni # AES-NI OpenCrypto module +device ossl # OpenSSL OpenCrypto module device ioat # Intel I/OAT DMA engine # Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Oct 20 17:24:29 2020 (r366900) +++ head/sys/conf/files.amd64 Tue Oct 20 17:50:18 2020 (r366901) @@ -137,6 +137,9 @@ cddl/dev/dtrace/amd64/dtrace_asm.S optional dtrace c cddl/dev/dtrace/amd64/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" crypto/aesni/aeskeys_amd64.S optional aesni crypto/des/des_enc.c optional netsmb +crypto/openssl/amd64/sha1-x86_64.S optional ossl +crypto/openssl/amd64/sha256-x86_64.S optional ossl +crypto/openssl/amd64/sha512-x86_64.S optional ossl dev/acpi_support/acpi_wmi_if.m standard dev/agp/agp_amd64.c optional agp dev/agp/agp_i810.c optional agp Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Oct 20 17:24:29 2020 (r366900) +++ head/sys/conf/files.i386 Tue Oct 20 17:50:18 2020 (r366901) @@ -77,6 +77,9 @@ compat/linux/linux.c optional compat_linux compat/ndis/winx32_wrap.S optional ndisapi pci crypto/aesni/aeskeys_i386.S optional aesni crypto/des/arch/i386/des_enc.S optional netsmb +crypto/openssl/i386/sha1-586.S optional ossl +crypto/openssl/i386/sha256-586.S optional ossl +crypto/openssl/i386/sha512-586.S optional ossl dev/agp/agp_ali.c optional agp dev/agp/agp_amd.c optional agp dev/agp/agp_amd64.c optional agp Modified: head/sys/conf/files.x86 ============================================================================== --- head/sys/conf/files.x86 Tue Oct 20 17:24:29 2020 (r366900) +++ head/sys/conf/files.x86 Tue Oct 20 17:50:18 2020 (r366901) @@ -53,6 +53,10 @@ intel_sha256.o optional aesni \ compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} -mmmx -msse -msse4 -msha ${.IMPSRC}" \ no-implicit-rule \ clean "intel_sha256.o" +crypto/openssl/ossl.c optional ossl +crypto/openssl/ossl_sha1.c optional ossl +crypto/openssl/ossl_sha256.c optional ossl +crypto/openssl/ossl_sha512.c optional ossl crypto/via/padlock.c optional padlock crypto/via/padlock_cipher.c optional padlock crypto/via/padlock_hash.c optional padlock Added: head/sys/crypto/openssl/ossl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/crypto/openssl/ossl.c Tue Oct 20 17:50:18 2020 (r366901) @@ -0,0 +1,369 @@ +/* + * Copyright (c) 2020 Netflix, Inc + * + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + */ + +/* + * A driver for the OpenCrypto framework which uses assembly routines + * from OpenSSL. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include "cryptodev_if.h" + +struct ossl_softc { + int32_t sc_cid; +}; + +struct ossl_session_hash { + struct ossl_hash_context ictx; + struct ossl_hash_context octx; + struct auth_hash *axf; + u_int mlen; +}; + +struct ossl_session { + struct ossl_session_hash hash; +}; + +/* + * See OPENSSL_ia32cap(3). + * + * [0] = cpu_feature but with a few custom bits + * [1] = cpu_feature2 but with AMD XOP in bit 11 + * [2] = cpu_stdext_feature + * [3] = 0 + */ +unsigned int OPENSSL_ia32cap_P[4]; + +static MALLOC_DEFINE(M_OSSL, "ossl", "OpenSSL crypto"); + +static void +ossl_cpuid(void) +{ + uint64_t xcr0; + u_int regs[4]; + u_int max_cores; + + /* Derived from OpenSSL_ia32_cpuid. */ + + OPENSSL_ia32cap_P[0] = cpu_feature & ~(CPUID_B20 | CPUID_IA64); + if (cpu_vendor_id == CPU_VENDOR_INTEL) { + OPENSSL_ia32cap_P[0] |= CPUID_IA64; + if ((cpu_id & 0xf00) != 0xf00) + OPENSSL_ia32cap_P[0] |= CPUID_B20; + } + + /* Only leave CPUID_HTT on if HTT is present. */ + if (cpu_vendor_id == CPU_VENDOR_AMD && cpu_exthigh >= 0x80000008) { + max_cores = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; + if (cpu_feature & CPUID_HTT) { + if ((cpu_procinfo & CPUID_HTT_CORES) >> 16 <= max_cores) + OPENSSL_ia32cap_P[0] &= ~CPUID_HTT; + } + } else { + if (cpu_high >= 4) { + cpuid_count(4, 0, regs); + max_cores = (regs[0] >> 26) & 0xfff; + } else + max_cores = -1; + } + if (max_cores == 0) + OPENSSL_ia32cap_P[0] &= ~CPUID_HTT; + else if ((cpu_procinfo & CPUID_HTT_CORES) >> 16 == 0) + OPENSSL_ia32cap_P[0] &= ~CPUID_HTT; + + OPENSSL_ia32cap_P[1] = cpu_feature2 & ~AMDID2_XOP; + if (cpu_vendor_id == CPU_VENDOR_AMD) + OPENSSL_ia32cap_P[1] |= amd_feature2 & AMDID2_XOP; + + OPENSSL_ia32cap_P[2] = cpu_stdext_feature; + if ((OPENSSL_ia32cap_P[1] & CPUID2_XSAVE) == 0) + OPENSSL_ia32cap_P[2] &= ~(CPUID_STDEXT_AVX512F | + CPUID_STDEXT_AVX512DQ); + + /* Disable AVX512F on Skylake-X. */ + if ((cpu_id & 0x0fff0ff0) == 0x00050650) + OPENSSL_ia32cap_P[2] &= ~(CPUID_STDEXT_AVX512F); + + if (cpu_feature2 & CPUID2_OSXSAVE) + xcr0 = rxcr(0); + else + xcr0 = 0; + + if ((xcr0 & (XFEATURE_AVX512 | XFEATURE_AVX)) != + (XFEATURE_AVX512 | XFEATURE_AVX)) + OPENSSL_ia32cap_P[2] &= ~(CPUID_STDEXT_AVX512VL | + CPUID_STDEXT_AVX512BW | CPUID_STDEXT_AVX512IFMA | + CPUID_STDEXT_AVX512F); + if ((xcr0 & XFEATURE_AVX) != XFEATURE_AVX) { + OPENSSL_ia32cap_P[1] &= ~(CPUID2_AVX | AMDID2_XOP | CPUID2_FMA); + OPENSSL_ia32cap_P[2] &= ~CPUID_STDEXT_AVX2; + } +} + +static void +ossl_identify(driver_t *driver, device_t parent) +{ + + if (device_find_child(parent, "ossl", -1) == NULL) + BUS_ADD_CHILD(parent, 10, "ossl", -1); +} + +static int +ossl_probe(device_t dev) +{ + + device_set_desc(dev, "OpenSSL crypto"); + return (BUS_PROBE_DEFAULT); +} + +static int +ossl_attach(device_t dev) +{ + struct ossl_softc *sc; + + sc = device_get_softc(dev); + + ossl_cpuid(); + sc->sc_cid = crypto_get_driverid(dev, sizeof(struct ossl_session), + CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | + CRYPTOCAP_F_ACCEL_SOFTWARE); + if (sc->sc_cid < 0) { + device_printf(dev, "failed to allocate crypto driver id\n"); + return (ENXIO); + } + + return (0); +} + +static int +ossl_detach(device_t dev) +{ + struct ossl_softc *sc; + + sc = device_get_softc(dev); + + crypto_unregister_all(sc->sc_cid); + + return (0); +} + +static struct auth_hash * +ossl_lookup_hash(const struct crypto_session_params *csp) +{ + + switch (csp->csp_auth_alg) { + case CRYPTO_SHA1: + case CRYPTO_SHA1_HMAC: + return (&ossl_hash_sha1); + case CRYPTO_SHA2_224: + case CRYPTO_SHA2_224_HMAC: + return (&ossl_hash_sha224); + case CRYPTO_SHA2_256: + case CRYPTO_SHA2_256_HMAC: + return (&ossl_hash_sha256); + case CRYPTO_SHA2_384: + case CRYPTO_SHA2_384_HMAC: + return (&ossl_hash_sha384); + case CRYPTO_SHA2_512: + case CRYPTO_SHA2_512_HMAC: + return (&ossl_hash_sha512); + default: + return (NULL); + } +} + +static int +ossl_probesession(device_t dev, const struct crypto_session_params *csp) +{ + + if ((csp->csp_flags & ~(CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD)) != + 0) + return (EINVAL); + switch (csp->csp_mode) { + case CSP_MODE_DIGEST: + if (ossl_lookup_hash(csp) == NULL) + return (EINVAL); + break; + default: + return (EINVAL); + } + + return (CRYPTODEV_PROBE_ACCEL_SOFTWARE); +} + +static void +ossl_setkey_hmac(struct ossl_session *s, const void *key, int klen) +{ + + hmac_init_ipad(s->hash.axf, key, klen, &s->hash.ictx); + hmac_init_opad(s->hash.axf, key, klen, &s->hash.octx); +} + +static int +ossl_newsession(device_t dev, crypto_session_t cses, + const struct crypto_session_params *csp) +{ + struct ossl_session *s; + struct auth_hash *axf; + + s = crypto_get_driver_session(cses); + + axf = ossl_lookup_hash(csp); + s->hash.axf = axf; + if (csp->csp_auth_mlen == 0) + s->hash.mlen = axf->hashsize; + else + s->hash.mlen = csp->csp_auth_mlen; + + if (csp->csp_auth_klen == 0) { + axf->Init(&s->hash.ictx); + } else { + if (csp->csp_auth_key != NULL) { + fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); + ossl_setkey_hmac(s, csp->csp_auth_key, + csp->csp_auth_klen); + fpu_kern_leave(curthread, NULL); + } + } + return (0); +} + +static int +ossl_process(device_t dev, struct cryptop *crp, int hint) +{ + struct ossl_hash_context ctx; + char digest[HASH_MAX_LEN]; + const struct crypto_session_params *csp; + struct ossl_session *s; + struct auth_hash *axf; + int error; + bool fpu_entered; + + s = crypto_get_driver_session(crp->crp_session); + csp = crypto_get_params(crp->crp_session); + axf = s->hash.axf; + + if (is_fpu_kern_thread(0)) { + fpu_entered = false; + } else { + fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); + fpu_entered = true; + } + + if (crp->crp_auth_key != NULL) + ossl_setkey_hmac(s, crp->crp_auth_key, csp->csp_auth_klen); + + ctx = s->hash.ictx; + + if (crp->crp_aad != NULL) + error = axf->Update(&ctx, crp->crp_aad, crp->crp_aad_length); + else + error = crypto_apply(crp, crp->crp_aad_start, + crp->crp_aad_length, axf->Update, &ctx); + if (error) + goto out; + + error = crypto_apply(crp, crp->crp_payload_start, + crp->crp_payload_length, axf->Update, &ctx); + if (error) + goto out; + + axf->Final(digest, &ctx); + + if (csp->csp_auth_klen != 0) { + ctx = s->hash.octx; + axf->Update(&ctx, digest, axf->hashsize); + axf->Final(digest, &ctx); + } + + if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { + char digest2[HASH_MAX_LEN]; + + crypto_copydata(crp, crp->crp_digest_start, s->hash.mlen, + digest2); + if (timingsafe_bcmp(digest, digest2, s->hash.mlen) != 0) + error = EBADMSG; + explicit_bzero(digest2, sizeof(digest2)); + } else { + crypto_copyback(crp, crp->crp_digest_start, s->hash.mlen, + digest); + } + explicit_bzero(digest, sizeof(digest)); + +out: + if (fpu_entered) + fpu_kern_leave(curthread, NULL); + + crp->crp_etype = error; + crypto_done(crp); + + explicit_bzero(&ctx, sizeof(ctx)); + return (0); +} + +static device_method_t ossl_methods[] = { + DEVMETHOD(device_identify, ossl_identify), + DEVMETHOD(device_probe, ossl_probe), + DEVMETHOD(device_attach, ossl_attach), + DEVMETHOD(device_detach, ossl_detach), + + DEVMETHOD(cryptodev_probesession, ossl_probesession), + DEVMETHOD(cryptodev_newsession, ossl_newsession), + DEVMETHOD(cryptodev_process, ossl_process), + + DEVMETHOD_END +}; + +static driver_t ossl_driver = { + "ossl", + ossl_methods, + sizeof(struct ossl_softc) +}; + +static devclass_t ossl_devclass; + +DRIVER_MODULE(ossl, nexus, ossl_driver, ossl_devclass, NULL, NULL); +MODULE_VERSION(ossl, 1); +MODULE_DEPEND(ossl, crypto, 1, 1, 1); Added: head/sys/crypto/openssl/ossl.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/crypto/openssl/ossl.h Tue Oct 20 17:50:18 2020 (r366901) @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2020 Netflix, Inc + * + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ + +#ifndef __OSSL_H__ +#define __OSSL_H__ + +/* Compatibility shims. */ +#define OPENSSL_cleanse explicit_bzero + +/* Used by assembly routines to select CPU-specific variants. */ +extern unsigned int OPENSSL_ia32cap_P[4]; + +/* Needs to be big enough to hold any hash context. */ +struct ossl_hash_context { + uint32_t dummy[54]; +} __aligned(32); + +extern struct auth_hash ossl_hash_sha1; +extern struct auth_hash ossl_hash_sha224; +extern struct auth_hash ossl_hash_sha256; +extern struct auth_hash ossl_hash_sha384; +extern struct auth_hash ossl_hash_sha512; + +#endif /* !__OSSL_H__ */ Copied and modified: head/sys/crypto/openssl/ossl_hash.h (from r366898, head/crypto/openssl/include/crypto/md32_common.h) ============================================================================== --- head/crypto/openssl/include/crypto/md32_common.h Tue Oct 20 17:00:43 2020 (r366898, copy source) +++ head/sys/crypto/openssl/ossl_hash.h Tue Oct 20 17:50:18 2020 (r366901) @@ -5,96 +5,17 @@ * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html + * + * $FreeBSD$ */ -/*- - * This is a generic 32 bit "collector" for message digest algorithms. - * Whenever needed it collects input character stream into chunks of - * 32 bit values and invokes a block function that performs actual hash - * calculations. +/* + * Derived from include/crypto/md32_common.h * - * Porting guide. - * - * Obligatory macros: - * - * DATA_ORDER_IS_BIG_ENDIAN or DATA_ORDER_IS_LITTLE_ENDIAN - * this macro defines byte order of input stream. - * HASH_CBLOCK - * size of a unit chunk HASH_BLOCK operates on. - * HASH_LONG - * has to be at least 32 bit wide. - * HASH_CTX - * context structure that at least contains following - * members: - * typedef struct { - * ... - * HASH_LONG Nl,Nh; - * either { - * HASH_LONG data[HASH_LBLOCK]; - * unsigned char data[HASH_CBLOCK]; - * }; - * unsigned int num; - * ... - * } HASH_CTX; - * data[] vector is expected to be zeroed upon first call to - * HASH_UPDATE. - * HASH_UPDATE - * name of "Update" function, implemented here. - * HASH_TRANSFORM - * name of "Transform" function, implemented here. - * HASH_FINAL - * name of "Final" function, implemented here. - * HASH_BLOCK_DATA_ORDER - * name of "block" function capable of treating *unaligned* input - * message in original (data) byte order, implemented externally. - * HASH_MAKE_STRING - * macro converting context variables to an ASCII hash string. - * - * MD5 example: - * - * #define DATA_ORDER_IS_LITTLE_ENDIAN - * - * #define HASH_LONG MD5_LONG - * #define HASH_CTX MD5_CTX - * #define HASH_CBLOCK MD5_CBLOCK - * #define HASH_UPDATE MD5_Update - * #define HASH_TRANSFORM MD5_Transform - * #define HASH_FINAL MD5_Final - * #define HASH_BLOCK_DATA_ORDER md5_block_data_order + * HASH_UPDATE and HASH_FINAL have been updated to work with the + * auth_hash interface. */ -#include - -#if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN) -# error "DATA_ORDER must be defined!" -#endif - -#ifndef HASH_CBLOCK -# error "HASH_CBLOCK must be defined!" -#endif -#ifndef HASH_LONG -# error "HASH_LONG must be defined!" -#endif -#ifndef HASH_CTX -# error "HASH_CTX must be defined!" -#endif - -#ifndef HASH_UPDATE -# error "HASH_UPDATE must be defined!" -#endif -#ifndef HASH_TRANSFORM -# error "HASH_TRANSFORM must be defined!" -#endif -#ifndef HASH_FINAL -# error "HASH_FINAL must be defined!" -#endif - -#ifndef HASH_BLOCK_DATA_ORDER -# error "HASH_BLOCK_DATA_ORDER must be defined!" -#endif - -#define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n)))) - #if defined(DATA_ORDER_IS_BIG_ENDIAN) # define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++)))<<24), \ @@ -125,15 +46,17 @@ * Time for some action :-) */ -int HASH_UPDATE(HASH_CTX *c, const void *data_, size_t len) +static int +HASH_UPDATE(void *c_, const void *data_, unsigned int len) { + HASH_CTX *c = c_; const unsigned char *data = data_; unsigned char *p; HASH_LONG l; size_t n; if (len == 0) - return 1; + return 0; l = (c->Nl + (((HASH_LONG) len) << 3)) & 0xffffffffUL; if (l < c->Nl) /* overflow */ @@ -163,7 +86,7 @@ int HASH_UPDATE(HASH_CTX *c, const void *data_, size_t } else { memcpy(p + n, data, len); c->num += (unsigned int)len; - return 1; + return 0; } } @@ -180,16 +103,13 @@ int HASH_UPDATE(HASH_CTX *c, const void *data_, size_t c->num = (unsigned int)len; memcpy(p, data, len); } - return 1; + return 0; } -void HASH_TRANSFORM(HASH_CTX *c, const unsigned char *data) +static void +HASH_FINAL(uint8_t *md, void *c_) { - HASH_BLOCK_DATA_ORDER(c, data, 1); -} - -int HASH_FINAL(unsigned char *md, HASH_CTX *c) -{ + HASH_CTX *c = c_; unsigned char *p = (unsigned char *)c->data; size_t n = c->num; @@ -222,35 +142,5 @@ int HASH_FINAL(unsigned char *md, HASH_CTX *c) HASH_MAKE_STRING(c, md); #endif - return 1; + return; } - -#ifndef MD32_REG_T -# if defined(__alpha) || defined(__sparcv9) || defined(__mips) -# define MD32_REG_T long -/* - * This comment was originally written for MD5, which is why it - * discusses A-D. But it basically applies to all 32-bit digests, - * which is why it was moved to common header file. - * - * In case you wonder why A-D are declared as long and not - * as MD5_LONG. Doing so results in slight performance - * boost on LP64 architectures. The catch is we don't - * really care if 32 MSBs of a 64-bit register get polluted - * with eventual overflows as we *save* only 32 LSBs in - * *either* case. Now declaring 'em long excuses the compiler - * from keeping 32 MSBs zeroed resulting in 13% performance - * improvement under SPARC Solaris7/64 and 5% under AlphaLinux. - * Well, to be honest it should say that this *prevents* - * performance degradation. - */ -# else -/* - * Above is not absolute and there are LP64 compilers that - * generate better code if MD32_REG_T is defined int. The above - * pre-processor condition reflects the circumstances under which - * the conclusion was made and is subject to further extension. - */ -# define MD32_REG_T int -# endif -#endif Copied and modified: head/sys/crypto/openssl/ossl_sha.h (from r366898, head/crypto/openssl/include/openssl/sha.h) ============================================================================== --- head/crypto/openssl/include/openssl/sha.h Tue Oct 20 17:00:43 2020 (r366898, copy source) +++ head/sys/crypto/openssl/ossl_sha.h Tue Oct 20 17:50:18 2020 (r366901) @@ -5,31 +5,27 @@ * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html + * + * $FreeBSD$ */ -#ifndef HEADER_SHA_H -# define HEADER_SHA_H +#ifndef __OSSL_SHA_H__ +#define __OSSL_SHA_H__ -# include -# include - -#ifdef __cplusplus -extern "C" { -#endif - -/*- - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! SHA_LONG has to be at least 32 bits wide. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +/* + * This is always included last which permits the namespace hacks below + * to work. */ +#define SHA256_CTX OSSL_SHA256_CTX +#define SHA512_CTX OSSL_SHA512_CTX + +/* From include/openssl/sha.h */ # define SHA_LONG unsigned int # define SHA_LBLOCK 16 # define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a * contiguous array of 32 bit wide * big-endian values. */ -# define SHA_LAST_BLOCK (SHA_CBLOCK-8) -# define SHA_DIGEST_LENGTH 20 typedef struct SHAstate_st { SHA_LONG h0, h1, h2, h3, h4; @@ -38,12 +34,6 @@ typedef struct SHAstate_st { unsigned int num; } SHA_CTX; -int SHA1_Init(SHA_CTX *c); -int SHA1_Update(SHA_CTX *c, const void *data, size_t len); -int SHA1_Final(unsigned char *md, SHA_CTX *c); -unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); -void SHA1_Transform(SHA_CTX *c, const unsigned char *data); - # define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a * contiguous array of 32 bit wide * big-endian values. */ @@ -55,42 +45,15 @@ typedef struct SHA256state_st { unsigned int num, md_len; } SHA256_CTX; -int SHA224_Init(SHA256_CTX *c); -int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); -int SHA224_Final(unsigned char *md, SHA256_CTX *c); -unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md); -int SHA256_Init(SHA256_CTX *c); -int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); -int SHA256_Final(unsigned char *md, SHA256_CTX *c); -unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md); -void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); - -# define SHA224_DIGEST_LENGTH 28 -# define SHA256_DIGEST_LENGTH 32 -# define SHA384_DIGEST_LENGTH 48 -# define SHA512_DIGEST_LENGTH 64 - /* - * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 - * being exactly 64-bit wide. See Implementation Notes in sha512.c - * for further details. - */ -/* * SHA-512 treats input data as a * contiguous array of 64 bit * wide big-endian values. */ # define SHA512_CBLOCK (SHA_LBLOCK*8) -# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -# define SHA_LONG64 unsigned __int64 -# define U64(C) C##UI64 -# elif defined(__arch64__) -# define SHA_LONG64 unsigned long -# define U64(C) C##UL -# else + # define SHA_LONG64 unsigned long long # define U64(C) C##ULL -# endif typedef struct SHA512state_st { SHA_LONG64 h[8]; @@ -102,18 +65,4 @@ typedef struct SHA512state_st { unsigned int num, md_len; } SHA512_CTX; -int SHA384_Init(SHA512_CTX *c); -int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); -int SHA384_Final(unsigned char *md, SHA512_CTX *c); -unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md); -int SHA512_Init(SHA512_CTX *c); -int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); -int SHA512_Final(unsigned char *md, SHA512_CTX *c); -unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md); -void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); - -#ifdef __cplusplus -} -#endif - -#endif +#endif /* !__OSSL_SHA_H__ */ Copied and modified: head/sys/crypto/openssl/ossl_sha1.c (from r366898, head/crypto/openssl/crypto/sha/sha_local.h) ============================================================================== --- head/crypto/openssl/crypto/sha/sha_local.h Tue Oct 20 17:00:43 2020 (r366898, copy source) +++ head/sys/crypto/openssl/ossl_sha1.c Tue Oct 20 17:50:18 2020 (r366901) @@ -7,12 +7,22 @@ * https://www.openssl.org/source/license.html */ -#include -#include +#include +__FBSDID("$FreeBSD$"); -#include -#include +#include +#include +#include +#include + +#include +#include + +/* sha1-x86_64.S */ +void sha1_block_data_order(SHA_CTX *c, const void *p, size_t len); + +/* From crypto/sha/sha_local.h */ #define DATA_ORDER_IS_BIG_ENDIAN #define HASH_LONG SHA_LONG @@ -27,398 +37,41 @@ ll=(c)->h4; (void)HOST_l2c(ll,(s)); \ } while (0) -#define HASH_UPDATE SHA1_Update -#define HASH_TRANSFORM SHA1_Transform -#define HASH_FINAL SHA1_Final -#define HASH_INIT SHA1_Init +#define HASH_UPDATE ossl_sha1_update +#define HASH_FINAL ossl_sha1_final +#define HASH_INIT ossl_sha1_init #define HASH_BLOCK_DATA_ORDER sha1_block_data_order -#define Xupdate(a,ix,ia,ib,ic,id) ( (a)=(ia^ib^ic^id), \ - ix=(a)=ROTATE((a),1) \ - ) -#ifndef SHA1_ASM -static void sha1_block_data_order(SHA_CTX *c, const void *p, size_t num); -#else -void sha1_block_data_order(SHA_CTX *c, const void *p, size_t num); -#endif - -#include "crypto/md32_common.h" - #define INIT_DATA_h0 0x67452301UL #define INIT_DATA_h1 0xefcdab89UL #define INIT_DATA_h2 0x98badcfeUL #define INIT_DATA_h3 0x10325476UL #define INIT_DATA_h4 0xc3d2e1f0UL -int HASH_INIT(SHA_CTX *c) +static void +HASH_INIT(void *c_) { + SHA_CTX *c = c_; memset(c, 0, sizeof(*c)); c->h0 = INIT_DATA_h0; c->h1 = INIT_DATA_h1; c->h2 = INIT_DATA_h2; c->h3 = INIT_DATA_h3; c->h4 = INIT_DATA_h4; - return 1; } -#define K_00_19 0x5a827999UL -#define K_20_39 0x6ed9eba1UL -#define K_40_59 0x8f1bbcdcUL -#define K_60_79 0xca62c1d6UL +#include "ossl_hash.h" -/* - * As pointed out by Wei Dai, F() below can be simplified to the code in - * F_00_19. Wei attributes these optimizations to Peter Gutmann's SHS code, - * and he attributes it to Rich Schroeppel. - * #define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) - * I've just become aware of another tweak to be made, again from Wei Dai, - * in F_40_59, (x&a)|(y&a) -> (x|y)&a - */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Oct 20 20:11:29 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFE52439A64; Tue, 20 Oct 2020 20:11:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CG4X14kgLz4hqp; Tue, 20 Oct 2020 20:11:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85CC51A638; Tue, 20 Oct 2020 20:11:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09KKBTwR050942; Tue, 20 Oct 2020 20:11:29 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09KKBTFW050941; Tue, 20 Oct 2020 20:11:29 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202010202011.09KKBTFW050941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 20 Oct 2020 20:11:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366902 - head/sys/arm64/conf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm64/conf X-SVN-Commit-Revision: 366902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 20:11:29 -0000 Author: emaste Date: Tue Oct 20 20:11:29 2020 New Revision: 366902 URL: https://svnweb.freebsd.org/changeset/base/366902 Log: arm64: add uhci to GENERIC uhci is (or, can be) used by VMware ESXi-Arm. PR: 250308 Reported by: Vincent Milum Jr MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Tue Oct 20 17:50:18 2020 (r366901) +++ head/sys/arm64/conf/GENERIC Tue Oct 20 20:11:29 2020 (r366902) @@ -227,6 +227,7 @@ device rk_typec_phy # Rockchip TypeC PHY device dwcotg # DWC OTG controller device musb # Mentor Graphics USB OTG controller device ohci # OHCI USB interface +device uhci # UHCI USB interface device ehci # EHCI USB interface (USB 2.0) device ehci_mv # Marvell EHCI USB interface device xhci # XHCI USB interface (USB 3.0) From owner-svn-src-head@freebsd.org Tue Oct 20 20:59:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2757743A969; Tue, 20 Oct 2020 20:59:14 +0000 (UTC) (envelope-from rew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CG5b60JJbz4lNj; Tue, 20 Oct 2020 20:59:14 +0000 (UTC) (envelope-from rew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E32AE1AF2F; Tue, 20 Oct 2020 20:59:13 +0000 (UTC) (envelope-from rew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09KKxDpM080511; Tue, 20 Oct 2020 20:59:13 GMT (envelope-from rew@FreeBSD.org) Received: (from rew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09KKxDAW080510; Tue, 20 Oct 2020 20:59:13 GMT (envelope-from rew@FreeBSD.org) Message-Id: <202010202059.09KKxDAW080510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rew set sender to rew@FreeBSD.org using -f From: Robert Wing Date: Tue, 20 Oct 2020 20:59:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366903 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: rew X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 366903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Tue, 20 Oct 2020 20:59:14 -0000 Author: rew Date: Tue Oct 20 20:59:13 2020 New Revision: 366903 URL: https://svnweb.freebsd.org/changeset/base/366903 Log: geom_ctl.c: remove stale header files - Remove "opt_geom.h", no kernel options are used. - Remove , no sysctl functionality is used here. - Remove , requirements for bio moved out in r112534. - Remove and , last used by DROP_GIANT() and PICKUP_GIANT(), which were removed in r115624. - Remove and , not used. Reviewed by: phk, kevans (mentor) Approved by: phk, kevans (mentor) Differential Revision: https://reviews.freebsd.org/D26805 Modified: head/sys/geom/geom_ctl.c Modified: head/sys/geom/geom_ctl.c ============================================================================== --- head/sys/geom/geom_ctl.c Tue Oct 20 20:11:29 2020 (r366902) +++ head/sys/geom/geom_ctl.c Tue Oct 20 20:59:13 2020 (r366903) @@ -38,21 +38,11 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_geom.h" - #include #include -#include -#include -#include #include -#include #include -#include #include - -#include -#include #include #include From owner-svn-src-head@freebsd.org Wed Oct 21 00:15:13 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DFD543DE15; Wed, 21 Oct 2020 00:15:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CG9xF1LXFz4tln; Wed, 21 Oct 2020 00:15:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12A621D424; Wed, 21 Oct 2020 00:15:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09L0FCJG001633; Wed, 21 Oct 2020 00:15:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09L0FC2g001632; Wed, 21 Oct 2020 00:15:12 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202010210015.09L0FC2g001632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Oct 2020 00:15:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366904 - in head/sys: amd64/ia32 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/ia32 i386/i386 X-SVN-Commit-Revision: 366904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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, 21 Oct 2020 00:15:13 -0000 Author: kib Date: Wed Oct 21 00:15:12 2020 New Revision: 366904 URL: https://svnweb.freebsd.org/changeset/base/366904 Log: Improve FPU Tag Word reconstruction on i386 to indicate register states. Improve the code reconstructing en_tw in struct fpreg32 from FXSAVE results so that all register states are indicated correctly. The previous code unconditionally mapped non-empty register state to 'normalized value' constant. The new code explicitly distinguishes the 'zero value' and 'special value' constants as well. This improves consistency between real FSAVE and translation from FXSAVE, and ensures that tests using PT_GETFPREGS can rely on a single correct value independently of the underlying implementation. PR: 250454 Sponsored by: The FreeBSD Foundation Obtained from: Moritz Systems Submitted by: MichaÅ‚ Górny Discussed with: emaste MFC after: 1 week Differential revision: https://reviews.freebsd.org/D26856 Modified: head/sys/amd64/ia32/ia32_reg.c head/sys/i386/i386/npx.c Modified: head/sys/amd64/ia32/ia32_reg.c ============================================================================== --- head/sys/amd64/ia32/ia32_reg.c Tue Oct 20 20:59:13 2020 (r366903) +++ head/sys/amd64/ia32/ia32_reg.c Wed Oct 21 00:15:12 2020 (r366904) @@ -145,7 +145,11 @@ fill_fpregs32(struct thread *td, struct fpreg32 *regs) struct save87 *sv_87; struct env87 *penv_87; struct envxmm *penv_xmm; - int i; + struct fpacc87 *fx_reg; + int i, st; + uint64_t mantissa; + uint16_t tw, exp; + uint8_t ab_tw; bzero(regs, sizeof(*regs)); sv_87 = (struct save87 *)regs; @@ -171,13 +175,39 @@ fill_fpregs32(struct thread *td, struct fpreg32 *regs) /* Entry into the kernel always sets TF_HASSEGS */ penv_87->en_fos = td->td_frame->tf_ds; - /* FPU registers and tags */ - penv_87->en_tw = 0xffff; - for (i = 0; i < 8; ++i) { - sv_87->sv_ac[i] = sv_fpu->sv_fp[i].fp_acc; - if ((penv_xmm->en_tw & (1 << i)) != 0) - penv_87->en_tw &= ~(3 << i * 2); + /* + * FPU registers and tags. + * For ST(i), i = fpu_reg - top; we start with fpu_reg=7. + */ + st = 7 - ((penv_xmm->en_sw >> 11) & 7); + ab_tw = penv_xmm->en_tw; + tw = 0; + for (i = 0x80; i != 0; i >>= 1) { + sv_87->sv_ac[st] = sv_fpu->sv_fp[st].fp_acc; + tw <<= 2; + if ((ab_tw & i) != 0) { + /* Non-empty - we need to check ST(i) */ + fx_reg = &sv_fpu->sv_fp[st].fp_acc; + /* The first 64 bits contain the mantissa. */ + mantissa = *((uint64_t *)fx_reg->fp_bytes); + /* + * The final 16 bits contain the sign bit and the exponent. + * Mask the sign bit since it is of no consequence to these + * tests. + */ + exp = *((uint16_t *)&fx_reg->fp_bytes[8]) & 0x7fff; + if (exp == 0) { + if (mantissa == 0) + tw |= 1; /* Zero */ + else + tw |= 2; /* Denormal */ + } else if (exp == 0x7fff) + tw |= 2; /* Infinity or NaN */ + } else + tw |= 3; /* Empty */ + st = (st - 1) & 7; } + penv_87->en_tw = tw; return (0); } Modified: head/sys/i386/i386/npx.c ============================================================================== --- head/sys/i386/i386/npx.c Tue Oct 20 20:59:13 2020 (r366903) +++ head/sys/i386/i386/npx.c Wed Oct 21 00:15:12 2020 (r366904) @@ -1154,7 +1154,11 @@ npx_fill_fpregs_xmm1(struct savexmm *sv_xmm, struct sa { struct env87 *penv_87; struct envxmm *penv_xmm; - int i; + struct fpacc87 *fx_reg; + int i, st; + uint64_t mantissa; + uint16_t tw, exp; + uint8_t ab_tw; penv_87 = &sv_87->sv_env; penv_xmm = &sv_xmm->sv_env; @@ -1168,14 +1172,39 @@ npx_fill_fpregs_xmm1(struct savexmm *sv_xmm, struct sa penv_87->en_foo = penv_xmm->en_foo; penv_87->en_fos = penv_xmm->en_fos; - /* FPU registers and tags */ - penv_87->en_tw = 0xffff; - for (i = 0; i < 8; ++i) { - sv_87->sv_ac[i] = sv_xmm->sv_fp[i].fp_acc; - if ((penv_xmm->en_tw & (1 << i)) != 0) - /* zero and special are set as valid */ - penv_87->en_tw &= ~(3 << i * 2); + /* + * FPU registers and tags. + * For ST(i), i = fpu_reg - top; we start with fpu_reg=7. + */ + st = 7 - ((penv_xmm->en_sw >> 11) & 7); + ab_tw = penv_xmm->en_tw; + tw = 0; + for (i = 0x80; i != 0; i >>= 1) { + sv_87->sv_ac[st] = sv_xmm->sv_fp[st].fp_acc; + tw <<= 2; + if (ab_tw & i) { + /* Non-empty - we need to check ST(i) */ + fx_reg = &sv_xmm->sv_fp[st].fp_acc; + /* The first 64 bits contain the mantissa. */ + mantissa = *((uint64_t *)fx_reg->fp_bytes); + /* + * The final 16 bits contain the sign bit and the exponent. + * Mask the sign bit since it is of no consequence to these + * tests. + */ + exp = *((uint16_t *)&fx_reg->fp_bytes[8]) & 0x7fff; + if (exp == 0) { + if (mantissa == 0) + tw |= 1; /* Zero */ + else + tw |= 2; /* Denormal */ + } else if (exp == 0x7fff) + tw |= 2; /* Infinity or NaN */ + } else + tw |= 3; /* Empty */ + st = (st - 1) & 7; } + penv_87->en_tw = tw; } void From owner-svn-src-head@freebsd.org Wed Oct 21 05:27:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 524E944333C; Wed, 21 Oct 2020 05:27:26 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGJsV1V8bz3csZ; Wed, 21 Oct 2020 05:27:26 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1653020E3D; Wed, 21 Oct 2020 05:27:26 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09L5RPeZ091221; Wed, 21 Oct 2020 05:27:25 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09L5RPxo091218; Wed, 21 Oct 2020 05:27:25 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202010210527.09L5RPxo091218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Wed, 21 Oct 2020 05:27:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366906 - in head: lib/libifconfig sbin/ifconfig X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: in head: lib/libifconfig sbin/ifconfig X-SVN-Commit-Revision: 366906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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, 21 Oct 2020 05:27:26 -0000 Author: freqlabs Date: Wed Oct 21 05:27:25 2020 New Revision: 366906 URL: https://svnweb.freebsd.org/changeset/base/366906 Log: Move list_cloners to libifconfig Move list_cloners() from ifconfig(8) to libifconfig(3) where it can be reused by other consumers. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D26858 Modified: head/lib/libifconfig/libifconfig.c head/lib/libifconfig/libifconfig.h head/sbin/ifconfig/ifclone.c Modified: head/lib/libifconfig/libifconfig.c ============================================================================== --- head/lib/libifconfig/libifconfig.c Wed Oct 21 00:46:53 2020 (r366905) +++ head/lib/libifconfig/libifconfig.c Wed Oct 21 05:27:25 2020 (r366906) @@ -628,3 +628,35 @@ ifconfig_set_vlantag(ifconfig_handle_t *h, const char } return (0); } + +int +ifconfig_list_cloners(ifconfig_handle_t *h, char **bufp, size_t *lenp) +{ + struct if_clonereq ifcr; + char *buf; + + memset(&ifcr, 0, sizeof(ifcr)); + *bufp = NULL; + *lenp = 0; + + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFGCLONERS, &ifcr) < 0) + return (-1); + + buf = malloc(ifcr.ifcr_total * IFNAMSIZ); + if (buf == NULL) { + h->error.errtype = OTHER; + h->error.errcode = ENOMEM; + return (-1); + } + + ifcr.ifcr_count = ifcr.ifcr_total; + ifcr.ifcr_buffer = buf; + if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCIFGCLONERS, &ifcr) < 0) { + free(buf); + return (-1); + } + + *bufp = buf; + *lenp = ifcr.ifcr_total; + return (0); +} Modified: head/lib/libifconfig/libifconfig.h ============================================================================== --- head/lib/libifconfig/libifconfig.h Wed Oct 21 00:46:53 2020 (r366905) +++ head/lib/libifconfig/libifconfig.h Wed Oct 21 05:27:25 2020 (r366906) @@ -279,3 +279,13 @@ int ifconfig_create_interface_vlan(ifconfig_handle_t * int ifconfig_set_vlantag(ifconfig_handle_t *h, const char *name, const char *vlandev, const unsigned short vlantag); + +/** Gets the names of all interface cloners available on the system + * @param bufp Set to the address of the names buffer on success or NULL + * if an error occurs. This buffer must be freed when done. + * @param lenp Set to the number of names in the returned buffer or 0 + * if an error occurs. Each name is contained within an + * IFNAMSIZ length slice of the buffer, for a total buffer + * length of *lenp * IFNAMSIZ bytes. + */ +int ifconfig_list_cloners(ifconfig_handle_t *h, char **bufp, size_t *lenp); Modified: head/sbin/ifconfig/ifclone.c ============================================================================== --- head/sbin/ifconfig/ifclone.c Wed Oct 21 00:46:53 2020 (r366905) +++ head/sbin/ifconfig/ifclone.c Wed Oct 21 05:27:25 2020 (r366906) @@ -41,6 +41,7 @@ static const char rcsid[] = #include #include +#include #include #include #include @@ -51,45 +52,27 @@ static const char rcsid[] = static void list_cloners(void) { - struct if_clonereq ifcr; - char *cp, *buf; - int idx; - int s; + ifconfig_handle_t *lifh; + char *cloners; + size_t cloners_count; - s = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (s == -1) - err(1, "socket(AF_LOCAL,SOCK_DGRAM)"); + lifh = ifconfig_open(); + if (lifh == NULL) + return; - memset(&ifcr, 0, sizeof(ifcr)); + if (ifconfig_list_cloners(lifh, &cloners, &cloners_count) < 0) + errc(1, ifconfig_err_errno(lifh), "unable to list cloners"); + ifconfig_close(lifh); - if (ioctl(s, SIOCIFGCLONERS, &ifcr) < 0) - err(1, "SIOCIFGCLONERS for count"); - - buf = malloc(ifcr.ifcr_total * IFNAMSIZ); - if (buf == NULL) - err(1, "unable to allocate cloner name buffer"); - - ifcr.ifcr_count = ifcr.ifcr_total; - ifcr.ifcr_buffer = buf; - - if (ioctl(s, SIOCIFGCLONERS, &ifcr) < 0) - err(1, "SIOCIFGCLONERS for names"); - - /* - * In case some disappeared in the mean time, clamp it down. - */ - if (ifcr.ifcr_count > ifcr.ifcr_total) - ifcr.ifcr_count = ifcr.ifcr_total; - - for (cp = buf, idx = 0; idx < ifcr.ifcr_count; idx++, cp += IFNAMSIZ) { - if (idx > 0) + for (const char *name = cloners; + name < cloners + cloners_count * IFNAMSIZ; + name += IFNAMSIZ) { + if (name > cloners) putchar(' '); - printf("%s", cp); + printf("%s", name); } - putchar('\n'); - free(buf); - close(s); + free(cloners); } struct clone_defcb { From owner-svn-src-head@freebsd.org Wed Oct 21 05:57:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27EBC443B86; Wed, 21 Oct 2020 05:57:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGKX60Dg6z3f0x; Wed, 21 Oct 2020 05:57:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAED321179; Wed, 21 Oct 2020 05:57:25 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09L5vPAR009646; Wed, 21 Oct 2020 05:57:25 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09L5vPvr009645; Wed, 21 Oct 2020 05:57:25 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010210557.09L5vPvr009645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 21 Oct 2020 05:57:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366907 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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, 21 Oct 2020 05:57:26 -0000 Author: mjg Date: Wed Oct 21 05:57:25 2020 New Revision: 366907 URL: https://svnweb.freebsd.org/changeset/base/366907 Log: cache: drop the spurious slash_prefixed argument Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Wed Oct 21 05:27:25 2020 (r366906) +++ head/sys/kern/vfs_cache.c Wed Oct 21 05:57:25 2020 (r366907) @@ -512,11 +512,11 @@ static void cache_zap_locked(struct namecache *ncp); static int vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, size_t *buflen); static int vn_fullpath_any_smr(struct vnode *vp, struct vnode *rdir, char *buf, - char **retbuf, size_t *buflen, bool slash_prefixed, size_t addend); + char **retbuf, size_t *buflen, size_t addend); static int vn_fullpath_any(struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, size_t *buflen); static int vn_fullpath_dir(struct vnode *vp, struct vnode *rdir, char *buf, - char **retbuf, size_t *len, bool slash_prefixed, size_t addend); + char **retbuf, size_t *len, size_t addend); static MALLOC_DEFINE(M_VFSCACHE, "vfscache", "VFS name cache entries"); @@ -2687,7 +2687,7 @@ vn_getcwd(char *buf, char **retbuf, size_t *buflen) vfs_smr_enter(); pwd = pwd_get_smr(); error = vn_fullpath_any_smr(pwd->pwd_cdir, pwd->pwd_rdir, buf, retbuf, - buflen, false, 0); + buflen, 0); VFS_SMR_ASSERT_NOT_ENTERED(); if (error < 0) { pwd = pwd_hold(curthread); @@ -2753,7 +2753,7 @@ vn_fullpath(struct vnode *vp, char **retbuf, char **fr buf = malloc(buflen, M_TEMP, M_WAITOK); vfs_smr_enter(); pwd = pwd_get_smr(); - error = vn_fullpath_any_smr(vp, pwd->pwd_rdir, buf, retbuf, &buflen, false, 0); + error = vn_fullpath_any_smr(vp, pwd->pwd_rdir, buf, retbuf, &buflen, 0); VFS_SMR_ASSERT_NOT_ENTERED(); if (error < 0) { pwd = pwd_hold(curthread); @@ -2785,7 +2785,7 @@ vn_fullpath_global(struct vnode *vp, char **retbuf, ch buflen = MAXPATHLEN; buf = malloc(buflen, M_TEMP, M_WAITOK); vfs_smr_enter(); - error = vn_fullpath_any_smr(vp, rootvnode, buf, retbuf, &buflen, false, 0); + error = vn_fullpath_any_smr(vp, rootvnode, buf, retbuf, &buflen, 0); VFS_SMR_ASSERT_NOT_ENTERED(); if (error < 0) { error = vn_fullpath_any(vp, rootvnode, buf, retbuf, &buflen); @@ -2887,7 +2887,7 @@ vn_vptocnp(struct vnode **vp, char *buf, size_t *bufle */ static int vn_fullpath_dir(struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, - size_t *len, bool slash_prefixed, size_t addend) + size_t *len, size_t addend) { #ifdef KDTRACE_HOOKS struct vnode *startvp = vp; @@ -2895,16 +2895,19 @@ vn_fullpath_dir(struct vnode *vp, struct vnode *rdir, struct vnode *vp1; size_t buflen; int error; + bool slash_prefixed; VNPASS(vp->v_type == VDIR || VN_IS_DOOMED(vp), vp); VNPASS(vp->v_usecount > 0, vp); buflen = *len; - if (!slash_prefixed) { + slash_prefixed = true; + if (addend == 0) { MPASS(*len >= 2); buflen--; buf[buflen] = '\0'; + slash_prefixed = false; } error = 0; @@ -3006,7 +3009,7 @@ cache_rev_failed_impl(int *reason, int line) static int vn_fullpath_any_smr(struct vnode *vp, struct vnode *rdir, char *buf, - char **retbuf, size_t *buflen, bool slash_prefixed, size_t addend) + char **retbuf, size_t *buflen, size_t addend) { #ifdef KDTRACE_HOOKS struct vnode *startvp = vp; @@ -3032,14 +3035,14 @@ vn_fullpath_any_smr(struct vnode *vp, struct vnode *rd orig_buflen = *buflen; - if (!slash_prefixed) { + if (addend == 0) { MPASS(*buflen >= 2); *buflen -= 1; buf[*buflen] = '\0'; } if (vp == rdir || vp == rootvnode) { - if (!slash_prefixed) { + if (addend == 0) { *buflen -= 1; buf[*buflen] = '/'; } @@ -3137,8 +3140,7 @@ static int vn_fullpath_any(struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, size_t *buflen) { - size_t orig_buflen; - bool slash_prefixed; + size_t orig_buflen, addend; int error; if (*buflen < 2) @@ -3147,7 +3149,7 @@ vn_fullpath_any(struct vnode *vp, struct vnode *rdir, orig_buflen = *buflen; vref(vp); - slash_prefixed = false; + addend = 0; if (vp->v_type != VDIR) { *buflen -= 1; buf[*buflen] = '\0'; @@ -3160,11 +3162,10 @@ vn_fullpath_any(struct vnode *vp, struct vnode *rdir, } *buflen -= 1; buf[*buflen] = '/'; - slash_prefixed = true; + addend = orig_buflen - *buflen; } - return (vn_fullpath_dir(vp, rdir, buf, retbuf, buflen, slash_prefixed, - orig_buflen - *buflen)); + return (vn_fullpath_dir(vp, rdir, buf, retbuf, buflen, addend)); } /* @@ -3189,7 +3190,6 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **ret struct vnode *vp; size_t addend; int error; - bool slash_prefixed; enum vtype type; if (*buflen < 2) @@ -3197,8 +3197,6 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **ret if (*buflen > MAXPATHLEN) *buflen = MAXPATHLEN; - slash_prefixed = false; - buf = malloc(*buflen, M_TEMP, M_WAITOK); addend = 0; @@ -3239,20 +3237,19 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **ret tmpbuf[0] = '/'; memcpy(&tmpbuf[1], cnp->cn_nameptr, cnp->cn_namelen); tmpbuf[addend - 1] = '\0'; - slash_prefixed = true; vp = ndp->ni_dvp; } vfs_smr_enter(); pwd = pwd_get_smr(); error = vn_fullpath_any_smr(vp, pwd->pwd_rdir, buf, retbuf, buflen, - slash_prefixed, addend); + addend); VFS_SMR_ASSERT_NOT_ENTERED(); if (error < 0) { pwd = pwd_hold(curthread); vref(vp); error = vn_fullpath_dir(vp, pwd->pwd_rdir, buf, retbuf, buflen, - slash_prefixed, addend); + addend); pwd_drop(pwd); if (error != 0) goto out_bad; From owner-svn-src-head@freebsd.org Wed Oct 21 15:01:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3010D44DB6B; Wed, 21 Oct 2020 15:01:34 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGYby0Py8z4PK8; Wed, 21 Oct 2020 15:01:34 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5B6E276FE; Wed, 21 Oct 2020 15:01:33 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09LF1XHZ041767; Wed, 21 Oct 2020 15:01:33 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09LF1XBr041764; Wed, 21 Oct 2020 15:01:33 GMT (envelope-from ae@FreeBSD.org) Message-Id: <202010211501.09LF1XBr041764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 21 Oct 2020 15:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366908 - in head: share/dtrace sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head: share/dtrace sys/netpfil/ipfw X-SVN-Commit-Revision: 366908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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, 21 Oct 2020 15:01:34 -0000 Author: ae Date: Wed Oct 21 15:01:33 2020 New Revision: 366908 URL: https://svnweb.freebsd.org/changeset/base/366908 Log: Add dtrace SDT probe ipfw:::rule-matched. It helps to reduce complexity with debugging of large ipfw rulesets. Also define several constants and translators, that can by used by dtrace scripts with this probe. Reviewed by: gnn Obtained from: Yandex LLC MFC after: 2 weeks Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D26879 Added: head/share/dtrace/ipfw.d (contents, props changed) Modified: head/share/dtrace/Makefile head/sys/netpfil/ipfw/ip_fw2.c Modified: head/share/dtrace/Makefile ============================================================================== --- head/share/dtrace/Makefile Wed Oct 21 05:57:25 2020 (r366907) +++ head/share/dtrace/Makefile Wed Oct 21 15:01:33 2020 (r366908) @@ -21,7 +21,7 @@ SCRIPTS= blocking \ SCRIPTSDIR= ${SHAREDIR}/dtrace -DSRCS= mbuf.d +DSRCS= mbuf.d ipfw.d FILES= ${DSRCS} FILESDIR= /usr/lib/dtrace Added: head/share/dtrace/ipfw.d ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/dtrace/ipfw.d Wed Oct 21 15:01:33 2020 (r366908) @@ -0,0 +1,219 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Yandex LLC + * Copyright (c) 2020 Andrey V. Elsukov + * + * 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 AUTHORS 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 AUTHORS 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$ + */ + +#pragma D depends_on provider ipfw + +/* ipfw_chk() return values */ +#pragma D binding "1.0" IP_FW_PASS +inline int IP_FW_PASS = 0; +#pragma D binding "1.0" IP_FW_DENY +inline int IP_FW_DENY = 1; +#pragma D binding "1.0" IP_FW_DIVERT +inline int IP_FW_DIVERT = 2; +#pragma D binding "1.0" IP_FW_TEE +inline int IP_FW_TEE = 3; +#pragma D binding "1.0" IP_FW_DUMMYNET +inline int IP_FW_DUMMYNET = 4; +#pragma D binding "1.0" IP_FW_NETGRAPH +inline int IP_FW_NETGRAPH = 5; +#pragma D binding "1.0" IP_FW_NGTEE +inline int IP_FW_NGTEE = 6; +#pragma D binding "1.0" IP_FW_NAT +inline int IP_FW_NAT = 7; +#pragma D binding "1.0" IP_FW_REASS +inline int IP_FW_REASS = 8; +#pragma D binding "1.0" IP_FW_NAT64 +inline int IP_FW_NAT64 = 9; + +#pragma D binding "1.0" ipfw_retcodes +inline string ipfw_retcodes[int ret] = + ret == IP_FW_PASS ? "PASS" : + ret == IP_FW_DENY ? "DENY" : + ret == IP_FW_DIVERT ? "DIVERT" : + ret == IP_FW_TEE ? "TEE" : + ret == IP_FW_DUMMYNET ? "DUMMYNET" : + ret == IP_FW_NETGRAPH ? "NETGRAPH" : + ret == IP_FW_NGTEE ? "NGTEE" : + ret == IP_FW_NAT ? "NAT" : + ret == IP_FW_REASS ? "REASS" : + ret == IP_FW_NAT64 ? "NAT64" : + ""; + +/* ip_fw_args flags */ +#pragma D binding "1.0" IPFW_ARGS_ETHER +inline int IPFW_ARGS_ETHER = 0x00010000; /* valid ethernet header */ +#pragma D binding "1.0" IPFW_ARGS_NH4 +inline int IPFW_ARGS_NH4 = 0x00020000; /* IPv4 next hop in hopstore */ +#pragma D binding "1.0" IPFW_ARGS_NH6 +inline int IPFW_ARGS_NH6 = 0x00040000; /* IPv6 next hop in hopstore */ +#pragma D binding "1.0" IPFW_ARGS_NH4PTR +inline int IPFW_ARGS_NH4PTR = 0x00080000; /* IPv4 next hop in next_hop */ +#pragma D binding "1.0" IPFW_ARGS_NH6PTR +inline int IPFW_ARGS_NH6PTR = 0x00100000; /* IPv6 next hop in next_hop6 */ +#pragma D binding "1.0" IPFW_ARGS_REF +inline int IPFW_ARGS_REF = 0x00200000; /* valid ipfw_rule_ref */ +#pragma D binding "1.0" IPFW_ARGS_IN +inline int IPFW_ARGS_IN = 0x00400000; /* called on input */ +#pragma D binding "1.0" IPFW_ARGS_OUT +inline int IPFW_ARGS_OUT = 0x00800000; /* called on output */ +#pragma D binding "1.0" IPFW_ARGS_IP4 +inline int IPFW_ARGS_IP4 = 0x01000000; /* belongs to v4 ISR */ +#pragma D binding "1.0" IPFW_ARGS_IP6 +inline int IPFW_ARGS_IP6 = 0x02000000; /* belongs to v6 ISR */ +#pragma D binding "1.0" IPFW_ARGS_DROP +inline int IPFW_ARGS_DROP = 0x04000000; /* drop it (dummynet) */ +#pragma D binding "1.0" IPFW_ARGS_LENMASK +inline int IPFW_ARGS_LENMASK = 0x0000ffff; /* length of data in *mem */ + +/* ipfw_rule_ref.info */ +#pragma D binding "1.0" IPFW_INFO_MASK +inline int IPFW_INFO_MASK = 0x0000ffff; +#pragma D binding "1.0" IPFW_INFO_OUT +inline int IPFW_INFO_OUT = 0x00000000; +#pragma D binding "1.0" IPFW_INFO_IN +inline int IPFW_INFO_IN = 0x80000000; +#pragma D binding "1.0" IPFW_ONEPASS +inline int IPFW_ONEPASS = 0x40000000; +#pragma D binding "1.0" IPFW_IS_MASK +inline int IPFW_IS_MASK = 0x30000000; +#pragma D binding "1.0" IPFW_IS_DIVERT +inline int IPFW_IS_DIVERT = 0x20000000; +#pragma D binding "1.0" IPFW_IS_DUMMYNET +inline int IPFW_IS_DUMMYNET = 0x10000000; +#pragma D binding "1.0" IPFW_IS_PIPE +inline int IPFW_IS_PIPE = 0x08000000; + +typedef struct ipfw_match_info { + uint32_t flags; + + struct mbuf *m; + void *mem; + struct inpcb *inp; + struct ifnet *ifp; + struct ip *ipp; + struct ip6_hdr *ip6p; + + /* flow id */ + uint8_t addr_type; + uint8_t proto; + uint8_t proto_flags; + uint16_t fib; /* XXX */ + in_addr_t dst_ip; /* in network byte order */ + in_addr_t src_ip; /* in network byte order */ + struct in6_addr dst_ip6; + struct in6_addr src_ip6; + + uint16_t dst_port; /* in host byte order */ + uint16_t src_port; /* in host byte order */ + + uint32_t flowid; /* IPv6 flowid */ + uint32_t extra; + + /* ipfw_rule_ref */ + uint32_t slot; + uint32_t rulenum; + uint32_t rule_id; + uint32_t chain_id; + uint32_t match_info; +} ipfw_match_info_t; + +#pragma D binding "1.0" translator +translator ipfw_match_info_t < struct ip_fw_args *p > { + flags = p->flags; + m = (p->flags & IPFW_ARGS_LENMASK) ? NULL : p->m; + mem = (p->flags & IPFW_ARGS_LENMASK) ? p->mem : NULL; + inp = p->inp; + ifp = p->ifp; + /* Initialize IP pointer corresponding to addr_type */ + ipp = (p->flags & IPFW_ARGS_IP4) ? + (p->flags & IPFW_ARGS_LENMASK) ? (struct ip *)p->mem : + (p->m != NULL) ? (struct ip *)p->m->m_data : NULL : NULL; + ip6p = (p->flags & IPFW_ARGS_IP6) ? + (p->flags & IPFW_ARGS_LENMASK) ? (struct ip6_hdr *)p->mem : + (p->m != NULL) ? (struct ip6_hdr *)p->m->m_data : NULL : NULL; + + /* fill f_id fields */ + addr_type = p->f_id.addr_type; + proto = p->f_id.proto; + proto_flags = p->f_id._flags; + + /* f_id.fib keeps truncated fibnum, use mbuf's fibnum if possible */ + fib = p->m != NULL ? p->m->m_pkthdr.fibnum : p->f_id.fib; + + /* + * ipfw_chk() keeps IPv4 addresses in host byte order. But for + * dtrace script it is useful to have them in network byte order, + * because inet_ntoa() uses address in network byte order. + */ + dst_ip = htonl(p->f_id.dst_ip); + src_ip = htonl(p->f_id.src_ip); + + dst_ip6 = p->f_id.dst_ip6; + src_ip6 = p->f_id.src_ip6; + + dst_port = p->f_id.dst_port; + src_port = p->f_id.src_port; + + flowid = p->f_id.flow_id6; + extra = p->f_id.extra; + + /* ipfw_rule_ref */ + slot = (p->flags & IPFW_ARGS_REF) ? p->rule.slot : 0; + rulenum = (p->flags & IPFW_ARGS_REF) ? p->rule.rulenum : 0; + rule_id = (p->flags & IPFW_ARGS_REF) ? p->rule.rule_id : 0; + chain_id = (p->flags & IPFW_ARGS_REF) ? p->rule.chain_id : 0; + match_info = (p->flags & IPFW_ARGS_REF) ? p->rule.info : 0; +}; + +typedef struct ipfw_rule_info { + uint16_t act_ofs; + uint16_t cmd_len; + uint32_t rulenum; + uint8_t flags; + uint8_t set; + uint32_t rule_id; + uint32_t cached_id; + uint32_t cached_pos; + uint32_t refcnt; +} ipfw_rule_info_t; + +#pragma D binding "1.0" translator +translator ipfw_rule_info_t < struct ip_fw *r > { + act_ofs = r->act_ofs; + cmd_len = r->cmd_len; + rulenum = r->rulenum; + flags = r->flags; + set = r->set; + rule_id = r->id; + cached_id = r->cached_id; + cached_pos = r->cached_pos; + refcnt = r->refcnt; +}; + Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Wed Oct 21 05:57:25 2020 (r366907) +++ head/sys/netpfil/ipfw/ip_fw2.c Wed Oct 21 15:01:33 2020 (r366908) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -106,6 +107,18 @@ __FBSDID("$FreeBSD$"); #include #endif +#define IPFW_PROBE(probe, arg0, arg1, arg2, arg3, arg4, arg5) \ + SDT_PROBE6(ipfw, , , probe, arg0, arg1, arg2, arg3, arg4, arg5) + +SDT_PROVIDER_DEFINE(ipfw); +SDT_PROBE_DEFINE6(ipfw, , , rule__matched, + "int", /* retval */ + "int", /* af */ + "void *", /* src addr */ + "void *", /* dst addr */ + "struct ip_fw_args *", /* args */ + "struct ip_fw *" /* rule */); + /* * static variables followed by global ones. * All ipfw global variables are here. @@ -3237,6 +3250,13 @@ do { \ struct ip_fw *rule = chain->map[f_pos]; /* Update statistics */ IPFW_INC_RULE_COUNTER(rule, pktlen); + IPFW_PROBE(rule__matched, retval, + is_ipv4 ? AF_INET : AF_INET6, + is_ipv4 ? (uintptr_t)&src_ip : + (uintptr_t)&args->f_id.src_ip6, + is_ipv4 ? (uintptr_t)&dst_ip : + (uintptr_t)&args->f_id.dst_ip6, + args, rule); } else { retval = IP_FW_DENY; printf("ipfw: ouch!, skip past end of rules, denying packet\n"); From owner-svn-src-head@freebsd.org Wed Oct 21 16:00:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3500844F2E3; Wed, 21 Oct 2020 16:00:17 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGZvj0Z8Jz4T0M; Wed, 21 Oct 2020 16:00:17 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAE06851B; Wed, 21 Oct 2020 16:00:16 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09LG0GuM075804; Wed, 21 Oct 2020 16:00:16 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09LG0FrC075799; Wed, 21 Oct 2020 16:00:15 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202010211600.09LG0FrC075799@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 21 Oct 2020 16:00:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366911 - in head/sys: cam dev/nvme kern sys ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/sys: cam dev/nvme kern sys ufs/ffs X-SVN-Commit-Revision: 366911 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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, 21 Oct 2020 16:00:17 -0000 Author: brooks Date: Wed Oct 21 16:00:15 2020 New Revision: 366911 URL: https://svnweb.freebsd.org/changeset/base/366911 Log: vmapbuf: don't smuggle address or length in buf Instead, add arguments to vmapbuf. Since this argument is always a pointer use a type of void * and cast to vm_offset_t in vmapbuf. (In CheriBSD we've altered vm_fault_quick_hold_pages to take a pointer and check its bounds.) In no other situtation does b_data contain a user pointer and vmapbuf replaces b_data with the actual mapping. Suggested by: jhb Reviewed by: imp, jhb Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26784 Modified: head/sys/cam/cam_periph.c head/sys/dev/nvme/nvme_ctrlr.c head/sys/kern/vfs_bio.c head/sys/sys/buf.h head/sys/ufs/ffs/ffs_rawread.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Wed Oct 21 15:06:44 2020 (r366910) +++ head/sys/cam/cam_periph.c Wed Oct 21 16:00:15 2020 (r366911) @@ -955,18 +955,12 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma */ mapinfo->bp[i] = uma_zalloc(pbuf_zone, M_WAITOK); - /* put our pointer in the data slot */ - mapinfo->bp[i]->b_data = *data_ptrs[i]; - - /* set the transfer length, we know it's < MAXPHYS */ - mapinfo->bp[i]->b_bufsize = lengths[i]; - /* set the direction */ mapinfo->bp[i]->b_iocmd = (dirs[i] == CAM_DIR_OUT) ? BIO_WRITE : BIO_READ; /* Map the buffer into kernel memory. */ - if (vmapbuf(mapinfo->bp[i], 1) < 0) { + if (vmapbuf(mapinfo->bp[i], *data_ptrs[i], lengths[i], 1) < 0) { uma_zfree(pbuf_zone, mapinfo->bp[i]); goto fail; } Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Wed Oct 21 15:06:44 2020 (r366910) +++ head/sys/dev/nvme/nvme_ctrlr.c Wed Oct 21 16:00:15 2020 (r366911) @@ -1268,10 +1268,8 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctr */ PHOLD(curproc); buf = uma_zalloc(pbuf_zone, M_WAITOK); - buf->b_data = pt->buf; - buf->b_bufsize = pt->len; buf->b_iocmd = pt->is_read ? BIO_READ : BIO_WRITE; - if (vmapbuf(buf, 1) < 0) { + if (vmapbuf(buf, pt->buf, pt->len, 1) < 0) { ret = EFAULT; goto err; } Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Oct 21 15:06:44 2020 (r366910) +++ head/sys/kern/vfs_bio.c Wed Oct 21 16:00:15 2020 (r366911) @@ -4907,22 +4907,21 @@ vm_hold_free_pages(struct buf *bp, int newbsize) * This function only works with pager buffers. */ int -vmapbuf(struct buf *bp, int mapbuf) +vmapbuf(struct buf *bp, void *uaddr, size_t len, int mapbuf) { vm_prot_t prot; int pidx; - if (bp->b_bufsize < 0) - return (-1); prot = VM_PROT_READ; if (bp->b_iocmd == BIO_READ) prot |= VM_PROT_WRITE; /* Less backwards than it looks */ if ((pidx = vm_fault_quick_hold_pages(&curproc->p_vmspace->vm_map, - (vm_offset_t)bp->b_data, bp->b_bufsize, prot, bp->b_pages, + (vm_offset_t)uaddr, len, prot, bp->b_pages, btoc(MAXPHYS))) < 0) return (-1); + bp->b_bufsize = len; bp->b_npages = pidx; - bp->b_offset = ((vm_offset_t)bp->b_data) & PAGE_MASK; + bp->b_offset = ((vm_offset_t)uaddr) & PAGE_MASK; if (mapbuf || !unmapped_buf_allowed) { pmap_qenter((vm_offset_t)bp->b_kvabase, bp->b_pages, pidx); bp->b_data = bp->b_kvabase + bp->b_offset; Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Wed Oct 21 15:06:44 2020 (r366910) +++ head/sys/sys/buf.h Wed Oct 21 16:00:15 2020 (r366911) @@ -575,7 +575,7 @@ void vfs_bio_set_flags(struct buf *bp, int ioflags); void vfs_bio_set_valid(struct buf *, int base, int size); void vfs_busy_pages(struct buf *, int clear_modify); void vfs_unbusy_pages(struct buf *); -int vmapbuf(struct buf *, int); +int vmapbuf(struct buf *, void *, size_t, int); void vunmapbuf(struct buf *); void brelvp(struct buf *); void bgetvp(struct vnode *, struct buf *); Modified: head/sys/ufs/ffs/ffs_rawread.c ============================================================================== --- head/sys/ufs/ffs/ffs_rawread.c Wed Oct 21 15:06:44 2020 (r366910) +++ head/sys/ufs/ffs/ffs_rawread.c Wed Oct 21 16:00:15 2020 (r366911) @@ -216,7 +216,6 @@ ffs_rawread_readahead(struct vnode *vp, bp->b_flags = 0; /* XXX necessary ? */ bp->b_iocmd = BIO_READ; bp->b_iodone = bdone; - bp->b_data = udata; blockno = offset / bsize; blockoff = (offset % bsize) / DEV_BSIZE; if ((daddr_t) blockno != blockno) { @@ -233,9 +232,8 @@ ffs_rawread_readahead(struct vnode *vp, if (bp->b_bcount + blockoff * DEV_BSIZE > bsize) bp->b_bcount = bsize - blockoff * DEV_BSIZE; - bp->b_bufsize = bp->b_bcount; - if (vmapbuf(bp, 1) < 0) + if (vmapbuf(bp, udata, bp->b_bcount, 1) < 0) return EFAULT; maybe_yield(); @@ -252,9 +250,8 @@ ffs_rawread_readahead(struct vnode *vp, if (bp->b_bcount + blockoff * DEV_BSIZE > bsize * (1 + bforwards)) bp->b_bcount = bsize * (1 + bforwards) - blockoff * DEV_BSIZE; - bp->b_bufsize = bp->b_bcount; - if (vmapbuf(bp, 1) < 0) + if (vmapbuf(bp, udata, bp->b_bcount, 1) < 0) return EFAULT; BO_STRATEGY(&dp->v_bufobj, bp); From owner-svn-src-head@freebsd.org Wed Oct 21 16:30:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA25644FF81; Wed, 21 Oct 2020 16:30:34 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGbZf44TSz4VlZ; Wed, 21 Oct 2020 16:30:34 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F5898A34; Wed, 21 Oct 2020 16:30:34 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09LGUYvT094432; Wed, 21 Oct 2020 16:30:34 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09LGUYUd094431; Wed, 21 Oct 2020 16:30:34 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202010211630.09LGUYUd094431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Wed, 21 Oct 2020 16:30:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366913 - head/usr.bin/col X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/usr.bin/col X-SVN-Commit-Revision: 366913 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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, 21 Oct 2020 16:30:34 -0000 Author: fernape (ports committer) Date: Wed Oct 21 16:30:34 2020 New Revision: 366913 URL: https://svnweb.freebsd.org/changeset/base/366913 Log: col(1): Add EXAMPLES section Add a small example. Cross reference clean up for colcrt, nroff and tbl. Reviewed by: gbe@, bcr@ Approved by: gbe@ Differential Revision: https://reviews.freebsd.org/D26864 Modified: head/usr.bin/col/col.1 Modified: head/usr.bin/col/col.1 ============================================================================== --- head/usr.bin/col/col.1 Wed Oct 21 16:04:57 2020 (r366912) +++ head/usr.bin/col/col.1 Wed Oct 21 16:30:34 2020 (r366913) @@ -31,7 +31,7 @@ .\" @(#)col.1 8.1 (Berkeley) 6/29/93 .\" $FreeBSD$ .\" -.Dd May 10, 2015 +.Dd October 21, 2020 .Dt COL 1 .Os .Sh NAME @@ -47,10 +47,6 @@ The utility filters out reverse (and half reverse) line feeds so that the output is in the correct order with only forward and half forward line feeds, and replaces white-space characters with tabs where possible. -This can be useful in processing the output of -.Xr nroff 1 -and -.Xr tbl 1 . .Pp The .Nm @@ -149,11 +145,19 @@ as described in .Xr environ 7 . .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +We can use +.Nm +to filter the output of +.Xr man 1 +and remove the backspace characters ( +.Em ^H +) before searching for some text: +.Bd -literal -offset indent +man ls | col -b | grep HISTORY +.Ed .Sh SEE ALSO -.Xr colcrt 1 , -.Xr expand 1 , -.Xr nroff 1 , -.Xr tbl 1 +.Xr expand 1 .Sh STANDARDS The .Nm From owner-svn-src-head@freebsd.org Wed Oct 21 17:11:58 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86E50428AB3; Wed, 21 Oct 2020 17:11:58 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGcVQ310kz4XCd; Wed, 21 Oct 2020 17:11:58 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AFF39503; Wed, 21 Oct 2020 17:11:58 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09LHBwGE023421; Wed, 21 Oct 2020 17:11:58 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09LHBwiu023420; Wed, 21 Oct 2020 17:11:58 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <202010211711.09LHBwiu023420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Wed, 21 Oct 2020 17:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366914 - head/sys/dev/ntb/test X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/sys/dev/ntb/test X-SVN-Commit-Revision: 366914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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, 21 Oct 2020 17:11:58 -0000 Author: vangyzen Date: Wed Oct 21 17:11:57 2020 New Revision: 366914 URL: https://svnweb.freebsd.org/changeset/base/366914 Log: ntb_tool: ubuf is too small to hold a human readable 64 bit value ubuf buffer is too small. It should be 18 if a NULL is not needed, or 19 to hold the NULL terminator for the full 64-BIT value plus the 0x prefix. Submitted by: bret_ketchum@dell.com Reviewed by: markj mav MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D26893 Modified: head/sys/dev/ntb/test/ntb_tool.c Modified: head/sys/dev/ntb/test/ntb_tool.c ============================================================================== --- head/sys/dev/ntb/test/ntb_tool.c Wed Oct 21 16:30:34 2020 (r366913) +++ head/sys/dev/ntb/test/ntb_tool.c Wed Oct 21 17:11:57 2020 (r366914) @@ -384,7 +384,7 @@ get_ubuf(struct sysctl_req *req, char *ubuf) static int read_out(struct sysctl_req *req, uint64_t val) { - char ubuf[16]; + char ubuf[19]; memset((void *)ubuf, 0, sizeof(ubuf)); snprintf(ubuf, sizeof(ubuf), "0x%jx", val); From owner-svn-src-head@freebsd.org Wed Oct 21 18:45:49 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37FE242A68E; Wed, 21 Oct 2020 18:45:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGfZj0jgPz4cXS; Wed, 21 Oct 2020 18:45:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBAC4A581; Wed, 21 Oct 2020 18:45:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09LIjmVN080168; Wed, 21 Oct 2020 18:45:48 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09LIjmZ5080167; Wed, 21 Oct 2020 18:45:48 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010211845.09LIjmZ5080167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 21 Oct 2020 18:45:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366915 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 366915 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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, 21 Oct 2020 18:45:49 -0000 Author: trasz Date: Wed Oct 21 18:45:48 2020 New Revision: 366915 URL: https://svnweb.freebsd.org/changeset/base/366915 Log: Make linux(4) warn about unsupported socket(2) types. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25680 Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Wed Oct 21 17:11:57 2020 (r366914) +++ head/sys/compat/linux/linux_socket.c Wed Oct 21 18:45:48 2020 (r366915) @@ -513,8 +513,11 @@ linux_socket(struct thread *td, struct linux_socket_ar if (retval_socket != 0) return (retval_socket); domain = linux_to_bsd_domain(args->domain); - if (domain == -1) + if (domain == -1) { + linux_msg(curthread, "unsupported socket domain %d, type %d, protocol %d", + args->domain, args->type & LINUX_SOCK_TYPE_MASK, args->protocol); return (EAFNOSUPPORT); + } retval_socket = kern_socket(td, domain, type, args->protocol); if (retval_socket) From owner-svn-src-head@freebsd.org Wed Oct 21 20:42:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D62642D070; Wed, 21 Oct 2020 20:42:30 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGj9L21CJz3Wg5; Wed, 21 Oct 2020 20:42:30 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 286A4B657; Wed, 21 Oct 2020 20:42:30 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09LKgUGO055768; Wed, 21 Oct 2020 20:42:30 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09LKgUbR055767; Wed, 21 Oct 2020 20:42:30 GMT (envelope-from np@FreeBSD.org) Message-Id: <202010212042.09LKgUbR055767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 21 Oct 2020 20:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366916 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 366916 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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, 21 Oct 2020 20:42:30 -0000 Author: np Date: Wed Oct 21 20:42:29 2020 New Revision: 366916 URL: https://svnweb.freebsd.org/changeset/base/366916 Log: cxgbe(4): display correct tid range for T6 based -SO cards. Reported by: Chelsio QA MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Wed Oct 21 18:45:48 2020 (r366915) +++ head/sys/dev/cxgbe/t4_main.c Wed Oct 21 20:42:29 2020 (r366916) @@ -9325,8 +9325,10 @@ sysctl_tids(SYSCTL_HANDLER_ARGS) if (b) sbuf_printf(sb, "%u-%u, ", t->tid_base, b - 1); sbuf_printf(sb, "%u-%u", hb, t->ntids - 1); - } else - sbuf_printf(sb, "%u-%u", t->tid_base, t->ntids - 1); + } else { + sbuf_printf(sb, "%u-%u", t->tid_base, t->tid_base + + t->ntids - 1); + } sbuf_printf(sb, ", in use: %u\n", atomic_load_acq_int(&t->tids_in_use)); } From owner-svn-src-head@freebsd.org Wed Oct 21 21:28:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4CB842DE68; Wed, 21 Oct 2020 21:28:22 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGkBG5Ylkz3YkF; Wed, 21 Oct 2020 21:28:22 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1F29BE70; Wed, 21 Oct 2020 21:28:22 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09LLSMfL080767; Wed, 21 Oct 2020 21:28:22 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09LLSK8d080756; Wed, 21 Oct 2020 21:28:20 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202010212128.09LLSK8d080756@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Wed, 21 Oct 2020 21:28:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366917 - in head: sbin/ifconfig sys/net tests/sys/net X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head: sbin/ifconfig sys/net tests/sys/net X-SVN-Commit-Revision: 366917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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, 21 Oct 2020 21:28:22 -0000 Author: melifaro Date: Wed Oct 21 21:28:20 2020 New Revision: 366917 URL: https://svnweb.freebsd.org/changeset/base/366917 Log: Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q). 802.1ad interfaces are created with ifconfig using the "vlanproto" parameter. Eg., the following creates a 802.1Q VLAN (id #42) over a 802.1ad S-VLAN (id #5) over a physical Ethernet interface (em0). ifconfig vlan5 create vlandev em0 vlan 5 vlanproto 802.1ad up ifconfig vlan42 create vlandev vlan5 vlan 42 inet 10.5.42.1/24 VLAN_MTU, VLAN_HWCSUM and VLAN_TSO capabilities should be properly supported. VLAN_HWTAGGING is only partially supported, as there is currently no IFCAP_VLAN_* denoting the possibility to set the VLAN EtherType to anything else than 0x8100 (802.1ad uses 0x88A8). Submitted by: Olivier Piras Sponsored by: RG Nets Differential Revision: https://reviews.freebsd.org/D26436 Modified: head/sbin/ifconfig/ifclone.c head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifconfig.h head/sbin/ifconfig/ifieee80211.c head/sbin/ifconfig/ifvlan.c head/sbin/ifconfig/ifvxlan.c head/sys/net/ethernet.h head/sys/net/if_clone.c head/sys/net/if_ethersubr.c head/sys/net/if_vlan.c head/sys/net/if_vlan_var.h head/tests/sys/net/if_vlan.sh Modified: head/sbin/ifconfig/ifclone.c ============================================================================== --- head/sbin/ifconfig/ifclone.c Wed Oct 21 20:42:29 2020 (r366916) +++ head/sbin/ifconfig/ifclone.c Wed Oct 21 21:28:20 2020 (r366917) @@ -49,6 +49,11 @@ static const char rcsid[] = #include "ifconfig.h" +typedef enum { + MT_PREFIX, + MT_FILTER, +} clone_match_type; + static void list_cloners(void) { @@ -76,7 +81,11 @@ list_cloners(void) } struct clone_defcb { - char ifprefix[IFNAMSIZ]; + union { + char ifprefix[IFNAMSIZ]; + clone_match_func *ifmatch; + }; + clone_match_type clone_mt; clone_callback_func *clone_cb; SLIST_ENTRY(clone_defcb) next; }; @@ -85,16 +94,29 @@ static SLIST_HEAD(, clone_defcb) clone_defcbh = SLIST_HEAD_INITIALIZER(clone_defcbh); void -clone_setdefcallback(const char *ifprefix, clone_callback_func *p) +clone_setdefcallback_prefix(const char *ifprefix, clone_callback_func *p) { struct clone_defcb *dcp; dcp = malloc(sizeof(*dcp)); strlcpy(dcp->ifprefix, ifprefix, IFNAMSIZ-1); + dcp->clone_mt = MT_PREFIX; dcp->clone_cb = p; SLIST_INSERT_HEAD(&clone_defcbh, dcp, next); } +void +clone_setdefcallback_filter(clone_match_func *filter, clone_callback_func *p) +{ + struct clone_defcb *dcp; + + dcp = malloc(sizeof(*dcp)); + dcp->ifmatch = filter; + dcp->clone_mt = MT_FILTER; + dcp->clone_cb = p; + SLIST_INSERT_HEAD(&clone_defcbh, dcp, next); +} + /* * Do the actual clone operation. Any parameters must have been * setup by now. If a callback has been setup to do the work @@ -114,8 +136,14 @@ ifclonecreate(int s, void *arg) if (clone_cb == NULL) { /* Try to find a default callback */ SLIST_FOREACH(dcp, &clone_defcbh, next) { - if (strncmp(dcp->ifprefix, ifr.ifr_name, - strlen(dcp->ifprefix)) == 0) { + if ((dcp->clone_mt == MT_PREFIX) && + (strncmp(dcp->ifprefix, ifr.ifr_name, + strlen(dcp->ifprefix)) == 0)) { + clone_cb = dcp->clone_cb; + break; + } + if ((dcp->clone_mt == MT_FILTER) && + dcp->ifmatch(ifr.ifr_name)) { clone_cb = dcp->clone_cb; break; } Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Wed Oct 21 20:42:29 2020 (r366916) +++ head/sbin/ifconfig/ifconfig.8 Wed Oct 21 21:28:20 2020 (r366917) @@ -582,7 +582,7 @@ they support in their capabilities. is a synonym for enabling all available WOL mechanisms. To disable WOL use .Fl wol . -.It Cm vlanmtu , vlanhwtag, vlanhwfilter, vlanhwcsum, vlanhwtso +.It Cm vlanmtu , vlanhwtag , vlanhwfilter , vlanhwcsum , vlanhwtso If the driver offers user-configurable VLAN support, enable reception of extended frames, tag processing in hardware, frame filtering in hardware, checksum offloading, or TSO on VLAN, @@ -592,7 +592,7 @@ Note that this must be configured on a physical interf not on a .Xr vlan 4 interface itself. -.It Fl vlanmtu , vlanhwtag , vlanhwfilter , vlanhwtso +.It Fl vlanmtu , vlanhwtag, vlanhwfilter, vlanhwtso If the driver offers user-configurable VLAN support, disable reception of extended frames, tag processing in hardware, frame filtering in hardware, or TSO on VLAN, @@ -2696,7 +2696,7 @@ interfaces: Set the VLAN tag value to .Ar vlan_tag . This value is a 12-bit VLAN Identifier (VID) which is used to create an 802.1Q -VLAN header for packets sent from the +or 802.1ad VLAN header for packets sent from the .Xr vlan 4 interface. Note that @@ -2704,6 +2704,15 @@ Note that and .Cm vlandev must both be set at the same time. +.It Cm vlanproto Ar vlan_proto +Set the VLAN encapsulation protocol to +.Ar vlan_proto . +Supported encapsulation protocols are currently +.Dq 802.1Q +and +.Dq 802.1ad . +The default encapsulation protocol is +.Dq 802.1Q . .It Cm vlanpcp Ar priority_code_point Priority code point .Pq Dv PCP Modified: head/sbin/ifconfig/ifconfig.h ============================================================================== --- head/sbin/ifconfig/ifconfig.h Wed Oct 21 20:42:29 2020 (r366916) +++ head/sbin/ifconfig/ifconfig.h Wed Oct 21 21:28:20 2020 (r366917) @@ -145,8 +145,10 @@ void printb(const char *s, unsigned value, const char void ifmaybeload(const char *name); +typedef int clone_match_func(const char *); typedef void clone_callback_func(int, struct ifreq *); -void clone_setdefcallback(const char *, clone_callback_func *); +void clone_setdefcallback_prefix(const char *, clone_callback_func *); +void clone_setdefcallback_filter(clone_match_func *, clone_callback_func *); void sfp_status(int s, struct ifreq *ifr, int verbose); Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Wed Oct 21 20:42:29 2020 (r366916) +++ head/sbin/ifconfig/ifieee80211.c Wed Oct 21 21:28:20 2020 (r366917) @@ -6069,5 +6069,5 @@ ieee80211_ctor(void) for (i = 0; i < nitems(ieee80211_cmds); i++) cmd_register(&ieee80211_cmds[i]); af_register(&af_ieee80211); - clone_setdefcallback("wlan", wlan_create); + clone_setdefcallback_prefix("wlan", wlan_create); } Modified: head/sbin/ifconfig/ifvlan.c ============================================================================== --- head/sbin/ifconfig/ifvlan.c Wed Oct 21 20:42:29 2020 (r366916) +++ head/sbin/ifconfig/ifvlan.c Wed Oct 21 21:28:20 2020 (r366917) @@ -66,8 +66,12 @@ static const char rcsid[] = #define NOTAG ((u_short) -1) +static const char proto_8021Q[] = "802.1q"; +static const char proto_8021ad[] = "802.1ad"; + static struct vlanreq params = { .vlr_tag = NOTAG, + .vlr_proto = ETHERTYPE_VLAN, }; static int @@ -87,6 +91,17 @@ vlan_status(int s) if (getvlan(s, &ifr, &vreq) == -1) return; printf("\tvlan: %d", vreq.vlr_tag); + printf(" vlanproto: "); + switch (vreq.vlr_proto) { + case ETHERTYPE_VLAN: + printf(proto_8021Q); + break; + case ETHERTYPE_QINQ: + printf(proto_8021ad); + break; + default: + printf("0x%04x", vreq.vlr_proto); + } if (ioctl(s, SIOCGVLANPCP, (caddr_t)&ifr) != -1) printf(" vlanpcp: %u", ifr.ifr_vlan_pcp); printf(" parent interface: %s", vreq.vlr_parent[0] == '\0' ? @@ -94,9 +109,49 @@ vlan_status(int s) printf("\n"); } +static int +vlan_match_ethervid(const char *name) +{ + return (strchr(name, '.') != NULL); +} + static void +vlan_parse_ethervid(const char *name) +{ + char ifname[IFNAMSIZ]; + char *cp; + int vid; + + strlcpy(ifname, name, IFNAMSIZ); + if ((cp = strrchr(ifname, '.')) == NULL) + return; + /* + * Don't mix vlan/vlandev parameters with dot notation. + */ + if (params.vlr_tag != NOTAG || params.vlr_parent[0] != '\0') + errx(1, "ambiguous vlan specification"); + /* + * Derive params from interface name: "parent.vid". + */ + *cp++ = '\0'; + if ((*cp < '1') || (*cp > '9')) + errx(1, "invalid vlan tag"); + + vid = *cp++ - '0'; + while ((*cp >= '0') && (*cp <= '9')) + vid = (vid * 10) + (*cp++ - '0'); + if ((*cp != '\0') || (vid & ~0xFFF)) + errx(1, "invalid vlan tag"); + + strlcpy(params.vlr_parent, ifname, IFNAMSIZ); + params.vlr_tag = (vid & 0xFFF); +} + +static void vlan_create(int s, struct ifreq *ifr) { + vlan_parse_ethervid(ifr->ifr_name); + if (params.vlr_tag != NOTAG || params.vlr_parent[0] != '\0') { /* * One or both parameters were specified, make sure both. @@ -159,6 +214,24 @@ DECL_CMD_FUNC(setvlandev, val, d) } static +DECL_CMD_FUNC(setvlanproto, val, d) +{ + struct vlanreq vreq; + + if (strncasecmp(proto_8021Q, val, + strlen(proto_8021Q)) == 0) { + params.vlr_proto = ETHERTYPE_VLAN; + } else if (strncasecmp(proto_8021ad, val, + strlen(proto_8021ad)) == 0) { + params.vlr_proto = ETHERTYPE_QINQ; + } else + errx(1, "invalid value for vlanproto"); + + if (getvlan(s, &ifr, &vreq) != -1) + vlan_set(s, &ifr); +} + +static DECL_CMD_FUNC(setvlanpcp, val, d) { u_long ul; @@ -195,10 +268,12 @@ DECL_CMD_FUNC(unsetvlandev, val, d) static struct cmd vlan_cmds[] = { DEF_CLONE_CMD_ARG("vlan", setvlantag), DEF_CLONE_CMD_ARG("vlandev", setvlandev), + DEF_CLONE_CMD_ARG("vlanproto", setvlanproto), DEF_CMD_ARG("vlanpcp", setvlanpcp), /* NB: non-clone cmds */ DEF_CMD_ARG("vlan", setvlantag), DEF_CMD_ARG("vlandev", setvlandev), + DEF_CMD_ARG("vlanproto", setvlanproto), /* XXX For compatibility. Should become DEF_CMD() some day. */ DEF_CMD_OPTARG("-vlandev", unsetvlandev), DEF_CMD("vlanmtu", IFCAP_VLAN_MTU, setifcap), @@ -227,5 +302,6 @@ vlan_ctor(void) cmd_register(&vlan_cmds[i]); af_register(&af_vlan); callback_register(vlan_cb, NULL); - clone_setdefcallback("vlan", vlan_create); + clone_setdefcallback_prefix("vlan", vlan_create); + clone_setdefcallback_filter(vlan_match_ethervid, vlan_create); } Modified: head/sbin/ifconfig/ifvxlan.c ============================================================================== --- head/sbin/ifconfig/ifvxlan.c Wed Oct 21 20:42:29 2020 (r366916) +++ head/sbin/ifconfig/ifvxlan.c Wed Oct 21 21:28:20 2020 (r366917) @@ -642,5 +642,5 @@ vxlan_ctor(void) cmd_register(&vxlan_cmds[i]); af_register(&af_vxlan); callback_register(vxlan_cb, NULL); - clone_setdefcallback("vxlan", vxlan_create); + clone_setdefcallback_prefix("vxlan", vxlan_create); } Modified: head/sys/net/ethernet.h ============================================================================== --- head/sys/net/ethernet.h Wed Oct 21 20:42:29 2020 (r366916) +++ head/sys/net/ethernet.h Wed Oct 21 21:28:20 2020 (r366917) @@ -428,6 +428,7 @@ struct mbuf; struct route; struct sockaddr; struct bpf_if; +struct ether_8021q_tag; extern uint32_t ether_crc32_le(const uint8_t *, size_t); extern uint32_t ether_crc32_be(const uint8_t *, size_t); @@ -441,10 +442,16 @@ extern int ether_output_frame(struct ifnet *, struct extern char *ether_sprintf(const u_int8_t *); void ether_vlan_mtap(struct bpf_if *, struct mbuf *, void *, u_int); -struct mbuf *ether_vlanencap(struct mbuf *, uint16_t); -bool ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p, - uint16_t vid, uint8_t pcp); +struct mbuf *ether_vlanencap_proto(struct mbuf *, uint16_t, uint16_t); +bool ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, + struct ifnet *p, struct ether_8021q_tag *); void ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr); + +static __inline struct mbuf *ether_vlanencap(struct mbuf *m, uint16_t tag) +{ + + return ether_vlanencap_proto(m, tag, ETHERTYPE_VLAN); +} /* new ethernet interface attached event */ typedef void (*ether_ifattach_event_handler_t)(void *, struct ifnet *); Modified: head/sys/net/if_clone.c ============================================================================== --- head/sys/net/if_clone.c Wed Oct 21 20:42:29 2020 (r366916) +++ head/sys/net/if_clone.c Wed Oct 21 21:28:20 2020 (r366917) @@ -571,7 +571,7 @@ if_clone_addgroup(struct ifnet *ifp, struct if_clone * /* * A utility function to extract unit numbers from interface names of - * the form name###. + * the form name###[.###]. * * Returns 0 on success and an error on failure. */ @@ -582,7 +582,9 @@ ifc_name2unit(const char *name, int *unit) int cutoff = INT_MAX / 10; int cutlim = INT_MAX % 10; - for (cp = name; *cp != '\0' && (*cp < '0' || *cp > '9'); cp++); + if ((cp = strrchr(name, '.')) == NULL) + cp = name; + for (; *cp != '\0' && (*cp < '0' || *cp > '9'); cp++); if (*cp == '\0') { *unit = -1; } else if (cp[0] == '0' && cp[1] != '\0') { Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Wed Oct 21 20:42:29 2020 (r366916) +++ head/sys/net/if_ethersubr.c Wed Oct 21 21:28:20 2020 (r366917) @@ -441,12 +441,19 @@ bad: if (m != NULL) static bool ether_set_pcp(struct mbuf **mp, struct ifnet *ifp, uint8_t pcp) { + struct ether_8021q_tag qtag; struct ether_header *eh; eh = mtod(*mp, struct ether_header *); if (ntohs(eh->ether_type) == ETHERTYPE_VLAN || - ether_8021q_frame(mp, ifp, ifp, 0, pcp)) + ntohs(eh->ether_type) == ETHERTYPE_QINQ) return (true); + + qtag.vid = 0; + qtag.pcp = pcp; + qtag.proto = ETHERTYPE_VLAN; + if (ether_8021q_frame(mp, ifp, ifp, &qtag)) + return (true); if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return (false); } @@ -616,9 +623,9 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m * If the hardware did not process an 802.1Q tag, do this now, * to allow 802.1P priority frames to be passed to the main input * path correctly. - * TODO: Deal with Q-in-Q frames, but not arbitrary nesting levels. */ - if ((m->m_flags & M_VLANTAG) == 0 && etype == ETHERTYPE_VLAN) { + if ((m->m_flags & M_VLANTAG) == 0 && + ((etype == ETHERTYPE_VLAN) || (etype == ETHERTYPE_QINQ))) { struct ether_vlan_header *evl; if (m->m_len < sizeof(*evl) && @@ -1303,7 +1310,7 @@ ether_vlan_mtap(struct bpf_if *bp, struct mbuf *m, voi } struct mbuf * -ether_vlanencap(struct mbuf *m, uint16_t tag) +ether_vlanencap_proto(struct mbuf *m, uint16_t tag, uint16_t proto) { struct ether_vlan_header *evl; @@ -1325,7 +1332,7 @@ ether_vlanencap(struct mbuf *m, uint16_t tag) evl = mtod(m, struct ether_vlan_header *); bcopy((char *)evl + ETHER_VLAN_ENCAP_LEN, (char *)evl, ETHER_HDR_LEN - ETHER_TYPE_LEN); - evl->evl_encap_proto = htons(ETHERTYPE_VLAN); + evl->evl_encap_proto = htons(proto); evl->evl_tag = htons(tag); return (m); } @@ -1354,7 +1361,7 @@ SYSCTL_INT(_net_link_vlan, OID_AUTO, mtag_pcp, CTLFLAG bool ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p, - uint16_t vid, uint8_t pcp) + struct ether_8021q_tag *qtag) { struct m_tag *mtag; int n; @@ -1391,7 +1398,7 @@ ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, * If PCP is set in mbuf, use it */ if ((*mp)->m_flags & M_VLANTAG) { - pcp = EVL_PRIOFTAG((*mp)->m_pkthdr.ether_vtag); + qtag->pcp = EVL_PRIOFTAG((*mp)->m_pkthdr.ether_vtag); } /* @@ -1403,14 +1410,15 @@ ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, */ if (vlan_mtag_pcp && (mtag = m_tag_locate(*mp, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL)) != NULL) - tag = EVL_MAKETAG(vid, *(uint8_t *)(mtag + 1), 0); + tag = EVL_MAKETAG(qtag->vid, *(uint8_t *)(mtag + 1), 0); else - tag = EVL_MAKETAG(vid, pcp, 0); - if (p->if_capenable & IFCAP_VLAN_HWTAGGING) { + tag = EVL_MAKETAG(qtag->vid, qtag->pcp, 0); + if ((p->if_capenable & IFCAP_VLAN_HWTAGGING) && + (qtag->proto == ETHERTYPE_VLAN)) { (*mp)->m_pkthdr.ether_vtag = tag; (*mp)->m_flags |= M_VLANTAG; } else { - *mp = ether_vlanencap(*mp, tag); + *mp = ether_vlanencap_proto(*mp, tag, qtag->proto); if (*mp == NULL) { if_printf(ife, "unable to prepend 802.1Q header"); return (false); Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Wed Oct 21 20:42:29 2020 (r366916) +++ head/sys/net/if_vlan.c Wed Oct 21 21:28:20 2020 (r366917) @@ -17,7 +17,7 @@ * no representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. - * + * * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF @@ -185,17 +185,17 @@ struct ifvlan { struct ifvlantrunk *ifv_trunk; struct ifnet *ifv_ifp; #define TRUNK(ifv) ((ifv)->ifv_trunk) -#define PARENT(ifv) ((ifv)->ifv_trunk->parent) +#define PARENT(ifv) (TRUNK(ifv)->parent) void *ifv_cookie; int ifv_pflags; /* special flags we have set on parent */ int ifv_capenable; int ifv_encaplen; /* encapsulation length */ int ifv_mtufudge; /* MTU fudged by this much */ int ifv_mintu; /* min transmission unit */ - uint16_t ifv_proto; /* encapsulation ethertype */ - uint16_t ifv_tag; /* tag to apply on packets leaving if */ - uint16_t ifv_vid; /* VLAN ID */ - uint8_t ifv_pcp; /* Priority Code Point (PCP). */ + struct ether_8021q_tag ifv_qtag; +#define ifv_proto ifv_qtag.proto +#define ifv_vid ifv_qtag.vid +#define ifv_pcp ifv_qtag.pcp struct task lladdr_task; CK_SLIST_HEAD(, vlan_mc_entry) vlan_mc_listhead; #ifndef VLAN_ARRAY @@ -222,9 +222,9 @@ static eventhandler_tag ifdetach_tag; static eventhandler_tag iflladdr_tag; /* - * if_vlan uses two module-level synchronizations primitives to allow concurrent - * modification of vlan interfaces and (mostly) allow for vlans to be destroyed - * while they are being used for tx/rx. To accomplish this in a way that has + * if_vlan uses two module-level synchronizations primitives to allow concurrent + * modification of vlan interfaces and (mostly) allow for vlans to be destroyed + * while they are being used for tx/rx. To accomplish this in a way that has * acceptable performance and cooperation with other parts of the network stack * there is a non-sleepable epoch(9) and an sx(9). * @@ -244,7 +244,7 @@ static eventhandler_tag iflladdr_tag; static struct sx _VLAN_SX_ID; #define VLAN_LOCKING_INIT() \ - sx_init(&_VLAN_SX_ID, "vlan_sx") + sx_init_flags(&_VLAN_SX_ID, "vlan_sx", SX_RECURSE) #define VLAN_LOCKING_DESTROY() \ sx_destroy(&_VLAN_SX_ID) @@ -306,7 +306,8 @@ static int vlan_output(struct ifnet *ifp, struct mbuf const struct sockaddr *dst, struct route *ro); static void vlan_unconfig(struct ifnet *ifp); static void vlan_unconfig_locked(struct ifnet *ifp, int departing); -static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag); +static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag, + uint16_t proto); static void vlan_link_state(struct ifnet *ifp); static void vlan_capabilities(struct ifvlan *ifv); static void vlan_trunk_capabilities(struct ifnet *ifp); @@ -760,7 +761,7 @@ vlan_pcp(struct ifnet *ifp, uint16_t *pcpp) /* * Return a driver specific cookie for this interface. Synchronization - * with setcookie must be provided by the driver. + * with setcookie must be provided by the driver. */ static void * vlan_cookie(struct ifnet *ifp) @@ -811,16 +812,6 @@ vlan_devat(struct ifnet *ifp, uint16_t vid) } /* - * Recalculate the cached VLAN tag exposed via the MIB. - */ -static void -vlan_tag_recalculate(struct ifvlan *ifv) -{ - - ifv->ifv_tag = EVL_MAKETAG(ifv->ifv_vid, ifv->ifv_pcp, 0); -} - -/* * VLAN support can be loaded as a module. The only place in the * system that's intimately aware of this is ether_input. We hook * into this code through vlan_input_p which is defined there and @@ -867,7 +858,7 @@ vlan_modevent(module_t mod, int type, void *data) #else "hash tables with chaining" #endif - + "\n"); break; case MOD_UNLOAD: @@ -926,7 +917,7 @@ VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_INIT_IF, SI_OR #endif /* - * Check for . style interface names. + * Check for .[. ...] style interface names. */ static struct ifnet * vlan_clone_match_ethervid(const char *name, int *vidp) @@ -937,7 +928,7 @@ vlan_clone_match_ethervid(const char *name, int *vidp) int vid; strlcpy(ifname, name, IFNAMSIZ); - if ((cp = strchr(ifname, '.')) == NULL) + if ((cp = strrchr(ifname, '.')) == NULL) return (NULL); *cp = '\0'; if ((ifp = ifunit_ref(ifname)) == NULL) @@ -990,6 +981,7 @@ vlan_clone_create(struct if_clone *ifc, char *name, si int unit; int error; int vid; + uint16_t proto; struct ifvlan *ifv; struct ifnet *ifp; struct ifnet *p; @@ -998,14 +990,15 @@ vlan_clone_create(struct if_clone *ifc, char *name, si struct vlanreq vlr; static const u_char eaddr[ETHER_ADDR_LEN]; /* 00:00:00:00:00:00 */ + proto = ETHERTYPE_VLAN; + /* - * There are 3 (ugh) ways to specify the cloned device: + * There are two ways to specify the cloned device: * o pass a parameter block with the clone request. - * o specify parameters in the text of the clone device name * o specify no parameters and get an unattached device that * must be configured separately. - * The first technique is preferred; the latter two are - * supported for backwards compatibility. + * The first technique is preferred; the latter is supported + * for backwards compatibility. * * XXXRW: Note historic use of the word "tag" here. New ioctls may be * called for. @@ -1023,10 +1016,8 @@ vlan_clone_create(struct if_clone *ifc, char *name, si return (error); } vid = vlr.vlr_tag; + proto = vlr.vlr_proto; wildcard = (unit < 0); - } else if ((p = vlan_clone_match_ethervid(name, &vid)) != NULL) { - unit = -1; - wildcard = 0; } else { p = NULL; error = ifc_name2unit(name, &unit); @@ -1092,7 +1083,7 @@ vlan_clone_create(struct if_clone *ifc, char *name, si sdl->sdl_type = IFT_L2VLAN; if (p != NULL) { - error = vlan_config(ifv, p, vid); + error = vlan_config(ifv, p, vid, proto); if_rele(p); if (error != 0) { /* @@ -1117,8 +1108,10 @@ static int vlan_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) { struct ifvlan *ifv = ifp->if_softc; - int unit = ifp->if_dunit; + if (ifp->if_vlantrunk) + return (EBUSY); + ether_ifdetach(ifp); /* first, remove it from system-wide lists */ vlan_unconfig(ifp); /* now it can be unconfigured and freed */ /* @@ -1130,7 +1123,7 @@ vlan_clone_destroy(struct if_clone *ifc, struct ifnet NET_EPOCH_WAIT(); if_free(ifp); free(ifv, M_VLAN); - ifc_free_unit(ifc, unit); + ifc_free_unit(ifc, ifp->if_dunit); return (0); } @@ -1196,7 +1189,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) return (ENETDOWN); } - if (!ether_8021q_frame(&m, ifp, p, ifv->ifv_vid, ifv->ifv_pcp)) { + if (!ether_8021q_frame(&m, ifp, p, &ifv->ifv_qtag)) { if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return (0); } @@ -1223,12 +1216,19 @@ vlan_output(struct ifnet *ifp, struct mbuf *m, const s NET_EPOCH_ASSERT(); + /* + * Find the first non-VLAN parent interface. + */ ifv = ifp->if_softc; - if (TRUNK(ifv) == NULL) { - m_freem(m); - return (ENETDOWN); - } - p = PARENT(ifv); + do { + if (TRUNK(ifv) == NULL) { + m_freem(m); + return (ENETDOWN); + } + p = PARENT(ifv); + ifv = p->if_softc; + } while (p->if_type == IFT_L2VLAN); + return p->if_output(ifp, m, dst, ro); } @@ -1357,7 +1357,8 @@ vlan_lladdr_fn(void *arg, int pending __unused) } static int -vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t vid) +vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t vid, + uint16_t proto) { struct epoch_tracker et; struct ifvlantrunk *trunk; @@ -1369,6 +1370,7 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint1 * they handle the tagging and headers themselves. */ if (p->if_type != IFT_ETHER && + p->if_type != IFT_L2VLAN && (p->if_capenable & IFCAP_VLAN_HWTAGGING) == 0) return (EPROTONOSUPPORT); if ((p->if_flags & VLAN_IFFLAGS) != VLAN_IFFLAGS) @@ -1400,11 +1402,10 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint1 ifv->ifv_vid = vid; /* must set this before vlan_inshash() */ ifv->ifv_pcp = 0; /* Default: best effort delivery. */ - vlan_tag_recalculate(ifv); error = vlan_inshash(trunk, ifv); if (error) goto done; - ifv->ifv_proto = ETHERTYPE_VLAN; + ifv->ifv_proto = proto; ifv->ifv_encaplen = ETHER_VLAN_ENCAP_LEN; ifv->ifv_mintu = ETHERMIN; ifv->ifv_pflags = 0; @@ -1915,7 +1916,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data break; } oldmtu = ifp->if_mtu; - error = vlan_config(ifv, p, vlr.vlr_tag); + error = vlan_config(ifv, p, vlr.vlr_tag, vlr.vlr_proto); if_rele(p); /* @@ -1943,11 +1944,12 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data strlcpy(vlr.vlr_parent, PARENT(ifv)->if_xname, sizeof(vlr.vlr_parent)); vlr.vlr_tag = ifv->ifv_vid; + vlr.vlr_proto = ifv->ifv_proto; } VLAN_SUNLOCK(); error = copyout(&vlr, ifr_data_get_ptr(ifr), sizeof(vlr)); break; - + case SIOCSIFFLAGS: /* * We should propagate selected flags to the parent, @@ -2001,7 +2003,6 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data } ifv->ifv_pcp = ifr->ifr_vlan_pcp; ifp->if_pcp = ifv->ifv_pcp; - vlan_tag_recalculate(ifv); /* broadcast event about PCP change */ EVENTHANDLER_INVOKE(ifnet_event, ifp, IFNET_EVENT_PCP); break; Modified: head/sys/net/if_vlan_var.h ============================================================================== --- head/sys/net/if_vlan_var.h Wed Oct 21 20:42:29 2020 (r366916) +++ head/sys/net/if_vlan_var.h Wed Oct 21 21:28:20 2020 (r366917) @@ -69,6 +69,7 @@ struct vlanreq { char vlr_parent[IFNAMSIZ]; u_short vlr_tag; + u_short vlr_proto; }; #define SIOCSETVLAN SIOCSIFGENERIC #define SIOCGETVLAN SIOCGIFGENERIC @@ -122,6 +123,15 @@ struct vlanreq { #define MTAG_8021Q 1326104895 #define MTAG_8021Q_PCP_IN 0 /* Input priority. */ #define MTAG_8021Q_PCP_OUT 1 /* Output priority. */ + +/* + * 802.1q full tag. Proto and vid are stored in host byte order. + */ +struct ether_8021q_tag { + uint16_t proto; + uint16_t vid; + uint8_t pcp; +}; #define VLAN_CAPABILITIES(_ifp) do { \ if ((_ifp)->if_vlantrunk != NULL) \ Modified: head/tests/sys/net/if_vlan.sh ============================================================================== --- head/tests/sys/net/if_vlan.sh Wed Oct 21 20:42:29 2020 (r366916) +++ head/tests/sys/net/if_vlan.sh Wed Oct 21 21:28:20 2020 (r366917) @@ -36,7 +36,185 @@ basic_cleanup() vnet_cleanup } +# Simple Q-in-Q (802.1Q over 802.1ad) + +atf_test_case "qinq_simple" "cleanup" +qinq_simple_head() +{ + atf_set descr 'Simple Q-in-Q test (802.1Q over 802.1ad)' + atf_set require.user root +} + +qinq_simple_body() +{ + vnet_init + + epair_qinq=$(vnet_mkepair) + + vnet_mkjail jqinq0 ${epair_qinq}a + vnet_mkjail jqinq1 ${epair_qinq}b + + vlan5a=$(jexec jqinq0 ifconfig vlan create \ + vlandev ${epair_qinq}a vlan 5 vlanproto 802.1ad) + vlan42a=$(jexec jqinq0 ifconfig vlan create \ + vlandev ${vlan5a} vlan 42 vlanproto 802.1q) + jexec jqinq0 ifconfig ${epair_qinq}a up + jexec jqinq0 ifconfig ${vlan5a} up + jexec jqinq0 ifconfig ${vlan42a} 10.5.42.1/24 up + + vlan5b=$(jexec jqinq1 ifconfig vlan create \ + vlandev ${epair_qinq}b vlan 5 vlanproto 802.1ad) + vlan42b=$(jexec jqinq1 ifconfig vlan create \ + vlandev ${vlan5b} vlan 42 vlanproto 802.1q) + jexec jqinq1 ifconfig ${epair_qinq}b up + jexec jqinq1 ifconfig ${vlan5b} up + jexec jqinq1 ifconfig ${vlan42b} 10.5.42.2/24 up + + atf_check -s exit:0 -o ignore jexec jqinq1 ping -c 1 10.5.42.1 +} + +qinq_simple_cleanup() +{ + vnet_cleanup +} + +# Deep Q-in-Q (802.1Q over 802.1ad over 802.1ad) + +atf_test_case "qinq_deep" "cleanup" +qinq_deep_head() +{ + atf_set descr 'Deep Q-in-Q test (802.1Q over 802.1ad over 802.1ad)' + atf_set require.user root +} + +qinq_deep_body() +{ + vnet_init + + epair_qinq=$(vnet_mkepair) + + vnet_mkjail jqinq2 ${epair_qinq}a + vnet_mkjail jqinq3 ${epair_qinq}b + + vlan5a=$(jexec jqinq2 ifconfig vlan create \ + vlandev ${epair_qinq}a vlan 5 vlanproto 802.1ad) + vlan6a=$(jexec jqinq2 ifconfig vlan create \ + vlandev ${vlan5a} vlan 6 vlanproto 802.1ad) + vlan42a=$(jexec jqinq2 ifconfig vlan create \ + vlandev ${vlan6a} vlan 42 vlanproto 802.1q) + jexec jqinq2 ifconfig ${epair_qinq}a up + jexec jqinq2 ifconfig ${vlan5a} up + jexec jqinq2 ifconfig ${vlan6a} up + jexec jqinq2 ifconfig ${vlan42a} 10.6.42.1/24 up + + vlan5b=$(jexec jqinq3 ifconfig vlan create \ + vlandev ${epair_qinq}b vlan 5 vlanproto 802.1ad) + vlan6b=$(jexec jqinq3 ifconfig vlan create \ + vlandev ${vlan5b} vlan 6 vlanproto 802.1ad) + vlan42b=$(jexec jqinq3 ifconfig vlan create \ + vlandev ${vlan6b} vlan 42 vlanproto 802.1q) + jexec jqinq3 ifconfig ${epair_qinq}b up + jexec jqinq3 ifconfig ${vlan5b} up + jexec jqinq3 ifconfig ${vlan6b} up + jexec jqinq3 ifconfig ${vlan42b} 10.6.42.2/24 up + + atf_check -s exit:0 -o ignore jexec jqinq3 ping -c 1 10.6.42.1 +} + +qinq_deep_cleanup() +{ + vnet_cleanup +} + +# Legacy Q-in-Q (802.1Q over 802.1Q) + +atf_test_case "qinq_legacy" "cleanup" +qinq_legacy_head() +{ + atf_set descr 'Legacy Q-in-Q test (802.1Q over 802.1Q)' + atf_set require.user root +} + +qinq_legacy_body() +{ + vnet_init + + epair_qinq=$(vnet_mkepair) + + vnet_mkjail jqinq4 ${epair_qinq}a + vnet_mkjail jqinq5 ${epair_qinq}b + + vlan5a=$(jexec jqinq4 ifconfig vlan create \ + vlandev ${epair_qinq}a vlan 5) + vlan42a=$(jexec jqinq4 ifconfig vlan create \ + vlandev ${vlan5a} vlan 42) + jexec jqinq4 ifconfig ${epair_qinq}a up + jexec jqinq4 ifconfig ${vlan5a} up + jexec jqinq4 ifconfig ${vlan42a} 10.5.42.1/24 up + + vlan5b=$(jexec jqinq5 ifconfig vlan create \ + vlandev ${epair_qinq}b vlan 5) + vlan42b=$(jexec jqinq5 ifconfig vlan create \ + vlandev ${vlan5b} vlan 42) + jexec jqinq5 ifconfig ${epair_qinq}b up + jexec jqinq5 ifconfig ${vlan5b} up + jexec jqinq5 ifconfig ${vlan42b} 10.5.42.2/24 up + + atf_check -s exit:0 -o ignore jexec jqinq5 ping -c 1 10.5.42.1 +} + +qinq_legacy_cleanup() +{ + vnet_cleanup +} + +# Simple Q-in-Q with dot notation + +atf_test_case "qinq_dot" "cleanup" +qinq_dot_head() +{ + atf_set descr 'Simple Q-in-Q test with dot notation' + atf_set require.user root +} + +qinq_dot_body() +{ + vnet_init + + epair_qinq=$(vnet_mkepair) + + vnet_mkjail jqinq6 ${epair_qinq}a + vnet_mkjail jqinq7 ${epair_qinq}b + + jexec jqinq6 ifconfig vlan5 create \ + vlandev ${epair_qinq}a vlan 5 vlanproto 802.1ad + jexec jqinq6 ifconfig vlan5.42 create \ + vlanproto 802.1q + jexec jqinq6 ifconfig ${epair_qinq}a up + jexec jqinq6 ifconfig vlan5 up + jexec jqinq6 ifconfig vlan5.42 10.5.42.1/24 up + + vlan5b=$(jexec jqinq7 ifconfig vlan create \ + vlandev ${epair_qinq}b vlan 5 vlanproto 802.1ad) + vlan42b=$(jexec jqinq7 ifconfig vlan create \ + vlandev ${vlan5b} vlan 42 vlanproto 802.1q) + jexec jqinq7 ifconfig ${epair_qinq}b up + jexec jqinq7 ifconfig ${vlan5b} up + jexec jqinq7 ifconfig ${vlan42b} 10.5.42.2/24 up + + atf_check -s exit:0 -o ignore jexec jqinq7 ping -c 1 10.5.42.1 +} + +qinq_dot_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" + atf_add_test_case "qinq_simple" + atf_add_test_case "qinq_deep" + atf_add_test_case "qinq_legacy" + atf_add_test_case "qinq_dot" } From owner-svn-src-head@freebsd.org Wed Oct 21 21:40:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44F8142E16C; Wed, 21 Oct 2020 21:40:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGkSL17hKz3ZPj; Wed, 21 Oct 2020 21:40:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A4DBC4B1; Wed, 21 Oct 2020 21:40:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09LLeXXD087132; Wed, 21 Oct 2020 21:40:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09LLeXIJ087131; Wed, 21 Oct 2020 21:40:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202010212140.09LLeXIJ087131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 21 Oct 2020 21:40:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366918 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 366918 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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, 21 Oct 2020 21:40:34 -0000 Author: kib Date: Wed Oct 21 21:40:33 2020 New Revision: 366918 URL: https://svnweb.freebsd.org/changeset/base/366918 Log: mmap(2): Document guard size for MAP_STACK and related EINVAL. Based on submission by: emaste Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D26894 Modified: head/lib/libc/sys/mmap.2 Modified: head/lib/libc/sys/mmap.2 ============================================================================== --- head/lib/libc/sys/mmap.2 Wed Oct 21 21:28:20 2020 (r366917) +++ head/lib/libc/sys/mmap.2 Wed Oct 21 21:40:33 2020 (r366918) @@ -28,7 +28,7 @@ .\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 .\" $FreeBSD$ .\" -.Dd February 26, 2020 +.Dd October 21, 2020 .Dt MMAP 2 .Os .Sh NAME @@ -351,6 +351,8 @@ Stacks created with automatically grow. Guards prevent inadvertent use of the regions into which those stacks can grow without requiring mapping the whole stack in advance. +The size of the guard, in pages, is specified by sysctl +.Dv security.bsd.stack_guard_page . .El .Pp The @@ -451,6 +453,11 @@ or .Dv MAP_STACK was specified. At least one of these flags must be included. +.It Bq Er EINVAL +.Dv MAP_STACK +was specified and +.Va len +is less than or equal to the guard size. .It Bq Er EINVAL .Dv MAP_FIXED was specified and the From owner-svn-src-head@freebsd.org Thu Oct 22 01:05:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C444435E82; Thu, 22 Oct 2020 01:05:36 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGq0w1m0bz44CJ; Thu, 22 Oct 2020 01:05:36 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F897E739; Thu, 22 Oct 2020 01:05:36 +0000 (UTC) (envelope-from philip@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09M15atl019144; Thu, 22 Oct 2020 01:05:36 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09M15ZGa019139; Thu, 22 Oct 2020 01:05:35 GMT (envelope-from philip@FreeBSD.org) Message-Id: <202010220105.09M15ZGa019139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Thu, 22 Oct 2020 01:05:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366921 - head/contrib/tzdata X-SVN-Group: head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: head/contrib/tzdata X-SVN-Commit-Revision: 366921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 01:05:36 -0000 Author: philip Date: Thu Oct 22 01:05:34 2020 New Revision: 366921 URL: https://svnweb.freebsd.org/changeset/base/366921 Log: Import tzdata 2020c Changes: https://github.com/eggert/tz/blob/2020d/NEWS MFC after: 1 day Modified: head/contrib/tzdata/Makefile head/contrib/tzdata/NEWS head/contrib/tzdata/asia head/contrib/tzdata/europe head/contrib/tzdata/version Directory Properties: head/contrib/tzdata/ (props changed) Modified: head/contrib/tzdata/Makefile ============================================================================== --- head/contrib/tzdata/Makefile Thu Oct 22 01:04:02 2020 (r366920) +++ head/contrib/tzdata/Makefile Thu Oct 22 01:05:34 2020 (r366921) @@ -1023,7 +1023,7 @@ tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-ti sed '1s/$$/-rearguard/' \ tzdata$(VERSION)-rearguard.dir/version : The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier. - touch -md 2020-10-12T22:53:00Z \ + TZ=UTC0 touch -mt 202010122253.00 \ tzdata$(VERSION)-rearguard.dir/pacificnew touch -cmr version tzdata$(VERSION)-rearguard.dir/version LC_ALL=C && export LC_ALL && \ Modified: head/contrib/tzdata/NEWS ============================================================================== --- head/contrib/tzdata/NEWS Thu Oct 22 01:04:02 2020 (r366920) +++ head/contrib/tzdata/NEWS Thu Oct 22 01:05:34 2020 (r366921) @@ -1,5 +1,23 @@ News for the tz database +Release 2020d - 2020-10-21 11:24:13 -0700 + + Briefly: + Palestine ends DST earlier than predicted, on 2020-10-24. + + Changes to past and future timestamps + + Palestine ends DST on 2020-10-24 at 01:00, instead of 2020-10-31 + as previously predicted (thanks to Sharef Mustafa.) Its + 2019-10-26 fall-back was at 00:00, not 01:00 (thanks to Steffen + Thorsen.) Its 2015-10-23 transition was at 01:00 not 00:00, and + its spring 2020 transition was on March 28 at 00:00, not March 27 + (thanks to Pierre Cashon.) This affects Asia/Gaza and + Asia/Hebron. Assume future spring and fall transitions will be on + the Saturday preceding the last Sunday of March and October, + respectively. + + Release 2020c - 2020-10-16 11:15:53 -0700 Briefly: Modified: head/contrib/tzdata/asia ============================================================================== --- head/contrib/tzdata/asia Thu Oct 22 01:04:02 2020 (r366920) +++ head/contrib/tzdata/asia Thu Oct 22 01:05:34 2020 (r366921) @@ -3221,14 +3221,41 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # From Sharef Mustafa (2019-10-18): # Palestine summer time will end on midnight Oct 26th 2019 ... -# http://www.palestinecabinet.gov.ps/website/ar/ViewDetails?ID=43948 # -# From Paul Eggert (2019-04-10): -# For now, guess spring-ahead transitions are March's last Friday at 00:00. +# From Steffen Thorsen (2020-10-20): +# Some sources such as these say, and display on clocks, that DST ended at +# midnight last year... +# https://www.amad.ps/ar/post/320006 # -# From Tim Parenti (2016-10-19): -# Predict fall transitions on October's last Saturday at 01:00 from now on. +# From Tim Parenti (2020-10-20): +# The report of the Palestinian Cabinet meeting of 2019-10-14 confirms +# a decision on (translated): "The start of the winter time in Palestine, by +# delaying the clock by sixty minutes, starting from midnight on Friday / +# Saturday corresponding to 26/10/2019." +# http://www.palestinecabinet.gov.ps/portal/meeting/details/43948 +# From Sharef Mustafa (2020-10-20): +# As per the palestinian cabinet announcement yesterday , the day light saving +# shall [end] on Oct 24th 2020 at 01:00AM by delaying the clock by 60 minutes. +# http://www.palestinecabinet.gov.ps/portal/Meeting/Details/51584 + +# From Tim Parenti (2020-10-20): +# Predict future fall transitions at 01:00 on the Saturday preceding October's +# last Sunday (i.e., Sat>=24). This is consistent with our predictions since +# 2016, although the time of the change differed slightly in 2019. + +# From Pierre Cashon (2020-10-20): +# The summer time this year started on March 28 at 00:00. +# https://wafa.ps/ar_page.aspx?id=GveQNZa872839351758aGveQNZ +# http://www.palestinecabinet.gov.ps/portal/meeting/details/50284 +# The winter time in 2015 started on October 23 at 01:00. +# https://wafa.ps/ar_page.aspx?id=CgpCdYa670694628582aCgpCdY +# http://www.palestinecabinet.gov.ps/portal/meeting/details/27583 +# +# From Paul Eggert (2019-04-10): +# For now, guess spring-ahead transitions are at 00:00 on the Saturday +# preceding March's last Sunday (i.e., Sat>=24). + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule EgyptAsia 1957 only - May 10 0:00 1:00 S Rule EgyptAsia 1957 1958 - Oct 1 0:00 0 - @@ -3243,10 +3270,10 @@ Rule Palestine 2004 only - Oct 1 1:00 0 - Rule Palestine 2005 only - Oct 4 2:00 0 - Rule Palestine 2006 2007 - Apr 1 0:00 1:00 S Rule Palestine 2006 only - Sep 22 0:00 0 - -Rule Palestine 2007 only - Sep Thu>=8 2:00 0 - +Rule Palestine 2007 only - Sep 13 2:00 0 - Rule Palestine 2008 2009 - Mar lastFri 0:00 1:00 S Rule Palestine 2008 only - Sep 1 0:00 0 - -Rule Palestine 2009 only - Sep Fri>=1 1:00 0 - +Rule Palestine 2009 only - Sep 4 1:00 0 - Rule Palestine 2010 only - Mar 26 0:00 1:00 S Rule Palestine 2010 only - Aug 11 0:00 0 - Rule Palestine 2011 only - Apr 1 0:01 1:00 S @@ -3255,12 +3282,16 @@ Rule Palestine 2011 only - Aug 30 0:00 1:00 S Rule Palestine 2011 only - Sep 30 0:00 0 - Rule Palestine 2012 2014 - Mar lastThu 24:00 1:00 S Rule Palestine 2012 only - Sep 21 1:00 0 - -Rule Palestine 2013 only - Sep Fri>=21 0:00 0 - -Rule Palestine 2014 2015 - Oct Fri>=21 0:00 0 - -Rule Palestine 2015 only - Mar lastFri 24:00 1:00 S +Rule Palestine 2013 only - Sep 27 0:00 0 - +Rule Palestine 2014 only - Oct 24 0:00 0 - +Rule Palestine 2015 only - Mar 28 0:00 1:00 S +Rule Palestine 2015 only - Oct 23 1:00 0 - Rule Palestine 2016 2018 - Mar Sat>=24 1:00 1:00 S -Rule Palestine 2016 max - Oct lastSat 1:00 0 - -Rule Palestine 2019 max - Mar lastFri 0:00 1:00 S +Rule Palestine 2016 2018 - Oct Sat>=24 1:00 0 - +Rule Palestine 2019 only - Mar 29 0:00 1:00 S +Rule Palestine 2019 only - Oct Sat>=24 0:00 0 - +Rule Palestine 2020 max - Mar Sat>=24 0:00 1:00 S +Rule Palestine 2020 max - Oct Sat>=24 1:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Gaza 2:17:52 - LMT 1900 Oct Modified: head/contrib/tzdata/europe ============================================================================== --- head/contrib/tzdata/europe Thu Oct 22 01:04:02 2020 (r366920) +++ head/contrib/tzdata/europe Thu Oct 22 01:05:34 2020 (r366921) @@ -1029,17 +1029,16 @@ Zone Europe/Prague 0:57:44 - LMT 1850 # Denmark, Faroe Islands, and Greenland # From Jesper Nørgaard Welen (2005-04-26): -# http://www.hum.aau.dk/~poe/tid/tine/DanskTid.htm says that the law -# [introducing standard time] was in effect from 1894-01-01.... -# The page http://www.retsinfo.dk/_GETDOCI_/ACCN/A18930008330-REGL +# the law [introducing standard time] was in effect from 1894-01-01.... +# The page https://www.retsinformation.dk/eli/lta/1893/83 # confirms this, and states that the law was put forth 1893-03-29. # # The EU [actually, EEC and Euratom] treaty with effect from 1973: -# http://www.retsinfo.dk/_GETDOCI_/ACCN/A19722110030-REGL +# https://www.retsinformation.dk/eli/lta/1972/21100 # # This provoked a new law from 1974 to make possible summer time changes # in subsequent decrees with the law -# http://www.retsinfo.dk/_GETDOCI_/ACCN/A19740022330-REGL +# https://www.retsinformation.dk/eli/lta/1974/223 # # It seems however that no decree was set forward until 1980. I have # not found any decree, but in another related law, the effecting DST @@ -1051,7 +1050,7 @@ Zone Europe/Prague 0:57:44 - LMT 1850 # The law is about the management of the extra hour, concerning # working hours reported and effect on obligatory-rest rules (which # was suspended on that night): -# http://www.retsinfo.dk/_GETDOCI_/ACCN/C19801120554-REGL +# https://web.archive.org/web/20140104053304/https://www.retsinformation.dk/Forms/R0710.aspx?id=60267 # From Jesper Nørgaard Welen (2005-06-11): # The Herning Folkeblad (1980-09-26) reported that the night between Modified: head/contrib/tzdata/version ============================================================================== --- head/contrib/tzdata/version Thu Oct 22 01:04:02 2020 (r366920) +++ head/contrib/tzdata/version Thu Oct 22 01:05:34 2020 (r366921) @@ -1 +1 @@ -2020c +2020d From owner-svn-src-head@freebsd.org Thu Oct 22 01:08:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73689435EC2; Thu, 22 Oct 2020 01:08:02 +0000 (UTC) (envelope-from philip@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGq3k2RXNz442n; Thu, 22 Oct 2020 01:08:02 +0000 (UTC) (envelope-from philip@freebsd.org) Received: from weatherwax.trouble.is (weatherwax.trouble.is [IPv6:2a00:1098:82:3a::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "weatherwax.trouble.is", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: philip/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 21227118E1; Thu, 22 Oct 2020 01:08:02 +0000 (UTC) (envelope-from philip@freebsd.org) Received: from rincewind.trouble.is (rincewind.trouble.is [95.216.22.234]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "rincewind.trouble.is", Issuer "Let's Encrypt Authority X3" (verified OK)) by weatherwax.trouble.is (Postfix) with ESMTPS id 4CGq3h1k7mz1dMQ; Thu, 22 Oct 2020 01:08:00 +0000 (UTC) Received: by rincewind.trouble.is (Postfix, from userid 1001) id 4CGq3g5MWpz4wPt; Thu, 22 Oct 2020 01:07:59 +0000 (UTC) Date: Thu, 22 Oct 2020 09:07:59 +0800 From: Philip Paeps To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366921 - head/contrib/tzdata Message-ID: <20201022010759.GK44806@rincewind.trouble.is> Mail-Followup-To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202010220105.09M15ZGa019139@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <202010220105.09M15ZGa019139@repo.freebsd.org> X-PGP-Fingerprint: 2CD1 92C2 6EE7 B7D1 F552 6619 31AE B9B5 FDBB CB0E X-Date: Today is Setting Orange, the 3rd day of The Aftermath in the YOLD 3186 X-Phase-of-Moon: The Moon is Waxing Crescent (35% of Full) X-Clacks-Overhead: GNU Terry Pratchett Organization: Happily Disorganized X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 01:08:02 -0000 On 2020-10-22 01:05:35 (+0000), Philip Paeps wrote: >Author: philip >Date: Thu Oct 22 01:05:34 2020 >New Revision: 366921 >URL: https://svnweb.freebsd.org/changeset/base/366921 > >Log: > Import tzdata 2020c > > Changes: https://github.com/eggert/tz/blob/2020d/NEWS Argh. Import tzdata 2020d of course. I got the link right at least. While it feels like a lot of churn in tzdata land recently, the actual changes are very small. Philip -- Philip Paeps Senior Reality Engineer Alternative Enterprises From owner-svn-src-head@freebsd.org Thu Oct 22 03:30:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A86D843C92C; Thu, 22 Oct 2020 03:30:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGtDJ42wLz4GZJ; Thu, 22 Oct 2020 03:30:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EE86102D4; Thu, 22 Oct 2020 03:30:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09M3UeC8017301; Thu, 22 Oct 2020 03:30:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09M3UdgL017298; Thu, 22 Oct 2020 03:30:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202010220330.09M3UdgL017298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Oct 2020 03:30:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366922 - in head/sys/dev: ahci mvs siis X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/dev: ahci mvs siis X-SVN-Commit-Revision: 366922 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 03:30:40 -0000 Author: mav Date: Thu Oct 22 03:30:39 2020 New Revision: 366922 URL: https://svnweb.freebsd.org/changeset/base/366922 Log: Pass lower 3 bits of sector_count for FPDMA commands. When this code was written those bits were N/A, but now the lowest bit is Rebuild Assist Recovery Control (RARC). MFC after: 1 month Modified: head/sys/dev/ahci/ahci.c head/sys/dev/mvs/mvs.c head/sys/dev/siis/siis.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Thu Oct 22 01:05:34 2020 (r366921) +++ head/sys/dev/ahci/ahci.c Thu Oct 22 03:30:39 2020 (r366922) @@ -2578,10 +2578,10 @@ ahci_setup_fis(struct ahci_channel *ch, struct ahci_cm fis[9] = ccb->ataio.cmd.lba_mid_exp; fis[10] = ccb->ataio.cmd.lba_high_exp; fis[11] = ccb->ataio.cmd.features_exp; + fis[12] = ccb->ataio.cmd.sector_count; if (ccb->ataio.cmd.flags & CAM_ATAIO_FPDMA) { - fis[12] = tag << 3; - } else { - fis[12] = ccb->ataio.cmd.sector_count; + fis[12] &= 0xf8; + fis[12] |= tag << 3; } fis[13] = ccb->ataio.cmd.sector_count_exp; fis[15] = ATA_A_4BIT; Modified: head/sys/dev/mvs/mvs.c ============================================================================== --- head/sys/dev/mvs/mvs.c Thu Oct 22 01:05:34 2020 (r366921) +++ head/sys/dev/mvs/mvs.c Thu Oct 22 03:30:39 2020 (r366922) @@ -1493,7 +1493,8 @@ mvs_execute_transaction(struct mvs_slot *slot) crqb->cmd[i++] = ccb->ataio.cmd.features; crqb->cmd[i++] = 0x11; if (ccb->ataio.cmd.flags & CAM_ATAIO_FPDMA) { - crqb->cmd[i++] = slot->tag << 3; + crqb->cmd[i++] = (slot->tag << 3) | + (ccb->ataio.cmd.sector_count & 0x07); crqb->cmd[i++] = 0x12; } else { crqb->cmd[i++] = ccb->ataio.cmd.sector_count_exp; Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Thu Oct 22 01:05:34 2020 (r366921) +++ head/sys/dev/siis/siis.c Thu Oct 22 03:30:39 2020 (r366922) @@ -1723,13 +1723,12 @@ siis_setup_fis(device_t dev, struct siis_cmd *ctp, uni fis[9] = ccb->ataio.cmd.lba_mid_exp; fis[10] = ccb->ataio.cmd.lba_high_exp; fis[11] = ccb->ataio.cmd.features_exp; + fis[12] = ccb->ataio.cmd.sector_count; if (ccb->ataio.cmd.flags & CAM_ATAIO_FPDMA) { - fis[12] = tag << 3; - fis[13] = 0; - } else { - fis[12] = ccb->ataio.cmd.sector_count; - fis[13] = ccb->ataio.cmd.sector_count_exp; + fis[12] &= 0xf8; + fis[12] |= tag << 3; } + fis[13] = ccb->ataio.cmd.sector_count_exp; fis[15] = ATA_A_4BIT; if (ccb->ataio.ata_flags & ATA_FLAG_AUX) { fis[16] = ccb->ataio.aux & 0xff; From owner-svn-src-head@freebsd.org Thu Oct 22 04:49:15 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DE5A43D74E; Thu, 22 Oct 2020 04:49:15 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGvyy6J2nz4KnB; Thu, 22 Oct 2020 04:49:14 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB9AB1159F; Thu, 22 Oct 2020 04:49:14 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09M4nEmD065164; Thu, 22 Oct 2020 04:49:14 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09M4nEXI065163; Thu, 22 Oct 2020 04:49:14 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202010220449.09M4nEXI065163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 22 Oct 2020 04:49:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366923 - head/sys/crypto/armv8 X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/crypto/armv8 X-SVN-Commit-Revision: 366923 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 04:49:15 -0000 Author: gonzo Date: Thu Oct 22 04:49:14 2020 New Revision: 366923 URL: https://svnweb.freebsd.org/changeset/base/366923 Log: [armv8crypto] Fix cryptodev probe logic in armv8crypto Add missing break to prevent falling through to the default case statement and returning EINVAL for all session configs. Sponsored by: Ampere Computing Submitted by: Klara, Inc. Modified: head/sys/crypto/armv8/armv8_crypto.c Modified: head/sys/crypto/armv8/armv8_crypto.c ============================================================================== --- head/sys/crypto/armv8/armv8_crypto.c Thu Oct 22 03:30:39 2020 (r366922) +++ head/sys/crypto/armv8/armv8_crypto.c Thu Oct 22 04:49:14 2020 (r366923) @@ -207,6 +207,7 @@ armv8_crypto_probesession(device_t dev, default: return (EINVAL); } + break; default: return (EINVAL); } From owner-svn-src-head@freebsd.org Thu Oct 22 05:07:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B4D143DA6B; Thu, 22 Oct 2020 05:07:26 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CGwMy12vXz4LJg; Thu, 22 Oct 2020 05:07:26 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02C49114F9; Thu, 22 Oct 2020 05:07:26 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09M57PRZ077213; Thu, 22 Oct 2020 05:07:25 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09M57PXf077212; Thu, 22 Oct 2020 05:07:25 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202010220507.09M57PXf077212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 22 Oct 2020 05:07:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366924 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 366924 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 05:07:26 -0000 Author: gonzo Date: Thu Oct 22 05:07:25 2020 New Revision: 366924 URL: https://svnweb.freebsd.org/changeset/base/366924 Log: [hwpmc] Fix call chain capture for ARM64 Use ELR register value instead of LR for PMC_TRAPFRAME_TO_PC macro since it's the former that indicates PC if the interrupted execution thread. This fixes a bug where pmcstat lost the leaf function of the call chain and started with the second function in the chain. Although this change is an improvement over the previous logic there is still posibility for incomplete data: if the leaf function does not have stack variables and does not call any other functions compiler would not generate a stack frame for it and the FP value would point to the caller's frame, so instead of the actual "caller1 -> caller2 -> leaf" chain only "caller1 -> leaf" would be captured. Sponsored by: Ampere Computing Submitted by: Klara, Inc. Modified: head/sys/arm64/include/pmc_mdep.h Modified: head/sys/arm64/include/pmc_mdep.h ============================================================================== --- head/sys/arm64/include/pmc_mdep.h Thu Oct 22 04:49:14 2020 (r366923) +++ head/sys/arm64/include/pmc_mdep.h Thu Oct 22 05:07:25 2020 (r366924) @@ -54,7 +54,7 @@ union pmc_md_pmc { ((S) >= (START) && (S) < (END)) #define PMC_IN_KERNEL(va) INKERNEL((va)) #define PMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS) -#define PMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_lr) +#define PMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_elr) #define PMC_TRAPFRAME_TO_FP(TF) ((TF)->tf_x[29]) /* From owner-svn-src-head@freebsd.org Thu Oct 22 08:40:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C36D9442A16; Thu, 22 Oct 2020 08:40:26 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CH15k4mXfz4YKr; Thu, 22 Oct 2020 08:40:26 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 881931411D; Thu, 22 Oct 2020 08:40:26 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09M8eQ1J008097; Thu, 22 Oct 2020 08:40:26 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09M8ePsI008093; Thu, 22 Oct 2020 08:40:25 GMT (envelope-from np@FreeBSD.org) Message-Id: <202010220840.09M8ePsI008093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 22 Oct 2020 08:40:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366929 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 366929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 08:40:26 -0000 Author: np Date: Thu Oct 22 08:40:25 2020 New Revision: 366929 URL: https://svnweb.freebsd.org/changeset/base/366929 Log: cxgbe(4): fix the size of the iq/eq maps. The firmware can allocate ingress and egress context ids anywhere from its configured range. Size the iq/eq maps to match the entire range instead of assuming that the firmware always allocates the first available context id. Reported by: Baptiste Wicht @ Verisign MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Thu Oct 22 06:51:47 2020 (r366928) +++ head/sys/dev/cxgbe/adapter.h Thu Oct 22 08:40:25 2020 (r366929) @@ -799,6 +799,8 @@ struct sge { uint16_t iq_base; /* first abs_id */ int eq_start; /* first cntxt_id */ int eq_base; /* first abs_id */ + int iqmap_sz; + int eqmap_sz; struct sge_iq **iqmap; /* iq->cntxt_id to iq mapping */ struct sge_eq **eqmap; /* eq->cntxt_id to eq mapping */ Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Oct 22 06:51:47 2020 (r366928) +++ head/sys/dev/cxgbe/t4_main.c Thu Oct 22 08:40:25 2020 (r366929) @@ -1358,6 +1358,8 @@ t4_attach(device_t dev) s->nm_txq = malloc(s->nnmtxq * sizeof(struct sge_nm_txq), M_CXGBE, M_ZERO | M_WAITOK); #endif + MPASS(s->niq <= s->iqmap_sz); + MPASS(s->neq <= s->eqmap_sz); s->ctrlq = malloc(nports * sizeof(struct sge_wrq), M_CXGBE, M_ZERO | M_WAITOK); @@ -1365,9 +1367,9 @@ t4_attach(device_t dev) M_ZERO | M_WAITOK); s->txq = malloc(s->ntxq * sizeof(struct sge_txq), M_CXGBE, M_ZERO | M_WAITOK); - s->iqmap = malloc(s->niq * sizeof(struct sge_iq *), M_CXGBE, + s->iqmap = malloc(s->iqmap_sz * sizeof(struct sge_iq *), M_CXGBE, M_ZERO | M_WAITOK); - s->eqmap = malloc(s->neq * sizeof(struct sge_eq *), M_CXGBE, + s->eqmap = malloc(s->eqmap_sz * sizeof(struct sge_eq *), M_CXGBE, M_ZERO | M_WAITOK); sc->irq = malloc(sc->intr_count * sizeof(struct irq), M_CXGBE, @@ -4456,6 +4458,19 @@ get_params__post_init(struct adapter *sc) ("%s: L2 table size (%u) larger than expected (%u)", __func__, sc->vres.l2t.size, L2T_SIZE)); sc->params.core_vdd = val[6]; + + param[0] = FW_PARAM_PFVF(IQFLINT_END); + param[1] = FW_PARAM_PFVF(EQ_END); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 2, param, val); + if (rc != 0) { + device_printf(sc->dev, + "failed to query parameters (post_init2): %d.\n", rc); + return (rc); + } + MPASS(val[0] >= sc->sge.iq_start); + sc->sge.iqmap_sz = val[0] - sc->sge.iq_start + 1; + MPASS(val[1] >= sc->sge.eq_start); + sc->sge.eqmap_sz = val[1] - sc->sge.eq_start + 1; if (chip_id(sc) >= CHELSIO_T6) { Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Thu Oct 22 06:51:47 2020 (r366928) +++ head/sys/dev/cxgbe/t4_netmap.c Thu Oct 22 08:40:25 2020 (r366929) @@ -188,9 +188,9 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq nm_rxq->iq_cntxt_id = be16toh(c.iqid); nm_rxq->iq_abs_id = be16toh(c.physiqid); cntxt_id = nm_rxq->iq_cntxt_id - sc->sge.iq_start; - if (cntxt_id >= sc->sge.niq) { + if (cntxt_id >= sc->sge.iqmap_sz) { panic ("%s: nm_rxq->iq_cntxt_id (%d) more than the max (%d)", - __func__, cntxt_id, sc->sge.niq - 1); + __func__, cntxt_id, sc->sge.iqmap_sz - 1); } sc->sge.iqmap[cntxt_id] = (void *)nm_rxq; @@ -201,9 +201,9 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq nm_rxq->fl_db_threshold = chip_id(sc) <= CHELSIO_T5 ? 8 : 4; MPASS(nm_rxq->fl_sidx == na->num_rx_desc); cntxt_id = nm_rxq->fl_cntxt_id - sc->sge.eq_start; - if (cntxt_id >= sc->sge.neq) { + if (cntxt_id >= sc->sge.eqmap_sz) { panic("%s: nm_rxq->fl_cntxt_id (%d) more than the max (%d)", - __func__, cntxt_id, sc->sge.neq - 1); + __func__, cntxt_id, sc->sge.eqmap_sz - 1); } sc->sge.eqmap[cntxt_id] = (void *)nm_rxq; @@ -300,9 +300,9 @@ alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq nm_txq->cntxt_id = G_FW_EQ_ETH_CMD_EQID(be32toh(c.eqid_pkd)); cntxt_id = nm_txq->cntxt_id - sc->sge.eq_start; - if (cntxt_id >= sc->sge.neq) + if (cntxt_id >= sc->sge.eqmap_sz) panic("%s: nm_txq->cntxt_id (%d) more than the max (%d)", __func__, - cntxt_id, sc->sge.neq - 1); + cntxt_id, sc->sge.eqmap_sz - 1); sc->sge.eqmap[cntxt_id] = (void *)nm_txq; nm_txq->pidx = nm_txq->cidx = 0; Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Thu Oct 22 06:51:47 2020 (r366928) +++ head/sys/dev/cxgbe/t4_sge.c Thu Oct 22 08:40:25 2020 (r366929) @@ -3567,9 +3567,9 @@ alloc_iq_fl(struct vi_info *vi, struct sge_iq *iq, str iq->flags |= IQ_ALLOCATED; cntxt_id = iq->cntxt_id - sc->sge.iq_start; - if (cntxt_id >= sc->sge.niq) { + if (cntxt_id >= sc->sge.iqmap_sz) { panic ("%s: iq->cntxt_id (%d) more than the max (%d)", __func__, - cntxt_id, sc->sge.niq - 1); + cntxt_id, sc->sge.iqmap_sz - 1); } sc->sge.iqmap[cntxt_id] = iq; @@ -3581,9 +3581,9 @@ alloc_iq_fl(struct vi_info *vi, struct sge_iq *iq, str fl->pidx = fl->cidx = 0; cntxt_id = fl->cntxt_id - sc->sge.eq_start; - if (cntxt_id >= sc->sge.neq) { + if (cntxt_id >= sc->sge.eqmap_sz) { panic("%s: fl->cntxt_id (%d) more than the max (%d)", - __func__, cntxt_id, sc->sge.neq - 1); + __func__, cntxt_id, sc->sge.eqmap_sz - 1); } sc->sge.eqmap[cntxt_id] = (void *)fl; @@ -4152,9 +4152,9 @@ ctrl_eq_alloc(struct adapter *sc, struct sge_eq *eq) eq->cntxt_id = G_FW_EQ_CTRL_CMD_EQID(be32toh(c.cmpliqid_eqid)); cntxt_id = eq->cntxt_id - sc->sge.eq_start; - if (cntxt_id >= sc->sge.neq) + if (cntxt_id >= sc->sge.eqmap_sz) panic("%s: eq->cntxt_id (%d) more than the max (%d)", __func__, - cntxt_id, sc->sge.neq - 1); + cntxt_id, sc->sge.eqmap_sz - 1); sc->sge.eqmap[cntxt_id] = eq; return (rc); @@ -4198,9 +4198,9 @@ eth_eq_alloc(struct adapter *sc, struct vi_info *vi, s eq->cntxt_id = G_FW_EQ_ETH_CMD_EQID(be32toh(c.eqid_pkd)); eq->abs_id = G_FW_EQ_ETH_CMD_PHYSEQID(be32toh(c.physeqid_pkd)); cntxt_id = eq->cntxt_id - sc->sge.eq_start; - if (cntxt_id >= sc->sge.neq) + if (cntxt_id >= sc->sge.eqmap_sz) panic("%s: eq->cntxt_id (%d) more than the max (%d)", __func__, - cntxt_id, sc->sge.neq - 1); + cntxt_id, sc->sge.eqmap_sz - 1); sc->sge.eqmap[cntxt_id] = eq; return (rc); @@ -4243,9 +4243,9 @@ ofld_eq_alloc(struct adapter *sc, struct vi_info *vi, eq->cntxt_id = G_FW_EQ_OFLD_CMD_EQID(be32toh(c.eqid_pkd)); cntxt_id = eq->cntxt_id - sc->sge.eq_start; - if (cntxt_id >= sc->sge.neq) + if (cntxt_id >= sc->sge.eqmap_sz) panic("%s: eq->cntxt_id (%d) more than the max (%d)", __func__, - cntxt_id, sc->sge.neq - 1); + cntxt_id, sc->sge.eqmap_sz - 1); sc->sge.eqmap[cntxt_id] = eq; return (rc); From owner-svn-src-head@freebsd.org Thu Oct 22 09:09:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5909D4432C4; Thu, 22 Oct 2020 09:09:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CH1ll1zTNz4b3P; Thu, 22 Oct 2020 09:09:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22A57143FC; Thu, 22 Oct 2020 09:09:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09M99tnM026751; Thu, 22 Oct 2020 09:09:55 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09M99r3D026742; Thu, 22 Oct 2020 09:09:53 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010220909.09M99r3D026742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Oct 2020 09:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366930 - in head/sys: conf modules modules/if_infiniband net ofed/drivers/infiniband/ulp/ipoib X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: conf modules modules/if_infiniband net ofed/drivers/infiniband/ulp/ipoib X-SVN-Commit-Revision: 366930 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 09:09:55 -0000 Author: hselasky Date: Thu Oct 22 09:09:53 2020 New Revision: 366930 URL: https://svnweb.freebsd.org/changeset/base/366930 Log: Factor out generic IP over infiniband, IPoIB, definitions and code into net/if_infiniband.c and net/infiniband.h . No functional change intended. Differential Revision: https://reviews.freebsd.org/D26254 Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Added: head/sys/modules/if_infiniband/ head/sys/modules/if_infiniband/Makefile (contents, props changed) head/sys/net/if_infiniband.c (contents, props changed) head/sys/net/infiniband.h (contents, props changed) Modified: head/sys/conf/files head/sys/modules/Makefile head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Oct 22 08:40:25 2020 (r366929) +++ head/sys/conf/files Thu Oct 22 09:09:53 2020 (r366930) @@ -4571,6 +4571,7 @@ compat/lindebugfs/lindebugfs.c optional lindebugfs \ compile-with "${LINUXKPI_C}" # OpenFabrics Enterprise Distribution (Infiniband) +net/if_infiniband.c optional ofed ofed/drivers/infiniband/core/ib_addr.c optional ofed \ compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_agent.c optional ofed \ Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Thu Oct 22 08:40:25 2020 (r366929) +++ head/sys/modules/Makefile Thu Oct 22 09:09:53 2020 (r366930) @@ -154,6 +154,7 @@ SUBDIR= \ ${_if_gif} \ ${_if_gre} \ ${_if_me} \ + if_infiniband \ if_lagg \ ${_if_ndis} \ ${_if_stf} \ Added: head/sys/modules/if_infiniband/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/if_infiniband/Makefile Thu Oct 22 09:09:53 2020 (r366930) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/net + +KMOD= if_infiniband +SRCS= if_infiniband.c \ + opt_inet.h \ + opt_inet6.h + +.include Added: head/sys/net/if_infiniband.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net/if_infiniband.c Thu Oct 22 09:09:53 2020 (r366930) @@ -0,0 +1,538 @@ +/*- + * Copyright (c) 2020 Mellanox Technologies. 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 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 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. + */ + +#include "opt_inet.h" +#include "opt_inet6.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +#ifdef INET +static inline void +infiniband_ipv4_multicast_map(uint32_t addr, + const uint8_t *broadcast, uint8_t *buf) +{ + uint8_t scope; + + addr = ntohl(addr); + scope = broadcast[5] & 0xF; + + buf[0] = 0; + buf[1] = 0xff; + buf[2] = 0xff; + buf[3] = 0xff; + buf[4] = 0xff; + buf[5] = 0x10 | scope; + buf[6] = 0x40; + buf[7] = 0x1b; + buf[8] = broadcast[8]; + buf[9] = broadcast[9]; + buf[10] = 0; + buf[11] = 0; + buf[12] = 0; + buf[13] = 0; + buf[14] = 0; + buf[15] = 0; + buf[16] = (addr >> 24) & 0xff; + buf[17] = (addr >> 16) & 0xff; + buf[18] = (addr >> 8) & 0xff; + buf[19] = addr & 0xff; +} +#endif + +#ifdef INET6 +static inline void +infiniband_ipv6_multicast_map(const struct in6_addr *addr, + const uint8_t *broadcast, uint8_t *buf) +{ + uint8_t scope; + + scope = broadcast[5] & 0xF; + + buf[0] = 0; + buf[1] = 0xff; + buf[2] = 0xff; + buf[3] = 0xff; + buf[4] = 0xff; + buf[5] = 0x10 | scope; + buf[6] = 0x60; + buf[7] = 0x1b; + buf[8] = broadcast[8]; + buf[9] = broadcast[9]; + memcpy(&buf[10], &addr->s6_addr[6], 10); +} +#endif + +/* + * This is for clients that have an infiniband_header in the mbuf. + */ +void +infiniband_bpf_mtap(struct ifnet *ifp, struct mbuf *mb) +{ + struct infiniband_header *ibh; + struct ether_header eh; + + if (mb->m_len < sizeof(*ibh)) + return; + + ibh = mtod(mb, struct infiniband_header *); + eh.ether_type = ibh->ib_protocol; + memset(eh.ether_shost, 0, ETHER_ADDR_LEN); + memcpy(eh.ether_dhost, ibh->ib_hwaddr + 4, ETHER_ADDR_LEN); + mb->m_data += sizeof(*ibh); + mb->m_len -= sizeof(*ibh); + mb->m_pkthdr.len -= sizeof(*ibh); + bpf_mtap2(ifp->if_bpf, &eh, sizeof(eh), mb); + mb->m_data -= sizeof(*ibh); + mb->m_len += sizeof(*ibh); + mb->m_pkthdr.len += sizeof(*ibh); +} + +/* + * Infiniband output routine. + */ +static int +infiniband_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, + struct route *ro) +{ + uint8_t edst[INFINIBAND_ADDR_LEN]; +#if defined(INET) || defined(INET6) + struct llentry *lle = NULL; +#endif + struct infiniband_header *ibh; + int error = 0; + uint16_t type; + bool is_gw; + + NET_EPOCH_ASSERT(); + + is_gw = ((ro != NULL) && (ro->ro_flags & RT_HAS_GW) != 0); + +#ifdef MAC + error = mac_ifnet_check_transmit(ifp, m); + if (error) + goto bad; +#endif + + M_PROFILE(m); + if (ifp->if_flags & IFF_MONITOR) { + error = ENETDOWN; + goto bad; + } + if (!((ifp->if_flags & IFF_UP) && + (ifp->if_drv_flags & IFF_DRV_RUNNING))) { + error = ENETDOWN; + goto bad; + } + + switch (dst->sa_family) { + case AF_LINK: + goto output; +#ifdef INET + case AF_INET: + if (lle != NULL && (lle->la_flags & LLE_VALID)) { + memcpy(edst, lle->ll_addr, sizeof(edst)); + } else if (m->m_flags & M_MCAST) { + infiniband_ipv4_multicast_map( + ((const struct sockaddr_in *)dst)->sin_addr.s_addr, + ifp->if_broadcastaddr, edst); + } else { + error = arpresolve(ifp, is_gw, m, dst, edst, NULL, NULL); + if (error) { + if (error == EWOULDBLOCK) + error = 0; + m = NULL; /* mbuf is consumed by resolver */ + goto bad; + } + } + type = htons(ETHERTYPE_IP); + break; + case AF_ARP: { + struct arphdr *ah; + + if (m->m_len < sizeof(*ah)) { + error = EINVAL; + goto bad; + } + + ah = mtod(m, struct arphdr *); + + if (m->m_len < arphdr_len(ah)) { + error = EINVAL; + goto bad; + } + ah->ar_hrd = htons(ARPHRD_INFINIBAND); + + switch (ntohs(ah->ar_op)) { + case ARPOP_REVREQUEST: + case ARPOP_REVREPLY: + type = htons(ETHERTYPE_REVARP); + break; + case ARPOP_REQUEST: + case ARPOP_REPLY: + default: + type = htons(ETHERTYPE_ARP); + break; + } + + if (m->m_flags & M_BCAST) { + memcpy(edst, ifp->if_broadcastaddr, INFINIBAND_ADDR_LEN); + } else { + if (ah->ar_hln != INFINIBAND_ADDR_LEN) { + error = EINVAL; + goto bad; + } + memcpy(edst, ar_tha(ah), INFINIBAND_ADDR_LEN); + } + break; + } +#endif +#ifdef INET6 + case AF_INET6: { + const struct ip6_hdr *ip6; + + ip6 = mtod(m, const struct ip6_hdr *); + if (m->m_len < sizeof(*ip6)) { + error = EINVAL; + goto bad; + } else if (lle != NULL && (lle->la_flags & LLE_VALID)) { + memcpy(edst, lle->ll_addr, sizeof(edst)); + } else if (m->m_flags & M_MCAST) { + infiniband_ipv6_multicast_map( + &((const struct sockaddr_in6 *)dst)->sin6_addr, + ifp->if_broadcastaddr, edst); + } else if (ip6->ip6_nxt == IPPROTO_ICMPV6) { + memcpy(edst, ifp->if_broadcastaddr, INFINIBAND_ADDR_LEN); + } else { + error = nd6_resolve(ifp, is_gw, m, dst, edst, NULL, NULL); + if (error) { + if (error == EWOULDBLOCK) + error = 0; + m = NULL; /* mbuf is consumed by resolver */ + goto bad; + } + } + type = htons(ETHERTYPE_IPV6); + break; + } +#endif + default: + error = EAFNOSUPPORT; + goto bad; + } + + /* + * Add local net header. If no space in first mbuf, + * allocate another. + */ + M_PREPEND(m, INFINIBAND_HDR_LEN, M_NOWAIT); + if (m == NULL) { + error = ENOBUFS; + goto bad; + } + ibh = mtod(m, struct infiniband_header *); + + ibh->ib_protocol = type; + memcpy(ibh->ib_hwaddr, edst, sizeof(edst)); + + /* + * Queue message on interface, update output statistics if + * successful, and start output if interface not yet active. + */ +output: + return (ifp->if_transmit(ifp, m)); +bad: + if (m != NULL) + m_freem(m); + return (error); +} + +/* + * Process a received Infiniband packet. + */ +static void +infiniband_input(struct ifnet *ifp, struct mbuf *m) +{ + struct infiniband_header *ibh; + struct epoch_tracker et; + int isr; + + CURVNET_SET_QUIET(ifp->if_vnet); + + if ((ifp->if_flags & IFF_UP) == 0) { + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); + m_freem(m); + goto done; + } + + ibh = mtod(m, struct infiniband_header *); + + /* + * Reset layer specific mbuf flags to avoid confusing upper + * layers: + */ + m->m_flags &= ~M_VLANTAG; + m_clrprotoflags(m); + + if (INFINIBAND_IS_MULTICAST(ibh->ib_hwaddr)) { + if (memcmp(ibh->ib_hwaddr, ifp->if_broadcastaddr, + ifp->if_addrlen) == 0) + m->m_flags |= M_BCAST; + else + m->m_flags |= M_MCAST; + if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1); + } + + /* Let BPF have it before we strip the header. */ + INFINIBAND_BPF_MTAP(ifp, m); + + /* Allow monitor mode to claim this frame, after stats are updated. */ + if (ifp->if_flags & IFF_MONITOR) { + m_freem(m); + goto done; + } + + /* Direct packet to correct FIB based on interface config. */ + M_SETFIB(m, ifp->if_fib); + + /* + * Dispatch frame to upper layer. + */ + switch (ibh->ib_protocol) { +#ifdef INET + case htons(ETHERTYPE_IP): + isr = NETISR_IP; + break; + + case htons(ETHERTYPE_ARP): + if (ifp->if_flags & IFF_NOARP) { + /* Discard packet if ARP is disabled on interface */ + m_freem(m); + goto done; + } + isr = NETISR_ARP; + break; +#endif +#ifdef INET6 + case htons(ETHERTYPE_IPV6): + isr = NETISR_IPV6; + break; +#endif + default: + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); + m_freem(m); + goto done; + } + + /* Strip off the Infiniband header. */ + m_adj(m, INFINIBAND_HDR_LEN); + +#ifdef MAC + /* + * Tag the mbuf with an appropriate MAC label before any other + * consumers can get to it. + */ + mac_ifnet_create_mbuf(ifp, m); +#endif + /* Allow monitor mode to claim this frame, after stats are updated. */ + NET_EPOCH_ENTER(et); + netisr_dispatch(isr, m); + NET_EPOCH_EXIT(et); +done: + CURVNET_RESTORE(); +} + +static int +infiniband_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa, + struct sockaddr *sa) +{ + struct sockaddr_dl *sdl; +#ifdef INET + struct sockaddr_in *sin; +#endif +#ifdef INET6 + struct sockaddr_in6 *sin6; +#endif + uint8_t *e_addr; + + switch (sa->sa_family) { + case AF_LINK: + /* + * No mapping needed. Just check that it's a valid MC address. + */ + sdl = (struct sockaddr_dl *)sa; + e_addr = LLADDR(sdl); + if (!INFINIBAND_IS_MULTICAST(e_addr)) + return (EADDRNOTAVAIL); + *llsa = NULL; + return 0; + +#ifdef INET + case AF_INET: + sin = (struct sockaddr_in *)sa; + if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) + return (EADDRNOTAVAIL); + sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); + sdl->sdl_alen = INFINIBAND_ADDR_LEN; + e_addr = LLADDR(sdl); + infiniband_ipv4_multicast_map(sin->sin_addr.s_addr, ifp->if_broadcastaddr, + e_addr); + *llsa = (struct sockaddr *)sdl; + return (0); +#endif +#ifdef INET6 + case AF_INET6: + sin6 = (struct sockaddr_in6 *)sa; + /* + * An IP6 address of 0 means listen to all of the + * multicast address used for IP6. This has no meaning + * in infiniband. + */ + if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) + return (EADDRNOTAVAIL); + if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) + return (EADDRNOTAVAIL); + sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); + sdl->sdl_alen = INFINIBAND_ADDR_LEN; + e_addr = LLADDR(sdl); + infiniband_ipv6_multicast_map(&sin6->sin6_addr, ifp->if_broadcastaddr, e_addr); + *llsa = (struct sockaddr *)sdl; + return (0); +#endif + default: + return (EAFNOSUPPORT); + } +} + +void +infiniband_ifattach(struct ifnet *ifp, const uint8_t *lla, const uint8_t *llb) +{ + struct sockaddr_dl *sdl; + struct ifaddr *ifa; + int i; + + ifp->if_addrlen = INFINIBAND_ADDR_LEN; + ifp->if_hdrlen = INFINIBAND_HDR_LEN; + ifp->if_mtu = INFINIBAND_MTU; + if_attach(ifp); + ifp->if_output = infiniband_output; + ifp->if_input = infiniband_input; + ifp->if_resolvemulti = infiniband_resolvemulti; + + if (ifp->if_baudrate == 0) + ifp->if_baudrate = IF_Gbps(10); /* default value */ + if (llb != NULL) + ifp->if_broadcastaddr = llb; + + ifa = ifp->if_addr; + KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__)); + sdl = (struct sockaddr_dl *)ifa->ifa_addr; + sdl->sdl_type = IFT_INFINIBAND; + sdl->sdl_alen = ifp->if_addrlen; + + if (lla != NULL) { + memcpy(LLADDR(sdl), lla, ifp->if_addrlen); + + if (ifp->if_hw_addr != NULL) + memcpy(ifp->if_hw_addr, lla, ifp->if_addrlen); + } else { + lla = LLADDR(sdl); + } + + /* Attach ethernet compatible network device */ + bpfattach(ifp, DLT_EN10MB, ETHER_HDR_LEN); + + /* Announce Infiniband MAC address if non-zero. */ + for (i = 0; i < ifp->if_addrlen; i++) + if (lla[i] != 0) + break; + if (i != ifp->if_addrlen) + if_printf(ifp, "Infiniband address: %20D\n", lla, ":"); + + /* Add necessary bits are setup; announce it now. */ + EVENTHANDLER_INVOKE(infiniband_ifattach_event, ifp); + + if (IS_DEFAULT_VNET(curvnet)) + devctl_notify("INFINIBAND", ifp->if_xname, "IFATTACH", NULL); +} + +/* + * Perform common duties while detaching an Infiniband interface + */ +void +infiniband_ifdetach(struct ifnet *ifp) +{ + bpfdetach(ifp); + if_detach(ifp); +} + +static int +infiniband_modevent(module_t mod, int type, void *data) +{ + switch (type) { + case MOD_LOAD: + case MOD_UNLOAD: + return (0); + default: + return (EOPNOTSUPP); + } +} + +static moduledata_t infiniband_mod = { + .name = "if_infiniband", + .evhand = &infiniband_modevent, +}; + +DECLARE_MODULE(if_infiniband, infiniband_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); +MODULE_VERSION(if_infiniband, 1); Added: head/sys/net/infiniband.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net/infiniband.h Thu Oct 22 09:09:53 2020 (r366930) @@ -0,0 +1,80 @@ +/*- + * Copyright (c) 2020 Mellanox Technologies. 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 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 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$ + */ + +#ifndef __INFINIBAND_H__ +#define __INFINIBAND_H__ + +#include +#include + +#define INFINIBAND_ADDR_LEN 20 /* bytes */ +#define INFINIBAND_MTU 1500 /* bytes - default value */ + +#define INFINIBAND_ENC_LEN 4 /* bytes */ +#define INFINIBAND_HDR_LEN \ + (INFINIBAND_ADDR_LEN + INFINIBAND_ENC_LEN) + +#define INFINIBAND_IS_MULTICAST(addr) \ + ((addr)[4] == 0xff) + +#define INFINIBAND_BPF_MTAP(_ifp, _m) \ +do { \ + if (bpf_peers_present((_ifp)->if_bpf)) { \ + M_ASSERTVALID(_m); \ + infiniband_bpf_mtap(_ifp, _m); \ + } \ +} while (0) + +struct infiniband_header { + uint8_t ib_hwaddr[INFINIBAND_ADDR_LEN]; + uint16_t ib_protocol; /* big endian */ + uint16_t ib_reserved; /* zero */ +} __packed; + +struct infiniband_address { + uint8_t octet[INFINIBAND_ADDR_LEN]; +} __packed; + +#ifdef _KERNEL + +#include + +struct ifnet; +struct mbuf; + +extern void infiniband_ifattach(struct ifnet *, const uint8_t *hwaddr, const uint8_t *bcaddr); +extern void infiniband_ifdetach(struct ifnet *); +extern void infiniband_bpf_mtap(struct ifnet *, struct mbuf *); + +/* new infiniband interface attached event */ +typedef void (*infiniband_ifattach_event_handler_t)(void *, struct ifnet *); + +EVENTHANDLER_DECLARE(infiniband_ifattach_event, infiniband_ifattach_event_handler_t); + +#endif + +#endif /* __INFINIBAND_H__ */ Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Thu Oct 22 08:40:25 2020 (r366929) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h Thu Oct 22 09:09:53 2020 (r366930) @@ -438,16 +438,7 @@ struct ipoib_path { extern struct workqueue_struct *ipoib_workqueue; -#define IPOIB_MTAP_PROTO(_ifp, _m, _proto) \ -do { \ - if (bpf_peers_present((_ifp)->if_bpf)) { \ - M_ASSERTVALID(_m); \ - ipoib_mtap_proto((_ifp), (_m), (_proto)); \ - } \ -} while (0) - /* functions */ -void ipoib_mtap_proto(struct ifnet *ifp, struct mbuf *mb, uint16_t proto); void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr); void ipoib_send_comp_handler(struct ib_cq *cq, void *dev_ptr); @@ -463,8 +454,6 @@ int ipoib_open(struct ipoib_dev_priv *priv); int ipoib_add_pkey_attr(struct ipoib_dev_priv *priv); int ipoib_add_umcast_attr(struct ipoib_dev_priv *priv); -void ipoib_demux(struct ifnet *ifp, struct mbuf *m, u_short proto); - void ipoib_send(struct ipoib_dev_priv *priv, struct mbuf *mb, struct ipoib_ah *address, u32 qpn); void ipoib_reap_ah(struct work_struct *work); @@ -540,7 +529,7 @@ int ipoib_poll_tx(struct ipoib_dev_priv *priv, bool do void ipoib_dma_unmap_rx(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req); void ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf *mb, unsigned int length); -struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int size); +struct mbuf *ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, int align, int size); void ipoib_set_ethtool_ops(struct ifnet *dev); Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Thu Oct 22 08:40:25 2020 (r366929) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c Thu Oct 22 09:09:53 2020 (r366930) @@ -153,7 +153,7 @@ static struct mbuf * ipoib_cm_alloc_rx_mb(struct ipoib_dev_priv *priv, struct ipoib_cm_rx_buf *rx_req) { return ipoib_alloc_map_mb(priv, (struct ipoib_rx_buf *)rx_req, - priv->cm.max_cm_mtu); + sizeof(struct ipoib_pseudoheader), priv->cm.max_cm_mtu); } static void ipoib_cm_free_rx_ring(struct ipoib_dev_priv *priv, @@ -484,10 +484,7 @@ void ipoib_cm_handle_rx_wc(struct ipoib_dev_priv *priv struct mbuf *mb, *newmb; struct ipoib_cm_rx *p; int has_srq; - u_short proto; - CURVNET_SET_QUIET(dev->if_vnet); - ipoib_dbg_data(priv, "cm recv completion: id %d, status: %d\n", wr_id, wc->status); @@ -561,16 +558,24 @@ void ipoib_cm_handle_rx_wc(struct ipoib_dev_priv *priv ipoib_dma_mb(priv, mb, wc->byte_len); - if_inc_counter(dev, IFCOUNTER_IPACKETS, 1); - if_inc_counter(dev, IFCOUNTER_IBYTES, mb->m_pkthdr.len); - mb->m_pkthdr.rcvif = dev; - proto = *mtod(mb, uint16_t *); - m_adj(mb, IPOIB_ENCAP_LEN); - IPOIB_MTAP_PROTO(dev, mb, proto); - ipoib_demux(dev, mb, ntohs(proto)); + M_PREPEND(mb, sizeof(struct ipoib_pseudoheader), M_NOWAIT); + if (likely(mb != NULL)) { + struct ipoib_header *ibh; + if_inc_counter(dev, IFCOUNTER_IPACKETS, 1); + if_inc_counter(dev, IFCOUNTER_IBYTES, mb->m_pkthdr.len); + + /* fixup destination infiniband address */ + ibh = mtod(mb, struct ipoib_header *); + memset(ibh->hwaddr, 0, 4); + memcpy(ibh->hwaddr + 4, priv->local_gid.raw, sizeof(union ib_gid)); + + dev->if_input(dev, mb); + } else { + if_inc_counter(dev, IFCOUNTER_IERRORS, 1); + } repost: if (has_srq) { if (unlikely(ipoib_cm_post_receive_srq(priv, wr_id))) @@ -587,7 +592,6 @@ repost: } } done: - CURVNET_RESTORE(); return; } Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Thu Oct 22 08:40:25 2020 (r366929) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c Thu Oct 22 09:09:53 2020 (r366930) @@ -112,17 +112,19 @@ ipoib_dma_mb(struct ipoib_dev_priv *priv, struct mbuf struct mbuf * ipoib_alloc_map_mb(struct ipoib_dev_priv *priv, struct ipoib_rx_buf *rx_req, - int size) + int align, int size) { struct mbuf *mb, *m; int i, j; rx_req->mb = NULL; - mb = m_getm2(NULL, size, M_NOWAIT, MT_DATA, M_PKTHDR); + mb = m_getm2(NULL, align + size, M_NOWAIT, MT_DATA, M_PKTHDR); if (mb == NULL) return (NULL); for (i = 0, m = mb; m != NULL; m = m->m_next, i++) { - m->m_len = M_SIZE(m); + m->m_len = M_SIZE(m) - align; + m->m_data += align; + align = 0; mb->m_pkthdr.len += m->m_len; rx_req->mapping[i] = ib_dma_map_single(priv->ca, mtod(m, void *), m->m_len, DMA_FROM_DEVICE); @@ -174,7 +176,7 @@ ipoib_alloc_rx_mb(struct ipoib_dev_priv *priv, int id) { return ipoib_alloc_map_mb(priv, &priv->rx_ring[id], - priv->max_ib_mtu + IB_GRH_BYTES); + 0, priv->max_ib_mtu + IB_GRH_BYTES); } static int ipoib_ib_post_receives(struct ipoib_dev_priv *priv) Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Oct 22 08:40:25 2020 (r366929) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Oct 22 09:09:53 2020 (r366930) @@ -40,21 +40,16 @@ __FBSDID("$FreeBSD$"); #include "ipoib.h" #include -static int ipoib_resolvemulti(struct ifnet *, struct sockaddr **, - struct sockaddr *); - - #include #include #include #include -#include /* For ARPHRD_xxx */ #include -#include -#include +#include + #include MODULE_AUTHOR("Roland Dreier"); @@ -98,19 +93,8 @@ static struct net_device *ipoib_get_net_dev_by_params( const union ib_gid *gid, const struct sockaddr *addr, void *client_data); static void ipoib_start(struct ifnet *dev); -static int ipoib_output(struct ifnet *ifp, struct mbuf *m, - const struct sockaddr *dst, struct route *ro); static int ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data); -static void ipoib_input(struct ifnet *ifp, struct mbuf *m); -#define IPOIB_MTAP(_ifp, _m) \ -do { \ - if (bpf_peers_present((_ifp)->if_bpf)) { \ - M_ASSERTVALID(_m); \ - ipoib_mtap_mb((_ifp), (_m)); \ - } \ -} while (0) - static struct unrhdr *ipoib_unrhdr; static void @@ -136,37 +120,6 @@ ipoib_unrhdr_uninit(void *arg) } SYSUNINIT(ipoib_unrhdr_uninit, SI_SUB_KLD - 1, SI_ORDER_ANY, ipoib_unrhdr_uninit, NULL); -/* - * This is for clients that have an ipoib_header in the mbuf. - */ -static void -ipoib_mtap_mb(struct ifnet *ifp, struct mbuf *mb) -{ - struct ipoib_header *ih; - struct ether_header eh; - - ih = mtod(mb, struct ipoib_header *); - eh.ether_type = ih->proto; - bcopy(ih->hwaddr, &eh.ether_dhost, ETHER_ADDR_LEN); - bzero(&eh.ether_shost, ETHER_ADDR_LEN); - mb->m_data += sizeof(struct ipoib_header); - mb->m_len -= sizeof(struct ipoib_header); - bpf_mtap2(ifp->if_bpf, &eh, sizeof(eh), mb); - mb->m_data -= sizeof(struct ipoib_header); - mb->m_len += sizeof(struct ipoib_header); -} - -void -ipoib_mtap_proto(struct ifnet *ifp, struct mbuf *mb, uint16_t proto) -{ - struct ether_header eh; - - eh.ether_type = proto; - bzero(&eh.ether_shost, ETHER_ADDR_LEN); - bzero(&eh.ether_dhost, ETHER_ADDR_LEN); - bpf_mtap2(ifp->if_bpf, &eh, sizeof(eh), mb); -} - static struct ib_client ipoib_client = { .name = "ipoib", .add = ipoib_add_one, @@ -787,7 +740,7 @@ ipoib_start_locked(struct ifnet *dev, struct ipoib_dev IFQ_DRV_DEQUEUE(&dev->if_snd, mb); if (mb == NULL) break; - IPOIB_MTAP(dev, mb); + INFINIBAND_BPF_MTAP(dev, mb); ipoib_send_one(priv, mb); } } @@ -875,8 +828,7 @@ ipoib_detach(struct ipoib_dev_priv *priv) dev = priv->dev; if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { priv->gone = 1; - bpfdetach(dev); - if_detach(dev); + infiniband_ifdetach(dev); if_free(dev); free_unr(ipoib_unrhdr, priv->unit); } else @@ -935,7 +887,6 @@ struct ipoib_dev_priv * ipoib_intf_alloc(const char *name) { struct ipoib_dev_priv *priv; - struct sockaddr_dl *sdl; struct ifnet *dev; priv = ipoib_priv_alloc(); @@ -953,24 +904,17 @@ ipoib_intf_alloc(const char *name) } if_initname(dev, name, priv->unit); dev->if_flags = IFF_BROADCAST | IFF_MULTICAST; - dev->if_addrlen = INFINIBAND_ALEN; - dev->if_hdrlen = IPOIB_HEADER_LEN; - if_attach(dev); + + infiniband_ifattach(dev, NULL, priv->broadcastaddr); + dev->if_init = ipoib_init; dev->if_ioctl = ipoib_ioctl; dev->if_start = ipoib_start; - dev->if_output = ipoib_output; - dev->if_input = ipoib_input; - dev->if_resolvemulti = ipoib_resolvemulti; - dev->if_baudrate = IF_Gbps(10); - dev->if_broadcastaddr = priv->broadcastaddr; + dev->if_snd.ifq_maxlen = ipoib_sendq_size * 2; - sdl = (struct sockaddr_dl *)dev->if_addr->ifa_addr; - sdl->sdl_type = IFT_INFINIBAND; - sdl->sdl_alen = dev->if_addrlen; + priv->dev = dev; if_link_state_change(dev, LINK_STATE_DOWN); - bpfattach(dev, DLT_EN10MB, ETHER_HDR_LEN); return dev->if_softc; } @@ -1165,7 +1109,6 @@ ipoib_match_dev_addr(const struct sockaddr *addr, stru struct ifaddr *ifa; int retval = 0; - CURVNET_SET(dev->if_vnet); NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) { if (ifa->ifa_addr == NULL || @@ -1179,7 +1122,6 @@ ipoib_match_dev_addr(const struct sockaddr *addr, stru } } NET_EPOCH_EXIT(et); - CURVNET_RESTORE(); return (retval); } @@ -1475,286 +1417,6 @@ ipoib_cleanup_module(void) ib_sa_unregister_client(&ipoib_sa_client); destroy_workqueue(ipoib_workqueue); } - -/* - * Infiniband output routine. - */ -static int -ipoib_output(struct ifnet *ifp, struct mbuf *m, - const struct sockaddr *dst, struct route *ro) -{ - u_char edst[INFINIBAND_ALEN]; -#if defined(INET) || defined(INET6) - struct llentry *lle = NULL; -#endif - struct ipoib_header *eh; - int error = 0, is_gw = 0; - short type; - - NET_EPOCH_ASSERT(); - - if (ro != NULL) - is_gw = (ro->ro_flags & RT_HAS_GW) != 0; -#ifdef MAC - error = mac_ifnet_check_transmit(ifp, m); - if (error) - goto bad; -#endif - - M_PROFILE(m); - if (ifp->if_flags & IFF_MONITOR) { - error = ENETDOWN; - goto bad; - } - if (!((ifp->if_flags & IFF_UP) && - (ifp->if_drv_flags & IFF_DRV_RUNNING))) { - error = ENETDOWN; - goto bad; - } - - switch (dst->sa_family) { -#ifdef INET - case AF_INET: - if (lle != NULL && (lle->la_flags & LLE_VALID)) - memcpy(edst, lle->ll_addr, sizeof(edst)); - else if (m->m_flags & M_MCAST) - ip_ib_mc_map(((struct sockaddr_in *)dst)->sin_addr.s_addr, ifp->if_broadcastaddr, edst); - else - error = arpresolve(ifp, is_gw, m, dst, edst, NULL, NULL); - if (error) - return (error == EWOULDBLOCK ? 0 : error); - type = htons(ETHERTYPE_IP); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Oct 22 09:17:57 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9DFC4435C9; Thu, 22 Oct 2020 09:17:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CH1x15jtkz4bfj; Thu, 22 Oct 2020 09:17:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A77D214751; Thu, 22 Oct 2020 09:17:57 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09M9Hvix032741; Thu, 22 Oct 2020 09:17:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09M9Hv3q032739; Thu, 22 Oct 2020 09:17:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010220917.09M9Hv3q032739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Oct 2020 09:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366931 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 366931 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 09:17:58 -0000 Author: hselasky Date: Thu Oct 22 09:17:56 2020 New Revision: 366931 URL: https://svnweb.freebsd.org/changeset/base/366931 Log: Implement mbuf hashing routines for IP over infiniband, IPoIB. No functional change intended. Differential Revision: https://reviews.freebsd.org/D26254 Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/kern/uipc_mbufhash.c head/sys/sys/mbuf.h Modified: head/sys/kern/uipc_mbufhash.c ============================================================================== --- head/sys/kern/uipc_mbufhash.c Thu Oct 22 09:09:53 2020 (r366930) +++ head/sys/kern/uipc_mbufhash.c Thu Oct 22 09:17:56 2020 (r366931) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #if defined(INET) || defined(INET6) #include @@ -42,7 +43,7 @@ __FBSDID("$FreeBSD$"); #endif static const void * -m_ether_tcpip_hash_gethdr(const struct mbuf *m, const u_int off, +m_common_hash_gethdr(const struct mbuf *m, const u_int off, const u_int len, void *buf) { @@ -65,9 +66,19 @@ m_ether_tcpip_hash_init(void) } uint32_t -m_ether_tcpip_hash(const uint32_t flags, const struct mbuf *m, - const uint32_t key) +m_infiniband_tcpip_hash_init(void) { + uint32_t seed; + + seed = arc4random(); + return (fnv_32_buf(&seed, sizeof(seed), FNV1_32_INIT)); +} + +static inline uint32_t +m_tcpip_hash(const uint32_t flags, const struct mbuf *m, + uint32_t p, int off, const uint16_t etype) +{ +#if defined(INET) || defined(INET6) union { #ifdef INET struct ip ip; @@ -75,49 +86,19 @@ m_ether_tcpip_hash(const uint32_t flags, const struct #ifdef INET6 struct ip6_hdr ip6; #endif - struct ether_vlan_header vlan; uint32_t port; } buf; - const struct ether_header *eh; - const struct ether_vlan_header *vlan; #ifdef INET const struct ip *ip; #endif #ifdef INET6 const struct ip6_hdr *ip6; #endif - uint32_t p; - int off; - uint16_t etype; - - p = key; - off = sizeof(*eh); - if (m->m_len < off) - goto done; - eh = mtod(m, struct ether_header *); - etype = ntohs(eh->ether_type); - if (flags & MBUF_HASHFLAG_L2) { - p = fnv_32_buf(&eh->ether_shost, ETHER_ADDR_LEN, p); - p = fnv_32_buf(&eh->ether_dhost, ETHER_ADDR_LEN, p); - } - /* Special handling for encapsulating VLAN frames */ - if ((m->m_flags & M_VLANTAG) && (flags & MBUF_HASHFLAG_L2)) { - p = fnv_32_buf(&m->m_pkthdr.ether_vtag, - sizeof(m->m_pkthdr.ether_vtag), p); - } else if (etype == ETHERTYPE_VLAN) { - vlan = m_ether_tcpip_hash_gethdr(m, off, sizeof(*vlan), &buf); - if (vlan == NULL) - goto done; - - if (flags & MBUF_HASHFLAG_L2) - p = fnv_32_buf(&vlan->evl_tag, sizeof(vlan->evl_tag), p); - etype = ntohs(vlan->evl_proto); - off += sizeof(*vlan) - sizeof(*eh); - } +#endif switch (etype) { #ifdef INET case ETHERTYPE_IP: - ip = m_ether_tcpip_hash_gethdr(m, off, sizeof(*ip), &buf); + ip = m_common_hash_gethdr(m, off, sizeof(*ip), &buf); if (ip == NULL) break; if (flags & MBUF_HASHFLAG_L3) { @@ -136,7 +117,7 @@ m_ether_tcpip_hash(const uint32_t flags, const struct if (iphlen < sizeof(*ip)) break; off += iphlen; - ports = m_ether_tcpip_hash_gethdr(m, + ports = m_common_hash_gethdr(m, off, sizeof(*ports), &buf); if (ports == NULL) break; @@ -150,7 +131,7 @@ m_ether_tcpip_hash(const uint32_t flags, const struct #endif #ifdef INET6 case ETHERTYPE_IPV6: - ip6 = m_ether_tcpip_hash_gethdr(m, off, sizeof(*ip6), &buf); + ip6 = m_common_hash_gethdr(m, off, sizeof(*ip6), &buf); if (ip6 == NULL) break; if (flags & MBUF_HASHFLAG_L3) { @@ -169,6 +150,62 @@ m_ether_tcpip_hash(const uint32_t flags, const struct default: break; } -done: return (p); +} + +uint32_t +m_ether_tcpip_hash(const uint32_t flags, const struct mbuf *m, + uint32_t p) +{ + union { + struct ether_vlan_header vlan; + } buf; + const struct ether_header *eh; + const struct ether_vlan_header *vlan; + int off; + uint16_t etype; + + off = sizeof(*eh); + if (m->m_len < off) + return (p); + eh = mtod(m, struct ether_header *); + etype = ntohs(eh->ether_type); + if (flags & MBUF_HASHFLAG_L2) { + p = fnv_32_buf(&eh->ether_shost, ETHER_ADDR_LEN, p); + p = fnv_32_buf(&eh->ether_dhost, ETHER_ADDR_LEN, p); + } + /* Special handling for encapsulating VLAN frames */ + if ((m->m_flags & M_VLANTAG) && (flags & MBUF_HASHFLAG_L2)) { + p = fnv_32_buf(&m->m_pkthdr.ether_vtag, + sizeof(m->m_pkthdr.ether_vtag), p); + } else if (etype == ETHERTYPE_VLAN) { + vlan = m_common_hash_gethdr(m, off, sizeof(*vlan), &buf); + if (vlan == NULL) + return (p); + + if (flags & MBUF_HASHFLAG_L2) + p = fnv_32_buf(&vlan->evl_tag, sizeof(vlan->evl_tag), p); + etype = ntohs(vlan->evl_proto); + off += sizeof(*vlan) - sizeof(*eh); + } + return (m_tcpip_hash(flags, m, p, off, etype)); +} + +uint32_t +m_infiniband_tcpip_hash(const uint32_t flags, const struct mbuf *m, + uint32_t p) +{ + const struct infiniband_header *ibh; + int off; + uint16_t etype; + + off = sizeof(*ibh); + if (m->m_len < off) + return (p); + ibh = mtod(m, struct infiniband_header *); + etype = ntohs(ibh->ib_protocol); + if (flags & MBUF_HASHFLAG_L2) + p = fnv_32_buf(&ibh->ib_hwaddr, INFINIBAND_ADDR_LEN, p); + + return (m_tcpip_hash(flags, m, p, off, etype)); } Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Thu Oct 22 09:09:53 2020 (r366930) +++ head/sys/sys/mbuf.h Thu Oct 22 09:17:56 2020 (r366931) @@ -1455,14 +1455,16 @@ rt_m_getfib(struct mbuf *m) ((_m)->m_pkthdr.fibnum) = (_fib); \ } while (0) -/* flags passed as first argument for "m_ether_tcpip_hash()" */ +/* flags passed as first argument for "m_xxx_tcpip_hash()" */ #define MBUF_HASHFLAG_L2 (1 << 2) #define MBUF_HASHFLAG_L3 (1 << 3) #define MBUF_HASHFLAG_L4 (1 << 4) /* mbuf hashing helper routines */ uint32_t m_ether_tcpip_hash_init(void); -uint32_t m_ether_tcpip_hash(const uint32_t, const struct mbuf *, const uint32_t); +uint32_t m_ether_tcpip_hash(const uint32_t, const struct mbuf *, uint32_t); +uint32_t m_infiniband_tcpip_hash_init(void); +uint32_t m_infiniband_tcpip_hash(const uint32_t, const struct mbuf *, uint32_t); #ifdef MBUF_PROFILING void m_profile(struct mbuf *m); From owner-svn-src-head@freebsd.org Thu Oct 22 09:28:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 590124435F1; Thu, 22 Oct 2020 09:28:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CH28r1dxHz4bx2; Thu, 22 Oct 2020 09:28:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 192FF148BD; Thu, 22 Oct 2020 09:28:12 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09M9SBnM038829; Thu, 22 Oct 2020 09:28:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09M9SBrC038828; Thu, 22 Oct 2020 09:28:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202010220928.09M9SBrC038828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 22 Oct 2020 09:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366932 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 09:28:12 -0000 Author: kib Date: Thu Oct 22 09:28:11 2020 New Revision: 366932 URL: https://svnweb.freebsd.org/changeset/base/366932 Log: sysv_sem: semusz depends on semume. Size of the per-process semaphore undo structure (semusz) depends on the number of the per-process undos. If kern.ipc.semume is adjusted, semusz must be adjusted as well, and it makes no sense to delegate adjustment to user. Make it automatic. Reported and tested by: Olef PR: 250361 Reviewed by: jhb, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D26826 Modified: head/sys/kern/sysv_sem.c Modified: head/sys/kern/sysv_sem.c ============================================================================== --- head/sys/kern/sysv_sem.c Thu Oct 22 09:17:56 2020 (r366931) +++ head/sys/kern/sysv_sem.c Thu Oct 22 09:28:11 2020 (r366932) @@ -187,13 +187,13 @@ struct sem_undo { #define SEM_ALIGN(bytes) roundup2(bytes, sizeof(long)) /* actual size of an undo structure */ -#define SEMUSZ SEM_ALIGN(offsetof(struct sem_undo, un_ent[SEMUME])) +#define SEMUSZ(x) SEM_ALIGN(offsetof(struct sem_undo, un_ent[(x)])) /* * Macro to find a particular sem_undo vector */ #define SEMU(ix) \ - ((struct sem_undo *)(((intptr_t)semu)+ix * seminfo.semusz)) + ((struct sem_undo *)(((intptr_t)semu) + (ix) * seminfo.semusz)) /* * semaphore info struct @@ -205,7 +205,7 @@ struct seminfo seminfo = { .semmsl = SEMMSL, /* max # of semaphores per id */ .semopm = SEMOPM, /* max # of operations per semop call */ .semume = SEMUME, /* max # of undo entries per process */ - .semusz = SEMUSZ, /* size in bytes of undo structure */ + .semusz = SEMUSZ(SEMUME), /* size in bytes of undo structure */ .semvmx = SEMVMX, /* semaphore maximum value */ .semaem = SEMAEM, /* adjust on exit max value */ }; @@ -222,7 +222,7 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, semopm, CTLFLAG_RDTUN, "Max operations per semop call"); SYSCTL_INT(_kern_ipc, OID_AUTO, semume, CTLFLAG_RDTUN, &seminfo.semume, 0, "Max undo entries per process"); -SYSCTL_INT(_kern_ipc, OID_AUTO, semusz, CTLFLAG_RDTUN, &seminfo.semusz, 0, +SYSCTL_INT(_kern_ipc, OID_AUTO, semusz, CTLFLAG_RD, &seminfo.semusz, 0, "Size in bytes of undo structure"); SYSCTL_INT(_kern_ipc, OID_AUTO, semvmx, CTLFLAG_RWTUN, &seminfo.semvmx, 0, "Semaphore maximum value"); @@ -284,6 +284,7 @@ seminit(void) M_WAITOK | M_ZERO); sema_mtx = malloc(sizeof(struct mtx) * seminfo.semmni, M_SEM, M_WAITOK | M_ZERO); + seminfo.semusz = SEMUSZ(seminfo.semume); semu = malloc(seminfo.semmnu * seminfo.semusz, M_SEM, M_WAITOK); for (i = 0; i < seminfo.semmni; i++) { From owner-svn-src-head@freebsd.org Thu Oct 22 09:47:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DC48444042; Thu, 22 Oct 2020 09:47:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CH2Zp2hhKz4dwS; Thu, 22 Oct 2020 09:47:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FC2214A5F; Thu, 22 Oct 2020 09:47:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09M9lEAV051500; Thu, 22 Oct 2020 09:47:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09M9lCYA051492; Thu, 22 Oct 2020 09:47:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010220947.09M9lCYA051492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Oct 2020 09:47:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366933 - in head: sbin/ifconfig share/man/man4 sys/net X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head: sbin/ifconfig share/man/man4 sys/net X-SVN-Commit-Revision: 366933 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 09:47:14 -0000 Author: hselasky Date: Thu Oct 22 09:47:12 2020 New Revision: 366933 URL: https://svnweb.freebsd.org/changeset/base/366933 Log: Add support for IP over infiniband, IPoIB, to lagg(4). Currently only the failover protocol is supported due to limitations in the IPoIB architecture. Refer to the lagg(4) manual page for how to configure and use this new feature. A new network interface type, IFT_INFINIBANDLAG, has been added, similar to the existing IFT_IEEE8023ADLAG . ifconfig(8) has been updated to accept a new laggtype argument when creating lagg(4) network interfaces. This new argument is used to distinguish between ethernet and infiniband type of lagg(4) network interface. The laggtype argument is optional and defaults to ethernet. The lagg(4) command line syntax is backwards compatible. Differential Revision: https://reviews.freebsd.org/D26254 Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/iflagg.c head/share/man/man4/lagg.4 head/sys/net/ieee8023ad_lacp.c head/sys/net/if_ethersubr.c head/sys/net/if_infiniband.c head/sys/net/if_lagg.c head/sys/net/if_lagg.h head/sys/net/if_types.h Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Thu Oct 22 09:28:11 2020 (r366932) +++ head/sbin/ifconfig/ifconfig.8 Thu Oct 22 09:47:12 2020 (r366933) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd September 17, 2020 +.Dd October 21, 2020 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2481,6 +2481,12 @@ Set to 0 to disable. .Pp The following parameters are specific to lagg interfaces: .Bl -tag -width indent +.It Cm laggtype Ar type +When creating a lagg interface the type can be specified as either +.Cm ethernet +or +.Cm infiniband . +If not specified ethernet is the default lagg type. .It Cm laggport Ar interface Add the interface named by .Ar interface Modified: head/sbin/ifconfig/iflagg.c ============================================================================== --- head/sbin/ifconfig/iflagg.c Thu Oct 22 09:28:11 2020 (r366932) +++ head/sbin/ifconfig/iflagg.c Thu Oct 22 09:47:12 2020 (r366933) @@ -30,8 +30,12 @@ static const char rcsid[] = #include "ifconfig.h" -char lacpbuf[120]; /* LACP peer '[(a,a,a),(p,p,p)]' */ +static struct iflaggparam params = { + .lagg_type = LAGG_TYPE_DEFAULT, +}; +static char lacpbuf[120]; /* LACP peer '[(a,a,a),(p,p,p)]' */ + static void setlaggport(const char *val, int d, int s, const struct afswtch *afp) { @@ -301,7 +305,31 @@ lagg_status(int s) } } +static +DECL_CMD_FUNC(setlaggtype, arg, d) +{ + static const struct lagg_types lt[] = LAGG_TYPES; + int i; + + for (i = 0; i < nitems(lt); i++) { + if (strcmp(arg, lt[i].lt_name) == 0) { + params.lagg_type = lt[i].lt_value; + return; + } + } + errx(1, "invalid lagg type: %s", arg); +} + +static void +lagg_create(int s, struct ifreq *ifr) +{ + ifr->ifr_data = (caddr_t) ¶ms; + if (ioctl(s, SIOCIFCREATE2, ifr) < 0) + err(1, "SIOCIFCREATE2"); +} + static struct cmd lagg_cmds[] = { + DEF_CLONE_CMD_ARG("laggtype", setlaggtype), DEF_CMD_ARG("laggport", setlaggport), DEF_CMD_ARG("-laggport", unsetlaggport), DEF_CMD_ARG("laggproto", setlaggproto), @@ -335,4 +363,5 @@ lagg_ctor(void) for (i = 0; i < nitems(lagg_cmds); i++) cmd_register(&lagg_cmds[i]); af_register(&af_lagg); + clone_setdefcallback("lagg", lagg_create); } Modified: head/share/man/man4/lagg.4 ============================================================================== --- head/share/man/man4/lagg.4 Thu Oct 22 09:28:11 2020 (r366932) +++ head/share/man/man4/lagg.4 Thu Oct 22 09:47:12 2020 (r366933) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 18, 2017 +.Dd October 21, 2020 .Dt LAGG 4 .Os .Sh NAME @@ -192,6 +192,15 @@ device will be used: .Pp (Note the mac address of the wireless device is forced to match the wired device as a workaround.) +.Pp +The following example shows how to create an infiniband failover interface. +.Bd -literal -offset indent +# ifconfig ib0 up +# ifconfig ib1 up +# ifconfig lagg0 create laggtype infiniband +# ifconfig lagg0 laggproto failover laggport ib0 laggport ib1 \e + 1.1.1.1 netmask 255.255.255.0 +.Ed .Sh SEE ALSO .Xr ng_one2many 4 , .Xr ifconfig 8 , Modified: head/sys/net/ieee8023ad_lacp.c ============================================================================== --- head/sys/net/ieee8023ad_lacp.c Thu Oct 22 09:28:11 2020 (r366932) +++ head/sys/net/ieee8023ad_lacp.c Thu Oct 22 09:47:12 2020 (r366933) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Thu Oct 22 09:28:11 2020 (r366932) +++ head/sys/net/if_ethersubr.c Thu Oct 22 09:47:12 2020 (r366933) @@ -110,7 +110,7 @@ void (*vlan_input_p)(struct ifnet *, struct mbuf *); void (*bridge_dn_p)(struct mbuf *, struct ifnet *); /* if_lagg(4) support */ -struct mbuf *(*lagg_input_p)(struct ifnet *, struct mbuf *); +struct mbuf *(*lagg_input_ethernet_p)(struct ifnet *, struct mbuf *); static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -608,9 +608,9 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m /* Handle input from a lagg(4) port */ if (ifp->if_type == IFT_IEEE8023ADLAG) { - KASSERT(lagg_input_p != NULL, + KASSERT(lagg_input_ethernet_p != NULL, ("%s: if_lagg not loaded!", __func__)); - m = (*lagg_input_p)(ifp, m); + m = (*lagg_input_ethernet_p)(ifp, m); if (m != NULL) ifp = m->m_pkthdr.rcvif; else { Modified: head/sys/net/if_infiniband.c ============================================================================== --- head/sys/net/if_infiniband.c Thu Oct 22 09:28:11 2020 (r366932) +++ head/sys/net/if_infiniband.c Thu Oct 22 09:47:12 2020 (r366933) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -58,6 +59,9 @@ __FBSDID("$FreeBSD$"); #include +/* if_lagg(4) support */ +struct mbuf *(*lagg_input_infiniband_p)(struct ifnet *, struct mbuf *); + #ifdef INET static inline void infiniband_ipv4_multicast_map(uint32_t addr, @@ -345,6 +349,16 @@ infiniband_input(struct ifnet *ifp, struct mbuf *m) /* Direct packet to correct FIB based on interface config. */ M_SETFIB(m, ifp->if_fib); + + /* Handle input from a lagg port */ + if (ifp->if_type == IFT_INFINIBANDLAG) { + KASSERT(lagg_input_infiniband_p != NULL, + ("%s: if_lagg not loaded!", __func__)); + m = (*lagg_input_infiniband_p)(ifp, m); + if (__predict_false(m == NULL)) + goto done; + ifp = m->m_pkthdr.rcvif; + } /* * Dispatch frame to upper layer. Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Thu Oct 22 09:28:11 2020 (r366932) +++ head/sys/net/if_lagg.c Thu Oct 22 09:47:12 2020 (r366933) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #if defined(INET) || defined(INET6) #include @@ -131,7 +132,8 @@ static MALLOC_DEFINE(M_LAGG, laggname, "802.3AD Link A static void lagg_capabilities(struct lagg_softc *); static int lagg_port_create(struct lagg_softc *, struct ifnet *); static int lagg_port_destroy(struct lagg_port *, int); -static struct mbuf *lagg_input(struct ifnet *, struct mbuf *); +static struct mbuf *lagg_input_ethernet(struct ifnet *, struct mbuf *); +static struct mbuf *lagg_input_infiniband(struct ifnet *, struct mbuf *); static void lagg_linkstate(struct lagg_softc *); static void lagg_port_state(struct ifnet *, int); static int lagg_port_ioctl(struct ifnet *, u_long, caddr_t); @@ -164,7 +166,8 @@ static int lagg_setflag(struct lagg_port *, int, int, int (*func)(struct ifnet *, int)); static int lagg_setflags(struct lagg_port *, int status); static uint64_t lagg_get_counter(struct ifnet *ifp, ift_counter cnt); -static int lagg_transmit(struct ifnet *, struct mbuf *); +static int lagg_transmit_ethernet(struct ifnet *, struct mbuf *); +static int lagg_transmit_infiniband(struct ifnet *, struct mbuf *); static void lagg_qflush(struct ifnet *); static int lagg_media_change(struct ifnet *); static void lagg_media_status(struct ifnet *, struct ifmediareq *); @@ -327,7 +330,8 @@ lagg_modevent(module_t mod, int type, void *data) switch (type) { case MOD_LOAD: - lagg_input_p = lagg_input; + lagg_input_ethernet_p = lagg_input_ethernet; + lagg_input_infiniband_p = lagg_input_infiniband; lagg_linkstate_p = lagg_port_state; lagg_detach_cookie = EVENTHANDLER_REGISTER( ifnet_departure_event, lagg_port_ifdetach, NULL, @@ -336,7 +340,8 @@ lagg_modevent(module_t mod, int type, void *data) case MOD_UNLOAD: EVENTHANDLER_DEREGISTER(ifnet_departure_event, lagg_detach_cookie); - lagg_input_p = NULL; + lagg_input_ethernet_p = NULL; + lagg_input_infiniband_p = NULL; lagg_linkstate_p = NULL; break; default: @@ -353,6 +358,7 @@ static moduledata_t lagg_mod = { DECLARE_MODULE(if_lagg, lagg_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_lagg, 1); +MODULE_DEPEND(if_lagg, if_infiniband, 1, 1, 1); static void lagg_proto_attach(struct lagg_softc *sc, lagg_proto pr) @@ -504,18 +510,48 @@ lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_i static int lagg_clone_create(struct if_clone *ifc, int unit, caddr_t params) { + struct iflaggparam iflp; struct lagg_softc *sc; struct ifnet *ifp; - static const u_char eaddr[6]; /* 00:00:00:00:00:00 */ + int if_type; + int error; + static const uint8_t eaddr[LAGG_ADDR_LEN]; + static const uint8_t ib_bcast_addr[INFINIBAND_ADDR_LEN] = { + 0x00, 0xff, 0xff, 0xff, + 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff + }; + if (params != NULL) { + error = copyin(params, &iflp, sizeof(iflp)); + if (error) + return (error); + + switch (iflp.lagg_type) { + case LAGG_TYPE_ETHERNET: + if_type = IFT_ETHER; + break; + case LAGG_TYPE_INFINIBAND: + if_type = IFT_INFINIBAND; + break; + default: + return (EINVAL); + } + } else { + if_type = IFT_ETHER; + } + sc = malloc(sizeof(*sc), M_LAGG, M_WAITOK|M_ZERO); - ifp = sc->sc_ifp = if_alloc(IFT_ETHER); + ifp = sc->sc_ifp = if_alloc(if_type); if (ifp == NULL) { free(sc, M_LAGG); return (ENOSPC); } LAGG_SX_INIT(sc); + mtx_init(&sc->sc_mtx, "lagg-mtx", NULL, MTX_DEF); + callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0); + LAGG_XLOCK(sc); if (V_def_use_flowid) sc->sc_opts |= LAGG_OPT_USE_FLOWID; @@ -530,15 +566,25 @@ lagg_clone_create(struct if_clone *ifc, int unit, cadd CK_SLIST_INIT(&sc->sc_ports); - /* Initialise pseudo media types */ - ifmedia_init(&sc->sc_media, 0, lagg_media_change, - lagg_media_status); - ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL); - ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO); + switch (if_type) { + case IFT_ETHER: + /* Initialise pseudo media types */ + ifmedia_init(&sc->sc_media, 0, lagg_media_change, + lagg_media_status); + ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO); - if_initname(ifp, laggname, unit); + if_initname(ifp, laggname, unit); + ifp->if_transmit = lagg_transmit_ethernet; + break; + case IFT_INFINIBAND: + if_initname(ifp, laggname, unit); + ifp->if_transmit = lagg_transmit_infiniband; + break; + default: + break; + } ifp->if_softc = sc; - ifp->if_transmit = lagg_transmit; ifp->if_qflush = lagg_qflush; ifp->if_init = lagg_init; ifp->if_ioctl = lagg_ioctl; @@ -555,9 +601,18 @@ lagg_clone_create(struct if_clone *ifc, int unit, cadd /* * Attach as an ordinary ethernet device, children will be attached - * as special device IFT_IEEE8023ADLAG. + * as special device IFT_IEEE8023ADLAG or IFT_INFINIBANDLAG. */ - ether_ifattach(ifp, eaddr); + switch (if_type) { + case IFT_ETHER: + ether_ifattach(ifp, eaddr); + break; + case IFT_INFINIBAND: + infiniband_ifattach(ifp, eaddr, ib_bcast_addr); + break; + default: + break; + } sc->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, lagg_register_vlan, sc, EVENTHANDLER_PRI_FIRST); @@ -595,14 +650,24 @@ lagg_clone_destroy(struct ifnet *ifp) lagg_proto_detach(sc); LAGG_XUNLOCK(sc); - ifmedia_removeall(&sc->sc_media); - ether_ifdetach(ifp); + switch (ifp->if_type) { + case IFT_ETHER: + ifmedia_removeall(&sc->sc_media); + ether_ifdetach(ifp); + break; + case IFT_INFINIBAND: + infiniband_ifdetach(ifp); + break; + default: + break; + } if_free(ifp); LAGG_LIST_LOCK(); SLIST_REMOVE(&V_lagg_list, sc, lagg_softc, sc_entries); LAGG_LIST_UNLOCK(); + mtx_destroy(&sc->sc_mtx); LAGG_SX_DESTROY(sc); free(sc, M_LAGG); } @@ -669,6 +734,7 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * struct lagg_port *lp, *tlp; struct ifreq ifr; int error, i, oldmtu; + int if_type; uint64_t *pval; LAGG_XLOCK_ASSERT(sc); @@ -695,9 +761,22 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * return (EBUSY); } - /* XXX Disallow non-ethernet interfaces (this should be any of 802) */ - if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) - return (EPROTONOSUPPORT); + switch (sc->sc_ifp->if_type) { + case IFT_ETHER: + /* XXX Disallow non-ethernet interfaces (this should be any of 802) */ + if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) + return (EPROTONOSUPPORT); + if_type = IFT_IEEE8023ADLAG; + break; + case IFT_INFINIBAND: + /* XXX Disallow non-infiniband interfaces */ + if (ifp->if_type != IFT_INFINIBAND) + return (EPROTONOSUPPORT); + if_type = IFT_INFINIBANDLAG; + break; + default: + break; + } /* Allow the first Ethernet member to define the MTU */ oldmtu = -1; @@ -754,14 +833,14 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * if_ref(ifp); lp->lp_ifp = ifp; - bcopy(IF_LLADDR(ifp), lp->lp_lladdr, ETHER_ADDR_LEN); + bcopy(IF_LLADDR(ifp), lp->lp_lladdr, ifp->if_addrlen); lp->lp_ifcapenable = ifp->if_capenable; if (CK_SLIST_EMPTY(&sc->sc_ports)) { - bcopy(IF_LLADDR(ifp), IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); + bcopy(IF_LLADDR(ifp), IF_LLADDR(sc->sc_ifp), ifp->if_addrlen); lagg_proto_lladdr(sc); EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); } else { - if_setlladdr(ifp, IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); + if_setlladdr(ifp, IF_LLADDR(sc->sc_ifp), ifp->if_addrlen); } lagg_setflags(lp, 1); @@ -770,7 +849,7 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet * /* Change the interface type */ lp->lp_iftype = ifp->if_type; - ifp->if_type = IFT_IEEE8023ADLAG; + ifp->if_type = if_type; ifp->if_lagg = lp; lp->lp_ioctl = ifp->if_ioctl; ifp->if_ioctl = lagg_port_ioctl; @@ -887,15 +966,15 @@ lagg_port_destroy(struct lagg_port *lp, int rundelport /* Update the primary interface */ if (lp == sc->sc_primary) { - uint8_t lladdr[ETHER_ADDR_LEN]; + uint8_t lladdr[LAGG_ADDR_LEN]; if ((lp0 = CK_SLIST_FIRST(&sc->sc_ports)) == NULL) - bzero(&lladdr, ETHER_ADDR_LEN); + bzero(&lladdr, LAGG_ADDR_LEN); else - bcopy(lp0->lp_lladdr, lladdr, ETHER_ADDR_LEN); + bcopy(lp0->lp_lladdr, lladdr, LAGG_ADDR_LEN); sc->sc_primary = lp0; if (sc->sc_destroying == 0) { - bcopy(lladdr, IF_LLADDR(sc->sc_ifp), ETHER_ADDR_LEN); + bcopy(lladdr, IF_LLADDR(sc->sc_ifp), sc->sc_ifp->if_addrlen); lagg_proto_lladdr(sc); EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); } @@ -905,7 +984,7 @@ lagg_port_destroy(struct lagg_port *lp, int rundelport * as well, to switch from old lladdr to its 'real' one) */ CK_SLIST_FOREACH(lp_ptr, &sc->sc_ports, lp_entries) - if_setlladdr(lp_ptr->lp_ifp, lladdr, ETHER_ADDR_LEN); + if_setlladdr(lp_ptr->lp_ifp, lladdr, lp_ptr->lp_ifp->if_addrlen); } if (lp->lp_ifflags) @@ -914,7 +993,7 @@ lagg_port_destroy(struct lagg_port *lp, int rundelport if (lp->lp_detaching == 0) { lagg_setflags(lp, 0); lagg_setcaps(lp, lp->lp_ifcapenable); - if_setlladdr(ifp, lp->lp_lladdr, ETHER_ADDR_LEN); + if_setlladdr(ifp, lp->lp_lladdr, ifp->if_addrlen); } /* @@ -938,9 +1017,15 @@ lagg_port_ioctl(struct ifnet *ifp, u_long cmd, caddr_t int error = 0; /* Should be checked by the caller */ - if (ifp->if_type != IFT_IEEE8023ADLAG || - (lp = ifp->if_lagg) == NULL || (sc = lp->lp_softc) == NULL) + switch (ifp->if_type) { + case IFT_IEEE8023ADLAG: + case IFT_INFINIBANDLAG: + if ((lp = ifp->if_lagg) == NULL || (sc = lp->lp_softc) == NULL) + goto fallback; + break; + default: goto fallback; + } switch (cmd) { case SIOCGLAGGPORT: @@ -1130,6 +1215,44 @@ lagg_port2req(struct lagg_port *lp, struct lagg_reqpor } static void +lagg_watchdog_infiniband(void *arg) +{ + struct lagg_softc *sc; + struct lagg_port *lp; + struct ifnet *ifp; + struct ifnet *lp_ifp; + + sc = arg; + + /* + * Because infiniband nodes have a fixed MAC address, which is + * generated by the so-called GID, we need to regularly update + * the link level address of the parent lagg device when + * the active port changes. Possibly we could piggy-back on + * link up/down events aswell, but using a timer also provides + * a guarantee against too frequent events. This operation + * does not have to be atomic. + */ + LAGG_RLOCK(); + lp = lagg_link_active(sc, sc->sc_primary); + if (lp != NULL) { + ifp = sc->sc_ifp; + lp_ifp = lp->lp_ifp; + + if (ifp != NULL && lp_ifp != NULL && + memcmp(IF_LLADDR(ifp), IF_LLADDR(lp_ifp), ifp->if_addrlen) != 0) { + memcpy(IF_LLADDR(ifp), IF_LLADDR(lp_ifp), ifp->if_addrlen); + CURVNET_SET(ifp->if_vnet); + EVENTHANDLER_INVOKE(iflladdr_event, ifp); + CURVNET_RESTORE(); + } + } + LAGG_RUNLOCK(); + + callout_reset(&sc->sc_watchdog, hz, &lagg_watchdog_infiniband, arg); +} + +static void lagg_init(void *xsc) { struct lagg_softc *sc = (struct lagg_softc *)xsc; @@ -1151,12 +1274,18 @@ lagg_init(void *xsc) */ CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { if (memcmp(IF_LLADDR(ifp), IF_LLADDR(lp->lp_ifp), - ETHER_ADDR_LEN) != 0) - if_setlladdr(lp->lp_ifp, IF_LLADDR(ifp), ETHER_ADDR_LEN); + ifp->if_addrlen) != 0) + if_setlladdr(lp->lp_ifp, IF_LLADDR(ifp), ifp->if_addrlen); } lagg_proto_init(sc); + if (ifp->if_type == IFT_INFINIBAND) { + mtx_lock(&sc->sc_mtx); + lagg_watchdog_infiniband(sc); + mtx_unlock(&sc->sc_mtx); + } + LAGG_XUNLOCK(sc); } @@ -1173,6 +1302,12 @@ lagg_stop(struct lagg_softc *sc) ifp->if_drv_flags &= ~IFF_DRV_RUNNING; lagg_proto_stop(sc); + + mtx_lock(&sc->sc_mtx); + callout_stop(&sc->sc_watchdog); + mtx_unlock(&sc->sc_mtx); + + callout_drain(&sc->sc_watchdog); } static int @@ -1228,7 +1363,12 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data error = EPROTONOSUPPORT; break; } - + /* Infiniband only supports the failover protocol. */ + if (ra->ra_proto != LAGG_PROTO_FAILOVER && + ifp->if_type == IFT_INFINIBAND) { + error = EPROTONOSUPPORT; + break; + } LAGG_XLOCK(sc); lagg_proto_detach(sc); LAGG_UNLOCK_ASSERT(); @@ -1546,7 +1686,10 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: - error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); + if (ifp->if_type == IFT_INFINIBAND) + error = EINVAL; + else + error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); break; case SIOCSIFCAP: @@ -1855,7 +1998,7 @@ lagg_setflags(struct lagg_port *lp, int status) } static int -lagg_transmit(struct ifnet *ifp, struct mbuf *m) +lagg_transmit_ethernet(struct ifnet *ifp, struct mbuf *m) { struct lagg_softc *sc = (struct lagg_softc *)ifp->if_softc; int error; @@ -1880,6 +2023,32 @@ lagg_transmit(struct ifnet *ifp, struct mbuf *m) return (error); } +static int +lagg_transmit_infiniband(struct ifnet *ifp, struct mbuf *m) +{ + struct lagg_softc *sc = (struct lagg_softc *)ifp->if_softc; + int error; + +#if defined(KERN_TLS) || defined(RATELIMIT) + if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) + MPASS(m->m_pkthdr.snd_tag->ifp == ifp); +#endif + LAGG_RLOCK(); + /* We need a Tx algorithm and at least one port */ + if (sc->sc_proto == LAGG_PROTO_NONE || sc->sc_count == 0) { + LAGG_RUNLOCK(); + m_freem(m); + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + return (ENXIO); + } + + INFINIBAND_BPF_MTAP(ifp, m); + + error = lagg_proto_start(sc, m); + LAGG_RUNLOCK(); + return (error); +} + /* * The ifp->if_qflush entry point for lagg(4) is no-op. */ @@ -1889,7 +2058,7 @@ lagg_qflush(struct ifnet *ifp __unused) } static struct mbuf * -lagg_input(struct ifnet *ifp, struct mbuf *m) +lagg_input_ethernet(struct ifnet *ifp, struct mbuf *m) { struct lagg_port *lp = ifp->if_lagg; struct lagg_softc *sc = lp->lp_softc; @@ -1905,6 +2074,34 @@ lagg_input(struct ifnet *ifp, struct mbuf *m) } ETHER_BPF_MTAP(scifp, m); + + m = lagg_proto_input(sc, lp, m); + if (m != NULL && (scifp->if_flags & IFF_MONITOR) != 0) { + m_freem(m); + m = NULL; + } + + LAGG_RUNLOCK(); + return (m); +} + +static struct mbuf * +lagg_input_infiniband(struct ifnet *ifp, struct mbuf *m) +{ + struct lagg_port *lp = ifp->if_lagg; + struct lagg_softc *sc = lp->lp_softc; + struct ifnet *scifp = sc->sc_ifp; + + LAGG_RLOCK(); + if ((scifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + lp->lp_detaching != 0 || + sc->sc_proto == LAGG_PROTO_NONE) { + LAGG_RUNLOCK(); + m_freem(m); + return (NULL); + } + + INFINIBAND_BPF_MTAP(scifp, m); m = lagg_proto_input(sc, lp, m); if (m != NULL && (scifp->if_flags & IFF_MONITOR) != 0) { Modified: head/sys/net/if_lagg.h ============================================================================== --- head/sys/net/if_lagg.h Thu Oct 22 09:28:11 2020 (r366932) +++ head/sys/net/if_lagg.h Thu Oct 22 09:47:12 2020 (r366933) @@ -72,7 +72,34 @@ struct lagg_protos { { "default", LAGG_PROTO_DEFAULT } \ } +/* Supported lagg TYPEs */ +typedef enum { + LAGG_TYPE_ETHERNET = 0, /* ethernet (default) */ + LAGG_TYPE_INFINIBAND, /* infiniband */ + LAGG_TYPE_MAX, +} lagg_type; + +struct lagg_types { + const char *lt_name; + lagg_type lt_value; +}; + +#define LAGG_TYPE_DEFAULT LAGG_TYPE_ETHERNET +#define LAGG_TYPES { \ + { "ethernet", LAGG_TYPE_ETHERNET }, \ + { "infiniband", LAGG_TYPE_INFINIBAND }, \ +} + /* + * lagg create clone params + */ +struct iflaggparam { + uint8_t lagg_type; /* see LAGG_TYPE_XXX */ + uint8_t reserved_8[3]; + uint32_t reserved_32[3]; +}; + +/* * lagg ioctls. */ @@ -206,7 +233,7 @@ struct lagg_counters { struct lagg_softc { struct ifnet *sc_ifp; /* virtual interface */ - struct rmlock sc_mtx; + struct mtx sc_mtx; /* watchdog mutex */ struct sx sc_sx; int sc_proto; /* lagg protocol */ u_int sc_count; /* number of ports */ @@ -230,12 +257,15 @@ struct lagg_softc { u_int sc_opts; int flowid_shift; /* shift the flowid */ struct lagg_counters detached_counters; /* detached ports sum */ + struct callout sc_watchdog; /* watchdog timer */ }; struct lagg_port { struct ifnet *lp_ifp; /* physical interface */ struct lagg_softc *lp_softc; /* parent lagg */ - uint8_t lp_lladdr[ETHER_ADDR_LEN]; +#define LAGG_ADDR_LEN \ + MAX(INFINIBAND_ADDR_LEN, ETHER_ADDR_LEN) + uint8_t lp_lladdr[LAGG_ADDR_LEN]; u_char lp_iftype; /* interface type */ uint32_t lp_prio; /* port priority */ @@ -257,7 +287,8 @@ struct lagg_port { struct epoch_context lp_epoch_ctx; }; -extern struct mbuf *(*lagg_input_p)(struct ifnet *, struct mbuf *); +extern struct mbuf *(*lagg_input_ethernet_p)(struct ifnet *, struct mbuf *); +extern struct mbuf *(*lagg_input_infiniband_p)(struct ifnet *, struct mbuf *); extern void (*lagg_linkstate_p)(struct ifnet *, int ); int lagg_enqueue(struct ifnet *, struct mbuf *); Modified: head/sys/net/if_types.h ============================================================================== --- head/sys/net/if_types.h Thu Oct 22 09:28:11 2020 (r366932) +++ head/sys/net/if_types.h Thu Oct 22 09:47:12 2020 (r366933) @@ -242,6 +242,7 @@ typedef enum { IFT_OPTICALCHANNEL = 0xc3, /* Optical Channel */ IFT_OPTICALTRANSPORT = 0xc4, /* Optical Transport */ IFT_INFINIBAND = 0xc7, /* Infiniband */ + IFT_INFINIBANDLAG = 0xc8, /* Infiniband Link Aggregate */ IFT_BRIDGE = 0xd1, /* Transparent bridge interface */ IFT_STF = 0xd7, /* 6to4 interface */ From owner-svn-src-head@freebsd.org Thu Oct 22 10:29:28 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A1F9444A71; Thu, 22 Oct 2020 10:29:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CH3WX0Xglz3SRj; Thu, 22 Oct 2020 10:29:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9D8D15621; Thu, 22 Oct 2020 10:29:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MATRfA075796; Thu, 22 Oct 2020 10:29:27 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MATRtK075795; Thu, 22 Oct 2020 10:29:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010221029.09MATRtK075795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Oct 2020 10:29:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366934 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 366934 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 10:29:28 -0000 Author: hselasky Date: Thu Oct 22 10:29:27 2020 New Revision: 366934 URL: https://svnweb.freebsd.org/changeset/base/366934 Log: Fix for monotolithic kernel builds using device lagg(4). Differential Revision: https://reviews.freebsd.org/D26254 Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Oct 22 09:47:12 2020 (r366933) +++ head/sys/conf/files Thu Oct 22 10:29:27 2020 (r366934) @@ -4571,7 +4571,7 @@ compat/lindebugfs/lindebugfs.c optional lindebugfs \ compile-with "${LINUXKPI_C}" # OpenFabrics Enterprise Distribution (Infiniband) -net/if_infiniband.c optional ofed +net/if_infiniband.c optional ofed | lagg ofed/drivers/infiniband/core/ib_addr.c optional ofed \ compile-with "${OFED_C}" ofed/drivers/infiniband/core/ib_agent.c optional ofed \ From owner-svn-src-head@freebsd.org Thu Oct 22 10:36:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C6D9444D2C; Thu, 22 Oct 2020 10:36:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CH3gP20NSz3SR6; Thu, 22 Oct 2020 10:36:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2371C157A2; Thu, 22 Oct 2020 10:36:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MAaGgi081829; Thu, 22 Oct 2020 10:36:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MAaGn6081828; Thu, 22 Oct 2020 10:36:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010221036.09MAaGn6081828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Oct 2020 10:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366935 - head/sbin/ifconfig X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sbin/ifconfig X-SVN-Commit-Revision: 366935 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 10:36:17 -0000 Author: hselasky Date: Thu Oct 22 10:36:16 2020 New Revision: 366935 URL: https://svnweb.freebsd.org/changeset/base/366935 Log: Fix for colliding change (r366917). Differential Revision: https://reviews.freebsd.org/D26254 Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sbin/ifconfig/iflagg.c Modified: head/sbin/ifconfig/iflagg.c ============================================================================== --- head/sbin/ifconfig/iflagg.c Thu Oct 22 10:29:27 2020 (r366934) +++ head/sbin/ifconfig/iflagg.c Thu Oct 22 10:36:16 2020 (r366935) @@ -363,5 +363,5 @@ lagg_ctor(void) for (i = 0; i < nitems(lagg_cmds); i++) cmd_register(&lagg_cmds[i]); af_register(&af_lagg); - clone_setdefcallback("lagg", lagg_create); + clone_setdefcallback_prefix("lagg", lagg_create); } From owner-svn-src-head@freebsd.org Thu Oct 22 12:22:09 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 673F7447AD9; Thu, 22 Oct 2020 12:22:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CH61Y29Wbz3YM3; Thu, 22 Oct 2020 12:22:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D95F16CC3; Thu, 22 Oct 2020 12:22:09 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MCM870048408; Thu, 22 Oct 2020 12:22:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MCM8qo048407; Thu, 22 Oct 2020 12:22:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010221222.09MCM8qo048407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 22 Oct 2020 12:22:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366936 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 366936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 12:22:09 -0000 Author: hselasky Date: Thu Oct 22 12:22:08 2020 New Revision: 366936 URL: https://svnweb.freebsd.org/changeset/base/366936 Log: Compile fix for MIPS, MIPS64, POWERPC and POWERPC64. Add missing include files. Differential Revision: https://reviews.freebsd.org/D26254 Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/net/if_infiniband.c Modified: head/sys/net/if_infiniband.c ============================================================================== --- head/sys/net/if_infiniband.c Thu Oct 22 10:36:16 2020 (r366935) +++ head/sys/net/if_infiniband.c Thu Oct 22 12:22:08 2020 (r366936) @@ -29,6 +29,8 @@ #include __FBSDID("$FreeBSD$"); +#include +#include #include #include #include From owner-svn-src-head@freebsd.org Thu Oct 22 13:22:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F96F448A1E; Thu, 22 Oct 2020 13:22:51 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CH7Mb05dkz3cd8; Thu, 22 Oct 2020 13:22:51 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id D61E518385; Thu, 22 Oct 2020 13:22:50 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f42.google.com with SMTP id t6so808835qvz.4; Thu, 22 Oct 2020 06:22:50 -0700 (PDT) X-Gm-Message-State: AOAM532W777w1WITHkDIiozX7vt++2AfiXfXfjRb2DZgq9kJW4231Uv1 gWULstbt5W1DEhOAkbPc12e+W6Vaq7dDyTo5GnQ= X-Google-Smtp-Source: ABdhPJzIi2RoZyRlYpt9VIIZC7qfkuXXath43UeS166VmN0mmmJHObVj8vx/V+AvO2v++hlG3RDYVov+9VBH8ovBTV0= X-Received: by 2002:a0c:c709:: with SMTP id w9mr2130396qvi.26.1603372970325; Thu, 22 Oct 2020 06:22:50 -0700 (PDT) MIME-Version: 1.0 References: <202010021826.092IQfdj023808@repo.freebsd.org> <44421602932538@mail.yandex.ru> <43251602934532@mail.yandex.ru> <59021602950992@mail.yandex.ru> In-Reply-To: From: Kyle Evans Date: Thu, 22 Oct 2020 08:22:38 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r366372 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf To: Warner Losh Cc: "Alexander V. Chernikov" , Hans Petter Selasky , Emmanuel Vadot , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 13:22:51 -0000 On Sat, Oct 17, 2020 at 11:40 AM Warner Losh wrote: > > > > On Sat, Oct 17, 2020, 10:11 AM Alexander V. Chernikov wrote: >> >> 17.10.2020, 14:07, "Hans Petter Selasky" : >> >> On 2020-10-17 14:34, Alexander V. Chernikov wrote: >> >> 17.10.2020, 12:32, "Hans Petter Selasky" : >> >> On 2020-10-17 13:27, Alexander V. Chernikov wrote: >> >> 02.10.2020, 19:26, "Emmanuel Vadot" > >: >> >> Author: manu >> Date: Fri Oct 2 18:26:41 2020 >> New Revision: 366372 >> URL: https://svnweb.freebsd.org/changeset/base/366372 >> >> Log: >> linuxkpi: Add backlight support >> >> Add backlight function to linuxkpi. >> Graphics drivers expose the backlight of the panel directly so >> allow them >> to use the backlight subsystem so >> user can use backlight(8) to configure them. >> >> Reviewed by: hselasky >> Relnotes: yes >> Differential Revision: The FreeBSD Foundation >> >> Added: >> head/sys/compat/linuxkpi/common/include/linux/backlight.h >> (contents, >> props changed) >> Modified: >> head/sys/compat/linuxkpi/common/include/linux/device.h >> head/sys/compat/linuxkpi/common/src/linux_kmod.c >> head/sys/compat/linuxkpi/common/src/linux_pci.c >> head/sys/conf/kmod.mk >> >> It breaks the build for me with >> /usr/home/melifaro/free/head/sys/compat/linuxkpi/common/src/linux_pci.c:70:10: >> fatal error: 'backlight_if.h' file not found >> >> >> How do you build? Doesn't break over here. >> >> GENERIC + COMPAT_LINUXKPI. >> >> >> >> Try adding: >> >> options backlight >> >> To the kernel config. >> >> Yep, thank you! >> Maybe it's worth considering adding static assert with the message describing this dependency? > > > Yes. It likely is worth doing something to highlight this issue. > > Warner > I think we just need to slap the two core backlight files with an ` | compat_linux` so that they simply get pulled in if you specify COMPAT_LINUX. config(8) handles this terribly, configng must have a better provides/requires/implies/whatever functionality so we can specify that compat_linux implies backlight and not do crud like this where it becomes more complicated to see what any given option really entails. Thanks, Kyle Evans From owner-svn-src-head@freebsd.org Thu Oct 22 16:48:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A207544CDB4; Thu, 22 Oct 2020 16:48:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHCwg08BYz473l; Thu, 22 Oct 2020 16:48:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 09MGm4qM047016 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 22 Oct 2020 19:48:07 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 09MGm4qM047016 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 09MGm4ns047015; Thu, 22 Oct 2020 19:48:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 22 Oct 2020 19:48:04 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366936 - head/sys/net Message-ID: <20201022164804.GQ2643@kib.kiev.ua> References: <202010221222.09MCM8qo048407@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202010221222.09MCM8qo048407@repo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CHCwg08BYz473l X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 16:48:19 -0000 On Thu, Oct 22, 2020 at 12:22:08PM +0000, Hans Petter Selasky wrote: > Author: hselasky > Date: Thu Oct 22 12:22:08 2020 > New Revision: 366936 > URL: https://svnweb.freebsd.org/changeset/base/366936 > > Log: > Compile fix for MIPS, MIPS64, POWERPC and POWERPC64. > Add missing include files. > > Differential Revision: https://reviews.freebsd.org/D26254 > Reviewed by: melifaro@ > MFC after: 1 week > Sponsored by: Mellanox Technologies // NVIDIA Networking > > Modified: > head/sys/net/if_infiniband.c > > Modified: head/sys/net/if_infiniband.c > ============================================================================== > --- head/sys/net/if_infiniband.c Thu Oct 22 10:36:16 2020 (r366935) > +++ head/sys/net/if_infiniband.c Thu Oct 22 12:22:08 2020 (r366936) > @@ -29,6 +29,8 @@ > #include > __FBSDID("$FreeBSD$"); > > +#include > +#include > #include > #include > #include sys/systm.h already includes sys/param.h. Also, sys/param.h already includes sys/types.h. From owner-svn-src-head@freebsd.org Thu Oct 22 17:05:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 064FF44DA14; Thu, 22 Oct 2020 17:05:56 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHDJz641Qz4822; Thu, 22 Oct 2020 17:05:55 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3D8319A73; Thu, 22 Oct 2020 17:05:55 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MH5ttZ024747; Thu, 22 Oct 2020 17:05:55 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MH5tXh024746; Thu, 22 Oct 2020 17:05:55 GMT (envelope-from np@FreeBSD.org) Message-Id: <202010221705.09MH5tXh024746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 22 Oct 2020 17:05:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366941 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 366941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 17:05:56 -0000 Author: np Date: Thu Oct 22 17:05:55 2020 New Revision: 366941 URL: https://svnweb.freebsd.org/changeset/base/366941 Log: if_vxlan(4): csum_flags_to_inner_flags takes the tunnel protocol as a parameter. No functional change. Modified: head/sys/net/if_vxlan.c Modified: head/sys/net/if_vxlan.c ============================================================================== --- head/sys/net/if_vxlan.c Thu Oct 22 16:41:13 2020 (r366940) +++ head/sys/net/if_vxlan.c Thu Oct 22 17:05:55 2020 (r366941) @@ -2423,9 +2423,9 @@ vxlan_encap_header(struct vxlan_softc *sc, struct mbuf * Return the CSUM_INNER_* equivalent of CSUM_* caps. */ static uint32_t -csum_flags_to_inner_flags(uint32_t csum_flags_in, uint32_t encap) +csum_flags_to_inner_flags(uint32_t csum_flags_in, const uint32_t encap) { - uint32_t csum_flags = CSUM_ENCAP_VXLAN; + uint32_t csum_flags = encap; const uint32_t v4 = CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP; /* From owner-svn-src-head@freebsd.org Thu Oct 22 17:46:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D949744E93D; Thu, 22 Oct 2020 17:46:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHFDH5VLPz4GXr; Thu, 22 Oct 2020 17:46:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FC3E1A632; Thu, 22 Oct 2020 17:46:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MHkt32053257; Thu, 22 Oct 2020 17:46:55 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MHktox053256; Thu, 22 Oct 2020 17:46:55 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <202010221746.09MHktox053256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 22 Oct 2020 17:46:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366943 - head/sys/crypto/ccp X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: head/sys/crypto/ccp X-SVN-Commit-Revision: 366943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 17:46:55 -0000 Author: jkim Date: Thu Oct 22 17:46:55 2020 New Revision: 366943 URL: https://svnweb.freebsd.org/changeset/base/366943 Log: Add a new CCP device ID found on my Ryzen 5 3600XT. MFC after: 1 week Modified: head/sys/crypto/ccp/ccp.c Modified: head/sys/crypto/ccp/ccp.c ============================================================================== --- head/sys/crypto/ccp/ccp.c Thu Oct 22 17:31:41 2020 (r366942) +++ head/sys/crypto/ccp/ccp.c Thu Oct 22 17:46:55 2020 (r366943) @@ -78,6 +78,7 @@ static struct pciid { } ccp_ids[] = { { 0x14561022, "AMD CCP-5a" }, { 0x14681022, "AMD CCP-5b" }, + { 0x14861022, "AMD CCP-5a" }, { 0x15df1022, "AMD CCP-5a" }, }; From owner-svn-src-head@freebsd.org Thu Oct 22 17:47:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1559A44E9DE; Thu, 22 Oct 2020 17:47:52 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHFFM6s2mz4GbS; Thu, 22 Oct 2020 17:47:51 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE7051AA0C; Thu, 22 Oct 2020 17:47:51 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MHlpIx053344; Thu, 22 Oct 2020 17:47:51 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MHlprO053343; Thu, 22 Oct 2020 17:47:51 GMT (envelope-from alc@FreeBSD.org) Message-Id: <202010221747.09MHlprO053343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 22 Oct 2020 17:47:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366944 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 366944 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 17:47:52 -0000 Author: alc Date: Thu Oct 22 17:47:51 2020 New Revision: 366944 URL: https://svnweb.freebsd.org/changeset/base/366944 Log: Micro-optimize uma_small_alloc(). Replace bzero(..., PAGE_SIZE) by pagezero(). Ultimately, they use the same method for bulk zeroing, but the generality of bzero() requires size and alignment checks that pagezero() does not. Eliminate an unnecessary #include. Reviewed by: emaste, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D26876 Modified: head/sys/arm64/arm64/uma_machdep.c Modified: head/sys/arm64/arm64/uma_machdep.c ============================================================================== --- head/sys/arm64/arm64/uma_machdep.c Thu Oct 22 17:46:55 2020 (r366943) +++ head/sys/arm64/arm64/uma_machdep.c Thu Oct 22 17:47:51 2020 (r366944) @@ -36,11 +36,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include -#include +#include void * uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, @@ -60,7 +59,7 @@ uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int dump_add_page(pa); va = (void *)PHYS_TO_DMAP(pa); if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); + pagezero(va); return (va); } From owner-svn-src-head@freebsd.org Thu Oct 22 17:55:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5664644EB54; Thu, 22 Oct 2020 17:55:01 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHFPX1fngz4HZH; Thu, 22 Oct 2020 17:54:55 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id BF9012602CC; Thu, 22 Oct 2020 19:54:45 +0200 (CEST) Subject: Re: svn commit: r366936 - head/sys/net To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202010221222.09MCM8qo048407@repo.freebsd.org> <20201022164804.GQ2643@kib.kiev.ua> From: Hans Petter Selasky Message-ID: <69bfca24-40a9-552a-62b3-8ab7b46ff3c7@selasky.org> Date: Thu, 22 Oct 2020 19:54:06 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201022164804.GQ2643@kib.kiev.ua> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CHFPX1fngz4HZH X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-2.63 / 15.00]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; ARC_NA(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.986]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.47)[-0.469]; NEURAL_HAM_MEDIUM(-0.87)[-0.872]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 17:55:02 -0000 On 2020-10-22 18:48, Konstantin Belousov wrote: > sys/systm.h already includes sys/param.h. Also, sys/param.h already includes > sys/types.h. I'll have a look tomorrow at this. Thanks for pointing out. --HPS From owner-svn-src-head@freebsd.org Thu Oct 22 18:00:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C07C144F313; Thu, 22 Oct 2020 18:00:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHFWW4m2Gz4KdH; Thu, 22 Oct 2020 18:00:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87E431A5DC; Thu, 22 Oct 2020 18:00:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MI07GP063876; Thu, 22 Oct 2020 18:00:07 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MI07GS063875; Thu, 22 Oct 2020 18:00:07 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202010221800.09MI07GS063875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 22 Oct 2020 18:00:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366945 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 366945 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 18:00:07 -0000 Author: glebius Date: Thu Oct 22 18:00:07 2020 New Revision: 366945 URL: https://svnweb.freebsd.org/changeset/base/366945 Log: Fix typo Modified: head/share/man/man9/pfil.9 Modified: head/share/man/man9/pfil.9 ============================================================================== --- head/share/man/man9/pfil.9 Thu Oct 22 17:47:51 2020 (r366944) +++ head/share/man/man9/pfil.9 Thu Oct 22 18:00:07 2020 (r366945) @@ -144,7 +144,7 @@ Link-layer packets. .El .Pp Default rulesets are automatically linked to these heads to preserve -historical behavavior. +historical behaviour. .Sh SEE ALSO .Xr ipfilter 4 , .Xr ipfw 4 , From owner-svn-src-head@freebsd.org Thu Oct 22 18:08:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF78744F4BA for ; Thu, 22 Oct 2020 18:08:26 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHFj56hY9z4L73 for ; Thu, 22 Oct 2020 18:08:25 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f43.google.com with SMTP id c194so3297854wme.2 for ; Thu, 22 Oct 2020 11:08:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=rXcj/sQ8OaAf7DlGOhNz+eIEoBhUV6nYblgb1YdD9uA=; b=VpAiJALzPZeIV1C+rHeAxlVhdl3PeodsFKsQ/IkNLuZ8WKYQq+W9SiHKRnnTHEZnDB O4X5UhyaaSLrlh65H8ba62ooEZkls/0utwA/K15r30lBFjl+M1aooPO+W4DwX9KaM59e EJL6VxYR8WMl113fKgKEghJGu6UjxirTfndjBb2GWfx+x2r+4XGJ53yPogDqcmmvPs8K zhiBQkvKXcb3Gg89+2DrYnvJjPAKFKWRtV+t7aBAa8Y/u1qMrdSIK0+r+iu08XSkDqQB U8YAgu7cvZlpMUPgwimm/EZqhRdPawaaVZQgTZF0yuHYPbexASBT8hLMrJUcL0IpWHNl aytQ== X-Gm-Message-State: AOAM533nx1BfZslf06h7NeVx54emY+hkYYIdOWPIPRBkmiqRXkIb7yPk uozUCul4elbb1Zd/3da4DoZcUQ== X-Google-Smtp-Source: ABdhPJz5DskL3QCTtZrnkhGW5Ja46+3RWVkzd1qI4s3Eh6Dex1vZ00UXv2RrPeKtWyWUMPPZtZogwA== X-Received: by 2002:a7b:cc89:: with SMTP id p9mr3923346wma.4.1603390104368; Thu, 22 Oct 2020 11:08:24 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id p11sm4917122wrm.44.2020.10.22.11.08.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2020 11:08:23 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: svn commit: r366945 - head/share/man/man9 From: Jessica Clarke In-Reply-To: <202010221800.09MI07GS063875@repo.freebsd.org> Date: Thu, 22 Oct 2020 19:08:22 +0100 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <0E880644-DBCF-4C7B-92AC-46A6FC401D54@freebsd.org> References: <202010221800.09MI07GS063875@repo.freebsd.org> To: Gleb Smirnoff X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4CHFj56hY9z4L73 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.128.43 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-1.75 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.26)[-0.257]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.02)[-1.016]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-0.98)[-0.977]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.128.43:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.43:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 18:08:26 -0000 On 22 Oct 2020, at 19:00, Gleb Smirnoff wrote: >=20 > Author: glebius > Date: Thu Oct 22 18:00:07 2020 > New Revision: 366945 > URL: https://svnweb.freebsd.org/changeset/base/366945 >=20 > Log: > Fix typo >=20 > Modified: > head/share/man/man9/pfil.9 >=20 > Modified: head/share/man/man9/pfil.9 > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/share/man/man9/pfil.9 Thu Oct 22 17:47:51 2020 = (r366944) > +++ head/share/man/man9/pfil.9 Thu Oct 22 18:00:07 2020 = (r366945) > @@ -144,7 +144,7 @@ Link-layer packets. > .El > .Pp > Default rulesets are automatically linked to these heads to preserve > -historical behavavior. > +historical behaviour. This doesn't just fix the duplicated "av", it also changes the locale, which is not a typo. That may or may not be feature depending on who you are :) Jess From owner-svn-src-head@freebsd.org Thu Oct 22 18:45:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22BF544FAC1; Thu, 22 Oct 2020 18:45:50 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHGXF6xRLz4MF6; Thu, 22 Oct 2020 18:45:49 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D11E51B529; Thu, 22 Oct 2020 18:45:49 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MIjnu3094208; Thu, 22 Oct 2020 18:45:49 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MIjndI094207; Thu, 22 Oct 2020 18:45:49 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202010221845.09MIjndI094207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Thu, 22 Oct 2020 18:45:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366946 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 366946 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 18:45:50 -0000 Author: gbe (doc committer) Date: Thu Oct 22 18:45:49 2020 New Revision: 366946 URL: https://svnweb.freebsd.org/changeset/base/366946 Log: socket(9): Remove duplicate word 'is is' MFC after: 1 week Modified: head/share/man/man9/socket.9 Modified: head/share/man/man9/socket.9 ============================================================================== --- head/share/man/man9/socket.9 Thu Oct 22 18:00:07 2020 (r366945) +++ head/share/man/man9/socket.9 Thu Oct 22 18:45:49 2020 (r366946) @@ -378,7 +378,7 @@ or A kernel system can use the .Fn sodtor_set function to set a destructor for a socket. -The destructor is called when the socket is is about to be freed. +The destructor is called when the socket is about to be freed. The destructor is called before the protocol detach routine. The destructor can serve as a callback to initiate additional cleanup actions. .Ss Socket I/O From owner-svn-src-head@freebsd.org Thu Oct 22 19:19:43 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CACC4281FD; Thu, 22 Oct 2020 19:19:43 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHHHM3f3Mz4Nqm; Thu, 22 Oct 2020 19:19:43 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 608481BA8F; Thu, 22 Oct 2020 19:19:43 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MJJhtc013088; Thu, 22 Oct 2020 19:19:43 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MJJhtX013087; Thu, 22 Oct 2020 19:19:43 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202010221919.09MJJhtX013087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Thu, 22 Oct 2020 19:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366947 - head/usr.sbin/nfsd X-SVN-Group: head X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: head/usr.sbin/nfsd X-SVN-Commit-Revision: 366947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 19:19:43 -0000 Author: gbe (doc committer) Date: Thu Oct 22 19:19:42 2020 New Revision: 366947 URL: https://svnweb.freebsd.org/changeset/base/366947 Log: pnfsserver(4): Fix some issues reported by mandoc - new sentence, new line Modified: head/usr.sbin/nfsd/pnfsserver.4 Modified: head/usr.sbin/nfsd/pnfsserver.4 ============================================================================== --- head/usr.sbin/nfsd/pnfsserver.4 Thu Oct 22 18:45:49 2020 (r366946) +++ head/usr.sbin/nfsd/pnfsserver.4 Thu Oct 22 19:19:42 2020 (r366947) @@ -248,11 +248,12 @@ after the DS failure or network partitioning occurs. the arguments for a LayoutReturn operation. .sp 3 - The system administrator can perform the pnfsdskill(8) command on the MDS -to disable it. If the system administrator does a pnfsdskill(8) and it fails -with ENXIO (Device not configured) that normally means the DS was already -disabled via #1 or #2. Since doing this is harmless, once a system -administrator knows that there is a problem with a mirrored DS, doing the -command is recommended. +to disable it. +If the system administrator does a pnfsdskill(8) and it fails with ENXIO +(Device not configured) that normally means the DS was already +disabled via #1 or #2. +Since doing this is harmless, once a system administrator knows that +there is a problem with a mirrored DS, doing the command is recommended. .sp Once a system administrator knows that a mirrored DS has malfunctioned or has been network partitioned, they should do the following as root/su @@ -266,9 +267,8 @@ Note that the must be the exac string used when the DS was mounted on the MDS. .Pp Once the mirrored DS has been disabled, the pNFS service should continue to -function, but file updates will only happen on the DS(s) -that have not been disabled. Assuming two way mirroring, that implies -the one DS of the pair stored in the +function, but file updates will only happen on the DS(s) that have not been disabled. +Assuming two way mirroring, that implies the one DS of the pair stored in the .Dq pnfsd.dsfile extended attribute for the file on the MDS, for files stored on the disabled DS. .Pp From owner-svn-src-head@freebsd.org Thu Oct 22 19:22:35 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53A9B428562; Thu, 22 Oct 2020 19:22:35 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHHLg18x9z4PCc; Thu, 22 Oct 2020 19:22:35 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B4111BD8C; Thu, 22 Oct 2020 19:22:35 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MJMYcF018871; Thu, 22 Oct 2020 19:22:34 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MJMYVx018870; Thu, 22 Oct 2020 19:22:34 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010221922.09MJMYVx018870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 22 Oct 2020 19:22:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366948 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366948 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 19:22:35 -0000 Author: mjg Date: Thu Oct 22 19:22:34 2020 New Revision: 366948 URL: https://svnweb.freebsd.org/changeset/base/366948 Log: cache: assert the created entry does not point to itself Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Thu Oct 22 19:19:42 2020 (r366947) +++ head/sys/kern/vfs_cache.c Thu Oct 22 19:22:34 2020 (r366948) @@ -2104,6 +2104,7 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, int len; u_long lnumcache; + VNPASS(dvp != vp, dvp); VNPASS(!VN_IS_DOOMED(dvp), dvp); VNPASS(dvp->v_type != VNON, dvp); if (vp != NULL) { From owner-svn-src-head@freebsd.org Thu Oct 22 19:25:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB9B0428924; Thu, 22 Oct 2020 19:25:02 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHHPV4YLZz4PcW; Thu, 22 Oct 2020 19:25:02 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B58D1BD19; Thu, 22 Oct 2020 19:25:02 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MJP2LA019022; Thu, 22 Oct 2020 19:25:02 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MJP21k019021; Thu, 22 Oct 2020 19:25:02 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202010221925.09MJP21k019021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Thu, 22 Oct 2020 19:25:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366949 - head/usr.sbin/nfsd X-SVN-Group: head X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: head/usr.sbin/nfsd X-SVN-Commit-Revision: 366949 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 19:25:02 -0000 Author: gbe (doc committer) Date: Thu Oct 22 19:25:01 2020 New Revision: 366949 URL: https://svnweb.freebsd.org/changeset/base/366949 Log: stablerestart(5): Fix some issues reported by mandoc - New sentence, new line Modified: head/usr.sbin/nfsd/stablerestart.5 Modified: head/usr.sbin/nfsd/stablerestart.5 ============================================================================== --- head/usr.sbin/nfsd/stablerestart.5 Thu Oct 22 19:22:34 2020 (r366948) +++ head/usr.sbin/nfsd/stablerestart.5 Thu Oct 22 19:25:01 2020 (r366949) @@ -52,18 +52,18 @@ first record. The lease duration is used to set the grace period. The boot times are used to avoid the unlikely occurrence of a boot time being reused, -due to a TOD clock going backwards. This record and the previous boot times with this boot time added is re-written at the -end of the grace period. +due to a TOD clock going backwards. +This record and the previous boot times with this boot time +added is re-written at the end of the grace period. .Pp The rest of the file are appended records, as defined by -struct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used -represent one of two things. There are records which indicate that a +struct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used represent one of two things. +There are records which indicate that a client successfully acquired state and records that indicate a client's state was revoked. State revoke records indicate that state information for a client was discarded, due to lease expiry and an otherwise conflicting open or lock request being made by a different client. -These records can be used -to determine if clients might have done either of the +These records can be used to determine if clients might have done either of the edge conditions. .Pp If a client might have done either edge condition or this file is @@ -71,8 +71,8 @@ empty or corrupted, the server returns NFSERR_NOGRACE request from the client. .Pp For correct operation of the server, it must be ensured that the file -is written to stable storage by the time a write op with IO_SYNC specified -has returned. This might require hardware level caching to be disabled for +is written to stable storage by the time a write op with IO_SYNC specified has returned. +This might require hardware level caching to be disabled for a local disk drive that holds the file, or similar. .Sh FILES .Bl -tag -width /var/db/nfs-stablerestart.bak -compact @@ -86,12 +86,11 @@ backup copy of the file .Xr nfsd 8 .Sh BUGS If the file is empty, the NFSv4 server has no choice but to return -NFSERR_NOGRACE for all reclaim requests. Although correct, this is -a highly undesirable occurrence, so the file should not be lost if -at all possible. The backup copy of the file is maintained -and used by the +NFSERR_NOGRACE for all reclaim requests. +Although correct, this is a highly undesirable occurrence, so the file should not be lost if +at all possible. +The backup copy of the file is maintained and used by the .Xr nfsd 8 to minimize the risk of this occurring. -To move the file, you must edit -the nfsd sources and recompile it. This was done to discourage -accidental relocation of the file. +To move the file, you must edit the nfsd sources and recompile it. +This was done to discourage accidental relocation of the file. From owner-svn-src-head@freebsd.org Thu Oct 22 19:28:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 201F04289A8; Thu, 22 Oct 2020 19:28:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHHTB01XKz4PjY; Thu, 22 Oct 2020 19:28:14 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D36C11BAB4; Thu, 22 Oct 2020 19:28:13 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MJSDJ8019197; Thu, 22 Oct 2020 19:28:13 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MJSC5h019191; Thu, 22 Oct 2020 19:28:12 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010221928.09MJSC5h019191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 22 Oct 2020 19:28:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366950 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 366950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 19:28:14 -0000 Author: mjg Date: Thu Oct 22 19:28:12 2020 New Revision: 366950 URL: https://svnweb.freebsd.org/changeset/base/366950 Log: vfs: prevent avoidable evictions on mkdir of existing directories mkdir -p /foo/bar/baz will mkdir each path component and ignore EEXIST. The NOCACHE lookup will make the namecache unnecessarily evict the existing entry, and then fallback to the fs lookup routine eventually leading namei to return an error as the directory is already there. For invocations like mkdir -p /usr/obj/usr/src/sys/GENERIC/modules this triggers fallbacks to the slowpath for concurrently executing lookups. Tested by: pho Discussed with: kib Modified: head/sys/kern/vfs_cache.c head/sys/kern/vfs_subr.c head/sys/kern/vfs_syscalls.c head/sys/kern/vnode_if.src head/sys/sys/namei.h head/sys/sys/vnode.h Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Thu Oct 22 19:25:01 2020 (r366949) +++ head/sys/kern/vfs_cache.c Thu Oct 22 19:28:12 2020 (r366950) @@ -1676,7 +1676,8 @@ cache_lookup_fallback(struct vnode *dvp, struct vnode int error; bool whiteout; - MPASS((cnp->cn_flags & (MAKEENTRY | ISDOTDOT)) == MAKEENTRY); + MPASS((cnp->cn_flags & ISDOTDOT) == 0); + MPASS((cnp->cn_flags & (MAKEENTRY | NC_KEEPPOSENTRY)) != 0); retry: hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp); @@ -1768,7 +1769,7 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, st MPASS((cnp->cn_flags & ISDOTDOT) == 0); - if ((cnp->cn_flags & MAKEENTRY) == 0) { + if ((cnp->cn_flags & (MAKEENTRY | NC_KEEPPOSENTRY)) == 0) { cache_remove_cnp(dvp, cnp); return (0); } @@ -2595,6 +2596,35 @@ cache_rename(struct vnode *fdvp, struct vnode *fvp, st cache_remove_cnp(tdvp, tcnp); } } + +#ifdef INVARIANTS +/* + * Validate that if an entry exists it matches. + */ +void +cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) +{ + struct namecache *ncp; + struct mtx *blp; + uint32_t hash; + + hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp); + if (CK_SLIST_EMPTY(NCHHASH(hash))) + return; + blp = HASH2BUCKETLOCK(hash); + mtx_lock(blp); + CK_SLIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { + if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen && + !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen)) { + if (ncp->nc_vp != vp) + panic("%s: mismatch (%p != %p); ncp %p [%s] dvp %p vp %p\n", + __func__, vp, ncp->nc_vp, ncp, ncp->nc_name, ncp->nc_dvp, + ncp->nc_vp); + } + } + mtx_unlock(blp); +} +#endif /* * Flush all entries referencing a particular filesystem. Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Thu Oct 22 19:25:01 2020 (r366949) +++ head/sys/kern/vfs_subr.c Thu Oct 22 19:28:12 2020 (r366950) @@ -5587,6 +5587,18 @@ vop_mkdir_post(void *ap, int rc) VFS_KNOTE_LOCKED(dvp, NOTE_WRITE | NOTE_LINK); } +#ifdef DEBUG_VFS_LOCKS +void +vop_mkdir_debugpost(void *ap, int rc) +{ + struct vop_mkdir_args *a; + + a = ap; + if (!rc) + cache_validate(a->a_dvp, *a->a_vpp, a->a_cnp); +} +#endif + void vop_mknod_pre(void *ap) { Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Thu Oct 22 19:25:01 2020 (r366949) +++ head/sys/kern/vfs_syscalls.c Thu Oct 22 19:28:12 2020 (r366950) @@ -3758,8 +3758,8 @@ kern_mkdirat(struct thread *td, int fd, const char *pa restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | - NOCACHE, segflg, path, fd, &cap_mkdirat_rights, - td); + NC_NOMAKEENTRY | NC_KEEPPOSENTRY, segflg, path, fd, + &cap_mkdirat_rights, td); nd.ni_cnd.cn_flags |= WILLBEDIR; if ((error = namei(&nd)) != 0) return (error); Modified: head/sys/kern/vnode_if.src ============================================================================== --- head/sys/kern/vnode_if.src Thu Oct 22 19:25:01 2020 (r366949) +++ head/sys/kern/vnode_if.src Thu Oct 22 19:28:12 2020 (r366950) @@ -336,6 +336,7 @@ vop_rename { %% mkdir vpp - E - %! mkdir pre vop_mkdir_pre %! mkdir post vop_mkdir_post +%! mkdir debugpost vop_mkdir_debugpost vop_mkdir { IN struct vnode *dvp; Modified: head/sys/sys/namei.h ============================================================================== --- head/sys/sys/namei.h Thu Oct 22 19:25:01 2020 (r366949) +++ head/sys/sys/namei.h Thu Oct 22 19:28:12 2020 (r366950) @@ -125,16 +125,19 @@ int cache_fplookup(struct nameidata *ndp, enum cache_f /* * namei operational modifier flags, stored in ni_cnd.flags */ +#define NC_NOMAKEENTRY 0x0001 /* name must not be added to cache */ +#define NC_KEEPPOSENTRY 0x0002 /* don't evict a positive entry */ +#define NOCACHE NC_NOMAKEENTRY /* for compatibility with older code */ #define LOCKLEAF 0x0004 /* lock vnode on return */ #define LOCKPARENT 0x0008 /* want parent vnode returned locked */ #define WANTPARENT 0x0010 /* want parent vnode returned unlocked */ -#define NOCACHE 0x0020 /* name must not be left in cache */ +/* UNUSED 0x0020 */ #define FOLLOW 0x0040 /* follow symbolic links */ #define BENEATH 0x0080 /* No escape from the start dir */ #define LOCKSHARED 0x0100 /* Shared lock leaf */ #define NOFOLLOW 0x0000 /* do not follow symbolic links (pseudo) */ #define RBENEATH 0x100000000ULL /* No escape, even tmp, from start dir */ -#define MODMASK 0xf000001fcULL /* mask of operational modifiers */ +#define MODMASK 0xf000001ffULL /* mask of operational modifiers */ /* * Namei parameter descriptors. * Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Thu Oct 22 19:25:01 2020 (r366949) +++ head/sys/sys/vnode.h Thu Oct 22 19:28:12 2020 (r366950) @@ -644,6 +644,15 @@ void cache_purge_negative(struct vnode *vp); void cache_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp, struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp); void cache_purgevfs(struct mount *mp); +#ifdef INVARIANTS +void cache_validate(struct vnode *dvp, struct vnode *vp, + struct componentname *cnp); +#else +static inline void +cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) +{ +} +#endif int change_dir(struct vnode *vp, struct thread *td); void cvtstat(struct stat *st, struct ostat *ost); void freebsd11_cvtnstat(struct stat *sb, struct nstat *nsb); @@ -880,6 +889,7 @@ void vop_lock_debugpost(void *a, int rc); void vop_unlock_debugpre(void *a); void vop_need_inactive_debugpre(void *a); void vop_need_inactive_debugpost(void *a, int rc); +void vop_mkdir_debugpost(void *a, int rc); #else #define vop_fplookup_vexec_debugpre(x) do { } while (0) #define vop_fplookup_vexec_debugpost(x, y) do { } while (0) @@ -889,6 +899,7 @@ void vop_need_inactive_debugpost(void *a, int rc); #define vop_unlock_debugpre(x) do { } while (0) #define vop_need_inactive_debugpre(x) do { } while (0) #define vop_need_inactive_debugpost(x, y) do { } while (0) +#define vop_mkdir_debugpost(x, y) do { } while (0) #endif void vop_rename_fail(struct vop_rename_args *ap); From owner-svn-src-head@freebsd.org Thu Oct 22 19:29:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AA6F4288F9; Thu, 22 Oct 2020 19:29:04 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHHV81mRTz4PW6; Thu, 22 Oct 2020 19:29:03 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by mail-ot1-x336.google.com with SMTP id n15so2551687otl.8; Thu, 22 Oct 2020 12:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LACqYI8fx3hAEtkVbriMRr37sBwl65AGreB3vXeduUk=; b=fLtpB+YvFvundI+5FvaH/cJQ/t0tPoTHNUDLZDNKZMkyGTVTCO5IXbKcfi+RtmKTLg SewAIYsi3Od8tViXHGgUKCTwYfrWHClBmgXuFHEUnKj6Qm9NNpt/INwiii7caESxBYYc XsdDbTerqh6BP7wjsbp/QFOxwioL2lh2P6srOy1wFZ5eqQyhwyD/1WgCc/MXR8SpurAc 9xtY/Jk7yEz9LYTl/xSZwj41rlbTao7nqXyVnWkBWTFQ3e0zTYHyD9MwBGEoLYq/8y4S MyWTLtJmhvZ7n3Vk062HzzAxhxt9DK1X8dNCMJbgbv4wmE9fRy1iKJj2Q1xoBzVecB2U eYmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LACqYI8fx3hAEtkVbriMRr37sBwl65AGreB3vXeduUk=; b=rdAoSum2F73dFUGwsg6P6lNHgz3NaGRYupDE10pvo33TgZMfX1UIM9R+nEyMGzPdXU ZFtWjdieXnU96pmA1xD6IAe7tQnP16iRXFlHn+xe6G9Ota11l8OeDoSL/9F41Es0Pk+l o4hj1//FeNPRfiGKUOFFuyCclx9Lk5F4jCoywFMEHg9kh4BgMAr5yFRWCdFvZ/qyPNls QCaHk4+Rc9SGrt7vlDa2vzN8WLE5pPrMlj28ZnMh9dxoV+SJ8VdXESc2IDJ6ubD/A0Pn IFTpFGtAy72XIS+HpL25EGDjryioGoeEevzl01rjauLyCZyZ3Lp7S3PlDWmyNuS6qPev bkEg== X-Gm-Message-State: AOAM533ef5tYLdFHBUUVrFqWjkfpZ6dRgc0QpNcWpy/464h5W3sKa5rj ILZa2c79j8pOcLJ8Y4U2PoureiXJgQVynK+svHQyRika5X8= X-Google-Smtp-Source: ABdhPJzt29I2uyAj6WBLi3szO13XgIluRIJp9zT+Kq2EVmBEadaDJ1jVzXu9qw7rIshhD75hODiBcq896ENRARNXPYY= X-Received: by 2002:a05:6830:100f:: with SMTP id a15mr3003028otp.117.1603394942648; Thu, 22 Oct 2020 12:29:02 -0700 (PDT) MIME-Version: 1.0 References: <202010221925.09MJP21k019021@repo.freebsd.org> In-Reply-To: <202010221925.09MJP21k019021@repo.freebsd.org> From: Benjamin Kaduk Date: Thu, 22 Oct 2020 12:28:51 -0700 Message-ID: Subject: Re: svn commit: r366949 - head/usr.sbin/nfsd To: Gordon Bergling Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 4CHHV81mRTz4PW6 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 19:29:04 -0000 On Thu, Oct 22, 2020 at 12:25 PM Gordon Bergling wrote: > Author: gbe (doc committer) > Date: Thu Oct 22 19:25:01 2020 > New Revision: 366949 > URL: https://svnweb.freebsd.org/changeset/base/366949 > > Log: > stablerestart(5): Fix some issues reported by mandoc > > - New sentence, new line > > Modified: > head/usr.sbin/nfsd/stablerestart.5 > > Modified: head/usr.sbin/nfsd/stablerestart.5 > > ============================================================================== > --- head/usr.sbin/nfsd/stablerestart.5 Thu Oct 22 19:22:34 2020 > (r366948) > +++ head/usr.sbin/nfsd/stablerestart.5 Thu Oct 22 19:25:01 2020 > (r366949) > @@ -52,18 +52,18 @@ first record. > The lease duration is used to set the grace period. > The boot times > are used to avoid the unlikely occurrence of a boot time being reused, > -due to a TOD clock going backwards. This record and the previous boot > times with this boot time added is re-written at the > -end of the grace period. > +due to a TOD clock going backwards. > +This record and the previous boot times with this boot time > +added is re-written at the end of the grace period. > .Pp > The rest of the file are appended records, as defined by > -struct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used > -represent one of two things. There are records which indicate that a > +struct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used > represent one of two things. > > There are some more markup options here, like (IIRC) .Fa for struct nfst_rec, and .Pa for /usr/include/fs/nfs/nfsrvstate.h -Ben From owner-svn-src-head@freebsd.org Thu Oct 22 19:35:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2891C428C3C; Thu, 22 Oct 2020 19:35:45 +0000 (UTC) (envelope-from zeising@freebsd.org) Received: from mail.daemonic.se (mail.daemonic.se [IPv6:2607:f740:d:20::25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHHdr5NWnz4QDW; Thu, 22 Oct 2020 19:35:44 +0000 (UTC) (envelope-from zeising@freebsd.org) Received: from cid.daemonic.se (localhost [IPv6:::1]) by mail.daemonic.se (Postfix) with ESMTP id 4CHHdj1wRVz3n0y; Thu, 22 Oct 2020 19:35:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at daemonic.se Received: from mail.daemonic.se ([IPv6:::1]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256) by cid.daemonic.se (mailscanner.daemonic.se [IPv6:::1]) (amavisd-new, port 10587) with ESMTPS id EgzR6tyJptif; Thu, 22 Oct 2020 19:35:36 +0000 (UTC) Received: from garnet.daemonic.se (unknown [IPv6:2001:470:dca9:1201:b119:c381:545a:fb32]) by mail.daemonic.se (Postfix) with ESMTPSA id 4CHHdh1khKz3mQt; Thu, 22 Oct 2020 19:35:36 +0000 (UTC) Subject: Re: svn commit: r366372 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf To: Kyle Evans , Warner Losh Cc: "Alexander V. Chernikov" , Hans Petter Selasky , Emmanuel Vadot , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <202010021826.092IQfdj023808@repo.freebsd.org> <44421602932538@mail.yandex.ru> <43251602934532@mail.yandex.ru> <59021602950992@mail.yandex.ru> From: Niclas Zeising Message-ID: Date: Thu, 22 Oct 2020 21:35:35 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CHHdr5NWnz4QDW X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:36236, ipnet:2607:f740:d::/48, country:US]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 19:35:45 -0000 On 2020-10-22 15:22, Kyle Evans wrote: > On Sat, Oct 17, 2020 at 11:40 AM Warner Losh wrote: >> >> >> >> On Sat, Oct 17, 2020, 10:11 AM Alexander V. Chernikov wrote: >>> >>> 17.10.2020, 14:07, "Hans Petter Selasky" : >>> >>> On 2020-10-17 14:34, Alexander V. Chernikov wrote: >>> >>> 17.10.2020, 12:32, "Hans Petter Selasky" : >>> >>> On 2020-10-17 13:27, Alexander V. Chernikov wrote: >>> >>> 02.10.2020, 19:26, "Emmanuel Vadot" >> >: >>> >>> Author: manu >>> Date: Fri Oct 2 18:26:41 2020 >>> New Revision: 366372 >>> URL: https://svnweb.freebsd.org/changeset/base/366372 >>> >>> Log: >>> linuxkpi: Add backlight support >>> >>> Add backlight function to linuxkpi. >>> Graphics drivers expose the backlight of the panel directly so >>> allow them >>> to use the backlight subsystem so >>> user can use backlight(8) to configure them. >>> >>> Reviewed by: hselasky >>> Relnotes: yes >>> Differential Revision: The FreeBSD Foundation >>> >>> Added: >>> head/sys/compat/linuxkpi/common/include/linux/backlight.h >>> (contents, >>> props changed) >>> Modified: >>> head/sys/compat/linuxkpi/common/include/linux/device.h >>> head/sys/compat/linuxkpi/common/src/linux_kmod.c >>> head/sys/compat/linuxkpi/common/src/linux_pci.c >>> head/sys/conf/kmod.mk >>> >>> It breaks the build for me with >>> /usr/home/melifaro/free/head/sys/compat/linuxkpi/common/src/linux_pci.c:70:10: >>> fatal error: 'backlight_if.h' file not found >>> >>> >>> How do you build? Doesn't break over here. >>> >>> GENERIC + COMPAT_LINUXKPI. >>> >>> >>> >>> Try adding: >>> >>> options backlight >>> >>> To the kernel config. >>> >>> Yep, thank you! >>> Maybe it's worth considering adding static assert with the message describing this dependency? >> >> >> Yes. It likely is worth doing something to highlight this issue. >> >> Warner >> > > I think we just need to slap the two core backlight files with an ` | > compat_linux` so that they simply get pulled in if you specify > COMPAT_LINUX. config(8) handles this terribly, configng must have a > better provides/requires/implies/whatever functionality so we can > specify that compat_linux implies backlight and not do crud like this > where it becomes more complicated to see what any given option really > entails. > > Thanks, COMPAT_LINUX can't be right. Isn't that the linuxolator? Regards -- Niclas Zeising From owner-svn-src-head@freebsd.org Thu Oct 22 19:43:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54BB542919F; Thu, 22 Oct 2020 19:43:44 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHHq41fZXz4QpV; Thu, 22 Oct 2020 19:43:44 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 145151ACCA; Thu, 22 Oct 2020 19:43:44 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f174.google.com with SMTP id h12so2216268qtu.1; Thu, 22 Oct 2020 12:43:44 -0700 (PDT) X-Gm-Message-State: AOAM531ScPAH3BjztWL4MGeraw3vXTy6d4POX64AngjWW+1Mhjg+DhFm h2QFKU8XbhRM1EPKrq9Wyiq2utAvoCmfPH9orOo= X-Google-Smtp-Source: ABdhPJwm+Pjx8Rj4nnZSpMU75FWwJCpK82ttNWM/oob9+ieNc0KkP432LGyEVDnMDN3kGCKkisG6pHYpR4x6WHkHG40= X-Received: by 2002:ac8:33e8:: with SMTP id d37mr3444053qtb.310.1603395823515; Thu, 22 Oct 2020 12:43:43 -0700 (PDT) MIME-Version: 1.0 References: <202010021826.092IQfdj023808@repo.freebsd.org> <44421602932538@mail.yandex.ru> <43251602934532@mail.yandex.ru> <59021602950992@mail.yandex.ru> In-Reply-To: From: Kyle Evans Date: Thu, 22 Oct 2020 14:43:31 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r366372 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf To: Niclas Zeising Cc: Warner Losh , "Alexander V. Chernikov" , Hans Petter Selasky , Emmanuel Vadot , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 19:43:44 -0000 On Thu, Oct 22, 2020 at 2:35 PM Niclas Zeising wrote: > > On 2020-10-22 15:22, Kyle Evans wrote: > > On Sat, Oct 17, 2020 at 11:40 AM Warner Losh wrote: > >> > >> > >> > >> On Sat, Oct 17, 2020, 10:11 AM Alexander V. Chernikov wrote: > >>> > >>> 17.10.2020, 14:07, "Hans Petter Selasky" : > >>> > >>> On 2020-10-17 14:34, Alexander V. Chernikov wrote: > >>> > >>> 17.10.2020, 12:32, "Hans Petter Selasky" : > >>> > >>> On 2020-10-17 13:27, Alexander V. Chernikov wrote: > >>> > >>> 02.10.2020, 19:26, "Emmanuel Vadot" >>> >: > >>> > >>> Author: manu > >>> Date: Fri Oct 2 18:26:41 2020 > >>> New Revision: 366372 > >>> URL: https://svnweb.freebsd.org/changeset/base/366372 > >>> > >>> Log: > >>> linuxkpi: Add backlight support > >>> > >>> Add backlight function to linuxkpi. > >>> Graphics drivers expose the backlight of the panel directly so > >>> allow them > >>> to use the backlight subsystem so > >>> user can use backlight(8) to configure them. > >>> > >>> Reviewed by: hselasky > >>> Relnotes: yes > >>> Differential Revision: The FreeBSD Foundation > >>> > >>> Added: > >>> head/sys/compat/linuxkpi/common/include/linux/backlight.h > >>> (contents, > >>> props changed) > >>> Modified: > >>> head/sys/compat/linuxkpi/common/include/linux/device.h > >>> head/sys/compat/linuxkpi/common/src/linux_kmod.c > >>> head/sys/compat/linuxkpi/common/src/linux_pci.c > >>> head/sys/conf/kmod.mk > >>> > >>> It breaks the build for me with > >>> /usr/home/melifaro/free/head/sys/compat/linuxkpi/common/src/linux_pci.c:70:10: > >>> fatal error: 'backlight_if.h' file not found > >>> > >>> > >>> How do you build? Doesn't break over here. > >>> > >>> GENERIC + COMPAT_LINUXKPI. > >>> > >>> > >>> > >>> Try adding: > >>> > >>> options backlight > >>> > >>> To the kernel config. > >>> > >>> Yep, thank you! > >>> Maybe it's worth considering adding static assert with the message describing this dependency? > >> > >> > >> Yes. It likely is worth doing something to highlight this issue. > >> > >> Warner > >> > > > > I think we just need to slap the two core backlight files with an ` | > > compat_linux` so that they simply get pulled in if you specify > > COMPAT_LINUX. config(8) handles this terribly, configng must have a > > better provides/requires/implies/whatever functionality so we can > > specify that compat_linux implies backlight and not do crud like this > > where it becomes more complicated to see what any given option really > > entails. > > > > Thanks, > > COMPAT_LINUX can't be right. Isn't that the linuxolator? > Regards > -- > Niclas Zeising Whoops, s/LINUX/LINUXKPI/ :-) From owner-svn-src-head@freebsd.org Thu Oct 22 20:02:03 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B3954294FD; Thu, 22 Oct 2020 20:02:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHJDC1MBvz4RhB; Thu, 22 Oct 2020 20:02:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11F481C2A4; Thu, 22 Oct 2020 20:02:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MK22Il041520; Thu, 22 Oct 2020 20:02:02 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MK22Le041519; Thu, 22 Oct 2020 20:02:02 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202010222002.09MK22Le041519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 22 Oct 2020 20:02:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366951 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 366951 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 20:02:03 -0000 Author: tsoome Date: Thu Oct 22 20:02:02 2020 New Revision: 366951 URL: https://svnweb.freebsd.org/changeset/base/366951 Log: loader: revert r342161 and r342151 We are using asize property from pool label and we do not depend on partition data to find last two pool labels and to validate LBA for disk IO. This does allow us to re-enable support for partitionless disk setups. Modified: head/stand/libsa/zfs/zfs.c Modified: head/stand/libsa/zfs/zfs.c ============================================================================== --- head/stand/libsa/zfs/zfs.c Thu Oct 22 19:28:12 2020 (r366950) +++ head/stand/libsa/zfs/zfs.c Thu Oct 22 20:02:02 2020 (r366951) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -1421,7 +1420,6 @@ zfs_attach_nvstore(void *vdev) int zfs_probe_dev(const char *devname, uint64_t *pool_guid) { - struct disk_devdesc *dev; struct ptable *table; struct zfs_probe_args pa; uint64_t mediasz; @@ -1432,22 +1430,10 @@ zfs_probe_dev(const char *devname, uint64_t *pool_guid pa.fd = open(devname, O_RDWR); if (pa.fd == -1) return (ENXIO); - /* - * We will not probe the whole disk, we can not boot from such - * disks and some systems will misreport the disk sizes and will - * hang while accessing the disk. - */ - if (archsw.arch_getdev((void **)&dev, devname, NULL) == 0) { - int partition = dev->d_partition; - int slice = dev->d_slice; - - free(dev); - if (partition != D_PARTNONE && slice != D_SLICENONE) { - ret = zfs_probe(pa.fd, pool_guid); - if (ret == 0) - return (0); - } - } + /* Probe the whole disk */ + ret = zfs_probe(pa.fd, pool_guid); + if (ret == 0) + return (0); /* Probe each partition */ ret = ioctl(pa.fd, DIOCGMEDIASIZE, &mediasz); From owner-svn-src-head@freebsd.org Thu Oct 22 20:11:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 973584299D3; Thu, 22 Oct 2020 20:11:02 +0000 (UTC) (envelope-from gbergling@gmail.com) Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHJQY4pBNz4SDY; Thu, 22 Oct 2020 20:11:01 +0000 (UTC) (envelope-from gbergling@gmail.com) Received: by mail-ed1-x536.google.com with SMTP id p13so3021127edi.7; Thu, 22 Oct 2020 13:11:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=U80m58vBFr0C5+K+lKPN/0p1nV3McwLdz5fbV4ojWR8=; b=j7wsr//o7WpZhjl4KdgR7Af12oFm2eVX3Bdv8pZL4SVnyhHyEKJuel3JoUkYavKTI4 3wt/4NC4OLQuOGbFNUg3Bs+SHBzESaoHveB8gylv671TylXqvqr6quvZpQeBAvbOUeZo 7beuIHBJTlYzgfxXyaOm/7j2XZI+BColDrw0MfaN4hoOj8c6IuGRDn+5XUBL778uJ8t3 +JvIMgPA4DWeKqSwGhIIpvYmBHP7ni2AzT2zIX/BXyGUx2++K/BNKmp5Q46L29WryGdi VFtv2klV0YW4vVZ1s1rUf5eZXxYfrg1Jte/h9S/KEOWf0PZNXFl2EAhdbi9tL5AHB4pv QQAQ== X-Gm-Message-State: AOAM5305VzPGTJS1kB/fAy574uZB87yIlynOBNPn0oYHi5kvf3F/YReE WRO5bjN1BBrN+EExxWN2BKA= X-Google-Smtp-Source: ABdhPJwt+VU236ZXH1qPIGDwQbZG6Ndv8UJuKFafWukUQSdD4bxL4zmSImZCQz+5zStITuwLVd69zQ== X-Received: by 2002:aa7:c5c4:: with SMTP id h4mr3972989eds.379.1603397459879; Thu, 22 Oct 2020 13:10:59 -0700 (PDT) Received: from tiny.0xfce3.net (p4fd3a1f5.dip0.t-ipconnect.de. [79.211.161.245]) by smtp.gmail.com with ESMTPSA id p10sm1375971ejy.68.2020.10.22.13.10.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2020 13:10:59 -0700 (PDT) Sender: Gordon Bergling Date: Thu, 22 Oct 2020 22:10:57 +0200 From: Gordon Bergling To: Benjamin Kaduk Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r366949 - head/usr.sbin/nfsd Message-ID: <20201022201057.GA7794@tiny.0xfce3.net> References: <202010221925.09MJP21k019021@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: X-Operating-System: FreeBSD 13.0-CURRENT arm64 X-Host-Uptime: 10:07PM up 1 day, 1:49, 3 users, load averages: 0.41, 0.29, 0.20 X-Rspamd-Queue-Id: 4CHJQY4pBNz4SDY X-Spamd-Bar: / X-Spamd-Result: default: False [0.51 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[googlemail.com]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-0.32)[-0.315]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[gbergling@googlemail.com,gbergling@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[79.211.161.245:received]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[gbergling@googlemail.com,gbergling@gmail.com]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; DMARC_POLICY_QUARANTINE(1.50)[googlemail.com : SPF not aligned (relaxed), DKIM not aligned (relaxed),quarantine]; NEURAL_HAM_LONG(-0.92)[-0.918]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_MEDIUM(0.45)[0.448]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::536:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 20:11:02 -0000 On Thu, Oct 22, 2020 at 12:28:51PM -0700, Benjamin Kaduk wrote: > On Thu, Oct 22, 2020 at 12:25 PM Gordon Bergling wrote: > > > Author: gbe (doc committer) > > Date: Thu Oct 22 19:25:01 2020 > > New Revision: 366949 > > URL: https://svnweb.freebsd.org/changeset/base/366949 > > > > Log: > > stablerestart(5): Fix some issues reported by mandoc > > > > - New sentence, new line > > > > Modified: > > head/usr.sbin/nfsd/stablerestart.5 > > > > Modified: head/usr.sbin/nfsd/stablerestart.5 > > > > ============================================================================== > > --- head/usr.sbin/nfsd/stablerestart.5 Thu Oct 22 19:22:34 2020 > > (r366948) > > +++ head/usr.sbin/nfsd/stablerestart.5 Thu Oct 22 19:25:01 2020 > > (r366949) > > @@ -52,18 +52,18 @@ first record. > > The lease duration is used to set the grace period. > > The boot times > > are used to avoid the unlikely occurrence of a boot time being reused, > > -due to a TOD clock going backwards. This record and the previous boot > > times with this boot time added is re-written at the > > -end of the grace period. > > +due to a TOD clock going backwards. > > +This record and the previous boot times with this boot time > > +added is re-written at the end of the grace period. > > .Pp > > The rest of the file are appended records, as defined by > > -struct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used > > -represent one of two things. There are records which indicate that a > > +struct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used > > represent one of two things. > > > There are some more markup options here, like (IIRC) .Fa for struct > nfst_rec, and .Pa for /usr/include/fs/nfs/nfsrvstate.h > > -Ben Hi Ben, I'll check further optimizations tomorrow! Thanks for the hint. -- Gordon From owner-svn-src-head@freebsd.org Thu Oct 22 20:21:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14129429B40; Thu, 22 Oct 2020 20:21:12 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHJfH6qM0z4SXZ; Thu, 22 Oct 2020 20:21:11 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE9F71C59F; Thu, 22 Oct 2020 20:21:11 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MKLBLr052714; Thu, 22 Oct 2020 20:21:11 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MKLBI6052713; Thu, 22 Oct 2020 20:21:11 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202010222021.09MKLBI6052713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 22 Oct 2020 20:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366952 - head/sys/dev/netmap X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/sys/dev/netmap X-SVN-Commit-Revision: 366952 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 20:21:12 -0000 Author: vmaffione Date: Thu Oct 22 20:21:11 2020 New Revision: 366952 URL: https://svnweb.freebsd.org/changeset/base/366952 Log: netmap: fix mutex double unlock bug https://github.com/luigirizzo/netmap/pull/733 Submitted by: brian90013 MFC after: 3 days Modified: head/sys/dev/netmap/netmap_mem2.c Modified: head/sys/dev/netmap/netmap_mem2.c ============================================================================== --- head/sys/dev/netmap/netmap_mem2.c Thu Oct 22 20:02:02 2020 (r366951) +++ head/sys/dev/netmap/netmap_mem2.c Thu Oct 22 20:21:11 2020 (r366952) @@ -2007,7 +2007,6 @@ netmap_mem2_if_new(struct netmap_adapter *na, struct n len = sizeof(struct netmap_if) + (ntot * sizeof(ssize_t)); nifp = netmap_if_malloc(na->nm_mem, len); if (nifp == NULL) { - NMA_UNLOCK(na->nm_mem); return NULL; } From owner-svn-src-head@freebsd.org Thu Oct 22 20:26:29 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7607942A02B; Thu, 22 Oct 2020 20:26:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHJmP2W15z4SrG; Thu, 22 Oct 2020 20:26:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A0CD1C82C; Thu, 22 Oct 2020 20:26:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09MKQTwq055367; Thu, 22 Oct 2020 20:26:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09MKQRVE055360; Thu, 22 Oct 2020 20:26:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202010222026.09MKQRVE055360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 22 Oct 2020 20:26:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366953 - in head: sys/dev/iscsi usr.sbin/iscsid X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head: sys/dev/iscsi usr.sbin/iscsid X-SVN-Commit-Revision: 366953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Thu, 22 Oct 2020 20:26:29 -0000 Author: mav Date: Thu Oct 22 20:26:27 2020 New Revision: 366953 URL: https://svnweb.freebsd.org/changeset/base/366953 Log: Negotiate iSCSIProtocolLevel of 2 (RFC 7144) in initiator. It does not change anything immediately, but allows further support of Command Priority, Status Qualifier and new task management functions. MFC after: 1 month Sponsored by: iXsystems, Inc. Modified: head/sys/dev/iscsi/iscsi.c head/sys/dev/iscsi/iscsi.h head/sys/dev/iscsi/iscsi_ioctl.h head/sys/dev/iscsi/iscsi_proto.h head/usr.sbin/iscsid/iscsid.c head/usr.sbin/iscsid/iscsid.h head/usr.sbin/iscsid/login.c Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Thu Oct 22 20:21:11 2020 (r366952) +++ head/sys/dev/iscsi/iscsi.c Thu Oct 22 20:26:27 2020 (r366953) @@ -1427,6 +1427,7 @@ iscsi_ioctl_daemon_handoff(struct iscsi_softc *sc, sizeof(is->is_target_alias)); is->is_tsih = handoff->idh_tsih; is->is_statsn = handoff->idh_statsn; + is->is_protocol_level = handoff->idh_protocol_level; is->is_initial_r2t = handoff->idh_initial_r2t; is->is_immediate_data = handoff->idh_immediate_data; Modified: head/sys/dev/iscsi/iscsi.h ============================================================================== --- head/sys/dev/iscsi/iscsi.h Thu Oct 22 20:21:11 2020 (r366952) +++ head/sys/dev/iscsi/iscsi.h Thu Oct 22 20:26:27 2020 (r366953) @@ -61,8 +61,7 @@ struct iscsi_session { uint32_t is_expcmdsn; uint32_t is_maxcmdsn; uint32_t is_initiator_task_tag; - int is_header_digest; - int is_data_digest; + int is_protocol_level; int is_initial_r2t; int is_max_burst_length; int is_first_burst_length; Modified: head/sys/dev/iscsi/iscsi_ioctl.h ============================================================================== --- head/sys/dev/iscsi/iscsi_ioctl.h Thu Oct 22 20:21:11 2020 (r366952) +++ head/sys/dev/iscsi/iscsi_ioctl.h Thu Oct 22 20:26:27 2020 (r366953) @@ -124,7 +124,8 @@ struct iscsi_daemon_handoff { unsigned int idh_session_id; int idh_socket; char idh_target_alias[ISCSI_ALIAS_LEN]; - uint8_t idh_spare_isid[6]; + int idh_protocol_level; + uint16_t idh_spare; uint16_t idh_tsih; uint16_t idh_spare_cid; uint32_t idh_statsn; Modified: head/sys/dev/iscsi/iscsi_proto.h ============================================================================== --- head/sys/dev/iscsi/iscsi_proto.h Thu Oct 22 20:21:11 2020 (r366952) +++ head/sys/dev/iscsi/iscsi_proto.h Thu Oct 22 20:26:27 2020 (r366953) @@ -90,10 +90,14 @@ CTASSERT(sizeof(struct iscsi_bhs) == ISCSI_BHS_SIZE); #define BHSSC_FLAGS_ATTR_HOQ 3 #define BHSSC_FLAGS_ATTR_ACA 4 +#define BHSSC_PRI_MASK 0xf0 +#define BHSSC_PRI_SHIFT 4 + struct iscsi_bhs_scsi_command { uint8_t bhssc_opcode; uint8_t bhssc_flags; - uint8_t bhssc_reserved[2]; + uint8_t bhssc_pri; + uint8_t bhssc_reserved; uint8_t bhssc_total_ahs_len; uint8_t bhssc_data_segment_len[3]; uint64_t bhssc_lun; Modified: head/usr.sbin/iscsid/iscsid.c ============================================================================== --- head/usr.sbin/iscsid/iscsid.c Thu Oct 22 20:21:11 2020 (r366952) +++ head/usr.sbin/iscsid/iscsid.c Thu Oct 22 20:26:27 2020 (r366953) @@ -172,6 +172,7 @@ connection_new(int iscsi_fd, const struct iscsi_daemon /* * Default values, from RFC 3720, section 12. */ + conn->conn_protocol_level = 0; conn->conn_header_digest = CONN_DIGEST_NONE; conn->conn_data_digest = CONN_DIGEST_NONE; conn->conn_initial_r2t = true; @@ -329,6 +330,7 @@ handoff(struct connection *conn) sizeof(idh.idh_target_alias)); idh.idh_tsih = conn->conn_tsih; idh.idh_statsn = conn->conn_statsn; + idh.idh_protocol_level = conn->conn_protocol_level; idh.idh_header_digest = conn->conn_header_digest; idh.idh_data_digest = conn->conn_data_digest; idh.idh_initial_r2t = conn->conn_initial_r2t; Modified: head/usr.sbin/iscsid/iscsid.h ============================================================================== --- head/usr.sbin/iscsid/iscsid.h Thu Oct 22 20:21:11 2020 (r366952) +++ head/usr.sbin/iscsid/iscsid.h Thu Oct 22 20:26:27 2020 (r366953) @@ -57,6 +57,7 @@ struct connection { uint8_t conn_isid[6]; uint16_t conn_tsih; uint32_t conn_statsn; + int conn_protocol_level; int conn_header_digest; int conn_data_digest; bool conn_initial_r2t; Modified: head/usr.sbin/iscsid/login.c ============================================================================== --- head/usr.sbin/iscsid/login.c Thu Oct 22 20:21:11 2020 (r366952) +++ head/usr.sbin/iscsid/login.c Thu Oct 22 20:26:27 2020 (r366953) @@ -341,6 +341,11 @@ login_negotiate_key(struct connection *conn, const cha sizeof(conn->conn_target_alias)); } else if (strcmp(value, "Irrelevant") == 0) { /* Ignore. */ + } else if (strcmp(name, "iSCSIProtocolLevel") == 0) { + tmp = strtoul(value, NULL, 10); + if (tmp < 0 || tmp > 31) + log_errx(1, "received invalid iSCSIProtocolLevel"); + conn->conn_protocol_level = tmp; } else if (strcmp(name, "HeaderDigest") == 0) { which = login_list_prefers(value, "CRC32C", "None"); switch (which) { @@ -500,6 +505,7 @@ login_negotiate(struct connection *conn) * The following keys are irrelevant for discovery sessions. */ if (conn->conn_conf.isc_discovery == 0) { + keys_add(request_keys, "iSCSIProtocolLevel", "2"); if (conn->conn_conf.isc_header_digest != 0) keys_add(request_keys, "HeaderDigest", "CRC32C"); else From owner-svn-src-head@freebsd.org Fri Oct 23 00:23:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA03442EBD2; Fri, 23 Oct 2020 00:23:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHQ2M3xtJz4fJg; Fri, 23 Oct 2020 00:23:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C0D71EC7D; Fri, 23 Oct 2020 00:23:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09N0Nt2m002559; Fri, 23 Oct 2020 00:23:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09N0Ns31002555; Fri, 23 Oct 2020 00:23:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202010230023.09N0Ns31002555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 23 Oct 2020 00:23:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366955 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 366955 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 00:23:55 -0000 Author: jhb Date: Fri Oct 23 00:23:54 2020 New Revision: 366955 URL: https://svnweb.freebsd.org/changeset/base/366955 Log: Handle CPL_RX_DATA on active TLS sockets. In certain edge cases, the NIC might have only received a partial TLS record which it needs to return to the driver. For example, if the local socket was closed while data was still in flight, a partial TLS record might be pending when the connection is closed. Receiving a RST in the middle of a TLS record is another example. When this happens, the firmware returns the the partial TLS record as plain TCP data via CPL_RX_DATA. Handle these requests by returning an error to OpenSSL (via so_error for KTLS or via an error TLS record header for the older Chelsio OpenSSL interface). Reported by: Sony Arpita Das @ Chelsio Reviewed by: np MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: Revision: https://reviews.freebsd.org/D26800 Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_tls.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Oct 23 00:00:52 2020 (r366954) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Fri Oct 23 00:23:54 2020 (r366955) @@ -1537,6 +1537,15 @@ do_rx_data(struct sge_iq *iq, const struct rss_header tp = intotcpcb(inp); + if (__predict_false(ulp_mode(toep) == ULP_MODE_TLS && + toep->flags & TPF_TLS_RECEIVE)) { + /* Received "raw" data on a TLS socket. */ + CTR3(KTR_CXGBE, "%s: tid %u, raw TLS data (%d bytes)", + __func__, tid, len); + do_rx_data_tls(cpl, toep, m); + return (0); + } + if (__predict_false(tp->rcv_nxt != be32toh(cpl->seq))) ddp_placed = be32toh(cpl->seq) - tp->rcv_nxt; Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Fri Oct 23 00:00:52 2020 (r366954) +++ head/sys/dev/cxgbe/tom/t4_tls.c Fri Oct 23 00:23:54 2020 (r366955) @@ -707,6 +707,8 @@ program_key_context(struct tcpcb *tp, struct toepcb *t V_TCB_TLS_SEQ(M_TCB_TLS_SEQ), V_TCB_TLS_SEQ(0)); t4_clear_rx_quiesce(toep); + + toep->flags |= TPF_TLS_RECEIVE; } else { unsigned short pdus_per_ulp; @@ -1064,6 +1066,7 @@ tls_alloc_ktls(struct toepcb *toep, struct ktls_sessio tls_stop_handshake_timer(toep); toep->flags &= ~TPF_FORCE_CREDITS; + toep->flags |= TPF_TLS_RECEIVE; /* * RX key tags are an index into the key portion of MA @@ -2218,6 +2221,135 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_head INP_WUNLOCK(inp); CURVNET_RESTORE(); return (0); +} + +void +do_rx_data_tls(const struct cpl_rx_data *cpl, struct toepcb *toep, + struct mbuf *m) +{ + struct inpcb *inp = toep->inp; + struct tls_ofld_info *tls_ofld = &toep->tls; + struct tls_hdr *hdr; + struct tcpcb *tp; + struct socket *so; + struct sockbuf *sb; + int error, len, rx_credits; + + len = m->m_pkthdr.len; + + INP_WLOCK_ASSERT(inp); + + so = inp_inpcbtosocket(inp); + tp = intotcpcb(inp); + sb = &so->so_rcv; + SOCKBUF_LOCK(sb); + CURVNET_SET(toep->vnet); + + tp->rcv_nxt += len; + KASSERT(tp->rcv_wnd >= len, ("%s: negative window size", __func__)); + tp->rcv_wnd -= len; + + /* Do we have a full TLS header? */ + if (len < sizeof(*hdr)) { + CTR3(KTR_CXGBE, "%s: tid %u len %d: too short for a TLS header", + __func__, toep->tid, len); + so->so_error = EMSGSIZE; + goto out; + } + hdr = mtod(m, struct tls_hdr *); + + /* Is the header valid? */ + if (be16toh(hdr->version) != tls_ofld->k_ctx.proto_ver) { + CTR3(KTR_CXGBE, "%s: tid %u invalid version %04x", + __func__, toep->tid, be16toh(hdr->version)); + error = EINVAL; + goto report_error; + } + if (be16toh(hdr->length) < sizeof(*hdr)) { + CTR3(KTR_CXGBE, "%s: tid %u invalid length %u", + __func__, toep->tid, be16toh(hdr->length)); + error = EBADMSG; + goto report_error; + } + + /* Did we get a truncated record? */ + if (len < be16toh(hdr->length)) { + CTR4(KTR_CXGBE, "%s: tid %u truncated TLS record (%d vs %u)", + __func__, toep->tid, len, be16toh(hdr->length)); + + error = EMSGSIZE; + goto report_error; + } + + /* Is the header type unknown? */ + switch (hdr->type) { + case CONTENT_TYPE_CCS: + case CONTENT_TYPE_ALERT: + case CONTENT_TYPE_APP_DATA: + case CONTENT_TYPE_HANDSHAKE: + break; + default: + CTR3(KTR_CXGBE, "%s: tid %u invalid TLS record type %u", + __func__, toep->tid, hdr->type); + error = EBADMSG; + goto report_error; + } + + /* + * Just punt. Although this could fall back to software + * decryption, this case should never really happen. + */ + CTR4(KTR_CXGBE, "%s: tid %u dropping TLS record type %u, length %u", + __func__, toep->tid, hdr->type, be16toh(hdr->length)); + error = EBADMSG; + +report_error: +#ifdef KERN_TLS + if (toep->tls.mode == TLS_MODE_KTLS) + so->so_error = error; + else +#endif + { + /* + * Report errors by sending an empty TLS record + * with an error record type. + */ + hdr->type = CONTENT_TYPE_ERROR; + + /* Trim this CPL's mbuf to only include the TLS header. */ + KASSERT(m->m_len == len && m->m_next == NULL, + ("%s: CPL spans multiple mbufs", __func__)); + m->m_len = TLS_HEADER_LENGTH; + m->m_pkthdr.len = TLS_HEADER_LENGTH; + + sbappendstream_locked(sb, m, 0); + m = NULL; + } + +out: + /* + * This connection is going to die anyway, so probably don't + * need to bother with returning credits. + */ + rx_credits = sbspace(sb) > tp->rcv_wnd ? sbspace(sb) - tp->rcv_wnd : 0; +#ifdef VERBOSE_TRACES + CTR4(KTR_CXGBE, "%s: tid %u rx_credits %u rcv_wnd %u", + __func__, toep->tid, rx_credits, tp->rcv_wnd); +#endif + if (rx_credits > 0 && sbused(sb) + tp->rcv_wnd < sb->sb_lowat) { + rx_credits = send_rx_credits(toep->vi->adapter, toep, + rx_credits); + tp->rcv_wnd += rx_credits; + tp->rcv_adv += rx_credits; + } + + sorwakeup_locked(so); + SOCKBUF_UNLOCK_ASSERT(sb); + + INP_WUNLOCK(inp); + CURVNET_RESTORE(); + + m_freem(m); } void Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Fri Oct 23 00:00:52 2020 (r366954) +++ head/sys/dev/cxgbe/tom/t4_tom.h Fri Oct 23 00:23:54 2020 (r366955) @@ -74,6 +74,7 @@ enum { TPF_FORCE_CREDITS = (1 << 10), /* always send credits */ TPF_KTLS = (1 << 11), /* send TLS records from KTLS */ TPF_INITIALIZED = (1 << 12), /* init_toepcb has been called */ + TPF_TLS_RECEIVE = (1 << 13), /* should receive TLS records */ }; enum { @@ -441,6 +442,7 @@ const struct offload_settings *lookup_offload_policy(s /* t4_tls.c */ bool can_tls_offload(struct adapter *); +void do_rx_data_tls(const struct cpl_rx_data *, struct toepcb *, struct mbuf *); int t4_ctloutput_tls(struct socket *, struct sockopt *); void t4_push_tls_records(struct adapter *, struct toepcb *, int); void t4_push_ktls(struct adapter *, struct toepcb *, int); From owner-svn-src-head@freebsd.org Fri Oct 23 01:36:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84EF3438301; Fri, 23 Oct 2020 01:36:55 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHRfb2x0kz4jT9; Fri, 23 Oct 2020 01:36:55 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 442AE1FEB7; Fri, 23 Oct 2020 01:36:55 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09N1at6Z045275; Fri, 23 Oct 2020 01:36:55 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09N1at21045274; Fri, 23 Oct 2020 01:36:55 GMT (envelope-from np@FreeBSD.org) Message-Id: <202010230136.09N1at21045274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 23 Oct 2020 01:36:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366958 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 366958 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 01:36:55 -0000 Author: np Date: Fri Oct 23 01:36:54 2020 New Revision: 366958 URL: https://svnweb.freebsd.org/changeset/base/366958 Log: cxgbe(4): refine the values reported in if_ratelimit_query. - Get the number of classes from chip_params. - Get the number of ethofld tids from the firmware. - Do not let tcp_ratelimit allocate all traffic classes. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sched.c Modified: head/sys/dev/cxgbe/t4_sched.c ============================================================================== --- head/sys/dev/cxgbe/t4_sched.c Fri Oct 23 01:06:42 2020 (r366957) +++ head/sys/dev/cxgbe/t4_sched.c Fri Oct 23 01:36:54 2020 (r366958) @@ -903,34 +903,46 @@ cxgbe_rate_tag_free(struct m_snd_tag *mst) mtx_unlock(&cst->lock); } -#define CXGBE_MAX_FLOWS 4000 /* Testing show so far thats all this adapter can do */ -#define CXGBE_UNIQUE_RATE_COUNT 16 /* Number of unique rates that can be setup */ - void -cxgbe_ratelimit_query(struct ifnet *ifp __unused, - struct if_ratelimit_query_results *q) +cxgbe_ratelimit_query(struct ifnet *ifp, struct if_ratelimit_query_results *q) { - /* - * This is a skeleton and needs future work - * by the driver supporters. It should be - * enhanced to look at the specific type of - * interface and select approprate values - * for these settings. This example goes - * with an earlier card (t5), it has a maximum - * number of 16 rates that the first guys in - * select (thus the flags value RT_IS_SELECTABLE). - * If it was a fixed table then we would setup a - * const array (example mlx5). Note the card tested - * can only support reasonably 4000 flows before - * the adapter has issues with sending so here - * we limit the number of flows using hardware - * pacing to that number, other cards may - * be able to raise or eliminate this limit. - */ + struct vi_info *vi = ifp->if_softc; + struct adapter *sc = vi->adapter; + q->rate_table = NULL; q->flags = RT_IS_SELECTABLE; - q->max_flows = CXGBE_MAX_FLOWS; - q->number_of_rates = CXGBE_UNIQUE_RATE_COUNT; - q->min_segment_burst = 4; /* Driver emits 4 in a burst */ + /* + * Absolute max limits from the firmware configuration. Practical + * limits depend on the burstsize, pktsize (ifp->if_mtu ultimately) and + * the card's cclk. + */ + q->max_flows = sc->tids.netids; + q->number_of_rates = sc->chip_params->nsched_cls; + q->min_segment_burst = 4; /* matches PKTSCHED_BURST in the firmware. */ + +#if 1 + if (chip_id(sc) < CHELSIO_T6) { + /* Based on testing by rrs@ with a T580 at burstsize = 4. */ + MPASS(q->min_segment_burst == 4); + q->max_flows = max(4000, q->max_flows); + } else { + /* XXX: TBD, carried forward from T5 for now. */ + q->max_flows = max(4000, q->max_flows); + } + + /* + * XXX: tcp_ratelimit.c grabs all available rates on link-up before it + * even knows whether hw pacing will be used or not. This prevents + * other consumers like SO_MAX_PACING_RATE or those using cxgbetool or + * the private ioctls from using any of traffic classes. + * + * Underreport the number of rates to tcp_ratelimit so that it doesn't + * hog all of them. This can be removed if/when tcp_ratelimit switches + * to making its allocations on first-use rather than link-up. There is + * nothing wrong with one particular consumer reserving all the classes + * but it should do so only if it'll actually use hw rate limiting. + */ + q->number_of_rates /= 4; +#endif } #endif From owner-svn-src-head@freebsd.org Fri Oct 23 02:24:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3D57439D8C; Fri, 23 Oct 2020 02:24:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHSjl5z5Xz4lZH; Fri, 23 Oct 2020 02:24:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B17552089D; Fri, 23 Oct 2020 02:24:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09N2Ohwu075534; Fri, 23 Oct 2020 02:24:43 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09N2OhWE075533; Fri, 23 Oct 2020 02:24:43 GMT (envelope-from np@FreeBSD.org) Message-Id: <202010230224.09N2OhWE075533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 23 Oct 2020 02:24:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366959 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 366959 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 02:24:44 -0000 Author: np Date: Fri Oct 23 02:24:43 2020 New Revision: 366959 URL: https://svnweb.freebsd.org/changeset/base/366959 Log: cxgbe(4): Fix min/max typo in r366958. Modified: head/sys/dev/cxgbe/t4_sched.c Modified: head/sys/dev/cxgbe/t4_sched.c ============================================================================== --- head/sys/dev/cxgbe/t4_sched.c Fri Oct 23 01:36:54 2020 (r366958) +++ head/sys/dev/cxgbe/t4_sched.c Fri Oct 23 02:24:43 2020 (r366959) @@ -924,10 +924,10 @@ cxgbe_ratelimit_query(struct ifnet *ifp, struct if_rat if (chip_id(sc) < CHELSIO_T6) { /* Based on testing by rrs@ with a T580 at burstsize = 4. */ MPASS(q->min_segment_burst == 4); - q->max_flows = max(4000, q->max_flows); + q->max_flows = min(4000, q->max_flows); } else { /* XXX: TBD, carried forward from T5 for now. */ - q->max_flows = max(4000, q->max_flows); + q->max_flows = min(4000, q->max_flows); } /* From owner-svn-src-head@freebsd.org Fri Oct 23 06:24:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C528343E433; Fri, 23 Oct 2020 06:24:38 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHZ2Z4qxtz3TXK; Fri, 23 Oct 2020 06:24:38 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 890182349C; Fri, 23 Oct 2020 06:24:38 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09N6OcpY029726; Fri, 23 Oct 2020 06:24:38 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09N6OcPu029725; Fri, 23 Oct 2020 06:24:38 GMT (envelope-from alc@FreeBSD.org) Message-Id: <202010230624.09N6OcPu029725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Fri, 23 Oct 2020 06:24:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366960 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 366960 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 06:24:38 -0000 Author: alc Date: Fri Oct 23 06:24:38 2020 New Revision: 366960 URL: https://svnweb.freebsd.org/changeset/base/366960 Log: Conditionally compile struct vm_phys_seg's md_first field. This field is only used by arm64's pmap. Reviewed by: kib, markj, scottph Differential Revision: https://reviews.freebsd.org/D26907 Modified: head/sys/vm/vm_phys.h Modified: head/sys/vm/vm_phys.h ============================================================================== --- head/sys/vm/vm_phys.h Fri Oct 23 02:24:43 2020 (r366959) +++ head/sys/vm/vm_phys.h Fri Oct 23 06:24:38 2020 (r366960) @@ -71,7 +71,9 @@ struct vm_phys_seg { #if VM_NRESERVLEVEL > 0 vm_reserv_t first_reserv; #endif +#ifdef __aarch64__ void *md_first; +#endif int domain; struct vm_freelist (*free_queues)[VM_NFREEPOOL][VM_NFREEORDER_MAX]; }; From owner-svn-src-head@freebsd.org Fri Oct 23 08:04:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51CD64401EC; Fri, 23 Oct 2020 08:04:51 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHcGB32s6z3Yqj; Fri, 23 Oct 2020 08:04:50 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id DA54B2602A3; Fri, 23 Oct 2020 10:04:47 +0200 (CEST) Subject: Re: svn commit: r366936 - head/sys/net From: Hans Petter Selasky To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202010221222.09MCM8qo048407@repo.freebsd.org> <20201022164804.GQ2643@kib.kiev.ua> <69bfca24-40a9-552a-62b3-8ab7b46ff3c7@selasky.org> Message-ID: Date: Fri, 23 Oct 2020 10:04:12 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <69bfca24-40a9-552a-62b3-8ab7b46ff3c7@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4CHcGB32s6z3Yqj X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-2.42 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net:c]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-0.99)[-0.986]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.26)[-0.261]; NEURAL_HAM_MEDIUM(-0.87)[-0.872]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 08:04:51 -0000 On 2020-10-22 19:54, Hans Petter Selasky wrote: > On 2020-10-22 18:48, Konstantin Belousov wrote: >> sys/systm.h already includes sys/param.h.  Also, sys/param.h already >> includes >> sys/types.h. > > I'll have a look tomorrow at this. Thanks for pointing out. It appears sys/systm.h needs sys/types.h included first: > In file included from /usr/img/freebsd.svn/src/sys/sys/systm.h:44: > ./machine/atomic.h:230:1: error: unknown type name 'u_char'; did you mean 'char'? > ATOMIC_CMPSET(char); --HPS From owner-svn-src-head@freebsd.org Fri Oct 23 08:44:54 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B49B7440D89; Fri, 23 Oct 2020 08:44:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHd8Q45z9z3bt0; Fri, 23 Oct 2020 08:44:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C9DC24E2C; Fri, 23 Oct 2020 08:44:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09N8is08016408; Fri, 23 Oct 2020 08:44:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09N8isn6016407; Fri, 23 Oct 2020 08:44:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010230844.09N8isn6016407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Oct 2020 08:44:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366961 - head/sys/fs/cuse X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/fs/cuse X-SVN-Commit-Revision: 366961 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 08:44:54 -0000 Author: hselasky Date: Fri Oct 23 08:44:53 2020 New Revision: 366961 URL: https://svnweb.freebsd.org/changeset/base/366961 Log: Fix for loading cuse.ko via rc.d . Make sure we declare the cuse(3) module by name and not only by the version information, so that "kldstat -q -m cuse" works. Found by: Goran Mekic MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/fs/cuse/cuse.c Modified: head/sys/fs/cuse/cuse.c ============================================================================== --- head/sys/fs/cuse/cuse.c Fri Oct 23 06:24:38 2020 (r366960) +++ head/sys/fs/cuse/cuse.c Fri Oct 23 08:44:53 2020 (r366961) @@ -64,6 +64,24 @@ #include #include +static int +cuse_modevent(module_t mod, int type, void *data) +{ + switch (type) { + case MOD_LOAD: + case MOD_UNLOAD: + return (0); + default: + return (EOPNOTSUPP); + } +} + +static moduledata_t cuse_mod = { + .name = "cuse", + .evhand = &cuse_modevent, +}; + +DECLARE_MODULE(cuse, cuse_mod, SI_SUB_DEVFS, SI_ORDER_FIRST); MODULE_VERSION(cuse, 1); /* From owner-svn-src-head@freebsd.org Fri Oct 23 09:22:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D2E944168C; Fri, 23 Oct 2020 09:22:24 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHdzh1Y46z3dCh; Fri, 23 Oct 2020 09:22:24 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19C7E255AA; Fri, 23 Oct 2020 09:22:24 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09N9MNwt040924; Fri, 23 Oct 2020 09:22:23 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09N9MNZu040921; Fri, 23 Oct 2020 09:22:23 GMT (envelope-from se@FreeBSD.org) Message-Id: <202010230922.09N9MNZu040921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org using -f From: =?UTF-8?Q?Stefan_E=c3=9fer?= Date: Fri, 23 Oct 2020 09:22:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366962 - in head: include usr.bin/calendar X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: in head: include usr.bin/calendar X-SVN-Commit-Revision: 366962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 09:22:24 -0000 Author: se Date: Fri Oct 23 09:22:23 2020 New Revision: 366962 URL: https://svnweb.freebsd.org/changeset/base/366962 Log: Add search of LOCALBASE/share/calendar for calendars supplied by a port. Calendar files in LOCALBASE override similarily named ones in the base system. This could easily be changed if the base system calendars should have precedence, but it could lead to a violation of POLA since then the port's files were ignored unless those in base have been deleted. There was no definition of _PATH_LOCALBASE in paths.h, but verbatim uses of /usr/local existed for _PATH_DEFPATH. Use _PATH_LOCALBASE here to ease a consistent modification of this prefix. Reviewed by: imp, pfg Differential Revision: https://reviews.freebsd.org/D26882 Modified: head/include/paths.h head/usr.bin/calendar/io.c head/usr.bin/calendar/pathnames.h Modified: head/include/paths.h ============================================================================== --- head/include/paths.h Fri Oct 23 08:44:53 2020 (r366961) +++ head/include/paths.h Fri Oct 23 09:22:23 2020 (r366962) @@ -37,8 +37,11 @@ #include +#define _PATH_LOCALBASE "/usr/local" + /* Default search path. */ -#define _PATH_DEFPATH "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" +#define _PATH_DEFPATH "/sbin:/bin:/usr/sbin:/usr/bin:" \ + _PATH_LOCALBASE "/sbin:" _PATH_LOCALBASE "/bin" /* All standard utilities path. */ #define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" /* Locate system binaries. */ Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Fri Oct 23 08:44:53 2020 (r366961) +++ head/usr.bin/calendar/io.c Fri Oct 23 09:22:23 2020 (r366962) @@ -71,7 +71,7 @@ enum { }; const char *calendarFile = "calendar"; /* default calendar file */ -static const char *calendarHomes[] = {".calendar", _PATH_INCLUDE}; /* HOME */ +static const char *calendarHomes[] = {".calendar", _PATH_INCLUDE_LOCAL, _PATH_INCLUDE}; /* HOME */ static const char *calendarNoMail = "nomail";/* don't sent mail if file exist */ static char path[MAXPATHLEN]; Modified: head/usr.bin/calendar/pathnames.h ============================================================================== --- head/usr.bin/calendar/pathnames.h Fri Oct 23 08:44:53 2020 (r366961) +++ head/usr.bin/calendar/pathnames.h Fri Oct 23 09:22:23 2020 (r366962) @@ -35,3 +35,4 @@ #include #define _PATH_INCLUDE "/usr/share/calendar" +#define _PATH_INCLUDE_LOCAL _PATH_LOCALBASE "/share/calendar" From owner-svn-src-head@freebsd.org Fri Oct 23 09:46:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D762B441CA0; Fri, 23 Oct 2020 09:46:30 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHfWT5MJHz3f5l; Fri, 23 Oct 2020 09:46:29 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 09N9kMO5089540 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 23 Oct 2020 12:46:25 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 09N9kMO5089540 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 09N9kLHC089538; Fri, 23 Oct 2020 12:46:21 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 23 Oct 2020 12:46:21 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366936 - head/sys/net Message-ID: <20201023094621.GW2643@kib.kiev.ua> References: <202010221222.09MCM8qo048407@repo.freebsd.org> <20201022164804.GQ2643@kib.kiev.ua> <69bfca24-40a9-552a-62b3-8ab7b46ff3c7@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CHfWT5MJHz3f5l X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [0.47 / 15.00]; ARC_NA(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; NEURAL_SPAM_MEDIUM(0.87)[0.868]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.45)[-0.448]; NEURAL_SPAM_LONG(0.05)[0.053]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 09:46:30 -0000 On Fri, Oct 23, 2020 at 10:04:12AM +0200, Hans Petter Selasky wrote: > On 2020-10-22 19:54, Hans Petter Selasky wrote: > > On 2020-10-22 18:48, Konstantin Belousov wrote: > > > sys/systm.h already includes sys/param.h.  Also, sys/param.h already > > > includes > > > sys/types.h. > > > > I'll have a look tomorrow at this. Thanks for pointing out. > > It appears sys/systm.h needs sys/types.h included first: Normally you do #include #include and I do not see why it would not work in this case. > > > In file included from /usr/img/freebsd.svn/src/sys/sys/systm.h:44: > > ./machine/atomic.h:230:1: error: unknown type name 'u_char'; did you mean 'char'? > > ATOMIC_CMPSET(char); > > --HPS From owner-svn-src-head@freebsd.org Fri Oct 23 10:00:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADA6A441FCB; Fri, 23 Oct 2020 10:00:56 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHfr84DfBz3fYQ; Fri, 23 Oct 2020 10:00:56 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 756C125C1D; Fri, 23 Oct 2020 10:00:56 +0000 (UTC) (envelope-from se@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NA0uO5060472; Fri, 23 Oct 2020 10:00:56 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NA0uMJ060471; Fri, 23 Oct 2020 10:00:56 GMT (envelope-from se@FreeBSD.org) Message-Id: <202010231000.09NA0uMJ060471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org using -f From: =?UTF-8?Q?Stefan_E=c3=9fer?= Date: Fri, 23 Oct 2020 10:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366963 - head/usr.bin/calendar X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/usr.bin/calendar X-SVN-Commit-Revision: 366963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 10:00:56 -0000 Author: se Date: Fri Oct 23 10:00:56 2020 New Revision: 366963 URL: https://svnweb.freebsd.org/changeset/base/366963 Log: Udpate calendar man-page to mention the search path added in r366962. Calendar files in /usr/lcoal/share/calendar take precedence over files in the base system. They can be provided by a port or package, but since such a port has not been committed, yet, no specific port name is suggested. In fact, multiple ports could exist (e.g. per locale) without conflicting with each other. Modified: head/usr.bin/calendar/calendar.1 Modified: head/usr.bin/calendar/calendar.1 ============================================================================== --- head/usr.bin/calendar/calendar.1 Fri Oct 23 09:22:23 2020 (r366962) +++ head/usr.bin/calendar/calendar.1 Fri Oct 23 10:00:56 2020 (r366963) @@ -28,7 +28,7 @@ .\" @(#)calendar.1 8.1 (Berkeley) 6/29/93 .\" $FreeBSD$ .\" -.Dd September 29, 2020 +.Dd Oktober 23, 2020 .Dt CALENDAR 1 .Os .Sh NAME @@ -245,7 +245,15 @@ A chdir is done into this directory if it exists. calendar file to use if no calendar file exists in the current directory. .It Pa ~/.calendar/nomail do not send mail if this file exists. +.It Pa /usr/share/calendar +system wide location of calendar files provided as part of the base system. +.It Pa /usr/local/share/calendar +system wide location for calendar files provided by a port or package. .El +.Pp +The order of precedence in searches for a calendar file is: +current directory, ~/.calendar, /usr/local/share/calendar, /usr/share/calendar. +Files of similar names are ignored in lower precedence locations. .Pp The following default calendar files are provided in .Pa /usr/share/calendar : From owner-svn-src-head@freebsd.org Fri Oct 23 11:26:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A5C8443F85; Fri, 23 Oct 2020 11:26:51 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHhlG3JZzz41Rc; Fri, 23 Oct 2020 11:26:50 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 145192602A3; Fri, 23 Oct 2020 13:26:41 +0200 (CEST) Subject: Re: svn commit: r366936 - head/sys/net To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202010221222.09MCM8qo048407@repo.freebsd.org> <20201022164804.GQ2643@kib.kiev.ua> <69bfca24-40a9-552a-62b3-8ab7b46ff3c7@selasky.org> <20201023094621.GW2643@kib.kiev.ua> From: Hans Petter Selasky Message-ID: <966178e3-078f-66d3-8baa-6672b998422e@selasky.org> Date: Fri, 23 Oct 2020 13:26:04 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201023094621.GW2643@kib.kiev.ua> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4CHhlG3JZzz41Rc X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-2.70 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net:c]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-0.99)[-0.986]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.54)[-0.539]; NEURAL_HAM_MEDIUM(-0.87)[-0.873]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 11:26:51 -0000 On 2020-10-23 11:46, Konstantin Belousov wrote: > On Fri, Oct 23, 2020 at 10:04:12AM +0200, Hans Petter Selasky wrote: >> On 2020-10-22 19:54, Hans Petter Selasky wrote: >>> On 2020-10-22 18:48, Konstantin Belousov wrote: >>>> sys/systm.h already includes sys/param.h.  Also, sys/param.h already >>>> includes >>>> sys/types.h. >>> >>> I'll have a look tomorrow at this. Thanks for pointing out. >> >> It appears sys/systm.h needs sys/types.h included first: > Normally you do > #include > #include > and I do not see why it would not work in this case. > >> >>> In file included from /usr/img/freebsd.svn/src/sys/sys/systm.h:44: >>> ./machine/atomic.h:230:1: error: unknown type name 'u_char'; did you mean 'char'? >>> ATOMIC_CMPSET(char); >> >> --HPS Hi, The following works, but it doesn't make much difference. Do we have a script or tool, which can do this? --HPS > Index: sys/net/if_infiniband.c > =================================================================== > --- sys/net/if_infiniband.c (revision 366936) > +++ sys/net/if_infiniband.c (working copy) > @@ -30,9 +30,8 @@ > __FBSDID("$FreeBSD$"); > > #include > +#include > #include > -#include > -#include > #include > #include > #include From owner-svn-src-head@freebsd.org Fri Oct 23 11:47:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DED024441B4; Fri, 23 Oct 2020 11:47:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHjBY6WKtz42RP; Fri, 23 Oct 2020 11:47:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 09NBktWn018798 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 23 Oct 2020 14:46:58 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 09NBktWn018798 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 09NBkt7P018797; Fri, 23 Oct 2020 14:46:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 23 Oct 2020 14:46:54 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366936 - head/sys/net Message-ID: <20201023114654.GY2643@kib.kiev.ua> References: <202010221222.09MCM8qo048407@repo.freebsd.org> <20201022164804.GQ2643@kib.kiev.ua> <69bfca24-40a9-552a-62b3-8ab7b46ff3c7@selasky.org> <20201023094621.GW2643@kib.kiev.ua> <966178e3-078f-66d3-8baa-6672b998422e@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <966178e3-078f-66d3-8baa-6672b998422e@selasky.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CHjBY6WKtz42RP X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [0.18 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_SPAM_SHORT(0.05)[0.046]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; NEURAL_SPAM_MEDIUM(0.08)[0.077]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.05)[0.053]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 11:47:02 -0000 On Fri, Oct 23, 2020 at 01:26:04PM +0200, Hans Petter Selasky wrote: > On 2020-10-23 11:46, Konstantin Belousov wrote: > > On Fri, Oct 23, 2020 at 10:04:12AM +0200, Hans Petter Selasky wrote: > > > On 2020-10-22 19:54, Hans Petter Selasky wrote: > > > > On 2020-10-22 18:48, Konstantin Belousov wrote: > > > > > sys/systm.h already includes sys/param.h.  Also, sys/param.h already > > > > > includes > > > > > sys/types.h. > > > > > > > > I'll have a look tomorrow at this. Thanks for pointing out. > > > > > > It appears sys/systm.h needs sys/types.h included first: > > Normally you do > > #include > > #include > > and I do not see why it would not work in this case. > > > > > > > > > In file included from /usr/img/freebsd.svn/src/sys/sys/systm.h:44: > > > > ./machine/atomic.h:230:1: error: unknown type name 'u_char'; did you mean 'char'? > > > > ATOMIC_CMPSET(char); > > > > > > --HPS > > Hi, > > The following works, but it doesn't make much difference. It makes a difference because this is an idiomatic an intended use of the headers. > > Do we have a script or tool, which can do this? I am not aware of. > > --HPS > > > Index: sys/net/if_infiniband.c > > =================================================================== > > --- sys/net/if_infiniband.c (revision 366936) > > +++ sys/net/if_infiniband.c (working copy) > > @@ -30,9 +30,8 @@ > > __FBSDID("$FreeBSD$"); > > #include > > +#include > > #include > > -#include > > -#include > > #include > > #include > > #include From owner-svn-src-head@freebsd.org Fri Oct 23 11:57:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D74F4444D7; Fri, 23 Oct 2020 11:57:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHjR83BKgz42kH; Fri, 23 Oct 2020 11:57:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CA2226F4D; Fri, 23 Oct 2020 11:57:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NBvucG032874; Fri, 23 Oct 2020 11:57:56 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NBvupX032873; Fri, 23 Oct 2020 11:57:56 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010231157.09NBvupX032873@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 23 Oct 2020 11:57:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366966 - head/sys/compat/linprocfs X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linprocfs X-SVN-Commit-Revision: 366966 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 11:57:56 -0000 Author: trasz Date: Fri Oct 23 11:57:55 2020 New Revision: 366966 URL: https://svnweb.freebsd.org/changeset/base/366966 Log: Add /proc/sys/kernel/ngroups_max to linprocfs(4). The id(1) command seems to use it - it works fine without it, but still. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26898 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Fri Oct 23 10:48:14 2020 (r366965) +++ head/sys/compat/linprocfs/linprocfs.c Fri Oct 23 11:57:55 2020 (r366966) @@ -1453,6 +1453,19 @@ linprocfs_domsgmnb(PFS_FILL_ARGS) } /* + * Filler function for proc/sys/kernel/ngroups_max + * + * Note that in Linux it defaults to 65536, not 1023. + */ +static int +linprocfs_dongroups_max(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d\n", ngroups_max); + return (0); +} + +/* * Filler function for proc/sys/kernel/pid_max */ static int @@ -1921,6 +1934,8 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "msgmni", &linprocfs_domsgmni, NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "msgmnb", &linprocfs_domsgmnb, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "ngroups_max", &linprocfs_dongroups_max, NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "pid_max", &linprocfs_dopid_max, NULL, NULL, NULL, PFS_RD); From owner-svn-src-head@freebsd.org Fri Oct 23 12:00:31 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2C694449F7; Fri, 23 Oct 2020 12:00:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHjV74Pm2z43K6; Fri, 23 Oct 2020 12:00:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B30627147; Fri, 23 Oct 2020 12:00:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NC0VCJ033246; Fri, 23 Oct 2020 12:00:31 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NC0Vkh033245; Fri, 23 Oct 2020 12:00:31 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010231200.09NC0Vkh033245@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 23 Oct 2020 12:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366967 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 366967 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 12:00:31 -0000 Author: trasz Date: Fri Oct 23 12:00:30 2020 New Revision: 366967 URL: https://svnweb.freebsd.org/changeset/base/366967 Log: Improve prctl(2) debug. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26899 Modified: head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Fri Oct 23 11:57:55 2020 (r366966) +++ head/sys/compat/linux/linux_misc.c Fri Oct 23 12:00:30 2020 (r366967) @@ -2001,7 +2001,15 @@ linux_prctl(struct thread *td, struct linux_prctl_args error = copyout(comm, (void *)(register_t)args->arg2, strlen(comm) + 1); break; + case LINUX_PR_GET_SECCOMP: + case LINUX_PR_SET_SECCOMP: + /* + * Same as returned by Linux without CONFIG_SECCOMP enabled. + */ + error = EINVAL; + break; default: + linux_msg(td, "unsupported prctl option %d", args->option); error = EINVAL; break; } Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Fri Oct 23 11:57:55 2020 (r366966) +++ head/sys/compat/linux/linux_misc.h Fri Oct 23 12:00:30 2020 (r366967) @@ -54,6 +54,8 @@ #define LINUX_PR_SET_KEEPCAPS 8 /* Set drop capabilities on setuid */ #define LINUX_PR_SET_NAME 15 /* Set process name. */ #define LINUX_PR_GET_NAME 16 /* Get process name. */ +#define LINUX_PR_GET_SECCOMP 21 +#define LINUX_PR_SET_SECCOMP 22 #define LINUX_MAX_COMM_LEN 16 /* Maximum length of the process name. */ From owner-svn-src-head@freebsd.org Fri Oct 23 12:42:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 89D12445CF2; Fri, 23 Oct 2020 12:42:34 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHkQd4RDXz45RY; Fri, 23 Oct 2020 12:42:33 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f169.google.com with SMTP id l16so1194756ilj.9; Fri, 23 Oct 2020 05:42:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PoQWkkYuAj8s112z6NfSAav/nobXkxH9AwBQhCY948U=; b=KuWzjUtTt1ziWk0UYGC8PtCZGvESoxdLAA/ues10RoWXCMP78y+3mlkc+JO2r2VH6R 8KiFXBn7x8j0HZnFDc3hyJDo/LCasrxk2U7BEvZe5xOQE/qNMW6m2VbBKG/iRnaHYYry MA9djbTUxfSdkaZc56NUcUpeNxWrqhrOmeB+3fSheRzhNa+q1eiPS83FD15+llUEXBcl ppY9o1rTECCqbhAmnBHE23aHB/Sd1hS+0UTJObXgiBNITLczw4VptPa02xyiDD2I6dNK snvi53j8UK/izRcRlLf8MqmQmVM3SYp56OVPXrDEMQakrUwxPF1sLq7vB75uIG6Nuv/X d+Iw== X-Gm-Message-State: AOAM530/8hq1bI65cKVHF3zNY4gpNoLoEh8vt3fV3wMR17Y9rRnWN2I1 usVFxHx6U3jhLsJ/K3v7v/fb0ntWxSdeIZnYcx4P8Sq/VIU= X-Google-Smtp-Source: ABdhPJyBSUwYmp1V1zkScI5Odn2XCWh3Ml/ClcopOfaV+ZRtq0DGfE1zpcpOgwTAJIsUrXX8eq8Yk6cwxPIpzbHn034= X-Received: by 2002:a92:d490:: with SMTP id p16mr1427149ilg.98.1603456952144; Fri, 23 Oct 2020 05:42:32 -0700 (PDT) MIME-Version: 1.0 References: <202010221222.09MCM8qo048407@repo.freebsd.org> <20201022164804.GQ2643@kib.kiev.ua> <69bfca24-40a9-552a-62b3-8ab7b46ff3c7@selasky.org> <20201023094621.GW2643@kib.kiev.ua> <966178e3-078f-66d3-8baa-6672b998422e@selasky.org> In-Reply-To: <966178e3-078f-66d3-8baa-6672b998422e@selasky.org> From: Ed Maste Date: Fri, 23 Oct 2020 08:42:20 -0400 Message-ID: Subject: Re: svn commit: r366936 - head/sys/net To: Hans Petter Selasky Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CHkQd4RDXz45RY X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.169 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-2.12 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.94)[-0.936]; RCVD_COUNT_TWO(0.00)[2]; FREEFALL_USER(0.00)[carpeddiem]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; RCVD_TLS_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-0.95)[-0.955]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.23)[-0.231]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.169:from]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.169:from]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MIME_TRACE(0.00)[0:+]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 12:42:34 -0000 On Fri, 23 Oct 2020 at 07:27, Hans Petter Selasky wrote: > > Do we have a script or tool, which can do this? Clang-format can do it; have a look at the IncludeCategories in .clang-format at the top of the tree to see the current rule set for includes. From owner-svn-src-head@freebsd.org Fri Oct 23 14:15:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3543D4473FB; Fri, 23 Oct 2020 14:15:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHmVR0XFYz4BGg; Fri, 23 Oct 2020 14:15:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA4258BDA; Fri, 23 Oct 2020 14:15:58 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NEFwu4018392; Fri, 23 Oct 2020 14:15:58 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NEFwSe018391; Fri, 23 Oct 2020 14:15:58 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202010231415.09NEFwSe018391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 23 Oct 2020 14:15:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366968 - head/sys/dev/ntb X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/ntb X-SVN-Commit-Revision: 366968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 14:15:59 -0000 Author: markj Date: Fri Oct 23 14:15:58 2020 New Revision: 366968 URL: https://svnweb.freebsd.org/changeset/base/366968 Log: ntb: Fix an assertion to permit >= 32 doorbells MFC after: 1 week Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Modified: head/sys/dev/ntb/ntb_transport.c Modified: head/sys/dev/ntb/ntb_transport.c ============================================================================== --- head/sys/dev/ntb/ntb_transport.c Fri Oct 23 12:00:30 2020 (r366967) +++ head/sys/dev/ntb/ntb_transport.c Fri Oct 23 14:15:58 2020 (r366968) @@ -357,7 +357,7 @@ ntb_transport_attach(device_t dev) spad_count = ntb_spad_count(dev); db_bitmap = ntb_db_valid_mask(dev); db_count = flsll(db_bitmap); - KASSERT(db_bitmap == (1 << db_count) - 1, + KASSERT(db_bitmap == ((uint64_t)1 << db_count) - 1, ("Doorbells are not sequential (%jx).\n", db_bitmap)); if (nt->mw_count == 0) { From owner-svn-src-head@freebsd.org Fri Oct 23 14:16:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 917DD447ADB; Fri, 23 Oct 2020 14:16:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHmWT3gwXz4C8s; Fri, 23 Oct 2020 14:16:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6123B89CE; Fri, 23 Oct 2020 14:16:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NEGrZ0018479; Fri, 23 Oct 2020 14:16:53 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NEGquh018476; Fri, 23 Oct 2020 14:16:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202010231416.09NEGquh018476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 23 Oct 2020 14:16:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366969 - in head: share/man/man4 sys/dev/ntb/ntb_hw X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 366969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 14:16:53 -0000 Author: markj Date: Fri Oct 23 14:16:52 2020 New Revision: 366969 URL: https://svnweb.freebsd.org/changeset/base/366969 Log: ntb: Add Intel Xeon Gen3 support The NTB hardware starting with Skylake has some changes to the register map and the doorbell interface. Add a new NTB_XEON_GEN3 device type and use it to conditionalize driver logic that differs from the existing Xeon code. Reviewed by: vangyzen Discussed with: cem, Bret Ketchum MFC after: 1 month Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26683 Modified: head/share/man/man4/ntb_hw_intel.4 head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c head/sys/dev/ntb/ntb_hw/ntb_hw_intel.h Modified: head/share/man/man4/ntb_hw_intel.4 ============================================================================== --- head/share/man/man4/ntb_hw_intel.4 Fri Oct 23 14:15:58 2020 (r366968) +++ head/share/man/man4/ntb_hw_intel.4 Fri Oct 23 14:16:52 2020 (r366969) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 30, 2017 +.Dd October 11, 2020 .Dt NTB_HW_INTEL 4 .Os .Sh NAME @@ -50,16 +50,18 @@ The driver provides support for the Non-Transparent Bridge (NTB) hardware in Intel Xeon E3/E5 and S1200 processor families, which allow one of their PCIe ports to be switched from transparent to non-transparent bridge mode. -In this mode bridge looks not as a PCI bridge, but as PCI endpoint device. +In this mode the bridge looks not like a PCI bridge, but like a PCI endpoint +device. The driver hides hardware details, exposing memory windows, scratchpads -and doorbells of the other side via hardware independent KPI to +and doorbells of the other side via a hardware independent KPI to the .Xr ntb 4 subsystem. .Pp The hardware provides 2 or 3 memory windows to the other system's memory, -16 scratchpad registers and 14 or 34 doorbells to interrupt the other system. -On Xeon processors one of memory windows is typically consumed by the driver -itself to workaround multiple hardware erratas. +16 scratchpad registers and 14, 31 or 34 doorbells to interrupt the other +system, depending on the platform. +On Xeon processors one of the memory windows is typically consumed by the driver +itself to work around multiple hardware errata. .Sh CONFIGURATION The NTB configuration should be set by BIOS. It includes enabling NTB, choosing between NTB-to-NTB (back-to-back) or @@ -67,9 +69,10 @@ NTB-to-Root Port mode, enabling split BAR mode (one of two 64-bit BARs can be split into two 32-bit ones) and configuring BAR sizes in bits (from 12 to 29/39) for both NTB sides. .Pp -The recommended configuration is NTB-to-NTB mode, split bar is enabled and -all BAR sizes are set to 20 (1 MiB). +The recommended configuration is NTB-to-NTB mode, split bar enabled and +all BAR sizes set to 20 (1 MiB). This needs to be done on both systems. +Note, on Xeon SkyLake and newer platforms, split bar mode is not available. .Sh SEE ALSO .Xr if_ntb 4 , .Xr ntb_transport 4 , Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Fri Oct 23 14:15:58 2020 (r366968) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Fri Oct 23 14:16:52 2020 (r366969) @@ -68,7 +68,8 @@ __FBSDID("$FreeBSD$"); #include "ntb_hw_intel.h" #include "../ntb.h" -#define MAX_MSIX_INTERRUPTS MAX(XEON_DB_COUNT, ATOM_DB_COUNT) +#define MAX_MSIX_INTERRUPTS \ + MAX(MAX(XEON_DB_COUNT, ATOM_DB_COUNT), XEON_GEN3_DB_COUNT) #define NTB_HB_TIMEOUT 1 /* second */ #define ATOM_LINK_RECOVERY_TIME 500 /* ms */ @@ -87,7 +88,8 @@ __FBSDID("$FreeBSD$"); #define PCI_MSIX_ENTRY_DATA 8 enum ntb_device_type { - NTB_XEON, + NTB_XEON_GEN1, + NTB_XEON_GEN3, NTB_ATOM }; @@ -338,6 +340,7 @@ static int map_memory_window_bar(struct ntb_softc *ntb static void intel_ntb_unmap_pci_bar(struct ntb_softc *ntb); static int intel_ntb_remap_msix(device_t, uint32_t desired, uint32_t avail); static int intel_ntb_init_isr(struct ntb_softc *ntb); +static int intel_ntb_xeon_gen3_init_isr(struct ntb_softc *ntb); static int intel_ntb_setup_legacy_interrupt(struct ntb_softc *ntb); static int intel_ntb_setup_msix(struct ntb_softc *ntb, uint32_t num_vectors); static void intel_ntb_teardown_interrupts(struct ntb_softc *ntb); @@ -355,8 +358,10 @@ static void intel_ntb_exchange_msix(void *); static struct ntb_hw_info *intel_ntb_get_device_info(uint32_t device_id); static void intel_ntb_detect_max_mw(struct ntb_softc *ntb); static int intel_ntb_detect_xeon(struct ntb_softc *ntb); +static int intel_ntb_detect_xeon_gen3(struct ntb_softc *ntb); static int intel_ntb_detect_atom(struct ntb_softc *ntb); static int intel_ntb_xeon_init_dev(struct ntb_softc *ntb); +static int intel_ntb_xeon_gen3_init_dev(struct ntb_softc *ntb); static int intel_ntb_atom_init_dev(struct ntb_softc *ntb); static void intel_ntb_teardown_xeon(struct ntb_softc *ntb); static void configure_atom_secondary_side_bars(struct ntb_softc *ntb); @@ -368,6 +373,9 @@ static void xeon_set_pbar_xlat(struct ntb_softc *, uin enum ntb_bar idx); static int xeon_setup_b2b_mw(struct ntb_softc *, const struct ntb_b2b_addr *addr, const struct ntb_b2b_addr *peer_addr); +static int xeon_gen3_setup_b2b_mw(struct ntb_softc *); +static int intel_ntb_mw_set_trans(device_t dev, unsigned idx, bus_addr_t addr, + size_t size); static inline bool link_is_up(struct ntb_softc *ntb); static inline bool _xeon_link_is_up(struct ntb_softc *ntb); static inline bool atom_link_is_err(struct ntb_softc *ntb); @@ -479,6 +487,7 @@ SYSCTL_INT(_hw_ntb, OID_AUTO, b2b_mw_idx, CTLFLAG_RDTU #define NTB_B2BDOORBELL_BIT14 (1 << 3) /* Software/configuration owns the top 16 bits. */ #define NTB_SPLIT_BAR (1ull << 16) +#define NTB_ONE_MSIX (1ull << 17) #define NTB_FEATURES_STR \ "\20\21SPLIT_BAR4\04B2B_DOORBELL_BIT14\03SB01BASE_LOCKUP" \ @@ -490,18 +499,21 @@ static struct ntb_hw_info pci_ids[] = { NTB_ATOM, 0 }, { 0x37258086, "JSF Xeon C35xx/C55xx Non-Transparent Bridge B2B", - NTB_XEON, NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 }, + NTB_XEON_GEN1, NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 }, { 0x3C0D8086, "SNB Xeon E5/Core i7 Non-Transparent Bridge B2B", - NTB_XEON, NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 }, - { 0x0E0D8086, "IVT Xeon E5 V2 Non-Transparent Bridge B2B", NTB_XEON, - NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 | + NTB_XEON_GEN1, NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 }, + { 0x0E0D8086, "IVT Xeon E5 V2 Non-Transparent Bridge B2B", + NTB_XEON_GEN1, NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 | NTB_SB01BASE_LOCKUP | NTB_BAR_SIZE_4K }, - { 0x2F0D8086, "HSX Xeon E5 V3 Non-Transparent Bridge B2B", NTB_XEON, - NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 | + { 0x2F0D8086, "HSX Xeon E5 V3 Non-Transparent Bridge B2B", + NTB_XEON_GEN1, NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 | NTB_SB01BASE_LOCKUP }, - { 0x6F0D8086, "BDX Xeon E5 V4 Non-Transparent Bridge B2B", NTB_XEON, - NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 | + { 0x6F0D8086, "BDX Xeon E5 V4 Non-Transparent Bridge B2B", + NTB_XEON_GEN1, NTB_SDOORBELL_LOCKUP | NTB_B2BDOORBELL_BIT14 | NTB_SB01BASE_LOCKUP }, + + { 0x201C8086, "SKL Xeon E5 V5 Non-Transparent Bridge B2B", + NTB_XEON_GEN3, 0 }, }; static const struct ntb_reg atom_reg = { @@ -586,6 +598,37 @@ static struct ntb_b2b_addr xeon_b2b_dsd_addr = { .bar5_addr32 = XEON_B2B_BAR5_ADDR32, }; +static const struct ntb_reg xeon_gen3_reg = { + .ntb_ctl = XEON_GEN3_REG_IMNTB_CTRL, + .lnk_sta = XEON_GEN3_INT_LNK_STS_OFFSET, + .db_size = sizeof(uint32_t), + .mw_bar = { NTB_B2B_BAR_1, NTB_B2B_BAR_2 }, +}; + +static const struct ntb_alt_reg xeon_gen3_pri_reg = { + .db_bell = XEON_GEN3_REG_EMDOORBELL, + .db_mask = XEON_GEN3_REG_IMINT_DISABLE, + .spad = XEON_GEN3_REG_IMSPAD, +}; + +static const struct ntb_alt_reg xeon_gen3_b2b_reg = { + .db_bell = XEON_GEN3_REG_IMDOORBELL, + .db_mask = XEON_GEN3_REG_EMINT_DISABLE, + .spad = XEON_GEN3_REG_IMB2B_SSPAD, +}; + +static const struct ntb_xlat_reg xeon_gen3_sec_xlat = { + .bar0_base = XEON_GEN3_EXT_REG_BAR0BASE, + .bar2_base = XEON_GEN3_EXT_REG_BAR1BASE, + .bar4_base = XEON_GEN3_EXT_REG_BAR2BASE, + + .bar2_limit = XEON_GEN3_REG_IMBAR1XLIMIT, + .bar4_limit = XEON_GEN3_REG_IMBAR2XLIMIT, + + .bar2_xlat = XEON_GEN3_REG_IMBAR1XBASE, + .bar4_xlat = XEON_GEN3_REG_IMBAR2XBASE, +}; + SYSCTL_NODE(_hw_ntb, OID_AUTO, xeon_b2b, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "B2B MW segment overrides -- MUST be the same on both sides"); @@ -662,6 +705,8 @@ intel_ntb_attach(device_t device) if (ntb->type == NTB_ATOM) error = intel_ntb_detect_atom(ntb); + else if (ntb->type == NTB_XEON_GEN3) + error = intel_ntb_detect_xeon_gen3(ntb); else error = intel_ntb_detect_xeon(ntb); if (error != 0) @@ -676,6 +721,8 @@ intel_ntb_attach(device_t device) goto out; if (ntb->type == NTB_ATOM) error = intel_ntb_atom_init_dev(ntb); + else if (ntb->type == NTB_XEON_GEN3) + error = intel_ntb_xeon_gen3_init_dev(ntb); else error = intel_ntb_xeon_init_dev(ntb); if (error != 0) @@ -715,7 +762,7 @@ intel_ntb_detach(device_t device) callout_drain(&ntb->lr_timer); callout_drain(&ntb->peer_msix_work); pci_disable_busmaster(ntb->device); - if (ntb->type == NTB_XEON) + if (ntb->type == NTB_XEON_GEN1) intel_ntb_teardown_xeon(ntb); intel_ntb_teardown_interrupts(ntb); @@ -825,22 +872,39 @@ intel_ntb_map_pci_bars(struct ntb_softc *ntb) rc = map_memory_window_bar(ntb, bar); if (rc != 0) goto out; - bar->psz_off = XEON_PBAR23SZ_OFFSET; - bar->ssz_off = XEON_SBAR23SZ_OFFSET; - bar->pbarxlat_off = XEON_PBAR2XLAT_OFFSET; + if (ntb->type == NTB_XEON_GEN3) { + bar->psz_off = XEON_GEN3_INT_REG_IMBAR1SZ; + bar->ssz_off = XEON_GEN3_INT_REG_EMBAR1SZ; + bar->pbarxlat_off = XEON_GEN3_REG_EMBAR1XBASE; + } else { + bar->psz_off = XEON_PBAR23SZ_OFFSET; + bar->ssz_off = XEON_SBAR23SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR2XLAT_OFFSET; + } bar = &ntb->bar_info[NTB_B2B_BAR_2]; bar->pci_resource_id = PCIR_BAR(4); rc = map_memory_window_bar(ntb, bar); if (rc != 0) goto out; - bar->psz_off = XEON_PBAR4SZ_OFFSET; - bar->ssz_off = XEON_SBAR4SZ_OFFSET; - bar->pbarxlat_off = XEON_PBAR4XLAT_OFFSET; + if (ntb->type == NTB_XEON_GEN3) { + bar->psz_off = XEON_GEN3_INT_REG_IMBAR2SZ; + bar->ssz_off = XEON_GEN3_INT_REG_EMBAR2SZ; + bar->pbarxlat_off = XEON_GEN3_REG_EMBAR2XBASE; + } else { + bar->psz_off = XEON_PBAR4SZ_OFFSET; + bar->ssz_off = XEON_SBAR4SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR4XLAT_OFFSET; + } if (!HAS_FEATURE(ntb, NTB_SPLIT_BAR)) goto out; + if (ntb->type == NTB_XEON_GEN3) { + device_printf(ntb->device, "no split bar support\n"); + return (ENXIO); + } + bar = &ntb->bar_info[NTB_B2B_BAR_3]; bar->pci_resource_id = PCIR_BAR(5); rc = map_memory_window_bar(ntb, bar); @@ -1060,6 +1124,63 @@ intel_ntb_remap_msix(device_t dev, uint32_t desired, u } static int +intel_ntb_xeon_gen3_init_isr(struct ntb_softc *ntb) +{ + uint64_t i, reg; + uint32_t desired_vectors, num_vectors; + int rc; + + ntb->allocated_interrupts = 0; + ntb->last_ts = ticks; + + /* Mask all the interrupts, including hardware interrupt */ + intel_ntb_reg_write(8, XEON_GEN3_REG_IMINT_DISABLE, ~0ULL); + + /* Clear Interrupt Status */ + reg = intel_ntb_reg_read(8, XEON_GEN3_REG_IMINT_STATUS); + intel_ntb_reg_write(8, XEON_GEN3_REG_IMINT_STATUS, reg); + + num_vectors = desired_vectors = MIN(pci_msix_count(ntb->device), + XEON_GEN3_DB_MSIX_VECTOR_COUNT); + + rc = pci_alloc_msix(ntb->device, &num_vectors); + if (rc != 0) { + device_printf(ntb->device, + "Interrupt allocation failed %d\n", rc); + return (rc); + } + if (desired_vectors != num_vectors) { + device_printf(ntb->device, "Couldn't get %d vectors\n", + XEON_GEN3_DB_MSIX_VECTOR_COUNT); + return (ENXIO); + } + /* 32 db + 1 hardware */ + if (num_vectors == XEON_GEN3_DB_MSIX_VECTOR_COUNT) { + /* Program INTVECXX source register */ + for (i = 0; i < XEON_GEN3_DB_MSIX_VECTOR_COUNT; i++) { + /* interrupt source i for vector i */ + intel_ntb_reg_write(1, XEON_GEN3_REG_IMINTVEC00 + i, i); + if (i == (XEON_GEN3_DB_MSIX_VECTOR_COUNT - 1)) { + intel_ntb_reg_write(1, + XEON_GEN3_REG_IMINTVEC00 + i, + XEON_GEN3_LINK_VECTOR_INDEX); + } + } + + intel_ntb_create_msix_vec(ntb, num_vectors); + rc = intel_ntb_setup_msix(ntb, num_vectors); + + /* enable all interrupts */ + intel_ntb_reg_write(8, XEON_GEN3_REG_IMINT_DISABLE, 0ULL); + } else { + device_printf(ntb->device, "need to remap interrupts, giving up.\n"); + return (ENXIO); + } + + return (0); +} + +static int intel_ntb_init_isr(struct ntb_softc *ntb) { uint32_t desired_vectors, num_vectors; @@ -1098,7 +1219,7 @@ intel_ntb_init_isr(struct ntb_softc *ntb) } else num_vectors = 1; - if (ntb->type == NTB_XEON && num_vectors < ntb->db_vec_count) { + if (ntb->type == NTB_XEON_GEN1 && num_vectors < ntb->db_vec_count) { if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP)) { device_printf(ntb->device, "Errata workaround does not support MSI or INTX\n"); @@ -1177,20 +1298,17 @@ intel_ntb_teardown_interrupts(struct ntb_softc *ntb) pci_release_msi(ntb->device); } -/* - * Doorbell register and mask are 64-bit on Atom, 16-bit on Xeon. Abstract it - * out to make code clearer. - */ static inline uint64_t db_ioread(struct ntb_softc *ntb, uint64_t regoff) { - if (ntb->type == NTB_ATOM) + switch (ntb->type) { + case NTB_ATOM: + case NTB_XEON_GEN3: return (intel_ntb_reg_read(8, regoff)); - - KASSERT(ntb->type == NTB_XEON, ("bad ntb type")); - - return (intel_ntb_reg_read(2, regoff)); + case NTB_XEON_GEN1: + return (intel_ntb_reg_read(2, regoff)); + } } static inline void @@ -1211,13 +1329,15 @@ static inline void db_iowrite_raw(struct ntb_softc *ntb, uint64_t regoff, uint64_t val) { - if (ntb->type == NTB_ATOM) { + switch (ntb->type) { + case NTB_ATOM: + case NTB_XEON_GEN3: intel_ntb_reg_write(8, regoff, val); - return; + break; + case NTB_XEON_GEN1: + intel_ntb_reg_write(2, regoff, (uint16_t)val); + break; } - - KASSERT(ntb->type == NTB_XEON, ("bad ntb type")); - intel_ntb_reg_write(2, regoff, (uint16_t)val); } static void @@ -1267,8 +1387,10 @@ intel_ntb_db_read(device_t dev) if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP)) return (ntb->fake_db); - - return (db_ioread(ntb, ntb->self_reg->db_bell)); + if (ntb->type == NTB_XEON_GEN3) + return (intel_ntb_reg_read(8, XEON_GEN3_REG_IMINT_STATUS)); + else + return (db_ioread(ntb, ntb->self_reg->db_bell)); } static void @@ -1288,7 +1410,11 @@ intel_ntb_db_clear(device_t dev, uint64_t bits) return; } - db_iowrite(ntb, ntb->self_reg->db_bell, bits); + if (ntb->type == NTB_XEON_GEN3) + intel_ntb_reg_write(4, XEON_GEN3_REG_IMINT_STATUS, + (uint32_t)bits); + else + db_iowrite(ntb, ntb->self_reg->db_bell, bits); } static inline uint64_t @@ -1322,9 +1448,14 @@ intel_ntb_interrupt(struct ntb_softc *ntb, uint32_t ve ntb->last_ts = ticks; vec_mask = intel_ntb_vec_mask(ntb, vec); + if (ntb->type == NTB_XEON_GEN3 && vec == XEON_GEN3_LINK_VECTOR_INDEX) + vec_mask |= ntb->db_link_mask; if ((vec_mask & ntb->db_link_mask) != 0) { if (intel_ntb_poll_link(ntb)) ntb_link_event(ntb->device); + if (ntb->type == NTB_XEON_GEN3) + intel_ntb_reg_write(8, XEON_GEN3_REG_IMINT_STATUS, + intel_ntb_reg_read(8, XEON_GEN3_REG_IMINT_STATUS)); } if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP) && @@ -1449,15 +1580,23 @@ static void intel_ntb_detect_max_mw(struct ntb_softc *ntb) { - if (ntb->type == NTB_ATOM) { + switch (ntb->type) { + case NTB_ATOM: ntb->mw_count = ATOM_MW_COUNT; - return; + break; + case NTB_XEON_GEN1: + if (HAS_FEATURE(ntb, NTB_SPLIT_BAR)) + ntb->mw_count = XEON_HSX_SPLIT_MW_COUNT; + else + ntb->mw_count = XEON_SNB_MW_COUNT; + break; + case NTB_XEON_GEN3: + if (HAS_FEATURE(ntb, NTB_SPLIT_BAR)) + ntb->mw_count = XEON_GEN3_SPLIT_MW_COUNT; + else + ntb->mw_count = XEON_GEN3_MW_COUNT; + break; } - - if (HAS_FEATURE(ntb, NTB_SPLIT_BAR)) - ntb->mw_count = XEON_HSX_SPLIT_MW_COUNT; - else - ntb->mw_count = XEON_SNB_MW_COUNT; } static int @@ -1534,6 +1673,54 @@ intel_ntb_detect_atom(struct ntb_softc *ntb) } static int +intel_ntb_detect_xeon_gen3(struct ntb_softc *ntb) +{ + uint8_t ppd, conn_type; + + ppd = pci_read_config(ntb->device, XEON_GEN3_INT_REG_PPD, 1); + ntb->ppd = ppd; + + /* check port definition */ + conn_type = XEON_GEN3_REG_PPD_PORT_DEF_F(ppd); + switch (conn_type) { + case NTB_CONN_B2B: + ntb->conn_type = conn_type; + break; + default: + device_printf(ntb->device, "Unsupported connection type: %u\n", + conn_type); + return (ENXIO); + } + + /* check cross link configuration status */ + if (XEON_GEN3_REG_PPD_CONF_STS_F(ppd)) { + /* NTB Port is configured as DSD/USP */ + ntb->dev_type = NTB_DEV_DSD; + } else { + /* NTB Port is configured as USD/DSP */ + ntb->dev_type = NTB_DEV_USD; + } + + if (XEON_GEN3_REG_PPD_ONE_MSIX_F(ppd)) { + /* + * This bit when set, causes only a single MSI-X message to be + * generated if MSI-X is enabled. + */ + ntb->features |= NTB_ONE_MSIX; + } + + if (XEON_GEN3_REG_PPD_BAR45_SPL_F(ppd)) { + /* BARs 4 and 5 are presented as two 32b non-prefetchable BARs */ + ntb->features |= NTB_SPLIT_BAR; + } + + device_printf(ntb->device, "conn type 0x%02x, dev type 0x%02x," + "features 0x%02x\n", ntb->conn_type, ntb->dev_type, ntb->features); + + return (0); +} + +static int intel_ntb_xeon_init_dev(struct ntb_softc *ntb) { int rc; @@ -1618,6 +1805,42 @@ intel_ntb_xeon_init_dev(struct ntb_softc *ntb) } static int +intel_ntb_xeon_gen3_init_dev(struct ntb_softc *ntb) +{ + int rc; + + ntb->spad_count = XEON_GEN3_SPAD_COUNT; + ntb->db_count = XEON_GEN3_DB_COUNT; + ntb->db_link_mask = XEON_GEN3_DB_LINK_BIT; + ntb->db_vec_count = XEON_GEN3_DB_MSIX_VECTOR_COUNT; + ntb->db_vec_shift = XEON_GEN3_DB_MSIX_VECTOR_SHIFT; + + if (ntb->conn_type != NTB_CONN_B2B) { + device_printf(ntb->device, "Connection type %d not supported\n", + ntb->conn_type); + return (ENXIO); + } + + ntb->reg = &xeon_gen3_reg; + ntb->self_reg = &xeon_gen3_pri_reg; + ntb->peer_reg = &xeon_gen3_b2b_reg; + ntb->xlat_reg = &xeon_gen3_sec_xlat; + + ntb->db_valid_mask = (1ULL << ntb->db_count) - 1; + + xeon_gen3_setup_b2b_mw(ntb); + + /* Enable Bus Master and Memory Space on the External Side */ + intel_ntb_reg_write(2, XEON_GEN3_EXT_REG_PCI_CMD, + PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN); + + /* Setup Interrupt */ + rc = intel_ntb_xeon_gen3_init_isr(ntb); + + return (rc); +} + +static int intel_ntb_atom_init_dev(struct ntb_softc *ntb) { int error; @@ -1908,6 +2131,50 @@ xeon_setup_b2b_mw(struct ntb_softc *ntb, const struct return (0); } +static int +xeon_gen3_setup_b2b_mw(struct ntb_softc *ntb) +{ + uint64_t reg; + uint32_t embarsz, imbarsz; + + /* IMBAR1SZ should be equal to EMBAR1SZ */ + embarsz = pci_read_config(ntb->device, XEON_GEN3_INT_REG_EMBAR1SZ, 1); + imbarsz = pci_read_config(ntb->device, XEON_GEN3_INT_REG_IMBAR1SZ, 1); + if (embarsz != imbarsz) { + device_printf(ntb->device, + "IMBAR1SZ (%u) should be equal to EMBAR1SZ (%u)\n", + imbarsz, embarsz); + return (EIO); + } + + /* IMBAR2SZ should be equal to EMBAR2SZ */ + embarsz = pci_read_config(ntb->device, XEON_GEN3_INT_REG_EMBAR2SZ, 1); + imbarsz = pci_read_config(ntb->device, XEON_GEN3_INT_REG_IMBAR2SZ, 1); + if (embarsz != imbarsz) { + device_printf(ntb->device, + "IMBAR2SZ (%u) should be equal to EMBAR2SZ (%u)\n", + imbarsz, embarsz); + return (EIO); + } + + /* Client will provide the incoming IMBAR1/2XBASE, zero it for now */ + intel_ntb_reg_write(8, XEON_GEN3_REG_IMBAR1XBASE, 0); + intel_ntb_reg_write(8, XEON_GEN3_REG_IMBAR2XBASE, 0); + + /* + * If the value in EMBAR1LIMIT is set equal to the value in EMBAR1, + * the memory window for EMBAR1 is disabled. + * Note: It is needed to avoid malacious access. + */ + reg = pci_read_config(ntb->device, XEON_GEN3_EXT_REG_BAR1BASE, 8); + intel_ntb_reg_write(8, XEON_GEN3_REG_IMBAR1XLIMIT, reg); + + reg = pci_read_config(ntb->device, XEON_GEN3_EXT_REG_BAR2BASE, 8); + intel_ntb_reg_write(8, XEON_GEN3_REG_IMBAR2XLIMIT, reg); + + return (0); +} + static inline bool _xeon_link_is_up(struct ntb_softc *ntb) { @@ -1921,7 +2188,7 @@ static inline bool link_is_up(struct ntb_softc *ntb) { - if (ntb->type == NTB_XEON) + if (ntb->type == NTB_XEON_GEN1 || ntb->type == NTB_XEON_GEN3) return (_xeon_link_is_up(ntb) && (ntb->peer_msix_good || !HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP))); @@ -2185,7 +2452,9 @@ intel_ntb_poll_link(struct ntb_softc *ntb) ntb->ntb_ctl = ntb_cntl; ntb->lnk_sta = intel_ntb_reg_read(4, ntb->reg->lnk_sta); } else { - db_iowrite_raw(ntb, ntb->self_reg->db_bell, ntb->db_link_mask); + if (ntb->type == NTB_XEON_GEN1) + db_iowrite_raw(ntb, ntb->self_reg->db_bell, + ntb->db_link_mask); reg_val = pci_read_config(ntb->device, ntb->reg->lnk_sta, 2); if (reg_val == ntb->lnk_sta) @@ -2960,6 +3229,8 @@ intel_ntb_mw_set_trans(device_t dev, unsigned idx, bus if (limit_reg != 0 && size != mw_size) limit = base + size; + else + limit = base + mw_size; /* Set and verify translation address */ intel_ntb_reg_write(8, xlat_reg, addr); @@ -2977,8 +3248,22 @@ intel_ntb_mw_set_trans(device_t dev, unsigned idx, bus intel_ntb_reg_write(8, xlat_reg, 0); return (EIO); } + + if (ntb->type == NTB_XEON_GEN3) { + limit = base + size; + + /* set EMBAR1/2XLIMIT */ + if (!idx) + intel_ntb_reg_write(8, + XEON_GEN3_REG_EMBAR1XLIMIT, limit); + else + intel_ntb_reg_write(8, + XEON_GEN3_REG_EMBAR2XLIMIT, limit); + } } else { /* Configure 32-bit (split) BAR MW */ + if (ntb->type == NTB_XEON_GEN3) + return (EIO); if ((addr & UINT32_MAX) != addr) return (ERANGE); @@ -3062,10 +3347,16 @@ intel_ntb_mw_set_wc_internal(struct ntb_softc *ntb, un } static void -intel_ntb_peer_db_set(device_t dev, uint64_t bit) +intel_ntb_peer_db_set(device_t dev, uint64_t bits) { struct ntb_softc *ntb = device_get_softc(dev); + uint64_t db; + if ((bits & ~ntb->db_valid_mask) != 0) { + device_printf(ntb->device, "Invalid doorbell bits %lx\n", bits); + return; + } + if (HAS_FEATURE(ntb, NTB_SB01BASE_LOCKUP)) { struct ntb_pci_bar_info *lapic; unsigned i; @@ -3073,7 +3364,7 @@ intel_ntb_peer_db_set(device_t dev, uint64_t bit) lapic = ntb->peer_lapic_bar; for (i = 0; i < XEON_NONLINK_DB_MSIX_BITS; i++) { - if ((bit & intel_ntb_db_vector_mask(dev, i)) != 0) + if ((bits & intel_ntb_db_vector_mask(dev, i)) != 0) bus_space_write_4(lapic->pci_bus_tag, lapic->pci_bus_handle, ntb->peer_msix_data[i].nmd_ofs, @@ -3083,11 +3374,22 @@ intel_ntb_peer_db_set(device_t dev, uint64_t bit) } if (HAS_FEATURE(ntb, NTB_SDOORBELL_LOCKUP)) { - intel_ntb_mw_write(2, XEON_PDOORBELL_OFFSET, bit); + intel_ntb_mw_write(2, XEON_PDOORBELL_OFFSET, bits); return; } - db_iowrite(ntb, ntb->peer_reg->db_bell, bit); + if (ntb->type == NTB_XEON_GEN3) { + while (bits != 0) { + db = ffsll(bits); + + intel_ntb_reg_write(1, + ntb->peer_reg->db_bell + (db - 1) * 4, 0x1); + + bits = bits & (bits - 1); + } + } else { + db_iowrite(ntb, ntb->peer_reg->db_bell, bits); + } } static int Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.h ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_intel.h Fri Oct 23 14:15:58 2020 (r366968) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_intel.h Fri Oct 23 14:16:52 2020 (r366969) @@ -30,7 +30,26 @@ #ifndef _NTB_REGS_H_ #define _NTB_REGS_H_ +#include +#include +/*--------------------------------------------------------------------------- + * Macro: M*_M : Create a mask to isolate a bit field of a data word. + * M*_F : Extract value from a bit field of a data word. + * M*_I : Insert value into a bit field of a data word. + * + * Purpose: Bit field manipulation macros for mask, insert and extract for + * 8-bit, 16-bit, 32-bit and 64-bit data words. + * + * Params: [in] P = Bit position of start of the bit field (lsb is 0). + * [in] N = Size of the bit field in bits. + * [in] X = Value to insert or remove from the bit field. + *--------------------------------------------------------------------------- + */ +#define M8_M(P, N) ((UINT8_MAX >> (8 - (N))) << (P)) +#define M8_F(X, P, N) (((uint8_t)(X) & M8_M(P, N)) >> (P)) +#define M8_I(X, P, N) (((uint8_t)(X) << (P)) & M8_M(P, N)) + #define NTB_LINK_STATUS_ACTIVE 0x2000 #define NTB_LINK_SPEED_MASK 0x000f #define NTB_LINK_WIDTH_MASK 0x03f0 @@ -164,5 +183,73 @@ /* The peer ntb secondary config space is 32KB fixed size */ #define XEON_B2B_MIN_SIZE 0x8000 +#define XEON_GEN3_MW_COUNT 2 +#define XEON_GEN3_SPLIT_MW_COUNT 3 +#define XEON_GEN3_SPAD_COUNT 16 +#define XEON_GEN3_DB_COUNT 32 +#define XEON_GEN3_DB_LINK 32 +#define XEON_GEN3_DB_LINK_BIT (1ULL << XEON_GEN3_DB_LINK) +#define XEON_GEN3_DB_MSIX_VECTOR_COUNT 33 +#define XEON_GEN3_DB_MSIX_VECTOR_SHIFT 1 + +#define XEON_GEN3_LINK_VECTOR_INDEX 31 + +/* Xeon Skylake NTB register definitions */ + +/* + * Internal EndPoint Configuration Registers + */ +#define XEON_GEN3_INT_REG_BAR0BASE 0x10 +#define XEON_GEN3_INT_REG_BAR1BASE 0x18 +#define XEON_GEN3_INT_REG_BAR2BASE 0x20 +#define XEON_GEN3_INT_REG_IMBAR1SZ 0xd0 +#define XEON_GEN3_INT_REG_IMBAR2SZ 0xd1 +#define XEON_GEN3_INT_REG_EMBAR1SZ 0xd2 +#define XEON_GEN3_INT_REG_EMBAR2SZ 0xd3 +#define XEON_GEN3_INT_REG_PPD 0xd4 +#define XEON_GEN3_INT_LNK_STS_OFFSET 0x01a2 + +/* + * External EndPoint Configuration Registers + * These are located within BAR0 of the internal endpoint. + */ +#define XEON_GEN3_EXT_REG_PCI_CMD 0x4504 +#define XEON_GEN3_EXT_REG_BAR0BASE 0x4510 +#define XEON_GEN3_EXT_REG_BAR1BASE 0x4518 +#define XEON_GEN3_EXT_REG_BAR2BASE 0x4520 + +/* + * Internal Endpoint Memory Mapped Registers + */ +#define XEON_GEN3_REG_IMNTB_CTRL 0x0000 +#define XEON_GEN3_REG_IMBAR1XBASE 0x0010 +#define XEON_GEN3_REG_IMBAR1XLIMIT 0x0018 +#define XEON_GEN3_REG_IMBAR2XBASE 0x0020 +#define XEON_GEN3_REG_IMBAR2XLIMIT 0x0028 +#define XEON_GEN3_REG_IMINT_STATUS 0x0040 +#define XEON_GEN3_REG_IMINT_DISABLE 0x0048 +#define XEON_GEN3_REG_IMSPAD 0x0080 +#define XEON_GEN3_REG_IMINTVEC00 0x00d0 +#define XEON_GEN3_REG_IMDOORBELL 0x0100 +#define XEON_GEN3_REG_IMB2B_SSPAD 0x0180 /* Pseudo SP registers */ + +/* + * External Endpoint Memory Mapped Registers + */ +#define XEON_GEN3_REG_EMBAR0XBASE 0x4008 +#define XEON_GEN3_REG_EMBAR1XBASE 0x4010 +#define XEON_GEN3_REG_EMBAR1XLIMIT 0x4018 +#define XEON_GEN3_REG_EMBAR2XBASE 0x4020 +#define XEON_GEN3_REG_EMBAR2XLIMIT 0x4028 +#define XEON_GEN3_REG_EMINT_STATUS 0x4040 +#define XEON_GEN3_REG_EMINT_DISABLE 0x4048 +#define XEON_GEN3_REG_EMSPAD 0x4080 +#define XEON_GEN3_REG_EMDOORBELL 0x4100 + +/* XEON_GEN3_INT_REG_PPD: PPD register */ +#define XEON_GEN3_REG_PPD_PORT_DEF_F(X) M8_F(X, 0, 2) +#define XEON_GEN3_REG_PPD_CONF_STS_F(X) M8_F(X, 4, 1) +#define XEON_GEN3_REG_PPD_ONE_MSIX_F(X) M8_F(X, 5, 1) +#define XEON_GEN3_REG_PPD_BAR45_SPL_F(X) M8_F(X, 6, 1) #endif /* _NTB_REGS_H_ */ From owner-svn-src-head@freebsd.org Fri Oct 23 14:25:49 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23B36447B4C; Fri, 23 Oct 2020 14:25:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHmjn0655z4CBG; Fri, 23 Oct 2020 14:25:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6A618AC9; Fri, 23 Oct 2020 14:25:48 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NEPmkV025146; Fri, 23 Oct 2020 14:25:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NEPmoT025145; Fri, 23 Oct 2020 14:25:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202010231425.09NEPmoT025145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 23 Oct 2020 14:25:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366970 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 366970 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 14:25:49 -0000 Author: markj Date: Fri Oct 23 14:25:48 2020 New Revision: 366970 URL: https://svnweb.freebsd.org/changeset/base/366970 Log: Add some missing nv(9) MLINKS MFC after: 1 week Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Fri Oct 23 14:16:52 2020 (r366969) +++ head/share/man/man9/Makefile Fri Oct 23 14:25:48 2020 (r366970) @@ -1563,6 +1563,11 @@ MLINKS+=nv.9 libnv.9 \ nv.9 nvlist_add_stringf.9 \ nv.9 nvlist_add_stringv.9 \ nv.9 nvlist_add_string_array.9 \ + nv.9 nvlist_append_bool_array.9 \ + nv.9 nvlist_append_descriptor_array.9 \ + nv.9 nvlist_append_nvlist_array.9 \ + nv.9 nvlist_append_number_array.9 \ + nv.9 nvlist_append_string_array.9 \ nv.9 nvlist_clone.9 \ nv.9 nvlist_create.9 \ nv.9 nvlist_destroy.9 \ From owner-svn-src-head@freebsd.org Fri Oct 23 14:56:18 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CF274482BB; Fri, 23 Oct 2020 14:56:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHnNy1W7Cz4Djm; Fri, 23 Oct 2020 14:56:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12B8D938A; Fri, 23 Oct 2020 14:56:18 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NEuHYZ043347; Fri, 23 Oct 2020 14:56:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NEuHZE043346; Fri, 23 Oct 2020 14:56:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202010231456.09NEuHZE043346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 23 Oct 2020 14:56:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366972 - head/usr.sbin/rtsold X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.sbin/rtsold X-SVN-Commit-Revision: 366972 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 14:56:18 -0000 Author: markj Date: Fri Oct 23 14:56:17 2020 New Revision: 366972 URL: https://svnweb.freebsd.org/changeset/base/366972 Log: rtsold: Remove an incorrect __unused annotation MFC after: 1 week Modified: head/usr.sbin/rtsold/cap_script.c Modified: head/usr.sbin/rtsold/cap_script.c ============================================================================== --- head/usr.sbin/rtsold/cap_script.c Fri Oct 23 14:47:32 2020 (r366971) +++ head/usr.sbin/rtsold/cap_script.c Fri Oct 23 14:56:17 2020 (r366972) @@ -207,7 +207,7 @@ script_command(const char *cmd, const nvlist_t *limits } static int -script_limit(const nvlist_t *oldlimits, const nvlist_t *newlimits __unused) +script_limit(const nvlist_t *oldlimits, const nvlist_t *newlimits) { const char *name; void *cookie; From owner-svn-src-head@freebsd.org Fri Oct 23 15:12:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0587B448930; Fri, 23 Oct 2020 15:12:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHnlB6R75z4FWR; Fri, 23 Oct 2020 15:12:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C01D0979B; Fri, 23 Oct 2020 15:12:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NFC6tR055170; Fri, 23 Oct 2020 15:12:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NFC6GT055169; Fri, 23 Oct 2020 15:12:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202010231512.09NFC6GT055169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 23 Oct 2020 15:12:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366973 - head/sys/dev/ntb/ntb_hw X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 366973 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 15:12:07 -0000 Author: markj Date: Fri Oct 23 15:12:06 2020 New Revision: 366973 URL: https://svnweb.freebsd.org/changeset/base/366973 Log: ntb: Fix the 32-bit build after r366969 Reported by: Jenkins MFC with: r366969 Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Fri Oct 23 14:56:17 2020 (r366972) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Fri Oct 23 15:12:06 2020 (r366973) @@ -3353,7 +3353,8 @@ intel_ntb_peer_db_set(device_t dev, uint64_t bits) uint64_t db; if ((bits & ~ntb->db_valid_mask) != 0) { - device_printf(ntb->device, "Invalid doorbell bits %lx\n", bits); + device_printf(ntb->device, "Invalid doorbell bits %#jx\n", + (uintmax_t)bits); return; } From owner-svn-src-head@freebsd.org Fri Oct 23 15:49:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 185944491F1; Fri, 23 Oct 2020 15:49:19 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHpZ66lW8z4HCh; Fri, 23 Oct 2020 15:49:18 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC0AB9D16; Fri, 23 Oct 2020 15:49:18 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NFnIDP073711; Fri, 23 Oct 2020 15:49:18 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NFnIg4073710; Fri, 23 Oct 2020 15:49:18 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010231549.09NFnIg4073710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 23 Oct 2020 15:49:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366974 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 15:49:19 -0000 Author: mjg Date: Fri Oct 23 15:49:18 2020 New Revision: 366974 URL: https://svnweb.freebsd.org/changeset/base/366974 Log: vfs: stop taking the interlock in vnode reclaim It no longer protects any of tested fields, keeping all the checks racy. While here make vtryrecycle drop the vnode on its own. Avoids an additional lock trip. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Fri Oct 23 15:12:06 2020 (r366973) +++ head/sys/kern/vfs_subr.c Fri Oct 23 15:49:18 2020 (r366974) @@ -1121,24 +1121,12 @@ restart: if (vp->v_type == VBAD || vp->v_type == VNON) goto next_iter; - if (!VI_TRYLOCK(vp)) - goto next_iter; - - if (vp->v_usecount > 0 || vp->v_holdcnt == 0 || - (!reclaim_nc_src && !LIST_EMPTY(&vp->v_cache_src)) || - VN_IS_DOOMED(vp) || vp->v_type == VNON) { - VI_UNLOCK(vp); - goto next_iter; - } - object = atomic_load_ptr(&vp->v_object); if (object == NULL || object->resident_page_count > trigger) { - VI_UNLOCK(vp); goto next_iter; } - vholdl(vp); - VI_UNLOCK(vp); + vhold(vp); TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); TAILQ_INSERT_AFTER(&vnode_list, vp, mvp, v_vnodelist); mtx_unlock(&vnode_list_mtx); @@ -1235,21 +1223,18 @@ restart: * blocking. */ if (vp->v_holdcnt > 0 || (mnt_op != NULL && (mp = vp->v_mount) != NULL && - mp->mnt_op != mnt_op) || !VI_TRYLOCK(vp)) { + mp->mnt_op != mnt_op)) { continue; } TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); TAILQ_INSERT_AFTER(&vnode_list, vp, mvp, v_vnodelist); if (__predict_false(vp->v_type == VBAD || vp->v_type == VNON)) { - VI_UNLOCK(vp); continue; } - vholdl(vp); + vhold(vp); count--; mtx_unlock(&vnode_list_mtx); - VI_UNLOCK(vp); vtryrecycle(vp); - vdrop(vp); mtx_lock(&vnode_list_mtx); goto restart; } @@ -1520,6 +1505,7 @@ vtryrecycle(struct vnode *vp) CTR2(KTR_VFS, "%s: impossible to recycle, vp %p lock is already held", __func__, vp); + vdrop(vp); return (EWOULDBLOCK); } /* @@ -1530,6 +1516,7 @@ vtryrecycle(struct vnode *vp) CTR2(KTR_VFS, "%s: impossible to recycle, cannot start the write for %p", __func__, vp); + vdrop(vp); return (EBUSY); } /* @@ -1541,7 +1528,7 @@ vtryrecycle(struct vnode *vp) VI_LOCK(vp); if (vp->v_usecount) { VOP_UNLOCK(vp); - VI_UNLOCK(vp); + vdropl(vp); vn_finished_write(vnmp); CTR2(KTR_VFS, "%s: impossible to recycle, %p is already referenced", @@ -1553,7 +1540,7 @@ vtryrecycle(struct vnode *vp) vgonel(vp); } VOP_UNLOCK(vp); - VI_UNLOCK(vp); + vdropl(vp); vn_finished_write(vnmp); return (0); } From owner-svn-src-head@freebsd.org Fri Oct 23 15:50:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B5B944943A; Fri, 23 Oct 2020 15:50:50 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHpbt1skjz4HPC; Fri, 23 Oct 2020 15:50:50 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23AE09D19; Fri, 23 Oct 2020 15:50:50 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NFoool073861; Fri, 23 Oct 2020 15:50:50 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NFonDx073858; Fri, 23 Oct 2020 15:50:49 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010231550.09NFonDx073858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 23 Oct 2020 15:50:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366975 - in head/sys: contrib/openzfs/module/os/freebsd/zfs fs/tmpfs ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: contrib/openzfs/module/os/freebsd/zfs fs/tmpfs ufs/ufs X-SVN-Commit-Revision: 366975 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 15:50:50 -0000 Author: mjg Date: Fri Oct 23 15:50:49 2020 New Revision: 366975 URL: https://svnweb.freebsd.org/changeset/base/366975 Log: vfs: drop spurious cache_purge on rmdir The removed directory gets cache_purged which is sufficient to remove any entries related to the parent. Note only tmpfs, ufs and zfs are patched. Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Fri Oct 23 15:49:18 2020 (r366974) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Fri Oct 23 15:50:49 2020 (r366975) @@ -2332,8 +2332,6 @@ zfs_rmdir_(vnode_t *dvp, vnode_t *vp, const char *name return (error); } - cache_purge(dvp); - error = zfs_link_destroy(dzp, name, zp, tx, ZEXISTS, NULL); if (error == 0) { Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Fri Oct 23 15:49:18 2020 (r366974) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Fri Oct 23 15:50:49 2020 (r366975) @@ -1331,7 +1331,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v) TMPFS_NODE_UNLOCK(dnode); if (tmpfs_use_nc(dvp)) { - cache_purge(dvp); cache_purge(vp); } Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Fri Oct 23 15:49:18 2020 (r366974) +++ head/sys/ufs/ufs/ufs_vnops.c Fri Oct 23 15:50:49 2020 (r366975) @@ -2204,7 +2204,6 @@ ufs_rmdir(ap) softdep_revert_rmdir(dp, ip); goto out; } - cache_purge(dvp); /* * The only stuff left in the directory is "." and "..". The "." * reference is inconsequential since we are quashing it. The soft From owner-svn-src-head@freebsd.org Fri Oct 23 15:56:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A98054494BB; Fri, 23 Oct 2020 15:56:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHpkG43S4z4HSZ; Fri, 23 Oct 2020 15:56:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E9059E66; Fri, 23 Oct 2020 15:56:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NFuMrD079617; Fri, 23 Oct 2020 15:56:22 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NFuMFb079616; Fri, 23 Oct 2020 15:56:22 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010231556.09NFuMFb079616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 23 Oct 2020 15:56:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366976 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366976 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 15:56:22 -0000 Author: mjg Date: Fri Oct 23 15:56:22 2020 New Revision: 366976 URL: https://svnweb.freebsd.org/changeset/base/366976 Log: cache: reduce memory waste in struct namecache The previous scheme for calculating the total size was doing sizeof on the struct and then adding the wanted space for the buffer. nc_name is at offset 58 while sizeof(struct namecache) is 64. With CACHE_PATH_CUTOFF of 39 bytes and 1 byte of padding we were allocating 104 bytes for the entry and never accounting for the 6 byte padding, wasting that space. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Fri Oct 23 15:50:49 2020 (r366975) +++ head/sys/kern/vfs_cache.c Fri Oct 23 15:56:22 2020 (r366976) @@ -162,6 +162,7 @@ struct namecache_ts { struct timespec nc_time; /* timespec provided by fs */ struct timespec nc_dotdottime; /* dotdot timespec provided by fs */ int nc_ticks; /* ticks value when entry was added */ + int nc_pad; struct namecache nc_nc; }; @@ -172,12 +173,19 @@ struct namecache_ts { * alignment for everyone. Note this is a nop for 64-bit platforms. */ #define CACHE_ZONE_ALIGNMENT UMA_ALIGNOF(time_t) -#define CACHE_PATH_CUTOFF 39 -#define CACHE_ZONE_SMALL_SIZE (sizeof(struct namecache) + CACHE_PATH_CUTOFF + 1) -#define CACHE_ZONE_SMALL_TS_SIZE (sizeof(struct namecache_ts) + CACHE_PATH_CUTOFF + 1) -#define CACHE_ZONE_LARGE_SIZE (sizeof(struct namecache) + NAME_MAX + 1) -#define CACHE_ZONE_LARGE_TS_SIZE (sizeof(struct namecache_ts) + NAME_MAX + 1) +#ifdef __LP64__ +#define CACHE_PATH_CUTOFF 45 +#define CACHE_LARGE_PAD 6 +#else +#define CACHE_PATH_CUTOFF 41 +#define CACHE_LARGE_PAD 2 +#endif + +#define CACHE_ZONE_SMALL_SIZE (offsetof(struct namecache, nc_name) + CACHE_PATH_CUTOFF + 1) +#define CACHE_ZONE_SMALL_TS_SIZE (offsetof(struct namecache_ts, nc_nc) + CACHE_ZONE_SMALL_SIZE) +#define CACHE_ZONE_LARGE_SIZE (offsetof(struct namecache, nc_name) + NAME_MAX + 1 + CACHE_LARGE_PAD) +#define CACHE_ZONE_LARGE_TS_SIZE (offsetof(struct namecache_ts, nc_nc) + CACHE_ZONE_LARGE_SIZE) _Static_assert((CACHE_ZONE_SMALL_SIZE % (CACHE_ZONE_ALIGNMENT + 1)) == 0, "bad zone size"); _Static_assert((CACHE_ZONE_SMALL_TS_SIZE % (CACHE_ZONE_ALIGNMENT + 1)) == 0, "bad zone size"); From owner-svn-src-head@freebsd.org Fri Oct 23 16:11:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B25C449B67 for ; Fri, 23 Oct 2020 16:11:52 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHq475r4tz4JjN for ; Fri, 23 Oct 2020 16:11:51 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f54.google.com with SMTP id c194so2124656wme.2 for ; Fri, 23 Oct 2020 09:11:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=uB9o/6Oq8nwdZI/zKgtxz9enWKa50DwsmI7p7LF1tTM=; b=QDoHUDsdI19hQG3SzkSMSYKkCpRoDEmXfPskYCrsNN7np1hO5xQpa06EjU8/P5hZWD PzZJKpdC2KqZNZK71OsIfTpX4OLl3eskfu1jt8cSSxHuFnYitDbmyalkApTrenQQvyxA 5IJtGsVH7eDuUOLkizGNiZFyjrbGS5wQqr0SLCnYVdWvA504hzRbh0yrb/7m63EBhp0S xC0Zc5qdOv/DG7WCjAWvjGRdXs2/TePZRa1Mnch1gmeVbl+bXOM+8/cmJ77jv5/8I+R9 bsgvodu1C2F+Tudg0pkgUSTe0ee2fwkmKNET+VPNcB3PEBTcOhIUMQ+fUuh3X0ssq/Yt tDpQ== X-Gm-Message-State: AOAM533xILSEJd/NCINsznvha/up3pn1cyqcAr7cSd/GItRSJ3gmYc8O ZkqThNoEk7SOQ69JzFZNYQ7srw== X-Google-Smtp-Source: ABdhPJxXtP0Xq6t+sLI58e9fSNPmECW9lRrd0wWpA+Gap4njExPLQH+PM/TiqoqC5yddQNGf0yE71A== X-Received: by 2002:a1c:7c1a:: with SMTP id x26mr3105822wmc.4.1603469509992; Fri, 23 Oct 2020 09:11:49 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id r128sm4389116wma.20.2020.10.23.09.11.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2020 09:11:49 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: svn commit: r366976 - head/sys/kern From: Jessica Clarke In-Reply-To: <202010231556.09NFuMFb079616@repo.freebsd.org> Date: Fri, 23 Oct 2020 17:11:47 +0100 Cc: src-committers , svn-src-all , svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <202010231556.09NFuMFb079616@repo.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4CHq475r4tz4JjN X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.128.54 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.14 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.67)[-0.668]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.004]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-0.97)[-0.967]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.128.54:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.54:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 16:11:52 -0000 On 23 Oct 2020, at 16:56, Mateusz Guzik wrote: >=20 > Author: mjg > Date: Fri Oct 23 15:56:22 2020 > New Revision: 366976 > URL: https://svnweb.freebsd.org/changeset/base/366976 >=20 > Log: > cache: reduce memory waste in struct namecache >=20 > The previous scheme for calculating the total size was doing sizeof > on the struct and then adding the wanted space for the buffer. >=20 > nc_name is at offset 58 while sizeof(struct namecache) is 64. > With CACHE_PATH_CUTOFF of 39 bytes and 1 byte of padding we were > allocating 104 bytes for the entry and never accounting for the 6 > byte padding, wasting that space. >=20 > Modified: > head/sys/kern/vfs_cache.c >=20 > Modified: head/sys/kern/vfs_cache.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/vfs_cache.c Fri Oct 23 15:50:49 2020 = (r366975) > +++ head/sys/kern/vfs_cache.c Fri Oct 23 15:56:22 2020 = (r366976) > @@ -162,6 +162,7 @@ struct namecache_ts { > struct timespec nc_time; /* timespec provided by fs */ > struct timespec nc_dotdottime; /* dotdot timespec provided by = fs */ > int nc_ticks; /* ticks value when entry was = added */ > + int nc_pad; > struct namecache nc_nc; > }; >=20 > @@ -172,12 +173,19 @@ struct namecache_ts { > * alignment for everyone. Note this is a nop for 64-bit platforms. > */ > #define CACHE_ZONE_ALIGNMENT UMA_ALIGNOF(time_t) > -#define CACHE_PATH_CUTOFF 39 >=20 > -#define CACHE_ZONE_SMALL_SIZE (sizeof(struct = namecache) + CACHE_PATH_CUTOFF + 1) > -#define CACHE_ZONE_SMALL_TS_SIZE (sizeof(struct namecache_ts) + = CACHE_PATH_CUTOFF + 1) > -#define CACHE_ZONE_LARGE_SIZE (sizeof(struct = namecache) + NAME_MAX + 1) > -#define CACHE_ZONE_LARGE_TS_SIZE (sizeof(struct namecache_ts) + = NAME_MAX + 1) > +#ifdef __LP64__ > +#define CACHE_PATH_CUTOFF 45 > +#define CACHE_LARGE_PAD 6 > +#else > +#define CACHE_PATH_CUTOFF 41 > +#define CACHE_LARGE_PAD 2 > +#endif Is there any explanation of where these magic constants come from? There should at least be a comment IMO, of better yet have a C expression to evaluate them without needing #ifdef-based hard-coding (which then annoys things like CHERI that has 128-bit pointers in its pure capability kernel that causes us to have to go and reverse-engineer where these numbers came from so we can figure out what the right value should be for us). Jess From owner-svn-src-head@freebsd.org Fri Oct 23 16:35:25 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5CE344A8CC; Fri, 23 Oct 2020 16:35:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHqbK5CpTz4Ld3; Fri, 23 Oct 2020 16:35:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79041A4C6; Fri, 23 Oct 2020 16:35:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NGZP24004818; Fri, 23 Oct 2020 16:35:25 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NGZNCN004809; Fri, 23 Oct 2020 16:35:23 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202010231635.09NGZNCN004809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 23 Oct 2020 16:35:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366977 - in head: contrib/elftoolchain/libelf lib/libelf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: contrib/elftoolchain/libelf lib/libelf X-SVN-Commit-Revision: 366977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 16:35:25 -0000 Author: emaste Date: Fri Oct 23 16:35:23 2020 New Revision: 366977 URL: https://svnweb.freebsd.org/changeset/base/366977 Log: libelf: add compression header support GNU and Oracle libelf implementations added support for section compression, intended to reduce the size of DWARF debug info (which might be an order of magnitude larger than the code). There are two compressed ELF section formats: 1. Old GNU - sections are renmaed to start with 'z'. Section contains a magic number, uncompressed size, and compressed data. 2. Oracle and New GNU - compressed sections use the SHF_COMPRESSED flag. The compression header contains the compression type, uncompressed size, and uncompressed alignment. The second style is preferred and this change implements only that one. Submitted by: Tiger Gao Reviewed by: markj MFC after: 2 weeks Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24566 Added: head/contrib/elftoolchain/libelf/gelf_chdr.c (contents, props changed) head/contrib/elftoolchain/libelf/gelf_getchdr.3 (contents, props changed) head/contrib/elftoolchain/libelf/libelf_chdr.c (contents, props changed) Modified: head/contrib/elftoolchain/libelf/Version.map head/contrib/elftoolchain/libelf/_libelf.h head/contrib/elftoolchain/libelf/gelf.3 head/contrib/elftoolchain/libelf/gelf.h head/contrib/elftoolchain/libelf/libelf.h head/lib/libelf/Makefile Modified: head/contrib/elftoolchain/libelf/Version.map ============================================================================== --- head/contrib/elftoolchain/libelf/Version.map Fri Oct 23 15:56:22 2020 (r366976) +++ head/contrib/elftoolchain/libelf/Version.map Fri Oct 23 16:35:23 2020 (r366977) @@ -91,6 +91,13 @@ global: gelf_update_symshndx; gelf_xlatetof; gelf_xlatetom; +}; + +R1.1 { +global: + elf32_getchdr; + elf64_getchdr; + gelf_getchdr; local: *; -}; +} R1.0; Modified: head/contrib/elftoolchain/libelf/_libelf.h ============================================================================== --- head/contrib/elftoolchain/libelf/_libelf.h Fri Oct 23 15:56:22 2020 (r366976) +++ head/contrib/elftoolchain/libelf/_libelf.h Fri Oct 23 16:35:23 2020 (r366977) @@ -220,6 +220,7 @@ size_t _libelf_fsize(Elf_Type _t, int _elfclass, unsig size_t count); _libelf_translator_function *_libelf_get_translator(Elf_Type _t, int _direction, int _elfclass, int _elfmachine); +void *_libelf_getchdr(Elf_Scn *_e, int _elfclass); void *_libelf_getphdr(Elf *_e, int _elfclass); void *_libelf_getshdr(Elf_Scn *_scn, int _elfclass); void _libelf_init_elf(Elf *_e, Elf_Kind _kind); Modified: head/contrib/elftoolchain/libelf/gelf.3 ============================================================================== --- head/contrib/elftoolchain/libelf/gelf.3 Fri Oct 23 15:56:22 2020 (r366976) +++ head/contrib/elftoolchain/libelf/gelf.3 Fri Oct 23 16:35:23 2020 (r366977) @@ -23,7 +23,7 @@ .\" .\" $Id: gelf.3 3743 2019-06-12 19:36:30Z jkoshy $ .\" -.Dd June 12, 2019 +.Dd October 23, 2020 .Dt GELF 3 .Os .Sh NAME @@ -45,6 +45,8 @@ The GElf API defines the following class-independent d .Bl -tag -width GElf_Sxword .It Vt GElf_Addr A representation of ELF addresses. +.It Vt GElf_Chdr +A class-independent representation of an ELF Compression Header. .It Vt GElf_Dyn A class-independent representation of ELF .Sy .dynamic @@ -144,6 +146,8 @@ native representation. .El .It "Retrieving ELF Data" .Bl -tag -compact -width indent +.It Fn gelf_getchdr +Retrieve an ELF Compression Header from the underlying ELF descriptor. .It Fn gelf_getdyn Retrieve an ELF .Sy .dynamic Modified: head/contrib/elftoolchain/libelf/gelf.h ============================================================================== --- head/contrib/elftoolchain/libelf/gelf.h Fri Oct 23 15:56:22 2020 (r366976) +++ head/contrib/elftoolchain/libelf/gelf.h Fri Oct 23 16:35:23 2020 (r366977) @@ -39,6 +39,7 @@ typedef Elf64_Sxword GElf_Sxword; /* Signed long words typedef Elf64_Word GElf_Word; /* Unsigned words (32 bit) */ typedef Elf64_Xword GElf_Xword; /* Unsigned long words (64 bit) */ +typedef Elf64_Chdr GElf_Chdr; /* Compressed section header */ typedef Elf64_Dyn GElf_Dyn; /* ".dynamic" section entries */ typedef Elf64_Ehdr GElf_Ehdr; /* ELF header */ typedef Elf64_Phdr GElf_Phdr; /* Program header */ @@ -73,6 +74,7 @@ extern "C" { long gelf_checksum(Elf *_elf); size_t gelf_fsize(Elf *_elf, Elf_Type _type, size_t _count, unsigned int _version); +GElf_Chdr *gelf_getchdr(Elf_Scn *_scn, GElf_Chdr *_dst); int gelf_getclass(Elf *_elf); GElf_Dyn *gelf_getdyn(Elf_Data *_data, int _index, GElf_Dyn *_dst); GElf_Ehdr *gelf_getehdr(Elf *_elf, GElf_Ehdr *_dst); Added: head/contrib/elftoolchain/libelf/gelf_chdr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/elftoolchain/libelf/gelf_chdr.c Fri Oct 23 16:35:23 2020 (r366977) @@ -0,0 +1,82 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Tiger Gao under sponsorship from + * the FreeBSD Foundation. + * + * 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. + */ + +#include +#include +#include +#include +#include + +#include "_libelf.h" + +Elf32_Chdr * +elf32_getchdr(Elf_Scn *s) +{ + return (_libelf_getchdr(s, ELFCLASS32)); +} + +Elf64_Chdr * +elf64_getchdr(Elf_Scn *s) +{ + return (_libelf_getchdr(s, ELFCLASS64)); +} + +GElf_Chdr * +gelf_getchdr(Elf_Scn *s, GElf_Chdr *d) +{ + int ec; + void *ch; + Elf32_Chdr *ch32; + Elf64_Chdr *ch64; + + if (d == NULL) { + LIBELF_SET_ERROR(ARGUMENT, 0); + return (NULL); + } + + if ((ch = _libelf_getchdr(s, ELFCLASSNONE)) == NULL) + return (NULL); + + ec = s->s_elf->e_class; + assert(ec == ELFCLASS32 || ec == ELFCLASS64); + + if (ec == ELFCLASS32) { + ch32 = (Elf32_Chdr *)ch; + + d->ch_type = (Elf64_Word)ch32->ch_type; + d->ch_size = (Elf64_Xword)ch32->ch_size; + d->ch_addralign = (Elf64_Xword)ch32->ch_addralign; + } else { + ch64 = (Elf64_Chdr *)ch; + *d = *ch64; + } + + return (d); +} Added: head/contrib/elftoolchain/libelf/gelf_getchdr.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/elftoolchain/libelf/gelf_getchdr.3 Fri Oct 23 16:35:23 2020 (r366977) @@ -0,0 +1,117 @@ +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2020 The FreeBSD Foundation +.\" +.\" This document was written by Tiger Gao under sponsorship from +.\" the FreeBSD Foundation. +.\" +.\" 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. +.\" +.\" $Id: gelf_getchdr.3 3639 2020-10-20 16:07:02Z tig $ +.\" +.Dd October 23, 2020 +.Dt GELF_GETCHDR 3 +.Os +.Sh NAME +.Nm elf32_getchdr , +.Nm elf64_getchdr , +.Nm gelf_getchdr +.Nd retrieve the compression header of a section +.Sh LIBRARY +.Lb libelf +.Sh SYNOPSIS +.In libelf.h +.Ft "Elf32_Chdr *" +.Fn elf32_getchdr "Elf_Scn *s" +.Ft "Elf64_Chdr *" +.Fn elf64_getchdr "Elf_Scn *s" +.In gelf.h +.Ft "GElf_Chdr *" +.Fn gelf_getchdr "Elf_Scn *scn" "GElf_Chdr *chdr" +.Sh DESCRIPTION +These functions return a pointer to the ELF Compression Header data +structure associated with section descriptor +.Ar scn . +.Pp +Function +.Fn elf32_getchdr +retrieves a pointer to an +.Vt Elf32_Chdr +structure. +Section descriptor +.Ar scn +must be associated with an ELF descriptor of class +.Dv ELFCLASS32 . +.Pp +Function +.Fn elf64_getchdr +retrieves a pointer to an +.Vt Elf64_Chdr +structure. +Section descriptor +.Ar scn +must be associated with an ELF descriptor of class +.Dv ELFCLASS64 . +.Pp +Function +.Fn gelf_getchdr +copies the values in the compression header associated with argument +.Ar scn +to the structure pointed to be argument +.Ar dst . +The +.Vt GElf_Chdr +data structure is described in +.Xr gelf 3 . +.Sh RETURN VALUES +Functions +.Fn elf32_getchdr +and +.Fn elf64_getchdr +return a valid pointer to the appropriate compression header on success +or NULL if an error was encountered. +.Pp +Function +.Fn gelf_getchdr +returns argument +.Ar dst +if successful, or NULL if an error was encountered. +.Sh ERRORS +These functions may fail with the following errors: +.Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_INVALID_SECTION_FLAGS +Arguments +.Ar scn +has invalid flags. +.It Bq Er ELF_E_INVALID_SECTION_TYPE +Argument +.Ar scn +has invalid type. +.It Bq Er ELF_E_NOT_COMPRESSED +Argument +.Ar scn +is not compressed. +.El +.Sh SEE ALSO +.Xr elf 3 , +.Xr elf_getscn 3 , +.Xr gelf 3 , Modified: head/contrib/elftoolchain/libelf/libelf.h ============================================================================== --- head/contrib/elftoolchain/libelf/libelf.h Fri Oct 23 15:56:22 2020 (r366976) +++ head/contrib/elftoolchain/libelf/libelf.h Fri Oct 23 16:35:23 2020 (r366977) @@ -162,6 +162,9 @@ enum Elf_Error { ELF_E_SEQUENCE, /* API calls out of sequence */ ELF_E_UNIMPL, /* Feature is unimplemented */ ELF_E_VERSION, /* Unknown API version */ + ELF_E_INVALID_SECTION_FLAGS, /* Invalid ELF section header flags */ + ELF_E_INVALID_SECTION_TYPE, /* Invalid ELF section header type */ + ELF_E_NOT_COMPRESSED, /* Section is not compressed */ ELF_E_NUM /* Max error number */ }; @@ -227,6 +230,7 @@ unsigned int elf_version(unsigned int _version); long elf32_checksum(Elf *_elf); size_t elf32_fsize(Elf_Type _type, size_t _count, unsigned int _version); +Elf32_Chdr *elf32_getchdr(Elf_Scn *_scn); Elf32_Ehdr *elf32_getehdr(Elf *_elf); Elf32_Phdr *elf32_getphdr(Elf *_elf); Elf32_Shdr *elf32_getshdr(Elf_Scn *_scn); @@ -240,6 +244,7 @@ Elf_Data *elf32_xlatetom(Elf_Data *_dst, const Elf_Dat long elf64_checksum(Elf *_elf); size_t elf64_fsize(Elf_Type _type, size_t _count, unsigned int _version); +Elf64_Chdr *elf64_getchdr(Elf_Scn *_scn); Elf64_Ehdr *elf64_getehdr(Elf *_elf); Elf64_Phdr *elf64_getphdr(Elf *_elf); Elf64_Shdr *elf64_getshdr(Elf_Scn *_scn); Added: head/contrib/elftoolchain/libelf/libelf_chdr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/elftoolchain/libelf/libelf_chdr.c Fri Oct 23 16:35:23 2020 (r366977) @@ -0,0 +1,104 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Tiger Gao under sponsorship from + * the FreeBSD Foundation. + * + * 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. + */ + +#include +#include + +#include "_libelf.h" + +void * +_libelf_getchdr(Elf_Scn *s, int ec) +{ + Elf *e; + void *sh; + Elf32_Shdr *sh32; + Elf64_Shdr *sh64; + + sh32 = NULL; + sh64 = NULL; + + if (s == NULL || (e = s->s_elf) == NULL || e->e_kind != ELF_K_ELF) { + LIBELF_SET_ERROR(ARGUMENT, 0); + return (NULL); + } + + if (ec == ELFCLASSNONE) { + ec = e->e_class; + } else if (ec != e->e_class) { + LIBELF_SET_ERROR(CLASS, 0); + return (NULL); + } + + if ((sh = _libelf_getshdr(s, ec)) == NULL) { + LIBELF_SET_ERROR(HEADER, 0); + return (NULL); + } + + if (ec == ELFCLASS32) { + sh32 = (Elf32_Shdr *)sh; + if ((sh32->sh_flags & SHF_ALLOC) != 0) { + LIBELF_SET_ERROR(INVALID_SECTION_FLAGS, 0); + return (NULL); + } + + if (sh32->sh_type == SHT_NULL || sh32->sh_type == SHT_NOBITS) { + LIBELF_SET_ERROR(INVALID_SECTION_TYPE, 0); + return (NULL); + } + + if ((sh32->sh_flags & SHF_COMPRESSED) == 0) { + LIBELF_SET_ERROR(NOT_COMPRESSED, 0); + return (NULL); + } + } else { + sh64 = (Elf64_Shdr *)sh; + if ((sh64->sh_flags & SHF_ALLOC) != 0) { + LIBELF_SET_ERROR(INVALID_SECTION_FLAGS, 0); + return (NULL); + } + + if (sh64->sh_type == SHT_NULL || sh64->sh_type == SHT_NOBITS) { + LIBELF_SET_ERROR(INVALID_SECTION_TYPE, 0); + return (NULL); + } + + if ((sh64->sh_flags & SHF_COMPRESSED) == 0) { + LIBELF_SET_ERROR(NOT_COMPRESSED, 0); + return (NULL); + } + } + + Elf_Data *d = elf_getdata(s, NULL); + + if (!d) + return (NULL); + + return ((void *)d->d_buf); +} Modified: head/lib/libelf/Makefile ============================================================================== --- head/lib/libelf/Makefile Fri Oct 23 15:56:22 2020 (r366976) +++ head/lib/libelf/Makefile Fri Oct 23 16:35:23 2020 (r366977) @@ -38,6 +38,7 @@ SRCS= elf.c \ elf_update.c \ elf_version.c \ gelf_cap.c \ + gelf_chdr.c \ gelf_checksum.c \ gelf_dyn.c \ gelf_ehdr.c \ @@ -57,6 +58,7 @@ SRCS= elf.c \ libelf_allocate.c \ libelf_ar.c \ libelf_ar_util.c \ + libelf_chdr.c \ libelf_checksum.c \ libelf_data.c \ libelf_ehdr.c \ From owner-svn-src-head@freebsd.org Fri Oct 23 18:18:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA81044C961; Fri, 23 Oct 2020 18:18:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHstY50spz4S5V; Fri, 23 Oct 2020 18:18:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 753F3B8A5; Fri, 23 Oct 2020 18:18:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NIIjc5067669; Fri, 23 Oct 2020 18:18:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NIIj5x067668; Fri, 23 Oct 2020 18:18:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202010231818.09NIIj5x067668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 23 Oct 2020 18:18:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366978 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 366978 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 18:18:45 -0000 Author: kib Date: Fri Oct 23 18:18:45 2020 New Revision: 366978 URL: https://svnweb.freebsd.org/changeset/base/366978 Log: xhci: Handle the case when MSI-X BAR is the same as IO BAR. PCIe allows for MSI-X BAR to be either dedicated, or MSI-X Table may be co-located in some functional BAR. In the later case xhci(4) is unable to allocate active resource for the table because BAR is already activated. Handle it by checking for this special case, and not try to alloc resource if MSI-X BAR is IO. Reported and tested by: emaste Reviewed by: emaste, hselasky Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D26913 Modified: head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Fri Oct 23 16:35:23 2020 (r366977) +++ head/sys/dev/usb/controller/xhci_pci.c Fri Oct 23 18:18:45 2020 (r366978) @@ -277,21 +277,29 @@ xhci_pci_attach(device_t self) rid = 0; if (xhci_use_msix && (msix_table = pci_msix_table_bar(self)) >= 0) { - sc->sc_msix_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, - &msix_table, RF_ACTIVE); - if (sc->sc_msix_res == NULL) { - /* May not be enabled */ - device_printf(self, - "Unable to map MSI-X table \n"); + if (msix_table == PCI_XHCI_CBMEM) { + sc->sc_msix_res = sc->sc_io_res; } else { + sc->sc_msix_res = bus_alloc_resource_any(self, + SYS_RES_MEMORY, &msix_table, RF_ACTIVE); + if (sc->sc_msix_res == NULL) { + /* May not be enabled */ + device_printf(self, + "Unable to map MSI-X table\n"); + } + } + if (sc->sc_msix_res != NULL) { count = 1; if (pci_alloc_msix(self, &count) == 0) { if (bootverbose) device_printf(self, "MSI-X enabled\n"); rid = 1; } else { - bus_release_resource(self, SYS_RES_MEMORY, - msix_table, sc->sc_msix_res); + if (sc->sc_msix_res != sc->sc_io_res) { + bus_release_resource(self, + SYS_RES_MEMORY, + msix_table, sc->sc_msix_res); + } sc->sc_msix_res = NULL; } } @@ -387,15 +395,15 @@ xhci_pci_detach(device_t self) sc->sc_irq_res = NULL; pci_release_msi(self); } + if (sc->sc_msix_res != NULL && sc->sc_msix_res != sc->sc_io_res) { + bus_release_resource(self, SYS_RES_MEMORY, + rman_get_rid(sc->sc_msix_res), sc->sc_msix_res); + sc->sc_msix_res = NULL; + } if (sc->sc_io_res) { bus_release_resource(self, SYS_RES_MEMORY, PCI_XHCI_CBMEM, sc->sc_io_res); sc->sc_io_res = NULL; - } - if (sc->sc_msix_res) { - bus_release_resource(self, SYS_RES_MEMORY, - rman_get_rid(sc->sc_msix_res), sc->sc_msix_res); - sc->sc_msix_res = NULL; } xhci_uninit(sc); From owner-svn-src-head@freebsd.org Fri Oct 23 21:27:49 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1D6044F363; Fri, 23 Oct 2020 21:27:49 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHy4j50v0z4cbn; Fri, 23 Oct 2020 21:27:49 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AB3FDE06; Fri, 23 Oct 2020 21:27:49 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NLRnT1095430; Fri, 23 Oct 2020 21:27:49 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NLRmFu095427; Fri, 23 Oct 2020 21:27:48 GMT (envelope-from br@FreeBSD.org) Message-Id: <202010232127.09NLRmFu095427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 23 Oct 2020 21:27:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366980 - in head/sys: dev/ahci kern x86/x86 X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: dev/ahci kern x86/x86 X-SVN-Commit-Revision: 366980 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 21:27:49 -0000 Author: br Date: Fri Oct 23 21:27:48 2020 New Revision: 366980 URL: https://svnweb.freebsd.org/changeset/base/366980 Log: Move the iommu stubs to a generic place, so they are available on all the platforms. This allows to not depend on the IOMMU macro in AHCI driver. Requested by: kib Suggested by: andrew Reviewed by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26887 Modified: head/sys/dev/ahci/ahci_pci.c head/sys/kern/subr_bus_dma.c head/sys/x86/x86/busdma_machdep.c Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Fri Oct 23 18:29:36 2020 (r366979) +++ head/sys/dev/ahci/ahci_pci.c Fri Oct 23 21:27:48 2020 (r366980) @@ -27,8 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_iommu.h" - #include #include #include @@ -501,7 +499,6 @@ ahci_pci_attach(device_t dev) i++; ctlr->quirks = ahci_ids[i].quirks; -#ifdef IOMMU if (ctlr->quirks & AHCI_Q_IOMMU_BUSWIDE) { /* * The controller issues DMA requests from PCI function 1, @@ -510,7 +507,6 @@ ahci_pci_attach(device_t dev) */ bus_dma_iommu_set_buswide(dev); } -#endif /* Limit speed for my onboard JMicron external port. * It is not eSATA really, limit to SATA 1 */ Modified: head/sys/kern/subr_bus_dma.c ============================================================================== --- head/sys/kern/subr_bus_dma.c Fri Oct 23 18:29:36 2020 (r366979) +++ head/sys/kern/subr_bus_dma.c Fri Oct 23 21:27:48 2020 (r366980) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include "opt_bus.h" +#include "opt_iommu.h" #include #include @@ -785,3 +786,21 @@ bus_dma_template_fill(bus_dma_template_t *t, bus_dma_p return; } +#ifndef IOMMU +bool bus_dma_iommu_set_buswide(device_t dev); +int bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map, + vm_paddr_t start, vm_size_t length, int flags); + +bool +bus_dma_iommu_set_buswide(device_t dev) +{ + return (false); +} + +int +bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map, + vm_paddr_t start, vm_size_t length, int flags) +{ + return (0); +} +#endif Modified: head/sys/x86/x86/busdma_machdep.c ============================================================================== --- head/sys/x86/x86/busdma_machdep.c Fri Oct 23 18:29:36 2020 (r366979) +++ head/sys/x86/x86/busdma_machdep.c Fri Oct 23 21:27:48 2020 (r366980) @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" -#include "opt_iommu.h" #include #include @@ -268,22 +267,3 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat) tc = (struct bus_dma_tag_common *)dmat; return (tc->impl->tag_destroy(dmat)); } - -#ifndef IOMMU -bool bus_dma_iommu_set_buswide(device_t dev); -int bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map, - vm_paddr_t start, vm_size_t length, int flags); - -bool -bus_dma_iommu_set_buswide(device_t dev) -{ - return (false); -} - -int -bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map, - vm_paddr_t start, vm_size_t length, int flags) -{ - return (0); -} -#endif From owner-svn-src-head@freebsd.org Fri Oct 23 22:27:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64F2C4285BA; Fri, 23 Oct 2020 22:27:46 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHzPt1yG5z4fvf; Fri, 23 Oct 2020 22:27:46 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27BE8E980; Fri, 23 Oct 2020 22:27:46 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NMRkMf032298; Fri, 23 Oct 2020 22:27:46 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NMRkEO032297; Fri, 23 Oct 2020 22:27:46 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202010232227.09NMRkEO032297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 23 Oct 2020 22:27:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366981 - head/lib/libc/tests/ssp X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/lib/libc/tests/ssp X-SVN-Commit-Revision: 366981 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 22:27:46 -0000 Author: brooks Date: Fri Oct 23 22:27:45 2020 New Revision: 366981 URL: https://svnweb.freebsd.org/changeset/base/366981 Log: Only use ASAN when using the in-tree compiler When building FreeBSD 11 on a FreeBSD 12 system with CROSS_TOOLCHAIN=llvm10 we end up trying to link against the packaged version of the sanitizer library. This resulted in a requirement for getentropy(3) which is not present in FreeBSD 11. Reviewed by: emaste MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26903 Modified: head/lib/libc/tests/ssp/Makefile Modified: head/lib/libc/tests/ssp/Makefile ============================================================================== --- head/lib/libc/tests/ssp/Makefile Fri Oct 23 21:27:48 2020 (r366980) +++ head/lib/libc/tests/ssp/Makefile Fri Oct 23 22:27:45 2020 (r366981) @@ -6,7 +6,9 @@ NO_WERROR= WARNS?= 2 CFLAGS.h_raw+= -fstack-protector-all -Wstack-protector -.if ${COMPILER_TYPE} == "clang" +.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc" +# Only use -fsanitize=bounds when using the in-tree compiler. Otherwise +# we may link to a sanitizer library targeted at a newer kernel/libc. CFLAGS.h_raw+= -fsanitize=bounds .elif ${COMPILER_TYPE} == "gcc" CFLAGS.h_raw+= --param ssp-buffer-size=1 From owner-svn-src-head@freebsd.org Fri Oct 23 23:56:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7972C42987D; Fri, 23 Oct 2020 23:56:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJ1Mj2HQ2z3VBC; Fri, 23 Oct 2020 23:56:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31A08F88C; Fri, 23 Oct 2020 23:56:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09NNu0NU087336; Fri, 23 Oct 2020 23:56:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09NNu0Iw087335; Fri, 23 Oct 2020 23:56:00 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202010232356.09NNu0Iw087335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 23 Oct 2020 23:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366982 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 366982 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Fri, 23 Oct 2020 23:56:01 -0000 Author: imp Date: Fri Oct 23 23:56:00 2020 New Revision: 366982 URL: https://svnweb.freebsd.org/changeset/base/366982 Log: warnx: Save errno across calls that might change it. When warn() family of functions is being used after err_set_file() has been set to, for example, /dev/null, errno is being clobbered, rendering it unreliable after, for example, procstat_getpathname() when it is supposed to emit a warning. Then the errno is changed to Inappropriate ioctl for device, destroying the original value (via calls to fprintf()functions). Submitted by: Juraj Lutter Differential Revision: https://reviews.freebsd.org/D26871 Modified: head/lib/libc/gen/err.c Modified: head/lib/libc/gen/err.c ============================================================================== --- head/lib/libc/gen/err.c Fri Oct 23 22:27:45 2020 (r366981) +++ head/lib/libc/gen/err.c Fri Oct 23 23:56:00 2020 (r366982) @@ -161,6 +161,9 @@ warnc(int code, const char *fmt, ...) void vwarnc(int code, const char *fmt, va_list ap) { + static int saved_errno; + + saved_errno = errno; if (err_file == NULL) err_set_file(NULL); fprintf(err_file, "%s: ", _getprogname()); @@ -169,6 +172,7 @@ vwarnc(int code, const char *fmt, va_list ap) fprintf(err_file, ": "); } fprintf(err_file, "%s\n", strerror(code)); + errno = saved_errno; } void @@ -183,10 +187,14 @@ warnx(const char *fmt, ...) void vwarnx(const char *fmt, va_list ap) { + static int saved_errno; + + saved_errno = errno; if (err_file == NULL) err_set_file(NULL); fprintf(err_file, "%s: ", _getprogname()); if (fmt != NULL) vfprintf(err_file, fmt, ap); fprintf(err_file, "\n"); + errno = saved_errno; } From owner-svn-src-head@freebsd.org Sat Oct 24 00:03:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC5A9429AA4; Sat, 24 Oct 2020 00:03:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJ1Wz4Xysz3Vfb; Sat, 24 Oct 2020 00:03:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F60CF554; Sat, 24 Oct 2020 00:03:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09O03BTt093196; Sat, 24 Oct 2020 00:03:11 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09O03BK9093195; Sat, 24 Oct 2020 00:03:11 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202010240003.09O03BK9093195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 24 Oct 2020 00:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366983 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 366983 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 00:03:11 -0000 Author: imp Date: Sat Oct 24 00:03:11 2020 New Revision: 366983 URL: https://svnweb.freebsd.org/changeset/base/366983 Log: warnx: fix needless static I noticed after the review that these shouldn't be static. Remove the 'static' from them, otherwise concurrent calls to warn* might see a similar but to the original. Modified: head/lib/libc/gen/err.c Modified: head/lib/libc/gen/err.c ============================================================================== --- head/lib/libc/gen/err.c Fri Oct 23 23:56:00 2020 (r366982) +++ head/lib/libc/gen/err.c Sat Oct 24 00:03:11 2020 (r366983) @@ -161,7 +161,7 @@ warnc(int code, const char *fmt, ...) void vwarnc(int code, const char *fmt, va_list ap) { - static int saved_errno; + int saved_errno; saved_errno = errno; if (err_file == NULL) @@ -187,7 +187,7 @@ warnx(const char *fmt, ...) void vwarnx(const char *fmt, va_list ap) { - static int saved_errno; + int saved_errno; saved_errno = errno; if (err_file == NULL) From owner-svn-src-head@freebsd.org Sat Oct 24 00:13:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A183B42A21A for ; Sat, 24 Oct 2020 00:13:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJ1ls2gWGz3Vql for ; Sat, 24 Oct 2020 00:13:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x732.google.com with SMTP id r7so3191347qkf.3 for ; Fri, 23 Oct 2020 17:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lM6tUyN3Mx+kHaxoJGq8B0DEQO+0VTE8xXxvh3gTATA=; b=Nhcgke35u1/TzP2zj9ReU36OwqyTBE67Sv9eadVwJ7kpIsO175LAyZzM2ec4gKzXhH A75ZQF2SufiYE8OMZgnOYX4SJXZPN6NpSkVijpQoECkMujBCIpnBaZa4UBuRVaRD+7R3 XzgSYU6QsEP/KyxJ+XVMTs7+X+MR/r0hcMjl6ckyE2at/lyULug5UqTMDMbRLnCgn7W7 BMH5Z89ZoRzIuJcfF0vPcI822UvKmXbyqjzQxyKF0UDD/ZGOuAAiC6wzLmjCBgbz8DsF qtVia4rudvCOe0OyqOq00oB7duBmNh/EZW1ufN8BG5UND6CaIkjplhwDrtZjRG0FepQp S3jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lM6tUyN3Mx+kHaxoJGq8B0DEQO+0VTE8xXxvh3gTATA=; b=RvWu0PMdZbLCPHa0DxDBmWPNnUTdKPxFCFDdDGwh8jxyWFSASA+5Epi2mvHDcumLrQ HVXw9TGbjpnq4T2jdwbJc1/mwlpKvFdkbE2TcGVUHJp0vKKoQK4PJfBHxh+tyWlnLCLU m6f4Et/ahqV6wlb2qyu+iN4iPmFesJdXAT9+T+VQi7ltcq2lxPxw8OLEQxyRV9XUxtj7 vCELCOiNEetTEYOy6QO4wpSn3JPLvn+iDJavqfJWh83Gi0gGISPMD+rbBIXc2/rbaaMb EOoS57OfpuNgezFlnra7yNg9KDTN/P76DoHkIj2RkwpTKLDULRkTnglqTr0SfvbcVX2b 1TJw== X-Gm-Message-State: AOAM530KS0TLqV0eOY7DTjcUMBMp6jeAJqBUFoP1XBJMurMja7DPk/Zj 7JyUdX9FA/WuTWywEOMjXWsfkDzREATjfZNpcEwX8A== X-Google-Smtp-Source: ABdhPJxetQP4RukmlrkxbDokpi28VbIbRn35ylpb5nP1GkLJORzm3BMgbWOYtfDFXF/yoEyuJvS8r3tOm2SPKOomA3k= X-Received: by 2002:a37:5ca:: with SMTP id 193mr5039696qkf.44.1603498408391; Fri, 23 Oct 2020 17:13:28 -0700 (PDT) MIME-Version: 1.0 References: <202010021826.092IQfdj023808@repo.freebsd.org> <44421602932538@mail.yandex.ru> <43251602934532@mail.yandex.ru> <59021602950992@mail.yandex.ru> In-Reply-To: From: Warner Losh Date: Fri, 23 Oct 2020 18:13:17 -0600 Message-ID: Subject: Re: svn commit: r366372 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf To: Kyle Evans Cc: Niclas Zeising , "Alexander V. Chernikov" , Hans Petter Selasky , Emmanuel Vadot , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 4CJ1ls2gWGz3Vql X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=Nhcgke35; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::732) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.98 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.990]; NEURAL_HAM_LONG(-0.96)[-0.964]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.02)[-1.024]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::732:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[svn-src-head]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 00:13:30 -0000 I was going to suggest and try this change, but life has been complicated... Has it been committed? Warner On Thu, Oct 22, 2020, 1:43 PM Kyle Evans wrote: > On Thu, Oct 22, 2020 at 2:35 PM Niclas Zeising > wrote: > > > > On 2020-10-22 15:22, Kyle Evans wrote: > > > On Sat, Oct 17, 2020 at 11:40 AM Warner Losh wrote: > > >> > > >> > > >> > > >> On Sat, Oct 17, 2020, 10:11 AM Alexander V. Chernikov < > melifaro@ipfw.ru> wrote: > > >>> > > >>> 17.10.2020, 14:07, "Hans Petter Selasky" : > > >>> > > >>> On 2020-10-17 14:34, Alexander V. Chernikov wrote: > > >>> > > >>> 17.10.2020, 12:32, "Hans Petter Selasky" : > > >>> > > >>> On 2020-10-17 13:27, Alexander V. Chernikov wrote: > > >>> > > >>> 02.10.2020, 19:26, "Emmanuel Vadot" > >>> >: > > >>> > > >>> Author: manu > > >>> Date: Fri Oct 2 18:26:41 2020 > > >>> New Revision: 366372 > > >>> URL: > https://svnweb.freebsd.org/changeset/base/366372 > > >>> > > >>> Log: > > >>> linuxkpi: Add backlight support > > >>> > > >>> Add backlight function to linuxkpi. > > >>> Graphics drivers expose the backlight of the > panel directly so > > >>> allow them > > >>> to use the backlight subsystem so > > >>> user can use backlight(8) to configure them. > > >>> > > >>> Reviewed by: hselasky > > >>> Relnotes: yes > > >>> Differential Revision: The FreeBSD Foundation > > >>> > > >>> Added: > > >>> > head/sys/compat/linuxkpi/common/include/linux/backlight.h > > >>> (contents, > > >>> props changed) > > >>> Modified: > > >>> > head/sys/compat/linuxkpi/common/include/linux/device.h > > >>> head/sys/compat/linuxkpi/common/src/linux_kmod.c > > >>> head/sys/compat/linuxkpi/common/src/linux_pci.c > > >>> head/sys/conf/kmod.mk > > >>> > > >>> It breaks the build for me with > > >>> > /usr/home/melifaro/free/head/sys/compat/linuxkpi/common/src/linux_pci.c:70:10: > > >>> fatal error: 'backlight_if.h' file not found > > >>> > > >>> > > >>> How do you build? Doesn't break over here. > > >>> > > >>> GENERIC + COMPAT_LINUXKPI. > > >>> > > >>> > > >>> > > >>> Try adding: > > >>> > > >>> options backlight > > >>> > > >>> To the kernel config. > > >>> > > >>> Yep, thank you! > > >>> Maybe it's worth considering adding static assert with the message > describing this dependency? > > >> > > >> > > >> Yes. It likely is worth doing something to highlight this issue. > > >> > > >> Warner > > >> > > > > > > I think we just need to slap the two core backlight files with an ` | > > > compat_linux` so that they simply get pulled in if you specify > > > COMPAT_LINUX. config(8) handles this terribly, configng must have a > > > better provides/requires/implies/whatever functionality so we can > > > specify that compat_linux implies backlight and not do crud like this > > > where it becomes more complicated to see what any given option really > > > entails. > > > > > > Thanks, > > > > COMPAT_LINUX can't be right. Isn't that the linuxolator? > > Regards > > -- > > Niclas Zeising > > Whoops, s/LINUX/LINUXKPI/ > > :-) > From owner-svn-src-head@freebsd.org Sat Oct 24 01:13:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1E1742B4A5; Sat, 24 Oct 2020 01:13:02 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJ34Z5dY1z3Yc5; Sat, 24 Oct 2020 01:13:02 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4D18106F2; Sat, 24 Oct 2020 01:13:02 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09O1D2ik036308; Sat, 24 Oct 2020 01:13:02 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09O1D2Xm036307; Sat, 24 Oct 2020 01:13:02 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010240113.09O1D2Xm036307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 24 Oct 2020 01:13:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366984 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366984 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 01:13:02 -0000 Author: mjg Date: Sat Oct 24 01:13:02 2020 New Revision: 366984 URL: https://svnweb.freebsd.org/changeset/base/366984 Log: cache: drop write-only vars Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Oct 24 00:03:11 2020 (r366983) +++ head/sys/kern/vfs_cache.c Sat Oct 24 01:13:02 2020 (r366984) @@ -1163,7 +1163,6 @@ cache_neg_evict(void) { struct namecache *ncp, *ncp2; struct neglist *nl; - struct negstate *ns; struct vnode *dvp; struct mtx *dvlp; struct mtx *blp; @@ -1188,7 +1187,6 @@ cache_neg_evict(void) mtx_unlock(&nl->nl_evict_lock); return (false); } - ns = NCP2NEGSTATE(ncp); nlen = ncp->nc_nlen; dvp = ncp->nc_dvp; hash = cache_get_hash(ncp->nc_name, nlen, dvp); @@ -4322,11 +4320,9 @@ cache_fplookup_parse_advance(struct cache_fpl *fpl) static int __noinline cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) { - struct componentname *cnp; struct vnode *dvp; seqc_t dvp_seqc; - cnp = fpl->cnp; dvp = fpl->dvp; dvp_seqc = fpl->dvp_seqc; From owner-svn-src-head@freebsd.org Sat Oct 24 01:13:16 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAE2E42B4BF; Sat, 24 Oct 2020 01:13:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJ34r5SVNz3YjG; Sat, 24 Oct 2020 01:13:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A013D1036A; Sat, 24 Oct 2020 01:13:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09O1DGjx036361; Sat, 24 Oct 2020 01:13:16 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09O1DG9w036360; Sat, 24 Oct 2020 01:13:16 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010240113.09O1DG9w036360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 24 Oct 2020 01:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366985 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366985 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 01:13:16 -0000 Author: mjg Date: Sat Oct 24 01:13:16 2020 New Revision: 366985 URL: https://svnweb.freebsd.org/changeset/base/366985 Log: cache: fix some typos Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Oct 24 01:13:02 2020 (r366984) +++ head/sys/kern/vfs_cache.c Sat Oct 24 01:13:16 2020 (r366985) @@ -305,7 +305,7 @@ SYSCTL_ULONG(_vfs_cache_param, OID_AUTO, negfactor, CT "Ratio of negative namecache entries"); /* - * Negative entry % of namecahe capacity above which automatic eviction is allowed. + * Negative entry % of namecache capacity above which automatic eviction is allowed. * * Check cache_neg_evict_cond for details. */ @@ -750,7 +750,7 @@ sysctl_negminpct(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_vfs_cache_param, OID_AUTO, negminpct, CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, 0, sysctl_negminpct, - "I", "Negative entry \% of namecahe capacity above which automatic eviction is allowed"); + "I", "Negative entry \% of namecache capacity above which automatic eviction is allowed"); #ifdef DIAGNOSTIC /* From owner-svn-src-head@freebsd.org Sat Oct 24 01:13:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D29742B357; Sat, 24 Oct 2020 01:13:48 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJ35S0JRCz3YVS; Sat, 24 Oct 2020 01:13:48 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC42010535; Sat, 24 Oct 2020 01:13:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09O1Dl4P036428; Sat, 24 Oct 2020 01:13:47 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09O1DluD036427; Sat, 24 Oct 2020 01:13:47 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010240113.09O1DluD036427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 24 Oct 2020 01:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366986 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366986 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 01:13:48 -0000 Author: mjg Date: Sat Oct 24 01:13:47 2020 New Revision: 366986 URL: https://svnweb.freebsd.org/changeset/base/366986 Log: cache: fold branch prediction into cache_ncp_canuse Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Oct 24 01:13:16 2020 (r366985) +++ head/sys/kern/vfs_cache.c Sat Oct 24 01:13:47 2020 (r366986) @@ -233,14 +233,15 @@ cache_ncp_invalidate(struct namecache *ncp) * All places which elide locks are supposed to call this after they are * done with reading from an entry. */ -static bool -cache_ncp_canuse(struct namecache *ncp) -{ +#define cache_ncp_canuse(ncp) ({ \ + struct namecache *_ncp = (ncp); \ + u_char _nc_flag; \ + \ + atomic_thread_fence_acq(); \ + _nc_flag = atomic_load_char(&_ncp->nc_flag); \ + __predict_true((_nc_flag & (NCF_INVALID | NCF_WIP)) == 0); \ +}) - atomic_thread_fence_acq(); - return ((atomic_load_char(&ncp->nc_flag) & (NCF_INVALID | NCF_WIP)) == 0); -} - /* * Name caching works as follows: * @@ -1056,7 +1057,7 @@ cache_neg_promote_cond(struct vnode *dvp, struct compo goto out_abort; } - if (__predict_false(!cache_ncp_canuse(ncp))) { + if (!cache_ncp_canuse(ncp)) { goto out_abort; } @@ -1834,7 +1835,7 @@ negative_success: cache_out_ts(ncp, tsp, ticksp); whiteout = (ncp->nc_flag & NCF_WHITE); neg_promote = cache_neg_hit_prep(ncp); - if (__predict_false(!cache_ncp_canuse(ncp))) { + if (!cache_ncp_canuse(ncp)) { cache_neg_hit_abort(ncp); vfs_smr_exit(); goto out_fallback; @@ -4008,7 +4009,7 @@ cache_fplookup_dotdot(struct cache_fpl *fpl) fpl->tvp = ncp->nc_dvp; } - if (__predict_false(!cache_ncp_canuse(ncp))) { + if (!cache_ncp_canuse(ncp)) { return (cache_fpl_aborted(fpl)); } @@ -4041,7 +4042,7 @@ cache_fplookup_neg(struct cache_fpl *fpl, struct namec return (cache_fpl_partial(fpl)); } neg_promote = cache_neg_hit_prep(ncp); - if (__predict_false(!cache_ncp_canuse(ncp))) { + if (!cache_ncp_canuse(ncp)) { cache_neg_hit_abort(ncp); return (cache_fpl_partial(fpl)); } @@ -4096,7 +4097,7 @@ cache_fplookup_next(struct cache_fpl *fpl) return (cache_fplookup_neg(fpl, ncp, hash)); } - if (__predict_false(!cache_ncp_canuse(ncp))) { + if (!cache_ncp_canuse(ncp)) { return (cache_fpl_partial(fpl)); } From owner-svn-src-head@freebsd.org Sat Oct 24 01:14:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC9CA42B75F; Sat, 24 Oct 2020 01:14:17 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJ3615l0Dz3Z1b; Sat, 24 Oct 2020 01:14:17 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8410106F4; Sat, 24 Oct 2020 01:14:17 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09O1EHaF036498; Sat, 24 Oct 2020 01:14:17 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09O1EHAH036497; Sat, 24 Oct 2020 01:14:17 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010240114.09O1EHAH036497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 24 Oct 2020 01:14:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366987 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366987 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 01:14:18 -0000 Author: mjg Date: Sat Oct 24 01:14:17 2020 New Revision: 366987 URL: https://svnweb.freebsd.org/changeset/base/366987 Log: cache: refactor alloc/free This in particular centralizes manipulation of numcache. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Oct 24 01:13:47 2020 (r366986) +++ head/sys/kern/vfs_cache.c Sat Oct 24 01:14:17 2020 (r366987) @@ -174,6 +174,19 @@ struct namecache_ts { */ #define CACHE_ZONE_ALIGNMENT UMA_ALIGNOF(time_t) +/* + * TODO: the initial value of CACHE_PATH_CUTOFF was inherited from the + * 4.4 BSD codebase. Later on struct namecache was tweaked to become + * smaller and the value was bumped to retain the total size, but it + * was never re-evaluated for suitability. A simple test counting + * lengths during package building shows that the value of 45 covers + * about 86% of all added entries, reaching 99% at 65. + * + * Regardless of the above, use of dedicated zones instead of malloc may be + * inducing additional waste. This may be hard to address as said zones are + * tied to VFS SMR. Even if retaining them, the current split should be + * reevaluated. + */ #ifdef __LP64__ #define CACHE_PATH_CUTOFF 45 #define CACHE_LARGE_PAD 6 @@ -212,6 +225,8 @@ _Static_assert((CACHE_ZONE_LARGE_TS_SIZE % (CACHE_ZONE */ #define NEG_HOT 0x01 +static bool cache_neg_evict_cond(u_long lnumcache); + /* * Mark an entry as invalid. * @@ -380,62 +395,7 @@ VP2VNODELOCK(struct vnode *vp) return (&vnodelocks[(((uintptr_t)(vp) >> 8) & ncvnodehash)]); } -/* - * UMA zones for the VFS cache. - * - * The small cache is used for entries with short names, which are the - * most common. The large cache is used for entries which are too big to - * fit in the small cache. - */ -static uma_zone_t __read_mostly cache_zone_small; -static uma_zone_t __read_mostly cache_zone_small_ts; -static uma_zone_t __read_mostly cache_zone_large; -static uma_zone_t __read_mostly cache_zone_large_ts; - -static struct namecache * -cache_alloc(int len, int ts) -{ - struct namecache_ts *ncp_ts; - struct namecache *ncp; - - if (__predict_false(ts)) { - if (len <= CACHE_PATH_CUTOFF) - ncp_ts = uma_zalloc_smr(cache_zone_small_ts, M_WAITOK); - else - ncp_ts = uma_zalloc_smr(cache_zone_large_ts, M_WAITOK); - ncp = &ncp_ts->nc_nc; - } else { - if (len <= CACHE_PATH_CUTOFF) - ncp = uma_zalloc_smr(cache_zone_small, M_WAITOK); - else - ncp = uma_zalloc_smr(cache_zone_large, M_WAITOK); - } - return (ncp); -} - static void -cache_free(struct namecache *ncp) -{ - struct namecache_ts *ncp_ts; - - MPASS(ncp != NULL); - if ((ncp->nc_flag & NCF_DVDROP) != 0) - vdrop(ncp->nc_dvp); - if (__predict_false(ncp->nc_flag & NCF_TS)) { - ncp_ts = __containerof(ncp, struct namecache_ts, nc_nc); - if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) - uma_zfree_smr(cache_zone_small_ts, ncp_ts); - else - uma_zfree_smr(cache_zone_large_ts, ncp_ts); - } else { - if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) - uma_zfree_smr(cache_zone_small, ncp); - else - uma_zfree_smr(cache_zone_large, ncp); - } -} - -static void cache_out_ts(struct namecache *ncp, struct timespec *tsp, int *ticksp) { struct namecache_ts *ncp_ts; @@ -547,6 +507,126 @@ cache_assert_vnode_locked(struct vnode *vp) } /* + * Directory vnodes with entries are held for two reasons: + * 1. make them less of a target for reclamation in vnlru + * 2. suffer smaller performance penalty in locked lookup as requeieing is avoided + * + * Note this preferably would not be done and it's a hold over from. It will be + * feasible to eliminate altogether if all filesystems start supporting + * lockless lookup. + */ +static void +cache_hold_vnode(struct vnode *vp) +{ + + cache_assert_vnode_locked(vp); + VNPASS(LIST_EMPTY(&vp->v_cache_src), vp); + vhold(vp); + counter_u64_add(numcachehv, 1); +} + +static void +cache_drop_vnode(struct vnode *vp) +{ + + /* + * Called after all locks are dropped, meaning we can't assert + * on the state of v_cache_src. + */ + vdrop(vp); + counter_u64_add(numcachehv, -1); +} + +/* + * UMA zones. + */ +static uma_zone_t __read_mostly cache_zone_small; +static uma_zone_t __read_mostly cache_zone_small_ts; +static uma_zone_t __read_mostly cache_zone_large; +static uma_zone_t __read_mostly cache_zone_large_ts; + +static struct namecache * +cache_alloc_uma(int len, bool ts) +{ + struct namecache_ts *ncp_ts; + struct namecache *ncp; + + if (__predict_false(ts)) { + if (len <= CACHE_PATH_CUTOFF) + ncp_ts = uma_zalloc_smr(cache_zone_small_ts, M_WAITOK); + else + ncp_ts = uma_zalloc_smr(cache_zone_large_ts, M_WAITOK); + ncp = &ncp_ts->nc_nc; + } else { + if (len <= CACHE_PATH_CUTOFF) + ncp = uma_zalloc_smr(cache_zone_small, M_WAITOK); + else + ncp = uma_zalloc_smr(cache_zone_large, M_WAITOK); + } + return (ncp); +} + +static void +cache_free_uma(struct namecache *ncp) +{ + struct namecache_ts *ncp_ts; + + if (__predict_false(ncp->nc_flag & NCF_TS)) { + ncp_ts = __containerof(ncp, struct namecache_ts, nc_nc); + if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) + uma_zfree_smr(cache_zone_small_ts, ncp_ts); + else + uma_zfree_smr(cache_zone_large_ts, ncp_ts); + } else { + if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) + uma_zfree_smr(cache_zone_small, ncp); + else + uma_zfree_smr(cache_zone_large, ncp); + } +} + +static struct namecache * +cache_alloc(int len, bool ts) +{ + u_long lnumcache; + + /* + * Avoid blowout in namecache entries. + * + * Bugs: + * 1. filesystems may end up tryng to add an already existing entry + * (for example this can happen after a cache miss during concurrent + * lookup), in which case we will call cache_neg_evict despite not + * adding anything. + * 2. the routine may fail to free anything and no provisions are made + * to make it try harder (see the inside for failure modes) + * 3. it only ever looks at negative entries. + */ + lnumcache = atomic_fetchadd_long(&numcache, 1) + 1; + if (cache_neg_evict_cond(lnumcache)) { + lnumcache = atomic_load_long(&numcache); + } + if (__predict_false(lnumcache >= ncsize)) { + atomic_subtract_long(&numcache, 1); + counter_u64_add(numdrops, 1); + return (NULL); + } + return (cache_alloc_uma(len, ts)); +} + +static void +cache_free(struct namecache *ncp) +{ + + MPASS(ncp != NULL); + if ((ncp->nc_flag & NCF_DVDROP) != 0) { + cache_drop_vnode(ncp->nc_dvp); + } + cache_free_uma(ncp); + atomic_subtract_long(&numcache, 1); +} + +/* * TODO: With the value stored we can do better than computing the hash based * on the address. The choice of FNV should also be revisited. */ @@ -1298,10 +1378,8 @@ cache_zap_locked(struct namecache *ncp) LIST_REMOVE(ncp, nc_src); if (LIST_EMPTY(&ncp->nc_dvp->v_cache_src)) { ncp->nc_flag |= NCF_DVDROP; - counter_u64_add(numcachehv, -1); } } - atomic_subtract_long(&numcache, 1); } static void @@ -2110,7 +2188,6 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, uint32_t hash; int flag; int len; - u_long lnumcache; VNPASS(dvp != vp, dvp); VNPASS(!VN_IS_DOOMED(dvp), dvp); @@ -2135,27 +2212,9 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, } } - /* - * Avoid blowout in namecache entries. - * - * Bugs: - * 1. filesystems may end up tryng to add an already existing entry - * (for example this can happen after a cache miss during concurrent - * lookup), in which case we will call cache_neg_evict despite not - * adding anything. - * 2. the routine may fail to free anything and no provisions are made - * to make it try harder (see the inside for failure modes) - * 3. it only ever looks at negative entries. - */ - lnumcache = atomic_fetchadd_long(&numcache, 1) + 1; - if (cache_neg_evict_cond(lnumcache)) { - lnumcache = atomic_load_long(&numcache); - } - if (__predict_false(lnumcache >= ncsize)) { - atomic_subtract_long(&numcache, 1); - counter_u64_add(numdrops, 1); + ncp = cache_alloc(cnp->cn_namelen, tsp != NULL); + if (ncp == NULL) return; - } cache_celockstate_init(&cel); ndd = NULL; @@ -2165,7 +2224,6 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, * Calculate the hash key and setup as much of the new * namecache entry as possible before acquiring the lock. */ - ncp = cache_alloc(cnp->cn_namelen, tsp != NULL); ncp->nc_flag = flag | NCF_WIP; ncp->nc_vp = vp; if (vp == NULL) @@ -2276,8 +2334,7 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, if (flag != NCF_ISDOTDOT) { if (LIST_EMPTY(&dvp->v_cache_src)) { - vhold(dvp); - counter_u64_add(numcachehv, 1); + cache_hold_vnode(dvp); } LIST_INSERT_HEAD(&dvp->v_cache_src, ncp, nc_src); } @@ -2318,7 +2375,6 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, return; out_unlock_free: cache_enter_unlock(&cel); - atomic_subtract_long(&numcache, 1); cache_free(ncp); return; } From owner-svn-src-head@freebsd.org Sat Oct 24 01:14:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3C0B42BA26; Sat, 24 Oct 2020 01:14:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJ36j3l4jz3Z0F; Sat, 24 Oct 2020 01:14:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63C351036C; Sat, 24 Oct 2020 01:14:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09O1ErMJ036568; Sat, 24 Oct 2020 01:14:53 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09O1ErBm036567; Sat, 24 Oct 2020 01:14:53 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010240114.09O1ErBm036567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 24 Oct 2020 01:14:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366988 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366988 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 01:14:53 -0000 Author: mjg Date: Sat Oct 24 01:14:52 2020 New Revision: 366988 URL: https://svnweb.freebsd.org/changeset/base/366988 Log: cache: batch updates to numcache in case of mass removal Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Oct 24 01:14:17 2020 (r366987) +++ head/sys/kern/vfs_cache.c Sat Oct 24 01:14:52 2020 (r366988) @@ -110,6 +110,7 @@ SDT_PROBE_DEFINE2(vfs, namecache, removecnp, hit, "str SDT_PROBE_DEFINE2(vfs, namecache, removecnp, miss, "struct vnode *", "struct componentname *"); SDT_PROBE_DEFINE1(vfs, namecache, purge, done, "struct vnode *"); +SDT_PROBE_DEFINE1(vfs, namecache, purge, batch, "int"); SDT_PROBE_DEFINE1(vfs, namecache, purge_negative, done, "struct vnode *"); SDT_PROBE_DEFINE1(vfs, namecache, purgevfs, done, "struct mount *"); SDT_PROBE_DEFINE3(vfs, namecache, zap, done, "struct vnode *", "char *", @@ -166,6 +167,8 @@ struct namecache_ts { struct namecache nc_nc; }; +TAILQ_HEAD(cache_freebatch, namecache); + /* * At least mips n32 performs 64-bit accesses to timespec as found * in namecache_ts and requires them to be aligned. Since others @@ -626,6 +629,27 @@ cache_free(struct namecache *ncp) atomic_subtract_long(&numcache, 1); } +static void +cache_free_batch(struct cache_freebatch *batch) +{ + struct namecache *ncp, *nnp; + int i; + + i = 0; + if (TAILQ_EMPTY(batch)) + goto out; + TAILQ_FOREACH_SAFE(ncp, batch, nc_dst, nnp) { + if ((ncp->nc_flag & NCF_DVDROP) != 0) { + cache_drop_vnode(ncp->nc_dvp); + } + cache_free_uma(ncp); + i++; + } + atomic_subtract_long(&numcache, i); +out: + SDT_PROBE1(vfs, namecache, purge, batch, i); +} + /* * TODO: With the value stored we can do better than computing the hash based * on the address. The choice of FNV should also be revisited. @@ -2524,11 +2548,11 @@ cache_changesize(u_long newmaxvnodes) static void cache_purge_impl(struct vnode *vp) { - TAILQ_HEAD(, namecache) ncps; - struct namecache *ncp, *nnp; + struct cache_freebatch batch; + struct namecache *ncp; struct mtx *vlp, *vlp2; - TAILQ_INIT(&ncps); + TAILQ_INIT(&batch); vlp = VP2VNODELOCK(vp); vlp2 = NULL; mtx_lock(vlp); @@ -2537,13 +2561,13 @@ retry: ncp = LIST_FIRST(&vp->v_cache_src); if (!cache_zap_locked_vnode_kl2(ncp, vp, &vlp2)) goto retry; - TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); + TAILQ_INSERT_TAIL(&batch, ncp, nc_dst); } while (!TAILQ_EMPTY(&vp->v_cache_dst)) { ncp = TAILQ_FIRST(&vp->v_cache_dst); if (!cache_zap_locked_vnode_kl2(ncp, vp, &vlp2)) goto retry; - TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); + TAILQ_INSERT_TAIL(&batch, ncp, nc_dst); } ncp = vp->v_cache_dd; if (ncp != NULL) { @@ -2551,15 +2575,13 @@ retry: ("lost dotdot link")); if (!cache_zap_locked_vnode_kl2(ncp, vp, &vlp2)) goto retry; - TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); + TAILQ_INSERT_TAIL(&batch, ncp, nc_dst); } KASSERT(vp->v_cache_dd == NULL, ("incomplete purge")); mtx_unlock(vlp); if (vlp2 != NULL) mtx_unlock(vlp2); - TAILQ_FOREACH_SAFE(ncp, &ncps, nc_dst, nnp) { - cache_free(ncp); - } + cache_free_batch(&batch); } /* @@ -2617,26 +2639,24 @@ cache_purge_vgone(struct vnode *vp) void cache_purge_negative(struct vnode *vp) { - TAILQ_HEAD(, namecache) ncps; + struct cache_freebatch batch; struct namecache *ncp, *nnp; struct mtx *vlp; SDT_PROBE1(vfs, namecache, purge_negative, done, vp); if (LIST_EMPTY(&vp->v_cache_src)) return; - TAILQ_INIT(&ncps); + TAILQ_INIT(&batch); vlp = VP2VNODELOCK(vp); mtx_lock(vlp); LIST_FOREACH_SAFE(ncp, &vp->v_cache_src, nc_src, nnp) { if (!(ncp->nc_flag & NCF_NEGATIVE)) continue; cache_zap_negative_locked_vnode_kl(ncp, vp); - TAILQ_INSERT_TAIL(&ncps, ncp, nc_dst); + TAILQ_INSERT_TAIL(&batch, ncp, nc_dst); } mtx_unlock(vlp); - TAILQ_FOREACH_SAFE(ncp, &ncps, nc_dst, nnp) { - cache_free(ncp); - } + cache_free_batch(&batch); } void From owner-svn-src-head@freebsd.org Sat Oct 24 01:59:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D93A742C9FF; Sat, 24 Oct 2020 01:59:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJ45d59K6z3bML; Sat, 24 Oct 2020 01:59:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94F1910F26; Sat, 24 Oct 2020 01:59:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09O1x1AR061130; Sat, 24 Oct 2020 01:59:01 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09O1x1j9061129; Sat, 24 Oct 2020 01:59:01 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202010240159.09O1x1j9061129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 24 Oct 2020 01:59:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366989 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 366989 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 01:59:01 -0000 Author: imp Date: Sat Oct 24 01:59:01 2020 New Revision: 366989 URL: https://svnweb.freebsd.org/changeset/base/366989 Log: nvme: Remove compat code for older kernels Remove code that supported pre-2011 kernels. CTLTYPE_S64 was defined in rev 217616. All supported branches have it, so remove its compat definition as OBE. Modified: head/sys/dev/nvme/nvme_sysctl.c Modified: head/sys/dev/nvme/nvme_sysctl.c ============================================================================== --- head/sys/dev/nvme/nvme_sysctl.c Sat Oct 24 01:14:52 2020 (r366988) +++ head/sys/dev/nvme/nvme_sysctl.c Sat Oct 24 01:59:01 2020 (r366989) @@ -52,16 +52,6 @@ SYSCTL_BOOL(_hw_nvme, OID_AUTO, verbose_cmd_dump, CTLF &nvme_verbose_cmd_dump, 0, "enable verbose command printting when a command fails"); -/* - * CTLTYPE_S64 and sysctl_handle_64 were added in r217616. Define these - * explicitly here for older kernels that don't include the r217616 - * changeset. - */ -#ifndef CTLTYPE_S64 -#define CTLTYPE_S64 CTLTYPE_QUAD -#define sysctl_handle_64 sysctl_handle_quad -#endif - static void nvme_dump_queue(struct nvme_qpair *qpair) { From owner-svn-src-head@freebsd.org Sat Oct 24 05:52:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5FEC43C988; Sat, 24 Oct 2020 05:52:30 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJ9H23yqhz454K; Sat, 24 Oct 2020 05:52:30 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 698DE13DAB; Sat, 24 Oct 2020 05:52:30 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09O5qU72009227; Sat, 24 Oct 2020 05:52:30 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09O5qUZi009226; Sat, 24 Oct 2020 05:52:30 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202010240552.09O5qUZi009226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 24 Oct 2020 05:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366992 - head/usr.bin/nfsstat X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/usr.bin/nfsstat X-SVN-Commit-Revision: 366992 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 05:52:30 -0000 Author: asomers Date: Sat Oct 24 05:52:29 2020 New Revision: 366992 URL: https://svnweb.freebsd.org/changeset/base/366992 Log: nfsstat: delete unused fields Ever since r192762 nfsstat has included a few fields whose values were always 0. They were copied from OpenBSD, but have never been used on FreeBSD. Don't display them. Reviewed by: rmacklem Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D26920 Modified: head/usr.bin/nfsstat/nfsstat.c Modified: head/usr.bin/nfsstat/nfsstat.c ============================================================================== --- head/usr.bin/nfsstat/nfsstat.c Sat Oct 24 05:26:58 2020 (r366991) +++ head/usr.bin/nfsstat/nfsstat.c Sat Oct 24 05:52:29 2020 (r366992) @@ -450,12 +450,7 @@ intpr(int clientOnly, int serverOnly) xo_close_container("operations"); xo_open_container("server"); - xo_emit("{T:Server Re-Failed}\n"); - xo_emit("{:retfailed/%16ju}\n", (uintmax_t)ext_nfsstats.srvrpc_errs); - xo_emit("{T:Server Faults}\n"); - xo_emit("{:faults/%13ju}\n", (uintmax_t)ext_nfsstats.srv_errs); - xo_emit("{T:Server Write Gathering:/%13.13s}\n"); xo_emit("{T:WriteOps/%13.13s}{T:WriteRPC/%13.13s}" @@ -473,12 +468,10 @@ intpr(int clientOnly, int serverOnly) xo_open_container("cache"); xo_emit("{T:Server Cache Stats:/%13.13s}\n"); - xo_emit("{T:Inprog/%13.13s}{T:Idem/%13.13s}" + xo_emit("{T:Inprog/%13.13s}" "{T:Non-Idem/%13.13s}{T:Misses/%13.13s}\n"); - xo_emit("{:inprog/%13ju}{:idem/%13ju}" - "{:nonidem/%13ju}{:misses/%13ju}\n", + xo_emit("{:inprog/%13ju}{:nonidem/%13ju}{:misses/%13ju}\n", (uintmax_t)ext_nfsstats.srvcache_inproghits, - (uintmax_t)ext_nfsstats.srvcache_idemdonehits, (uintmax_t)ext_nfsstats.srvcache_nonidemdonehits, (uintmax_t)ext_nfsstats.srvcache_misses); xo_close_container("cache"); @@ -1057,17 +1050,12 @@ exp_intpr(int clientOnly, int serverOnly, int nfs41) if (printtitle) xo_emit("{T:Server:}\n"); xo_open_container("server"); - xo_emit("{T:Retfailed/%13.13s}{T:Faults/%13.13s}" - "{T:Clients/%13.13s}\n"); - xo_emit("{:retfailed/%13ju}{:faults/%13ju}{:clients/%13ju}\n", - (uintmax_t)ext_nfsstats.srv_errs, - (uintmax_t)ext_nfsstats.srvrpc_errs, - (uintmax_t)ext_nfsstats.srvclients); - xo_emit("{T:OpenOwner/%13.13s}{T:Opens/%13.13s}" - "{T:LockOwner/%13.13s}{T:Locks/%13.13s}" + xo_emit("{T:Clients/%13.13s}{T:OpenOwner/%13.13s}" + "{T:Opens/%13.13s}{T:LockOwner/%13.13s}{T:Locks/%13.13s}" "{T:Delegs/%13.13s}\n"); - xo_emit("{:openowner/%13ju}{:opens/%13ju}{:lockowner/%13ju}" - "{:locks/%13ju}{:delegs/%13ju}\n", + xo_emit("{:clients/%13ju}{:openowner/%13ju}{:opens/%13ju}" + "{:lockowner/%13ju}{:locks/%13ju}{:delegs/%13ju}\n", + (uintmax_t)ext_nfsstats.srvclients, (uintmax_t)ext_nfsstats.srvopenowners, (uintmax_t)ext_nfsstats.srvopens, (uintmax_t)ext_nfsstats.srvlockowners, @@ -1078,13 +1066,12 @@ exp_intpr(int clientOnly, int serverOnly, int nfs41) if (printtitle) xo_emit("{T:Server Cache Stats:}\n"); xo_open_container("cache"); - xo_emit("{T:Inprog/%13.13s}{T:Idem/%13.13s}" + xo_emit("{T:Inprog/%13.13s}" "{T:Non-idem/%13.13s}{T:Misses/%13.13s}" "{T:CacheSize/%13.13s}{T:TCPPeak/%13.13s}\n"); - xo_emit("{:inprog/%13ju}{:idem/%13ju}{:nonidem/%13ju}" + xo_emit("{:inprog/%13ju}{:nonidem/%13ju}" "{:misses/%13ju}{:cachesize/%13ju}{:tcppeak/%13ju}\n", (uintmax_t)ext_nfsstats.srvcache_inproghits, - (uintmax_t)ext_nfsstats.srvcache_idemdonehits, (uintmax_t)ext_nfsstats.srvcache_nonidemdonehits, (uintmax_t)ext_nfsstats.srvcache_misses, (uintmax_t)ext_nfsstats.srvcache_size, From owner-svn-src-head@freebsd.org Sat Oct 24 07:48:49 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD49643FCED; Sat, 24 Oct 2020 07:48:49 +0000 (UTC) (envelope-from kozlov@ravenloft.kiev.ua) Received: from ravenloft.kiev.ua (ravenloft.kiev.ua [94.244.131.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJCsF2gzBz4CVd; Sat, 24 Oct 2020 07:48:49 +0000 (UTC) (envelope-from kozlov@ravenloft.kiev.ua) Date: Sat, 24 Oct 2020 09:48:40 +0200 From: Alex Kozlov To: Stefan =?iso-8859-1?Q?E=DFer?= Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366962 - in head: include usr.bin/calendar Message-ID: <20201024074840.GA26119@ravenloft.kiev.ua> References: <202010230922.09N9MNZu040921@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202010230922.09N9MNZu040921@repo.freebsd.org> X-Rspamd-Queue-Id: 4CJCsF2gzBz4CVd X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:34743, ipnet:94.244.128.0/18, country:UA] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 07:48:49 -0000 On Fri, Oct 23, 2020 at 09:22:23AM +0000, Stefan Eßer wrote: > Author: se > Date: Fri Oct 23 09:22:23 2020 > New Revision: 366962 > URL: https://svnweb.freebsd.org/changeset/base/366962 > > Log: > Add search of LOCALBASE/share/calendar for calendars supplied by a port. > > Calendar files in LOCALBASE override similarily named ones in the base > system. This could easily be changed if the base system calendars should > have precedence, but it could lead to a violation of POLA since then the > port's files were ignored unless those in base have been deleted. > > There was no definition of _PATH_LOCALBASE in paths.h, but verbatim uses > of /usr/local existed for _PATH_DEFPATH. Use _PATH_LOCALBASE here to ease > a consistent modification of this prefix. You are hardcoding assumption that LOCALBASE = /usr/local. Please make it overridable with LOCALBASE environment variable. > Reviewed by: imp, pfg > Differential Revision: https://reviews.freebsd.org/D26882 > > Modified: > head/include/paths.h > head/usr.bin/calendar/io.c > head/usr.bin/calendar/pathnames.h > > Modified: head/include/paths.h > ============================================================================== > --- head/include/paths.h Fri Oct 23 08:44:53 2020 (r366961) > +++ head/include/paths.h Fri Oct 23 09:22:23 2020 (r366962) > @@ -37,8 +37,11 @@ > > #include > > +#define _PATH_LOCALBASE "/usr/local" > + > /* Default search path. */ > -#define _PATH_DEFPATH "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin" > +#define _PATH_DEFPATH "/sbin:/bin:/usr/sbin:/usr/bin:" \ > + _PATH_LOCALBASE "/sbin:" _PATH_LOCALBASE "/bin" -- Alex From owner-svn-src-head@freebsd.org Sat Oct 24 09:52:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1825443711; Sat, 24 Oct 2020 09:52:33 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJGc06Ygzz4Ktc; Sat, 24 Oct 2020 09:52:32 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 6EB71260203; Sat, 24 Oct 2020 11:52:29 +0200 (CEST) Subject: Re: svn commit: r366372 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf To: Warner Losh , Kyle Evans Cc: Niclas Zeising , "Alexander V. Chernikov" , Emmanuel Vadot , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <202010021826.092IQfdj023808@repo.freebsd.org> <44421602932538@mail.yandex.ru> <43251602934532@mail.yandex.ru> <59021602950992@mail.yandex.ru> From: Hans Petter Selasky Message-ID: Date: Sat, 24 Oct 2020 11:51:51 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CJGc06Ygzz4Ktc X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-2.78 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; ARC_NA(0.00)[]; NEURAL_HAM_LONG(-0.95)[-0.951]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.48)[-0.478]; RCPT_COUNT_SEVEN(0.00)[8]; NEURAL_HAM_MEDIUM(-1.05)[-1.053]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 09:52:33 -0000 On 2020-10-24 02:13, Warner Losh wrote: > I was going to suggest and try this change, but life has been complicated... > > Has it been committed? > No, not yet. --HPS From owner-svn-src-head@freebsd.org Sat Oct 24 10:23:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F8224441CA; Sat, 24 Oct 2020 10:23:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJHHZ3JhHz4MYV; Sat, 24 Oct 2020 10:23:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5633816AFF; Sat, 24 Oct 2020 10:23:22 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OANMIP075641; Sat, 24 Oct 2020 10:23:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OANMcL075640; Sat, 24 Oct 2020 10:23:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010241023.09OANMcL075640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 24 Oct 2020 10:23:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366993 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 366993 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 10:23:22 -0000 Author: hselasky Date: Sat Oct 24 10:23:21 2020 New Revision: 366993 URL: https://svnweb.freebsd.org/changeset/base/366993 Log: Run code through "clang-format -style=file" with some additional fixes. No functional change. Suggested by: kib@ and emaste@ Differential Revision: https://reviews.freebsd.org/D26254 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/net/if_infiniband.c Modified: head/sys/net/if_infiniband.c ============================================================================== --- head/sys/net/if_infiniband.c Sat Oct 24 05:52:29 2020 (r366992) +++ head/sys/net/if_infiniband.c Sat Oct 24 10:23:21 2020 (r366993) @@ -30,44 +30,42 @@ __FBSDID("$FreeBSD$"); #include -#include -#include -#include +#include #include +#include +#include +#include #include #include -#include -#include +#include -#include -#include -#include +#include #include #include -#include -#include -#include +#include +#include #include -#include #include #include - -#include +#include +#include +#include +#include #include +#include #include - #include #include #include /* if_lagg(4) support */ -struct mbuf *(*lagg_input_infiniband_p)(struct ifnet *, struct mbuf *); +struct mbuf *(*lagg_input_infiniband_p)(struct ifnet *, struct mbuf *); #ifdef INET static inline void -infiniband_ipv4_multicast_map(uint32_t addr, - const uint8_t *broadcast, uint8_t *buf) +infiniband_ipv4_multicast_map( + uint32_t addr, const uint8_t *broadcast, uint8_t *buf) { uint8_t scope; @@ -99,8 +97,8 @@ infiniband_ipv4_multicast_map(uint32_t addr, #ifdef INET6 static inline void -infiniband_ipv6_multicast_map(const struct in6_addr *addr, - const uint8_t *broadcast, uint8_t *buf) +infiniband_ipv6_multicast_map( + const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf) { uint8_t scope; @@ -128,7 +126,7 @@ infiniband_bpf_mtap(struct ifnet *ifp, struct mbuf *mb { struct infiniband_header *ibh; struct ether_header eh; - + if (mb->m_len < sizeof(*ibh)) return; @@ -198,7 +196,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, c if (error) { if (error == EWOULDBLOCK) error = 0; - m = NULL; /* mbuf is consumed by resolver */ + m = NULL; /* mbuf is consumed by resolver */ goto bad; } } @@ -265,7 +263,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, c if (error) { if (error == EWOULDBLOCK) error = 0; - m = NULL; /* mbuf is consumed by resolver */ + m = NULL; /* mbuf is consumed by resolver */ goto bad; } } @@ -410,8 +408,8 @@ done: } static int -infiniband_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa, - struct sockaddr *sa) +infiniband_resolvemulti( + struct ifnet *ifp, struct sockaddr **llsa, struct sockaddr *sa) { struct sockaddr_dl *sdl; #ifdef INET @@ -442,8 +440,8 @@ infiniband_resolvemulti(struct ifnet *ifp, struct sock sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); sdl->sdl_alen = INFINIBAND_ADDR_LEN; e_addr = LLADDR(sdl); - infiniband_ipv4_multicast_map(sin->sin_addr.s_addr, ifp->if_broadcastaddr, - e_addr); + infiniband_ipv4_multicast_map( + sin->sin_addr.s_addr, ifp->if_broadcastaddr, e_addr); *llsa = (struct sockaddr *)sdl; return (0); #endif @@ -462,7 +460,8 @@ infiniband_resolvemulti(struct ifnet *ifp, struct sock sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); sdl->sdl_alen = INFINIBAND_ADDR_LEN; e_addr = LLADDR(sdl); - infiniband_ipv6_multicast_map(&sin6->sin6_addr, ifp->if_broadcastaddr, e_addr); + infiniband_ipv6_multicast_map( + &sin6->sin6_addr, ifp->if_broadcastaddr, e_addr); *llsa = (struct sockaddr *)sdl; return (0); #endif @@ -487,7 +486,7 @@ infiniband_ifattach(struct ifnet *ifp, const uint8_t * ifp->if_resolvemulti = infiniband_resolvemulti; if (ifp->if_baudrate == 0) - ifp->if_baudrate = IF_Gbps(10); /* default value */ + ifp->if_baudrate = IF_Gbps(10); /* default value */ if (llb != NULL) ifp->if_broadcastaddr = llb; From owner-svn-src-head@freebsd.org Sat Oct 24 10:46:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F407D444D0E; Sat, 24 Oct 2020 10:46:44 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJHpX3QCVz4NhB; Sat, 24 Oct 2020 10:46:44 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 09OAkSVP048836 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 24 Oct 2020 13:46:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 09OAkSVP048836 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 09OAkSGs048835; Sat, 24 Oct 2020 13:46:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 24 Oct 2020 13:46:28 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366993 - head/sys/net Message-ID: <20201024104628.GB2643@kib.kiev.ua> References: <202010241023.09OANMcL075640@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202010241023.09OANMcL075640@repo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CJHpX3QCVz4NhB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 10:46:45 -0000 On Sat, Oct 24, 2020 at 10:23:22AM +0000, Hans Petter Selasky wrote: > Author: hselasky > Date: Sat Oct 24 10:23:21 2020 > New Revision: 366993 > URL: https://svnweb.freebsd.org/changeset/base/366993 > > Log: > Run code through "clang-format -style=file" with some additional fixes. > No functional change. > > Suggested by: kib@ and emaste@ > Differential Revision: https://reviews.freebsd.org/D26254 > MFC after: 1 week > Sponsored by: Mellanox Technologies // NVIDIA Networking > > Modified: > head/sys/net/if_infiniband.c > > Modified: head/sys/net/if_infiniband.c > ============================================================================== > --- head/sys/net/if_infiniband.c Sat Oct 24 05:52:29 2020 (r366992) > +++ head/sys/net/if_infiniband.c Sat Oct 24 10:23:21 2020 (r366993) > @@ -30,44 +30,42 @@ > __FBSDID("$FreeBSD$"); > > #include > -#include > -#include > -#include sys/systm.h should come right after sys/param.h. These two headers are exceptions to the normal alphabetical rule. > +#include > #include > +#include > +#include > +#include > #include > #include > -#include > -#include > +#include > > -#include > -#include > -#include > +#include > #include > #include > -#include > -#include > -#include > +#include > +#include > #include > -#include > #include > #include > - > -#include > +#include > +#include > +#include > +#include > #include > +#include > #include > - > #include > #include > > #include > > /* if_lagg(4) support */ > -struct mbuf *(*lagg_input_infiniband_p)(struct ifnet *, struct mbuf *); > +struct mbuf *(*lagg_input_infiniband_p)(struct ifnet *, struct mbuf *); > > #ifdef INET > static inline void > -infiniband_ipv4_multicast_map(uint32_t addr, > - const uint8_t *broadcast, uint8_t *buf) > +infiniband_ipv4_multicast_map( > + uint32_t addr, const uint8_t *broadcast, uint8_t *buf) And this is arguably regression, we fill line up to columns 72-80 before splitting to the continuation line. > { > uint8_t scope; > > @@ -99,8 +97,8 @@ infiniband_ipv4_multicast_map(uint32_t addr, > > #ifdef INET6 > static inline void > -infiniband_ipv6_multicast_map(const struct in6_addr *addr, > - const uint8_t *broadcast, uint8_t *buf) > +infiniband_ipv6_multicast_map( > + const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf) > { > uint8_t scope; > > @@ -128,7 +126,7 @@ infiniband_bpf_mtap(struct ifnet *ifp, struct mbuf *mb > { > struct infiniband_header *ibh; > struct ether_header eh; > - > + > if (mb->m_len < sizeof(*ibh)) > return; > > @@ -198,7 +196,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, c > if (error) { > if (error == EWOULDBLOCK) > error = 0; > - m = NULL; /* mbuf is consumed by resolver */ > + m = NULL; /* mbuf is consumed by resolver */ This is a regression as well, in-line comment is typically preceeded by tab. > goto bad; > } > } > @@ -265,7 +263,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, c > if (error) { > if (error == EWOULDBLOCK) > error = 0; > - m = NULL; /* mbuf is consumed by resolver */ > + m = NULL; /* mbuf is consumed by resolver */ > goto bad; > } > } > @@ -410,8 +408,8 @@ done: > } > > static int > -infiniband_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa, > - struct sockaddr *sa) > +infiniband_resolvemulti( > + struct ifnet *ifp, struct sockaddr **llsa, struct sockaddr *sa) > { > struct sockaddr_dl *sdl; > #ifdef INET > @@ -442,8 +440,8 @@ infiniband_resolvemulti(struct ifnet *ifp, struct sock > sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); > sdl->sdl_alen = INFINIBAND_ADDR_LEN; > e_addr = LLADDR(sdl); > - infiniband_ipv4_multicast_map(sin->sin_addr.s_addr, ifp->if_broadcastaddr, > - e_addr); > + infiniband_ipv4_multicast_map( > + sin->sin_addr.s_addr, ifp->if_broadcastaddr, e_addr); > *llsa = (struct sockaddr *)sdl; > return (0); > #endif > @@ -462,7 +460,8 @@ infiniband_resolvemulti(struct ifnet *ifp, struct sock > sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND); > sdl->sdl_alen = INFINIBAND_ADDR_LEN; > e_addr = LLADDR(sdl); > - infiniband_ipv6_multicast_map(&sin6->sin6_addr, ifp->if_broadcastaddr, e_addr); > + infiniband_ipv6_multicast_map( > + &sin6->sin6_addr, ifp->if_broadcastaddr, e_addr); > *llsa = (struct sockaddr *)sdl; > return (0); > #endif > @@ -487,7 +486,7 @@ infiniband_ifattach(struct ifnet *ifp, const uint8_t * > ifp->if_resolvemulti = infiniband_resolvemulti; > > if (ifp->if_baudrate == 0) > - ifp->if_baudrate = IF_Gbps(10); /* default value */ > + ifp->if_baudrate = IF_Gbps(10); /* default value */ > if (llb != NULL) > ifp->if_broadcastaddr = llb; > From owner-svn-src-head@freebsd.org Sat Oct 24 10:52:10 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6126E444EBD; Sat, 24 Oct 2020 10:52:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJHwp2253z4P22; Sat, 24 Oct 2020 10:52:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A0DE17888; Sat, 24 Oct 2020 10:52:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OAqAaW091797; Sat, 24 Oct 2020 10:52:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OAqAUZ091796; Sat, 24 Oct 2020 10:52:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010241052.09OAqAUZ091796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 24 Oct 2020 10:52:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366994 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 366994 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 10:52:10 -0000 Author: hselasky Date: Sat Oct 24 10:52:09 2020 New Revision: 366994 URL: https://svnweb.freebsd.org/changeset/base/366994 Log: Fix order of header files: sys/systm.h should come right after sys/param.h Suggested by: kib@ Differential Revision: https://reviews.freebsd.org/D26254 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/net/if_infiniband.c Modified: head/sys/net/if_infiniband.c ============================================================================== --- head/sys/net/if_infiniband.c Sat Oct 24 10:23:21 2020 (r366993) +++ head/sys/net/if_infiniband.c Sat Oct 24 10:52:09 2020 (r366994) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -37,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include From owner-svn-src-head@freebsd.org Sat Oct 24 10:52:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FB02445245; Sat, 24 Oct 2020 10:52:26 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJHx60JzVz4PFb; Sat, 24 Oct 2020 10:52:25 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 7D5222601CA; Sat, 24 Oct 2020 12:52:24 +0200 (CEST) Subject: Re: svn commit: r366993 - head/sys/net To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202010241023.09OANMcL075640@repo.freebsd.org> <20201024104628.GB2643@kib.kiev.ua> From: Hans Petter Selasky Message-ID: Date: Sat, 24 Oct 2020 12:51:47 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201024104628.GB2643@kib.kiev.ua> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CJHx60JzVz4PFb X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-2.85 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net:c]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-0.94)[-0.939]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.59)[-0.587]; NEURAL_HAM_MEDIUM(-1.02)[-1.021]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 10:52:26 -0000 On 2020-10-24 12:46, Konstantin Belousov wrote: > sys/systm.h should come right after sys/param.h OK, fixed. --HPS From owner-svn-src-head@freebsd.org Sat Oct 24 12:52:06 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 903A54484D5; Sat, 24 Oct 2020 12:52:06 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJLbB3H7Tz4VyQ; Sat, 24 Oct 2020 12:52:06 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1603543926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DY17dSN5SGIFTfgtjE5floW7xxQaVGnldaldKOflv8M=; b=X2YifaXgMHfzE6JoOINl/5PDvp5l9KKw91JfXXDYDFdZMBOjJzLyrkSh3Me2n6wAWYiyJU +PPVyzAe/gmcjrBPx+tjbsjJcmm41mwAiVA71lWbmoQJQbzR3ueWwL1VPBjyFtNxNWlscx /835pCkY+ogwkWxrLuzr8StteZzAJPvDi6QFSuMszLJu9nw3q3Kio7SLyRtvAjR1hWIN4f WvoPq15AufZC8jbi5QPvPMTuWR55Mu5QgjR/PHCLp8nterGnUH3r3d27TalR3ut0l5RJ5r Xgfjerh9G7XZ6E+wH4N9Omz1Dtz3Wk4aj6UMwd4qrQM7KZec6cPXji/4KoeYzg== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 633B96CC1; Sat, 24 Oct 2020 12:52:06 +0000 (UTC) Date: Sat, 24 Oct 2020 12:52:06 +0000 From: Alexey Dokuchaev To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366993 - head/sys/net Message-ID: <20201024125206.GB38000@FreeBSD.org> References: <202010241023.09OANMcL075640@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202010241023.09OANMcL075640@repo.freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1603543926; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DY17dSN5SGIFTfgtjE5floW7xxQaVGnldaldKOflv8M=; b=qB6Tr4Ku8lSo/TI975MQi9Vkowl5p8slcEdB0dn7VYB9dsTHeDDVCQ28b/sMaKHJf/dOOJ gQbS6WhudHU3gy9plLbBKFsnCUFvtG5iXGWhzUdk2ZDucjSI9JnzbllaoZdkxDPFgXFiN6 E8tVeBJaX0Lc4WQF0ZaeaCOEjElkv+s2/+SOFog236depv6WH0JyilkfUdy6SNwrA7Y53z /+IxMvDEjB0W2Cu/UsYOCnoPBOUyV9GxsDkZwSPmcBrf/WVsn8g6jfg/cRZ5YPgVVDCUDG cANsoxFKqSG+SKXyEveLcbDQdw49T+y4kTn6Dah1eym53V4AEmu7jBKdMeHMpg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1603543926; a=rsa-sha256; cv=none; b=Z/4+8qwdrc0gI8WBVb4MrFfgQT5RPiDtw4Wy1DxUrkxm9ZinKiyDt0na/hbMu/4By38i3n 82JGlc4bcn9jzWiMig06zyZQSXUhAhINswz+K5P42PV/k325xb6WYeE3B49S9XJdEeaYn/ 60ub3Oiq/b2yfu1xfSBy4u57SOvFHxnsm5zM8Hc/LlQkC5uAG4c+J+SMAQ8649MWppgJqm fVJuBfGa/LN3ylcdv7d1BI/90S9tsoGKl2tXY5DNAkZy0SfAgg9RA8Bm7+FaIckSicK975 xWUR4Sp8BM4wBfcrOaH3X9sth05onh2phoj7Ynqu8NggzaJZR75Xbgo+Uabm6A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 12:52:06 -0000 On Sat, Oct 24, 2020 at 10:23:22AM +0000, Hans Petter Selasky wrote: > New Revision: 366993 > URL: https://svnweb.freebsd.org/changeset/base/366993 > > Log: > Run code through "clang-format -style=file" with some additional fixes. > No functional change. > > ... > @@ -99,8 +97,8 @@ infiniband_ipv4_multicast_map(uint32_t addr, > > #ifdef INET6 > static inline void > -infiniband_ipv6_multicast_map(const struct in6_addr *addr, > - const uint8_t *broadcast, uint8_t *buf) > +infiniband_ipv6_multicast_map( > + const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf) > { This is not how we format these in FreeBSD, please revert. It was correct before and no "fix" is need here. ./danfe From owner-svn-src-head@freebsd.org Sat Oct 24 13:07:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD31C448D9D; Sat, 24 Oct 2020 13:07:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJLxL4fNgz4WWY; Sat, 24 Oct 2020 13:07:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82C591908B; Sat, 24 Oct 2020 13:07:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OD7oBM075906; Sat, 24 Oct 2020 13:07:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OD7opi075905; Sat, 24 Oct 2020 13:07:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010241307.09OD7opi075905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 24 Oct 2020 13:07:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366995 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 366995 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 13:07:50 -0000 Author: hselasky Date: Sat Oct 24 13:07:50 2020 New Revision: 366995 URL: https://svnweb.freebsd.org/changeset/base/366995 Log: More style fixes (partial revert of r366994). Suggested by: danfe@ Differential Revision: https://reviews.freebsd.org/D26254 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/net/if_infiniband.c Modified: head/sys/net/if_infiniband.c ============================================================================== --- head/sys/net/if_infiniband.c Sat Oct 24 10:52:09 2020 (r366994) +++ head/sys/net/if_infiniband.c Sat Oct 24 13:07:50 2020 (r366995) @@ -64,8 +64,8 @@ struct mbuf *(*lagg_input_infiniband_p)(struct ifnet * #ifdef INET static inline void -infiniband_ipv4_multicast_map( - uint32_t addr, const uint8_t *broadcast, uint8_t *buf) +infiniband_ipv4_multicast_map(uint32_t addr, + const uint8_t *broadcast, uint8_t *buf) { uint8_t scope; @@ -97,8 +97,8 @@ infiniband_ipv4_multicast_map( #ifdef INET6 static inline void -infiniband_ipv6_multicast_map( - const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf) +infiniband_ipv6_multicast_map(const struct in6_addr *addr, + const uint8_t *broadcast, uint8_t *buf) { uint8_t scope; @@ -408,8 +408,8 @@ done: } static int -infiniband_resolvemulti( - struct ifnet *ifp, struct sockaddr **llsa, struct sockaddr *sa) +infiniband_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa, + struct sockaddr *sa) { struct sockaddr_dl *sdl; #ifdef INET From owner-svn-src-head@freebsd.org Sat Oct 24 13:08:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 445AA448F07; Sat, 24 Oct 2020 13:08:21 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJLxw0z21z4WrK; Sat, 24 Oct 2020 13:08:19 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 4E69F260393; Sat, 24 Oct 2020 15:08:12 +0200 (CEST) Subject: Re: svn commit: r366993 - head/sys/net To: Alexey Dokuchaev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202010241023.09OANMcL075640@repo.freebsd.org> <20201024125206.GB38000@FreeBSD.org> From: Hans Petter Selasky Message-ID: <999a005e-1ef8-3c45-fb07-94a3b6ebce1b@selasky.org> Date: Sat, 24 Oct 2020 15:07:34 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201024125206.GB38000@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CJLxw0z21z4WrK X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-2.74 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-0.95)[-0.953]; TO_DN_SOME(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.975]; NEURAL_HAM_SHORT(-0.52)[-0.516]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 13:08:21 -0000 On 2020-10-24 14:52, Alexey Dokuchaev wrote: > On Sat, Oct 24, 2020 at 10:23:22AM +0000, Hans Petter Selasky wrote: >> New Revision: 366993 >> URL: https://svnweb.freebsd.org/changeset/base/366993 >> >> Log: >> Run code through "clang-format -style=file" with some additional fixes. >> No functional change. >> >> ... >> @@ -99,8 +97,8 @@ infiniband_ipv4_multicast_map(uint32_t addr, >> >> #ifdef INET6 >> static inline void >> -infiniband_ipv6_multicast_map(const struct in6_addr *addr, >> - const uint8_t *broadcast, uint8_t *buf) >> +infiniband_ipv6_multicast_map( >> + const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf) >> { > > This is not how we format these in FreeBSD, please revert. It was correct > before and no "fix" is need here. Done. --HPS From owner-svn-src-head@freebsd.org Sat Oct 24 13:16:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BD0A4490F6; Sat, 24 Oct 2020 13:16:11 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJM6y6Sxmz4XkR; Sat, 24 Oct 2020 13:16:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2DE0192AE; Sat, 24 Oct 2020 13:16:10 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09ODGA6w082337; Sat, 24 Oct 2020 13:16:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09ODGAfN082336; Sat, 24 Oct 2020 13:16:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202010241316.09ODGAfN082336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 24 Oct 2020 13:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366996 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 366996 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 13:16:11 -0000 Author: hselasky Date: Sat Oct 24 13:16:10 2020 New Revision: 366996 URL: https://svnweb.freebsd.org/changeset/base/366996 Log: Implement xa_init() in the LinuxKPI as a wrapper for xa_init_flags(). MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/compat/linuxkpi/common/include/linux/xarray.h Modified: head/sys/compat/linuxkpi/common/include/linux/xarray.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/xarray.h Sat Oct 24 13:07:50 2020 (r366995) +++ head/sys/compat/linuxkpi/common/include/linux/xarray.h Sat Oct 24 13:16:10 2020 (r366996) @@ -91,4 +91,10 @@ xa_err(void *ptr) return (PTR_ERR_OR_ZERO(ptr)); } +static inline void +xa_init(struct xarray *xa) +{ + xa_init_flags(xa, 0); +} + #endif /* _LINUX_XARRAY_H_ */ From owner-svn-src-head@freebsd.org Sat Oct 24 13:30:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCEF3449AA8; Sat, 24 Oct 2020 13:30:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJMRd56K8z4YL4; Sat, 24 Oct 2020 13:30:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 934001942E; Sat, 24 Oct 2020 13:30:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09ODUbjh089522; Sat, 24 Oct 2020 13:30:37 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09ODUb6x089521; Sat, 24 Oct 2020 13:30:37 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010241330.09ODUb6x089521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 24 Oct 2020 13:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366997 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366997 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 13:30:37 -0000 Author: mjg Date: Sat Oct 24 13:30:37 2020 New Revision: 366997 URL: https://svnweb.freebsd.org/changeset/base/366997 Log: vfs: fix a race where reclaim vholds freed vnodes Reported by: pho Tested by: pho (previous version) Fixes: r366974 ("vfs: stop taking the interlock in vnode reclaim") Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sat Oct 24 13:16:10 2020 (r366996) +++ head/sys/kern/vfs_subr.c Sat Oct 24 13:30:37 2020 (r366997) @@ -109,6 +109,7 @@ static void syncer_shutdown(void *arg, int howto); static int vtryrecycle(struct vnode *vp); static void v_init_counters(struct vnode *); static void vgonel(struct vnode *); +static bool vhold_recycle(struct vnode *); static void vfs_knllock(void *arg); static void vfs_knlunlock(void *arg); static void vfs_knl_assert_locked(void *arg); @@ -1126,7 +1127,8 @@ restart: goto next_iter; } - vhold(vp); + if (!vhold_recycle(vp)) + goto next_iter; TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); TAILQ_INSERT_AFTER(&vnode_list, vp, mvp, v_vnodelist); mtx_unlock(&vnode_list_mtx); @@ -1231,7 +1233,8 @@ restart: if (__predict_false(vp->v_type == VBAD || vp->v_type == VNON)) { continue; } - vhold(vp); + if (!vhold_recycle(vp)) + continue; count--; mtx_unlock(&vnode_list_mtx); vtryrecycle(vp); @@ -3248,13 +3251,11 @@ vholdnz(struct vnode *vp) * However, while this is more performant, it hinders debugging by eliminating * the previously mentioned invariant. */ -bool -vhold_smr(struct vnode *vp) +static bool __always_inline +_vhold_cond(struct vnode *vp) { int count; - VFS_SMR_ASSERT_ENTERED(); - count = atomic_load_int(&vp->v_holdcnt); for (;;) { if (count & VHOLD_NO_SMR) { @@ -3270,6 +3271,28 @@ vhold_smr(struct vnode *vp) return (true); } } +} + +bool +vhold_smr(struct vnode *vp) +{ + + VFS_SMR_ASSERT_ENTERED(); + return (_vhold_cond(vp)); +} + +/* + * Special case for vnode recycling. + * + * Vnodes are present on the global list until UMA takes them out. + * Attempts to recycle only need the relevant lock and have no use for SMR. + */ +static bool +vhold_recycle(struct vnode *vp) +{ + + mtx_assert(&vnode_list_mtx, MA_OWNED); + return (_vhold_cond(vp)); } static void __noinline From owner-svn-src-head@freebsd.org Sat Oct 24 13:31:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06723449B20; Sat, 24 Oct 2020 13:31:26 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJMSY4fN9z4YlY; Sat, 24 Oct 2020 13:31:25 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8390018F78; Sat, 24 Oct 2020 13:31:25 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09ODVPGQ094209; Sat, 24 Oct 2020 13:31:25 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09ODVPmB094208; Sat, 24 Oct 2020 13:31:25 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010241331.09ODVPmB094208@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 24 Oct 2020 13:31:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366998 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366998 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 13:31:26 -0000 Author: mjg Date: Sat Oct 24 13:31:25 2020 New Revision: 366998 URL: https://svnweb.freebsd.org/changeset/base/366998 Log: cache: add the missing NC_NOMAKEENTRY and NC_KEEPPOSENTRY to lockless lookup They are de facto ignored. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Oct 24 13:30:37 2020 (r366997) +++ head/sys/kern/vfs_cache.c Sat Oct 24 13:31:25 2020 (r366998) @@ -3700,8 +3700,9 @@ cache_fpl_handled_impl(struct cache_fpl *fpl, int erro #define cache_fpl_handled(x, e) cache_fpl_handled_impl((x), (e), __LINE__) #define CACHE_FPL_SUPPORTED_CN_FLAGS \ - (LOCKLEAF | LOCKPARENT | WANTPARENT | NOCACHE | FOLLOW | LOCKSHARED | SAVENAME | \ - SAVESTART | WILLBEDIR | ISOPEN | NOMACCHECK | AUDITVNODE1 | AUDITVNODE2 | NOCAPCHECK) + (NC_NOMAKEENTRY | NC_KEEPPOSENTRY | LOCKLEAF | LOCKPARENT | WANTPARENT | \ + FOLLOW | LOCKSHARED | SAVENAME | SAVESTART | WILLBEDIR | ISOPEN | \ + NOMACCHECK | AUDITVNODE1 | AUDITVNODE2 | NOCAPCHECK) #define CACHE_FPL_INTERNAL_CN_FLAGS \ (ISDOTDOT | MAKEENTRY | ISLASTCN) From owner-svn-src-head@freebsd.org Sat Oct 24 13:31:41 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAA304499DC; Sat, 24 Oct 2020 13:31:41 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJMSs3tJ5z4Ypg; Sat, 24 Oct 2020 13:31:41 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65F5518F7C; Sat, 24 Oct 2020 13:31:41 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09ODVfNd094264; Sat, 24 Oct 2020 13:31:41 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09ODVfXC094262; Sat, 24 Oct 2020 13:31:41 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202010241331.09ODVfXC094262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 24 Oct 2020 13:31:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366999 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 366999 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 13:31:41 -0000 Author: mjg Date: Sat Oct 24 13:31:40 2020 New Revision: 366999 URL: https://svnweb.freebsd.org/changeset/base/366999 Log: cache: assorted typo fixes Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sat Oct 24 13:31:25 2020 (r366998) +++ head/sys/kern/vfs_cache.c Sat Oct 24 13:31:40 2020 (r366999) @@ -188,7 +188,7 @@ TAILQ_HEAD(cache_freebatch, namecache); * Regardless of the above, use of dedicated zones instead of malloc may be * inducing additional waste. This may be hard to address as said zones are * tied to VFS SMR. Even if retaining them, the current split should be - * reevaluated. + * re-evaluated. */ #ifdef __LP64__ #define CACHE_PATH_CUTOFF 45 @@ -597,7 +597,7 @@ cache_alloc(int len, bool ts) * Avoid blowout in namecache entries. * * Bugs: - * 1. filesystems may end up tryng to add an already existing entry + * 1. filesystems may end up trying to add an already existing entry * (for example this can happen after a cache miss during concurrent * lookup), in which case we will call cache_neg_evict despite not * adding anything. @@ -3285,12 +3285,12 @@ vn_fullpath_any(struct vnode *vp, struct vnode *rdir, /* * Resolve an arbitrary vnode to a pathname (taking care of hardlinks). * - * Since the namecache does not track handlings, the caller is expected to first + * Since the namecache does not track hardlinks, the caller is expected to first * look up the target vnode with SAVENAME | WANTPARENT flags passed to namei. * * Then we have 2 cases: * - if the found vnode is a directory, the path can be constructed just by - * fullowing names up the chain + * following names up the chain * - otherwise we populate the buffer with the saved name and start resolving * from the parent */ @@ -3327,7 +3327,7 @@ vn_fullpath_hardlink(struct nameidata *ndp, char **ret * populate part of the buffer and descend to vn_fullpath_dir with * vp == vp_crossmp. Prevent the problem by checking for VBAD. * - * This should be atomic_load(&vp->v_type) but it is ilegal to take + * This should be atomic_load(&vp->v_type) but it is illegal to take * an address of a bit field, even if said field is sized to char. * Work around the problem by reading the value into a full-sized enum * and then re-reading it with atomic_load which will still prevent From owner-svn-src-head@freebsd.org Sat Oct 24 13:38:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46535449DC6; Sat, 24 Oct 2020 13:38:21 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward501j.mail.yandex.net (forward501j.mail.yandex.net [IPv6:2a02:6b8:0:801:2::111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJMcW5QdWz4ZNZ; Sat, 24 Oct 2020 13:38:19 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from mxback8g.mail.yandex.net (mxback8g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:169]) by forward501j.mail.yandex.net (Yandex) with ESMTP id 8FB94338016C; Sat, 24 Oct 2020 16:38:14 +0300 (MSK) Received: from localhost (localhost [::1]) by mxback8g.mail.yandex.net (mxback/Yandex) with ESMTP id Jw6UX2hoTg-cDpeMpZx; Sat, 24 Oct 2020 16:38:13 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1603546693; bh=3QA//zdEhZE5MD4I1wkxXVEw32ck/3SNpF+wV96sM5A=; h=Message-Id:Cc:Subject:In-Reply-To:Date:References:To:From; b=R4rPs8b3TCoEtNehsnSxgfh9ref857kzIXCBpLLEAKgl3R2OVs3+KlqrdkAqRTtNx apEXRxtxPvSzsoVjN6uf3EzDRj/jw1G3hGxc9YCeccNcI2ZJCQBtGOt+v7mfbUYrnj zX90+oc16GQIO6CtWG+4f+1KxRA6ipzg9cXXpwMA= Received: by sas1-ffdbcd5f1d77.qloud-c.yandex.net with HTTP; Sat, 24 Oct 2020 16:38:12 +0300 From: Alexander V. Chernikov To: Hans Petter Selasky , Alexey Dokuchaev Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" In-Reply-To: <999a005e-1ef8-3c45-fb07-94a3b6ebce1b@selasky.org> References: <202010241023.09OANMcL075640@repo.freebsd.org> <20201024125206.GB38000@FreeBSD.org> <999a005e-1ef8-3c45-fb07-94a3b6ebce1b@selasky.org> Subject: Re: svn commit: r366993 - head/sys/net MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Sat, 24 Oct 2020 14:38:12 +0100 Message-Id: <317231603546378@mail.yandex.ru> Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 X-Rspamd-Queue-Id: 4CJMcW5QdWz4ZNZ X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ipfw.ru header.s=mail header.b=R4rPs8b3; dmarc=none; spf=pass (mx1.freebsd.org: domain of melifaro@ipfw.ru designates 2a02:6b8:0:801:2::111 as permitted sender) smtp.mailfrom=melifaro@ipfw.ru X-Spamd-Result: default: False [-3.90 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[ipfw.ru:s=mail]; FREEFALL_USER(0.00)[melifaro]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a02:6b8:0::/52]; NEURAL_HAM_LONG(-0.96)[-0.956]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[ipfw.ru]; NEURAL_HAM_MEDIUM(-1.09)[-1.089]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[ipfw.ru:+]; NEURAL_HAM_SHORT(-1.26)[-1.258]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:13238, ipnet:2a02:6b8::/32, country:RU]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; RCVD_IN_DNSWL_LOW(-0.10)[2a02:6b8:0:801:2::111:from] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 13:38:21 -0000 24.10.2020, 14:08, "Hans Petter Selasky" : > On 2020-10-24 14:52, Alexey Dokuchaev wrote: >>  On Sat, Oct 24, 2020 at 10:23:22AM +0000, Hans Petter Selasky wrote: >>>  New Revision: 366993 >>>  URL: https://svnweb.freebsd.org/changeset/base/366993 >>> >>>  Log: >>>     Run code through "clang-format -style=file" with some additional fixes. >>>     No functional change. >>> >>>  ... >>>  @@ -99,8 +97,8 @@ infiniband_ipv4_multicast_map(uint32_t addr, >>> >>>    #ifdef INET6 >>>    static inline void >>>  -infiniband_ipv6_multicast_map(const struct in6_addr *addr, >>>  - const uint8_t *broadcast, uint8_t *buf) >>>  +infiniband_ipv6_multicast_map( >>>  + const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf) >>>    { >> >>  This is not how we format these in FreeBSD, please revert. It was correct >>  before and no "fix" is need here. Given we already have nice .clang-format, that does most of the job, maybe it's worth considering looking into tweaking it further to fix this part? It would be nice if we could finally offload all formatting issues to the tool and focus on the actual code :-) > Done. > > --HPS From owner-svn-src-head@freebsd.org Sat Oct 24 14:09:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0F7144A5BD; Sat, 24 Oct 2020 14:09:47 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJNJq5b8vz4b6k; Sat, 24 Oct 2020 14:09:47 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1603548587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=A+mBUfjq3YEnBn2jJ4GHiidqc5JAvqh9tEDcnvz7gNU=; b=aRU9Ix9CWTlEJQNIzp9/EomaHTh9gHuD40rbnWjk06V2ZX4I4oKalcJPd3Rua9WJfRuxFY VycdoL4CMgjkduLlEQbyDvRgj7haFndCc+KXzcATaNFciAEXPPt4Lbntb2JRMz6BE74Iw7 iOkKs5mpWDYEExv9RUOWUcY6+eG0CMor7+BKxNI2Fg6/hFCdXjLzjJ4RLEdeZkvmjnyxxP BcHXMhNT9NHFc0Uhwz52v5MKlGVHlICJCYlC8+7nZlZqoT0iGGr3Nn01fJYkijiLb84FUj nk/r8Ghb6VahYO3V5REpr1Ihr3mcbRHGyR6rSEKEzb2tYx51jqPCs64b4da/4w== Received: by freefall.freebsd.org (Postfix, from userid 1033) id B23F07EE4; Sat, 24 Oct 2020 14:09:47 +0000 (UTC) Date: Sat, 24 Oct 2020 14:09:47 +0000 From: Alexey Dokuchaev To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366995 - head/sys/net Message-ID: <20201024140947.GA41396@FreeBSD.org> References: <202010241307.09OD7opi075905@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202010241307.09OD7opi075905@repo.freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1603548587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=A+mBUfjq3YEnBn2jJ4GHiidqc5JAvqh9tEDcnvz7gNU=; b=iMySvuBeHC9qUJtXKOvr2Spt5zRIMPbtaPpsNFsZDnCSjT2HPkpdeQIDH7iitqcEIrFJGX fxOc1jWiOsyZGk/D70Q9dgIg32JRtowScQto2h+ksqVkBgYgfNwRMQ6t+3note2VVmOLxi 400WGARy6Zrv2YxeDyTme+02ljvEckUcH9pKtRbgxKxuUJIsAgTU4T/2fYe77n4XcfEotQ dvX9GNUvyav6pPHoEobAr+bE5IbDq8wCm1/fJ89tGXZHQw3pOnZLuWGiFbuZhIIywFL4GI Hd0P+JlPjQJH/3iGDFEK/Ff0mfRgYKjV8vvQ7aTMtJM6+KNNyivLmYA/L+qAOw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1603548587; a=rsa-sha256; cv=none; b=bJdb1/oLskG9mJOFdnT/d5dxXQnUid3v15w1wLaWcdg3san6vu1Z7HiwHpwK6ZTZCTgEa8 ZSqR8dZHpNAod+bpZ0rH+f4FSpzjE+HCRVOZwWa9GstiHoZH8e5Ou3pZnV908RvQeK090c 45OGesa3fRN5b2FqkxW9uXf7puEVy2aSGkIZyPEmJ+LVcTZSjCEh9tHiZp8JR6D9n6bbzq 1ZrClbiyDGlXIJYEnNF2cLwXmK+2dAgEn9JI15KZefQUAAV6a1zG+hRxvAenWWCQCWwzfi KrFdb/0m/iyRNVkI52UqDGH7HEzSxAlgvl2irMwLqvH0myIBP7q6NMEde42fkQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 14:09:48 -0000 On Sat, Oct 24, 2020 at 01:07:50PM +0000, Hans Petter Selasky wrote: > New Revision: 366995 > URL: https://svnweb.freebsd.org/changeset/base/366995 > > Log: > More style fixes (partial revert of r366994). Thank you Hans Petter, I appreciate it. ./danfe From owner-svn-src-head@freebsd.org Sat Oct 24 14:23:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B010E44AD81; Sat, 24 Oct 2020 14:23:45 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJNcx49sgz4c1H; Sat, 24 Oct 2020 14:23:45 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7312519E17; Sat, 24 Oct 2020 14:23:45 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OENjWY025832; Sat, 24 Oct 2020 14:23:45 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OENj4b025830; Sat, 24 Oct 2020 14:23:45 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010241423.09OENj4b025830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 24 Oct 2020 14:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367000 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 367000 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 14:23:45 -0000 Author: trasz Date: Sat Oct 24 14:23:44 2020 New Revision: 367000 URL: https://svnweb.freebsd.org/changeset/base/367000 Log: Further improve prctl(2) debug. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26916 Modified: head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Sat Oct 24 13:31:40 2020 (r366999) +++ head/sys/compat/linux/linux_misc.c Sat Oct 24 14:23:44 2020 (r367000) @@ -1949,6 +1949,10 @@ linux_prctl(struct thread *td, struct linux_prctl_args (void *)(register_t)args->arg2, sizeof(pdeath_signal))); break; + case LINUX_PR_SET_DUMPABLE: + linux_msg(td, "unsupported prctl PR_SET_DUMPABLE"); + error = EINVAL; + break; case LINUX_PR_GET_KEEPCAPS: /* * Indicate that we always clear the effective and @@ -2006,6 +2010,14 @@ linux_prctl(struct thread *td, struct linux_prctl_args /* * Same as returned by Linux without CONFIG_SECCOMP enabled. */ + error = EINVAL; + break; + case LINUX_PR_SET_NO_NEW_PRIVS: + linux_msg(td, "unsupported prctl PR_SET_NO_NEW_PRIVS"); + error = EINVAL; + break; + case LINUX_PR_SET_PTRACER: + linux_msg(td, "unsupported prctl PR_SET_PTRACER"); error = EINVAL; break; default: Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Sat Oct 24 13:31:40 2020 (r366999) +++ head/sys/compat/linux/linux_misc.h Sat Oct 24 14:23:44 2020 (r367000) @@ -50,12 +50,15 @@ * Second arg is a ptr to return the * signal. */ +#define LINUX_PR_SET_DUMPABLE 4 #define LINUX_PR_GET_KEEPCAPS 7 /* Get drop capabilities on setuid */ #define LINUX_PR_SET_KEEPCAPS 8 /* Set drop capabilities on setuid */ #define LINUX_PR_SET_NAME 15 /* Set process name. */ #define LINUX_PR_GET_NAME 16 /* Get process name. */ #define LINUX_PR_GET_SECCOMP 21 #define LINUX_PR_SET_SECCOMP 22 +#define LINUX_PR_SET_NO_NEW_PRIVS 38 +#define LINUX_PR_SET_PTRACER 1499557217 #define LINUX_MAX_COMM_LEN 16 /* Maximum length of the process name. */ From owner-svn-src-head@freebsd.org Sat Oct 24 14:25:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93A1144AC2D; Sat, 24 Oct 2020 14:25:39 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJNg72hPnz4bwq; Sat, 24 Oct 2020 14:25:39 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F58E19C23; Sat, 24 Oct 2020 14:25:39 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OEPdmo025973; Sat, 24 Oct 2020 14:25:39 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OEPcaR025971; Sat, 24 Oct 2020 14:25:38 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202010241425.09OEPcaR025971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 24 Oct 2020 14:25:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367001 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 367001 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 14:25:39 -0000 Author: trasz Date: Sat Oct 24 14:25:38 2020 New Revision: 367001 URL: https://svnweb.freebsd.org/changeset/base/367001 Log: Tweak linux(4) socket(2) debug messages. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26900 Modified: head/sys/compat/linux/linux.h head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux.h ============================================================================== --- head/sys/compat/linux/linux.h Sat Oct 24 14:23:44 2020 (r367000) +++ head/sys/compat/linux/linux.h Sat Oct 24 14:25:38 2020 (r367001) @@ -58,6 +58,10 @@ struct l_sockaddr { #define LINUX_AF_IPX 4 #define LINUX_AF_APPLETALK 5 #define LINUX_AF_INET6 10 +#define LINUX_AF_NETLINK 16 + +#define LINUX_NETLINK_ROUTE 0 +#define LINUX_NETLINK_UEVENT 15 /* * net device flags Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sat Oct 24 14:23:44 2020 (r367000) +++ head/sys/compat/linux/linux_socket.c Sat Oct 24 14:25:38 2020 (r367001) @@ -514,6 +514,20 @@ linux_socket(struct thread *td, struct linux_socket_ar return (retval_socket); domain = linux_to_bsd_domain(args->domain); if (domain == -1) { + if (args->domain == LINUX_AF_NETLINK && + args->protocol == LINUX_NETLINK_ROUTE) { + linux_msg(curthread, + "unsupported socket(AF_NETLINK, %d, NETLINK_ROUTE)", type); + return (EAFNOSUPPORT); + } + + if (args->domain == LINUX_AF_NETLINK && + args->protocol == LINUX_NETLINK_UEVENT) { + linux_msg(curthread, + "unsupported socket(AF_NETLINK, %d, NETLINK_UEVENT)", type); + return (EAFNOSUPPORT); + } + linux_msg(curthread, "unsupported socket domain %d, type %d, protocol %d", args->domain, args->type & LINUX_SOCK_TYPE_MASK, args->protocol); return (EAFNOSUPPORT); From owner-svn-src-head@freebsd.org Sat Oct 24 14:37:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D697344B04D; Sat, 24 Oct 2020 14:37:50 +0000 (UTC) (envelope-from se@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJNxB5GWnz4clv; Sat, 24 Oct 2020 14:37:50 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-WLAN.fritz.box (p200300cd5f0bbc004c47393913af402f.dip0.t-ipconnect.de [IPv6:2003:cd:5f0b:bc00:4c47:3939:13af:402f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 533D72E4C8; Sat, 24 Oct 2020 14:37:49 +0000 (UTC) (envelope-from se@freebsd.org) To: Alex Kozlov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202010230922.09N9MNZu040921@repo.freebsd.org> <20201024074840.GA26119@ravenloft.kiev.ua> From: Stefan Esser Subject: Re: svn commit: r366962 - in head: include usr.bin/calendar Message-ID: <38d15142-1cb1-eb1f-215e-cee165743d99@freebsd.org> Date: Sat, 24 Oct 2020 16:37:45 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201024074840.GA26119@ravenloft.kiev.ua> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fHaH3cJ3zPPd9xr0lIAiIUSwpkdFLo50F" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 14:37:50 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --fHaH3cJ3zPPd9xr0lIAiIUSwpkdFLo50F Content-Type: multipart/mixed; boundary="Rw4sLqNGgi2W0fdUSBodEXdolg8Ht94dq"; protected-headers="v1" From: Stefan Esser To: Alex Kozlov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <38d15142-1cb1-eb1f-215e-cee165743d99@freebsd.org> Subject: Re: svn commit: r366962 - in head: include usr.bin/calendar References: <202010230922.09N9MNZu040921@repo.freebsd.org> <20201024074840.GA26119@ravenloft.kiev.ua> In-Reply-To: <20201024074840.GA26119@ravenloft.kiev.ua> --Rw4sLqNGgi2W0fdUSBodEXdolg8Ht94dq Content-Type: multipart/mixed; boundary="------------CE8C52AFC9DE309FF5D54B66" Content-Language: en-US This is a multi-part message in MIME format. --------------CE8C52AFC9DE309FF5D54B66 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Am 24.10.20 um 09:48 schrieb Alex Kozlov: > On Fri, Oct 23, 2020 at 09:22:23AM +0000, Stefan E=DFer wrote: >> Author: se >> Date: Fri Oct 23 09:22:23 2020 >> New Revision: 366962 >> URL: https://svnweb.freebsd.org/changeset/base/366962 >> >> Log: >> Add search of LOCALBASE/share/calendar for calendars supplied by a = port. >> =20 >> Calendar files in LOCALBASE override similarily named ones in the b= ase >> system. This could easily be changed if the base system calendars s= hould >> have precedence, but it could lead to a violation of POLA since the= n the >> port's files were ignored unless those in base have been deleted. >> =20 >> There was no definition of _PATH_LOCALBASE in paths.h, but verbatim= uses >> of /usr/local existed for _PATH_DEFPATH. Use _PATH_LOCALBASE here t= o ease >> a consistent modification of this prefix. > You are hardcoding assumption that LOCALBASE =3D /usr/local. Please mak= e it > overridable with LOCALBASE environment variable. This was a trivial change to get us going with calendars provided by a port (which has not been committed, yet - therefore there are no port-provided calendars, neither under /usr/local nor under any other PREFIX, as of now). I understand what you are asking for, but in such a case I'd rather think you want to rebuild FreeBSD with _PATH_LOCALBASE modified in paths.h. And I have made this a single instance that needs to be changed. Before my change there were 2 instances of /usr/local hard-coded in _PATH_DEFPATH - now you have to only change the definition of _PATH_LOCALBASE to adjust all 3 locations that use it. If you can show me precedence of a LOCALBASE environment variable being used in the way you suggest, I'd be willing to make calendar use it. But then I think a CALENDAR_HOME variable would be even more useful, since it would allow to search an additional user selected directory (and not just share/calendar within what you provide as LOCALBASE). Regards, STefan PS: If you are a source committer, you might even commit such a change yourself. But I'd think it should be reviewed, and it might be a good idea to wait until other changes (e.g. the switch-over to port-supplied calendar files) have been worked out. --------------CE8C52AFC9DE309FF5D54B66-- --Rw4sLqNGgi2W0fdUSBodEXdolg8Ht94dq-- --fHaH3cJ3zPPd9xr0lIAiIUSwpkdFLo50F Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAl+UPDkFAwAAAAAACgkQR+u171r99UTM HAf+L4sJ1K0QWrPF6AJpgiO+bstSsffBLUwc+fVP9G/kvlLakKlb9nh+nk6Fd4U+gEZS4r6rksdy 5/hHDstiGZSlIwZLLOfAu1rzvZI/KFkovtcB8njxdgokA5xoZjInurb6x/DtudHOcRUCrisiNDvc ndkRwGoISB58lEtSJBdIQVV72TLuph9tnSK9dTQeh+vSwUwEYd4+mPsM6XxQU40jhXUolJsf2lM6 419kd6E21upbo7QwwS0jnAtHn1RplgRrHk0e0dIgmvbExMS3M8raFe0ywJ0qo/3VhlOx3QfYc0W0 1ApaZbWx/TJMCna4ZP2P7dVtRqn6a8V5m3wmURm2sQ== =jEFn -----END PGP SIGNATURE----- --fHaH3cJ3zPPd9xr0lIAiIUSwpkdFLo50F-- From owner-svn-src-head@freebsd.org Sat Oct 24 14:39:18 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5048A44B305; Sat, 24 Oct 2020 14:39:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJNyt1SFBz4crg; Sat, 24 Oct 2020 14:39:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1551519E3B; Sat, 24 Oct 2020 14:39:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OEdH0L032479; Sat, 24 Oct 2020 14:39:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OEdH6t032475; Sat, 24 Oct 2020 14:39:17 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202010241439.09OEdH6t032475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Oct 2020 14:39:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367002 - in head/sys: compat/freebsd32 kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern X-SVN-Commit-Revision: 367002 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 14:39:18 -0000 Author: kevans Date: Sat Oct 24 14:39:17 2020 New Revision: 367002 URL: https://svnweb.freebsd.org/changeset/base/367002 Log: audit: correct reporting of *execve(2) success r326145 corrected do_execve() to return EJUSTRETURN upon success so that important registers are not clobbered. This had the side effect of tapping out 'failures' for all *execve(2) audit records, which is less than useful for auditing purposes. Audit exec returns earlier, where we can know for sure that EJUSTRETURN translates to success. Note that this unsets TDP_AUDITREC as we commit the audit record, so the usual audit in the syscall return path will do nothing. PR: 249179 Reported by: Eirik Oeverby Reviewed by: csjp, kib MFC after: 1 week Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26922 Modified: head/sys/compat/freebsd32/freebsd32_misc.c head/sys/kern/kern_exec.c head/sys/kern/subr_syscall.c Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Sat Oct 24 14:25:38 2020 (r367001) +++ head/sys/compat/freebsd32/freebsd32_misc.c Sat Oct 24 14:39:17 2020 (r367002) @@ -442,6 +442,7 @@ freebsd32_execve(struct thread *td, struct freebsd32_e if (error == 0) error = kern_execve(td, &eargs, NULL, oldvmspace); post_execve(td, error, oldvmspace); + AUDIT_SYSCALL_EXIT(error == EJUSTRETURN ? 0 : error, td); return (error); } @@ -462,6 +463,7 @@ freebsd32_fexecve(struct thread *td, struct freebsd32_ error = kern_execve(td, &eargs, NULL, oldvmspace); } post_execve(td, error, oldvmspace); + AUDIT_SYSCALL_EXIT(error == EJUSTRETURN ? 0 : error, td); return (error); } Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Sat Oct 24 14:25:38 2020 (r367001) +++ head/sys/kern/kern_exec.c Sat Oct 24 14:39:17 2020 (r367002) @@ -225,6 +225,7 @@ sys_execve(struct thread *td, struct execve_args *uap) if (error == 0) error = kern_execve(td, &args, NULL, oldvmspace); post_execve(td, error, oldvmspace); + AUDIT_SYSCALL_EXIT(error == EJUSTRETURN ? 0 : error, td); return (error); } @@ -252,6 +253,7 @@ sys_fexecve(struct thread *td, struct fexecve_args *ua error = kern_execve(td, &args, NULL, oldvmspace); } post_execve(td, error, oldvmspace); + AUDIT_SYSCALL_EXIT(error == EJUSTRETURN ? 0 : error, td); return (error); } @@ -280,6 +282,7 @@ sys___mac_execve(struct thread *td, struct __mac_execv if (error == 0) error = kern_execve(td, &args, uap->mac_p, oldvmspace); post_execve(td, error, oldvmspace); + AUDIT_SYSCALL_EXIT(error == EJUSTRETURN ? 0 : error, td); return (error); #else return (ENOSYS); Modified: head/sys/kern/subr_syscall.c ============================================================================== --- head/sys/kern/subr_syscall.c Sat Oct 24 14:25:38 2020 (r367001) +++ head/sys/kern/subr_syscall.c Sat Oct 24 14:39:17 2020 (r367002) @@ -154,7 +154,18 @@ syscallenter(struct thread *td) td->td_pflags &= ~TDP_NERRNO; else td->td_errno = error; + + /* + * Note that some syscall implementations (e.g., sys_execve) + * will commit the audit record just before their final return. + * These were done under the assumption that nothing of interest + * would happen between their return and here, where we would + * normally commit the audit record. These assumptions will + * need to be revisited should any substantial logic be added + * above. + */ AUDIT_SYSCALL_EXIT(error, td); + #ifdef KDTRACE_HOOKS /* Give the syscall:::return DTrace probe a chance to fire. */ if (__predict_false(sa->callp->sy_return != 0)) From owner-svn-src-head@freebsd.org Sat Oct 24 14:46:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 679CE44B73F; Sat, 24 Oct 2020 14:46:39 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJP7M258Qz4dVt; Sat, 24 Oct 2020 14:46:39 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B0D419E6A; Sat, 24 Oct 2020 14:46:39 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OEkdeY038322; Sat, 24 Oct 2020 14:46:39 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OEkdsF038321; Sat, 24 Oct 2020 14:46:39 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202010241446.09OEkdsF038321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Sat, 24 Oct 2020 14:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367003 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367003 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 14:46:39 -0000 Author: freqlabs Date: Sat Oct 24 14:46:38 2020 New Revision: 367003 URL: https://svnweb.freebsd.org/changeset/base/367003 Log: kern_sysctl: Misc code cleanup Remove unused oidpp parameter from sysctl_sysctl_next_ls and add high level comments to describe how it works. No functional change. Reviewed by: imp MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D26854 Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Sat Oct 24 14:39:17 2020 (r367002) +++ head/sys/kern/kern_sysctl.c Sat Oct 24 14:46:38 2020 (r367003) @@ -1100,9 +1100,13 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) static SYSCTL_NODE(_sysctl, CTL_SYSCTL_NAME, name, CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_name, ""); +/* + * Walk the sysctl subtree at lsp until we find the given name, + * and return the next name in order by oid_number. + */ static int sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *name, u_int namelen, - int *next, int *len, int level, struct sysctl_oid **oidpp, bool honor_skip) + int *next, int *len, int level, bool honor_skip) { struct sysctl_oid *oidp; @@ -1110,7 +1114,6 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *len = level; SLIST_FOREACH(oidp, lsp, oid_link) { *next = oidp->oid_number; - *oidpp = oidp; if ((oidp->oid_kind & CTLFLAG_DORMANT) != 0) continue; @@ -1118,46 +1121,77 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int if (honor_skip && (oidp->oid_kind & CTLFLAG_SKIP) != 0) continue; - if (!namelen) { + if (namelen == 0) { + /* + * We have reached a node with a full name match and are + * looking for the next oid in its children. + * + * For CTL_SYSCTL_NEXT we skip CTLTYPE_NODE (unless it + * has a handler) and move on to the children. + */ if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) return (0); if (oidp->oid_handler) - /* We really should call the handler here...*/ return (0); lsp = SYSCTL_CHILDREN(oidp); - if (!sysctl_sysctl_next_ls(lsp, 0, 0, next+1, - len, level+1, oidpp, honor_skip)) + if (!sysctl_sysctl_next_ls(lsp, NULL, 0, next + 1, len, + level + 1, honor_skip)) return (0); + /* + * There were no useable children in this node. + * Continue searching for the next oid at this level. + */ goto emptynode; } + /* + * No match yet. Continue seeking the given name. + * + * We are iterating in order by oid_number, so skip oids lower + * than the one we are looking for. + * + * When the current oid_number is higher than the one we seek, + * that means we have reached the next oid in the sequence and + * should return it. + * + * If the oid_number matches the name at this level then we + * have to find a node to continue searching at the next level. + */ if (oidp->oid_number < *name) continue; - if (oidp->oid_number > *name) { + /* + * We have reached the next oid. + * + * For CTL_SYSCTL_NEXT we skip CTLTYPE_NODE (unless it + * has a handler) and move on to the children. + */ if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) return (0); if (oidp->oid_handler) return (0); lsp = SYSCTL_CHILDREN(oidp); - if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1, - next+1, len, level+1, oidpp, honor_skip)) + if (!sysctl_sysctl_next_ls(lsp, name + 1, namelen - 1, + next + 1, len, level + 1, honor_skip)) return (0); goto next; } if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) continue; - if (oidp->oid_handler) continue; - lsp = SYSCTL_CHILDREN(oidp); - if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1, next+1, - len, level+1, oidpp, honor_skip)) + if (!sysctl_sysctl_next_ls(lsp, name + 1, namelen - 1, + next + 1, len, level + 1, honor_skip)) return (0); next: + /* + * There were no useable children in this node. + * Continue searching for the next oid at the root level. + */ namelen = 1; emptynode: + /* Reset len in case a failed recursive call changed it. */ *len = level; } return (ENOENT); @@ -1169,13 +1203,12 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS) int *name = (int *) arg1; u_int namelen = arg2; int len, error; - struct sysctl_oid *oid; struct sysctl_oid_list *lsp = &sysctl__children; struct rm_priotracker tracker; int next[CTL_MAXNAME]; SYSCTL_RLOCK(&tracker); - error = sysctl_sysctl_next_ls(lsp, name, namelen, next, &len, 1, &oid, + error = sysctl_sysctl_next_ls(lsp, name, namelen, next, &len, 1, oidp->oid_number == CTL_SYSCTL_NEXT); SYSCTL_RUNLOCK(&tracker); if (error) From owner-svn-src-head@freebsd.org Sat Oct 24 15:27:41 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E211D44C2E8 for ; Sat, 24 Oct 2020 15:27:41 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJQ2h6qLkz3RNJ for ; Sat, 24 Oct 2020 15:27:40 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72f.google.com with SMTP id x20so4486023qkn.1 for ; Sat, 24 Oct 2020 08:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SdeMX+1mHWz5ppQ2dcv5hUoGfnVrNWGKM7NYoewaOEY=; b=LrYuWVPi1JRw/yISuL3lDxSnd3nSLGVu7d7QqIbrNAGKloswNIzyVO2zHyq25+m25Q azJ1U7FGvKo6pl8eE99wrC70p3U1TgBnADYrFzO5T9zByRM9MzDV5v4qaINTdVrJpo3B IINJqVwunoIht1FORcD2UPVd3BGeuoKOcZQHxQC8sGh1kkILWAPwUAjp7TGyWvp3Q2Kd Ru85kMfo8WKtzOcAxe0eIuSOcX/BfoS/HV9v+POfNOCsPcczaHk49BKecUOXqMZywrJ2 92BtbsMJb9pycRj4EGDkFwtLkAP8AKQdN10LcKTkHENeoywIroFjMNhpM242yoxvMj5S Qnxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SdeMX+1mHWz5ppQ2dcv5hUoGfnVrNWGKM7NYoewaOEY=; b=eWMm4iuBxTM7+vXURnRfl69cqnmLEnbLTNT3skl16/3Y6rx5gkQ/oxGRus4CHMFolA pX03jr/Tpb1cmRoYrE+cJQ3BIbNGjSAoMXzUGDFLPmwYY9ziHqrhvmG8b7cQWYFrZm4x Vo/jW24NuMVW+TjMu8Zgttj9GWytwa4USna+xjGKoWQWVQCmMDqNV3PK6lN3ACeh+B5F wq/b+smsZZOA7ggbROvni+0sIbolbxecYE1d/3WqQf1isdkKYZlJiLVK8stGIC8Gwhmb VxpEDDzG3pSR0JiB1kUU0UN6iP/xenGCp+dgTryE3Um6w4fYftEmM+7GXiuTZyI5qxge LlgQ== X-Gm-Message-State: AOAM532wzAu7mUSvN/W6DYWdD3ZQ3WKZXNXubNr5d13jvLdQhcJgn4Np pUg5pKYO/A2xdYjKmhtW6I2dboxU/8XuVQ/8Iw6Nzw== X-Google-Smtp-Source: ABdhPJwvBRtz//IhRRsKPXkGlykwAVJakQ1j22LvQAgoSHyedgJS7kVnQXFAtQMUdVcM865doIXxsub+sHk0MXI1Mw8= X-Received: by 2002:a37:478c:: with SMTP id u134mr8438978qka.206.1603553259673; Sat, 24 Oct 2020 08:27:39 -0700 (PDT) MIME-Version: 1.0 References: <202010241023.09OANMcL075640@repo.freebsd.org> <20201024125206.GB38000@FreeBSD.org> <999a005e-1ef8-3c45-fb07-94a3b6ebce1b@selasky.org> <317231603546378@mail.yandex.ru> In-Reply-To: <317231603546378@mail.yandex.ru> From: Warner Losh Date: Sat, 24 Oct 2020 09:27:27 -0600 Message-ID: Subject: Re: svn commit: r366993 - head/sys/net To: "Alexander V. Chernikov" Cc: Hans Petter Selasky , Alexey Dokuchaev , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 4CJQ2h6qLkz3RNJ X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=LrYuWVPi; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72f) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.68 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.06)[-1.059]; NEURAL_HAM_LONG(-0.97)[-0.970]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.65)[-0.650]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::72f:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[svn-src-head] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 15:27:41 -0000 On Sat, Oct 24, 2020, 7:38 AM Alexander V. Chernikov wrote: > 24.10.2020, 14:08, "Hans Petter Selasky" : > > On 2020-10-24 14:52, Alexey Dokuchaev wrote: > >> On Sat, Oct 24, 2020 at 10:23:22AM +0000, Hans Petter Selasky wrote: > >>> New Revision: 366993 > >>> URL: https://svnweb.freebsd.org/changeset/base/366993 > >>> > >>> Log: > >>> Run code through "clang-format -style=file" with some additional > fixes. > >>> No functional change. > >>> > >>> ... > >>> @@ -99,8 +97,8 @@ infiniband_ipv4_multicast_map(uint32_t addr, > >>> > >>> #ifdef INET6 > >>> static inline void > >>> -infiniband_ipv6_multicast_map(const struct in6_addr *addr, > >>> - const uint8_t *broadcast, uint8_t *buf) > >>> +infiniband_ipv6_multicast_map( > >>> + const struct in6_addr *addr, const uint8_t *broadcast, uint8_t *buf) > >>> { > >> > >> This is not how we format these in FreeBSD, please revert. It was > correct > >> before and no "fix" is need here. > Given we already have nice .clang-format, that does most of the job, maybe > it's worth considering looking into tweaking it further to fix this part? > It would be nice if we could finally offload all formatting issues to the > tool and focus on the actual code :-) > It would be nice if it produced one of the style(9) acceptable formats without disrupting things already acceptable. That's been the big problem with the tweaks to date... some things are fixed, others break. It's getting a lot closer, though Warner > Done. > > > > --HPS > From owner-svn-src-head@freebsd.org Sat Oct 24 15:38:05 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AC9844C5D2; Sat, 24 Oct 2020 15:38:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJQGj35hDz3S86; Sat, 24 Oct 2020 15:38:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D5931AB25; Sat, 24 Oct 2020 15:38:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OFc5Oh069181; Sat, 24 Oct 2020 15:38:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OFc5d5069180; Sat, 24 Oct 2020 15:38:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202010241538.09OFc5d5069180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 24 Oct 2020 15:38:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367004 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 367004 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 15:38:05 -0000 Author: kevans Date: Sat Oct 24 15:38:04 2020 New Revision: 367004 URL: https://svnweb.freebsd.org/changeset/base/367004 Log: backlight(9): compile with COMPAT_LINUXKPI as well This would be more accurately expressed as COMPAT_LINUXKPI implying or requiring backlight, but config(8) doesn't really have a way to express that. This fixes the build with COMPAT_LINUXKPI specified in one's kernel config. Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Oct 24 14:46:38 2020 (r367003) +++ head/sys/conf/files Sat Oct 24 15:38:04 2020 (r367004) @@ -1312,8 +1312,8 @@ dev/ath/ath_rate/sample/sample.c optional ath_rate_sam dev/ath/ath_dfs/null/dfs_null.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" # -dev/backlight/backlight_if.m optional backlight -dev/backlight/backlight.c optional backlight +dev/backlight/backlight_if.m optional backlight | compat_linuxkpi +dev/backlight/backlight.c optional backlight | compat_linuxkpi dev/bce/if_bce.c optional bce dev/bfe/if_bfe.c optional bfe dev/bge/if_bge.c optional bge From owner-svn-src-head@freebsd.org Sat Oct 24 15:38:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCE3244CA90; Sat, 24 Oct 2020 15:38:44 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJQHS5c8Cz3SFC; Sat, 24 Oct 2020 15:38:44 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 97B4B2E5D4; Sat, 24 Oct 2020 15:38:44 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-vs1-f53.google.com with SMTP id f4so2543121vsk.7; Sat, 24 Oct 2020 08:38:44 -0700 (PDT) X-Gm-Message-State: AOAM530AWf5/0LSCC3d6zger62fbd9lb3lS5Gt2hekSQco6ceiEZcM1H Djwy75cXrY3Ph3KHIib8aRtYuBJm+L4zSYS72Po= X-Google-Smtp-Source: ABdhPJw8zSazbkDhC1QgGl97OSZ/esUgrJArmZCaxuw3a8YMOhPZVdQ8p4/A2nDQfShBYSbzhOTcWKsVcERXOxfNDuc= X-Received: by 2002:a67:fb50:: with SMTP id e16mr6262057vsr.10.1603553924055; Sat, 24 Oct 2020 08:38:44 -0700 (PDT) MIME-Version: 1.0 References: <202010021826.092IQfdj023808@repo.freebsd.org> <44421602932538@mail.yandex.ru> <43251602934532@mail.yandex.ru> <59021602950992@mail.yandex.ru> In-Reply-To: From: Kyle Evans Date: Sat, 24 Oct 2020 10:38:32 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r366372 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf To: Hans Petter Selasky Cc: Warner Losh , Kyle Evans , Niclas Zeising , "Alexander V. Chernikov" , Emmanuel Vadot , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 15:38:44 -0000 On Sat, Oct 24, 2020 at 4:52 AM Hans Petter Selasky wrote: > > On 2020-10-24 02:13, Warner Losh wrote: > > I was going to suggest and try this change, but life has been complicated... > > > > Has it been committed? > > > > No, not yet. > > --HPS > I went ahead and did so: r367004 From owner-svn-src-head@freebsd.org Sat Oct 24 15:42:35 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7239E44CC0A for ; Sat, 24 Oct 2020 15:42:35 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJQMt2XTfz3SWR for ; Sat, 24 Oct 2020 15:42:34 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72c.google.com with SMTP id k9so4503065qki.6 for ; Sat, 24 Oct 2020 08:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uMTYofULrj9eydUDjnYF5jgFqxPYtC3+Mtk8CLq5oSg=; b=NkdQEAWnLNGD8nFS/+PIWL4MjlAt0JSJuTul/pzCYR6zZ3uE0BcR5yT27rgXYEIcyW 3IjiKNBXsh+LmPa5snHfkKni6VP38MPdtfV8bQ7zIENNQRDJ6Sf1TW93iYSFyhBYVj20 HfAGwsKpbEYEuP+vOaegFxZkzm8nCse/lsXr7slKS3aotp+ctobUQMIEKHqijXEnYSaM de6YFf3ZBKwna3M644cUsoT+RLLZeg0m3Yvtyvf31pULBmqQr12eV6h/gMLT7kwbMs3d 11ZfuQOytzYD9c6IzTNajekJXzKMqNaDc0B/jYyLlQy1+RnBWxSrCEoD4Ei+l/9PRysz HX4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uMTYofULrj9eydUDjnYF5jgFqxPYtC3+Mtk8CLq5oSg=; b=eDmuNYP4aGLwLkFaNN3zPdPJqOUxZwd+Fq+F2uCp3dLDpKx3mFEkPPs9KMZ1dA6Ugv vrykj6HNdeqaOCXH9A+LF7mxnkA1H3S6fhpbcCUYpx+UZN7KwTUwtVYk/rmabbQBYWRr 37LwdGfayJHNLhwEnwBwWt7jVonhimLnWRKh9GGDKJTox8GAyZvzImtYES09lKDZI2tG Jalb4Td39a59564OkztW4AhGWNO4cLxGPD8NId9WGsi1K5kkFUT6K/TJCIOuzqPBw1Ax 7Kaq4QQ+30d1n1+YzX8ixKJa5rSa1Gea6G3FgmqQr0xKKOrcIV9nVnnM38rAUPLI1vwv QzyA== X-Gm-Message-State: AOAM533FKRdq8i1xjfeK8GwxjUTlT1TE3/L665fDoW4xR1FppTBFWbpi WsB9PsocbwLIxnDaYu+rvz8Ypd4TevJaSAgjT9HukQ== X-Google-Smtp-Source: ABdhPJyakgbC8nAlW2hjqlFNrQRATaI0vf6CyP8dlitTJhd3PE8hsQOZRyR7ctOJrvEl5pPDFKIFBsDXFwetOY+dcYk= X-Received: by 2002:a05:620a:1255:: with SMTP id a21mr7224481qkl.89.1603554153509; Sat, 24 Oct 2020 08:42:33 -0700 (PDT) MIME-Version: 1.0 References: <202010021826.092IQfdj023808@repo.freebsd.org> <44421602932538@mail.yandex.ru> <43251602934532@mail.yandex.ru> <59021602950992@mail.yandex.ru> In-Reply-To: From: Warner Losh Date: Sat, 24 Oct 2020 09:42:22 -0600 Message-ID: Subject: Re: svn commit: r366372 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf To: Kyle Evans Cc: Hans Petter Selasky , Niclas Zeising , "Alexander V. Chernikov" , Emmanuel Vadot , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 4CJQMt2XTfz3SWR X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=NkdQEAWn; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72c) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.75 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.06)[-1.064]; NEURAL_HAM_LONG(-0.97)[-0.965]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.72)[-0.722]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::72c:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[svn-src-head]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 15:42:35 -0000 On Sat, Oct 24, 2020 at 9:38 AM Kyle Evans wrote: > On Sat, Oct 24, 2020 at 4:52 AM Hans Petter Selasky > wrote: > > > > On 2020-10-24 02:13, Warner Losh wrote: > > > I was going to suggest and try this change, but life has been > complicated... > > > > > > Has it been committed? > > > > > > > No, not yet. > > > > --HPS > > > > I went ahead and did so: r367004 > Excellent. I was going to do that, but you committed exactly what I was going to. Warner From owner-svn-src-head@freebsd.org Sat Oct 24 15:58:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6528444D2BD; Sat, 24 Oct 2020 15:58:47 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJQkb2MVgz3TP1; Sat, 24 Oct 2020 15:58:47 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33B3F1B038; Sat, 24 Oct 2020 15:58:47 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OFwlY4081494; Sat, 24 Oct 2020 15:58:47 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OFwgLM081466; Sat, 24 Oct 2020 15:58:42 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202010241558.09OFwgLM081466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 24 Oct 2020 15:58:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367005 - head/contrib/less X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/contrib/less X-SVN-Commit-Revision: 367005 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 15:58:47 -0000 Author: delphij Date: Sat Oct 24 15:58:42 2020 New Revision: 367005 URL: https://svnweb.freebsd.org/changeset/base/367005 Log: MFV r366990: less v563. MFC after: 2 weeks Relnotes: yes Modified: head/contrib/less/NEWS head/contrib/less/README head/contrib/less/brac.c head/contrib/less/ch.c head/contrib/less/charset.c head/contrib/less/charset.h head/contrib/less/cmd.h head/contrib/less/cmdbuf.c head/contrib/less/command.c head/contrib/less/compose.uni head/contrib/less/cvt.c head/contrib/less/decode.c head/contrib/less/edit.c head/contrib/less/filename.c head/contrib/less/fmt.uni head/contrib/less/forwback.c head/contrib/less/funcs.h head/contrib/less/help.c head/contrib/less/ifile.c head/contrib/less/input.c head/contrib/less/jump.c head/contrib/less/less.h head/contrib/less/less.nro head/contrib/less/lessecho.c head/contrib/less/lessecho.nro head/contrib/less/lesskey.c head/contrib/less/lesskey.h head/contrib/less/lesskey.nro head/contrib/less/lglob.h head/contrib/less/line.c head/contrib/less/linenum.c head/contrib/less/lsystem.c head/contrib/less/main.c head/contrib/less/mark.c head/contrib/less/mkutable head/contrib/less/optfunc.c head/contrib/less/option.c head/contrib/less/option.h head/contrib/less/opttbl.c head/contrib/less/os.c head/contrib/less/output.c head/contrib/less/pattern.c head/contrib/less/pattern.h head/contrib/less/pckeys.h head/contrib/less/position.c head/contrib/less/position.h head/contrib/less/prompt.c head/contrib/less/screen.c head/contrib/less/scrsize.c head/contrib/less/search.c head/contrib/less/signal.c head/contrib/less/tags.c head/contrib/less/ttyin.c head/contrib/less/ubin.uni head/contrib/less/version.c head/contrib/less/wide.uni Directory Properties: head/contrib/less/ (props changed) Modified: head/contrib/less/NEWS ============================================================================== --- head/contrib/less/NEWS Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/NEWS Sat Oct 24 15:58:42 2020 (r367005) @@ -11,6 +11,31 @@ ====================================================================== + Major changes between "less" versions 551 and 563 + +* Update Unicode tables. + +* Treat Hangul Jamo medial vowels and final consonants as zero width. + +* Display error message immediately when -o is toggled and + input is not a pipe. + +* Fix regression: make screen repaint when "squished" and + a no-movement command is given. + +* Fix erroneous EOF calculation when F command is interrupted. + +* Make WIN32C version include this fix from 551: + Don't count lines in initial screen if using -X with -F. + +* Fix display bug in WIN32C version. + +* Fix memory corruption when built with libtermcap. + +* Support libtinfow. + +====================================================================== + Major changes between "less" versions 530 and 551 * Add --mouse option. Modified: head/contrib/less/README ============================================================================== --- head/contrib/less/README Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/README Sat Oct 24 15:58:42 2020 (r367005) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 551 + Less, version 563 - This is the distribution of less, version 551, released 11 Jun 2019. + This is the distribution of less, version 563, released 13 Jun 2020. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -32,6 +32,14 @@ This is the distribution of "less", a paginator simila The formatted manual page is in less.man. The manual page nroff source is in less.nro. Major changes made since the last posted version are in NEWS. + +======================================================================= +PRE-INSTALLATION (when using git) + +If you are building from a clone of a git repository, +type "make -f Makefile.aut". +If you are building from a numbered release package (a tar or zip file +with a name like less-999.tar.gz or less-999.zip), you should skip this step. ======================================================================= INSTALLATION (Unix systems only): Modified: head/contrib/less/brac.c ============================================================================== --- head/contrib/less/brac.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/brac.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: head/contrib/less/ch.c ============================================================================== --- head/contrib/less/ch.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/ch.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -408,6 +408,7 @@ end_logfile(VOID_PARAM) } close(logfile); logfile = -1; + free(namelogfile); namelogfile = NULL; } @@ -842,7 +843,8 @@ seekable(f) public void ch_set_eof(VOID_PARAM) { - ch_fsize = ch_fpos; + if (ch_fsize != NULL_POSITION && ch_fsize < ch_fpos) + ch_fsize = ch_fpos; } Modified: head/contrib/less/charset.c ============================================================================== --- head/contrib/less/charset.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/charset.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -509,7 +509,7 @@ prutfchar(ch) */ public int utf_len(ch) - unsigned char ch; + int ch; { if ((ch & 0x80) == 0) return 1; Modified: head/contrib/less/charset.h ============================================================================== --- head/contrib/less/charset.h Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/charset.h Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: head/contrib/less/cmd.h ============================================================================== --- head/contrib/less/cmd.h Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/cmd.h Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: head/contrib/less/cmdbuf.c ============================================================================== --- head/contrib/less/cmdbuf.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/cmdbuf.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -34,7 +34,7 @@ static int literal; /* Next input char should not be static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME -static int cmd_complete(); +static int cmd_complete LESSPARAMS((int action)); /* * These variables are statics used by cmd_complete. */ @@ -960,10 +960,7 @@ cmd_istr(str) step_char(&s, +1, endline); action = cmd_ichar(os, s - os); if (action != CC_OK) - { - bell(); return (action); - } } return (CC_OK); } Modified: head/contrib/less/command.c ============================================================================== --- head/contrib/less/command.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/command.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -90,7 +90,7 @@ struct ungot { }; static struct ungot* ungot = NULL; -static void multi_search(); +static void multi_search LESSPARAMS((char *pattern, int n, int silent)); /* * Move the cursor to start of prompt line before executing a command. @@ -1806,6 +1806,12 @@ commands(VOID_PARAM) optgetname = FALSE; mca_opt_toggle(); c = getcc(); + cbuf = opt_toggle_disallowed(c); + if (cbuf != NULL) + { + error(cbuf, NULL_PARG); + break; + } goto again; case A_DISP_OPTION: Modified: head/contrib/less/compose.uni ============================================================================== --- head/contrib/less/compose.uni Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/compose.uni Sat Oct 24 15:58:42 2020 (r367005) @@ -1,4 +1,4 @@ -/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Wed Feb 13 17:57:05 PST 2019 */ +/* Generated by "./mkutable -f2 Mn Me -- unicode/UnicodeData.txt" on Tue May 19 14:47:34 PDT 2020 */ { 0x0300, 0x036f }, /* Mn */ { 0x0483, 0x0487 }, /* Mn */ { 0x0488, 0x0489 }, /* Me */ @@ -58,7 +58,7 @@ { 0x0b3f, 0x0b3f }, /* Mn */ { 0x0b41, 0x0b44 }, /* Mn */ { 0x0b4d, 0x0b4d }, /* Mn */ - { 0x0b56, 0x0b56 }, /* Mn */ + { 0x0b55, 0x0b56 }, /* Mn */ { 0x0b62, 0x0b63 }, /* Mn */ { 0x0b82, 0x0b82 }, /* Mn */ { 0x0bc0, 0x0bc0 }, /* Mn */ @@ -81,6 +81,7 @@ { 0x0d41, 0x0d44 }, /* Mn */ { 0x0d4d, 0x0d4d }, /* Mn */ { 0x0d62, 0x0d63 }, /* Mn */ + { 0x0d81, 0x0d81 }, /* Mn */ { 0x0dca, 0x0dca }, /* Mn */ { 0x0dd2, 0x0dd4 }, /* Mn */ { 0x0dd6, 0x0dd6 }, /* Mn */ @@ -88,8 +89,7 @@ { 0x0e34, 0x0e3a }, /* Mn */ { 0x0e47, 0x0e4e }, /* Mn */ { 0x0eb1, 0x0eb1 }, /* Mn */ - { 0x0eb4, 0x0eb9 }, /* Mn */ - { 0x0ebb, 0x0ebc }, /* Mn */ + { 0x0eb4, 0x0ebc }, /* Mn */ { 0x0ec8, 0x0ecd }, /* Mn */ { 0x0f18, 0x0f19 }, /* Mn */ { 0x0f35, 0x0f35 }, /* Mn */ @@ -112,6 +112,7 @@ { 0x1085, 0x1086 }, /* Mn */ { 0x108d, 0x108d }, /* Mn */ { 0x109d, 0x109d }, /* Mn */ + { 0x1160, 0x11ff }, /* Mn */ { 0x135d, 0x135f }, /* Mn */ { 0x1712, 0x1714 }, /* Mn */ { 0x1732, 0x1734 }, /* Mn */ @@ -140,6 +141,7 @@ { 0x1a7f, 0x1a7f }, /* Mn */ { 0x1ab0, 0x1abd }, /* Mn */ { 0x1abe, 0x1abe }, /* Me */ + { 0x1abf, 0x1ac0 }, /* Mn */ { 0x1b00, 0x1b03 }, /* Mn */ { 0x1b34, 0x1b34 }, /* Mn */ { 0x1b36, 0x1b3a }, /* Mn */ @@ -183,6 +185,7 @@ { 0xa806, 0xa806 }, /* Mn */ { 0xa80b, 0xa80b }, /* Mn */ { 0xa825, 0xa826 }, /* Mn */ + { 0xa82c, 0xa82c }, /* Mn */ { 0xa8c4, 0xa8c5 }, /* Mn */ { 0xa8e0, 0xa8f1 }, /* Mn */ { 0xa8ff, 0xa8ff }, /* Mn */ @@ -191,7 +194,7 @@ { 0xa980, 0xa982 }, /* Mn */ { 0xa9b3, 0xa9b3 }, /* Mn */ { 0xa9b6, 0xa9b9 }, /* Mn */ - { 0xa9bc, 0xa9bc }, /* Mn */ + { 0xa9bc, 0xa9bd }, /* Mn */ { 0xa9e5, 0xa9e5 }, /* Mn */ { 0xaa29, 0xaa2e }, /* Mn */ { 0xaa31, 0xaa32 }, /* Mn */ @@ -209,6 +212,8 @@ { 0xabe5, 0xabe5 }, /* Mn */ { 0xabe8, 0xabe8 }, /* Mn */ { 0xabed, 0xabed }, /* Mn */ + { 0xd7b0, 0xd7c6 }, /* Mn */ + { 0xd7cb, 0xd7fb }, /* Mn */ { 0xfb1e, 0xfb1e }, /* Mn */ { 0xfe00, 0xfe0f }, /* Mn */ { 0xfe20, 0xfe2f }, /* Mn */ @@ -222,6 +227,7 @@ { 0x10a3f, 0x10a3f }, /* Mn */ { 0x10ae5, 0x10ae6 }, /* Mn */ { 0x10d24, 0x10d27 }, /* Mn */ + { 0x10eab, 0x10eac }, /* Mn */ { 0x10f46, 0x10f50 }, /* Mn */ { 0x11001, 0x11001 }, /* Mn */ { 0x11038, 0x11046 }, /* Mn */ @@ -235,6 +241,7 @@ { 0x11180, 0x11181 }, /* Mn */ { 0x111b6, 0x111be }, /* Mn */ { 0x111c9, 0x111cc }, /* Mn */ + { 0x111cf, 0x111cf }, /* Mn */ { 0x1122f, 0x11231 }, /* Mn */ { 0x11234, 0x11234 }, /* Mn */ { 0x11236, 0x11237 }, /* Mn */ @@ -270,6 +277,12 @@ { 0x11727, 0x1172b }, /* Mn */ { 0x1182f, 0x11837 }, /* Mn */ { 0x11839, 0x1183a }, /* Mn */ + { 0x1193b, 0x1193c }, /* Mn */ + { 0x1193e, 0x1193e }, /* Mn */ + { 0x11943, 0x11943 }, /* Mn */ + { 0x119d4, 0x119d7 }, /* Mn */ + { 0x119da, 0x119db }, /* Mn */ + { 0x119e0, 0x119e0 }, /* Mn */ { 0x11a01, 0x11a0a }, /* Mn */ { 0x11a33, 0x11a38 }, /* Mn */ { 0x11a3b, 0x11a3e }, /* Mn */ @@ -296,7 +309,9 @@ { 0x11ef3, 0x11ef4 }, /* Mn */ { 0x16af0, 0x16af4 }, /* Mn */ { 0x16b30, 0x16b36 }, /* Mn */ + { 0x16f4f, 0x16f4f }, /* Mn */ { 0x16f8f, 0x16f92 }, /* Mn */ + { 0x16fe4, 0x16fe4 }, /* Mn */ { 0x1bc9d, 0x1bc9e }, /* Mn */ { 0x1d167, 0x1d169 }, /* Mn */ { 0x1d17b, 0x1d182 }, /* Mn */ @@ -314,6 +329,9 @@ { 0x1e01b, 0x1e021 }, /* Mn */ { 0x1e023, 0x1e024 }, /* Mn */ { 0x1e026, 0x1e02a }, /* Mn */ + { 0x1e130, 0x1e136 }, /* Mn */ + { 0x1e2ae, 0x1e2ae }, /* Mn */ + { 0x1e2ec, 0x1e2ef }, /* Mn */ { 0x1e8d0, 0x1e8d6 }, /* Mn */ { 0x1e944, 0x1e94a }, /* Mn */ { 0xe0100, 0xe01ef }, /* Mn */ Modified: head/contrib/less/cvt.c ============================================================================== --- head/contrib/less/cvt.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/cvt.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: head/contrib/less/decode.c ============================================================================== --- head/contrib/less/decode.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/decode.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: head/contrib/less/edit.c ============================================================================== --- head/contrib/less/edit.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/edit.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -854,7 +854,6 @@ loop: /* * Don't do anything. */ - free(filename); return; case 'q': quit(QUIT_OK); Modified: head/contrib/less/filename.c ============================================================================== --- head/contrib/less/filename.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/filename.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -795,7 +795,7 @@ lglob(filename) } /* - * @@@ + * Return canonical pathname. */ public char * lrealpath(path) Modified: head/contrib/less/fmt.uni ============================================================================== --- head/contrib/less/fmt.uni Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/fmt.uni Sat Oct 24 15:58:42 2020 (r367005) @@ -1,4 +1,4 @@ -/* Generated by "./mkutable -f2 Cf -- unicode/UnicodeData.txt" on Wed Feb 13 17:57:05 PST 2019 */ +/* Generated by "./mkutable -f2 Cf -- unicode/UnicodeData.txt" on Tue May 19 14:47:34 PDT 2020 */ { 0x00ad, 0x00ad }, /* Cf */ { 0x0600, 0x0605 }, /* Cf */ { 0x061c, 0x061c }, /* Cf */ @@ -14,6 +14,7 @@ { 0xfff9, 0xfffb }, /* Cf */ { 0x110bd, 0x110bd }, /* Cf */ { 0x110cd, 0x110cd }, /* Cf */ + { 0x13430, 0x13438 }, /* Cf */ { 0x1bca0, 0x1bca3 }, /* Cf */ { 0x1d173, 0x1d17a }, /* Cf */ { 0xe0001, 0xe0001 }, /* Cf */ Modified: head/contrib/less/forwback.c ============================================================================== --- head/contrib/less/forwback.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/forwback.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -21,7 +21,6 @@ public int screen_trashed; public int squished; public int no_back_scroll = 0; public int forw_prompt; -public int same_pos_bell = 1; extern int sigs; extern int top_scroll; @@ -290,7 +289,7 @@ forw(n, pos, force, only_last, nblank) forw_prompt = 1; } - if (nlines == 0 && !ignore_eoi && same_pos_bell) + if (nlines == 0 && !ignore_eoi) eof_bell(); else if (do_repaint) repaint(); @@ -350,7 +349,7 @@ back(n, pos, force, only_last) } } - if (nlines == 0 && same_pos_bell) + if (nlines == 0) eof_bell(); else if (do_repaint) repaint(); Modified: head/contrib/less/funcs.h ============================================================================== --- head/contrib/less/funcs.h Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/funcs.h Sat Oct 24 15:58:42 2020 (r367005) @@ -61,7 +61,7 @@ public int binary_char LESSPARAMS ((LWCHAR c)); public int control_char LESSPARAMS ((LWCHAR c)); public char * prchar LESSPARAMS ((LWCHAR c)); public char * prutfchar LESSPARAMS ((LWCHAR ch)); -public int utf_len LESSPARAMS ((unsigned char ch)); +public int utf_len LESSPARAMS ((int ch)); public int is_utf8_well_formed LESSPARAMS ((char *ss, int slen)); public void utf_skip_to_lead LESSPARAMS ((char **pp, char *limit)); public LWCHAR get_wchar LESSPARAMS ((constant char *p)); @@ -187,10 +187,10 @@ public void pshift_all LESSPARAMS ((VOID_PARAM)); public int is_ansi_end LESSPARAMS ((LWCHAR ch)); public int is_ansi_middle LESSPARAMS ((LWCHAR ch)); public void skip_ansi LESSPARAMS ((char **pp, constant char *limit)); -public int pappend LESSPARAMS ((unsigned char c, POSITION pos)); +public int pappend LESSPARAMS ((int c, POSITION pos)); public int pflushmbc LESSPARAMS ((VOID_PARAM)); public void pdone LESSPARAMS ((int endline, int chopped, int forw)); -public void set_status_col LESSPARAMS ((char c)); +public void set_status_col LESSPARAMS ((int c)); public int gline LESSPARAMS ((int i, int *ap)); public void null_line LESSPARAMS ((VOID_PARAM)); public POSITION forw_raw_line LESSPARAMS ((POSITION curr_pos, char **linep, int *line_lenp)); @@ -243,6 +243,7 @@ public void scan_option LESSPARAMS ((char *s)); public void toggle_option LESSPARAMS ((struct loption *o, int lower, char *s, int how_toggle)); public int opt_has_param LESSPARAMS ((struct loption *o)); public char * opt_prompt LESSPARAMS ((struct loption *o)); +public char * opt_toggle_disallowed LESSPARAMS ((int c)); public int isoptpending LESSPARAMS ((VOID_PARAM)); public void nopendopt LESSPARAMS ((VOID_PARAM)); public int getnum LESSPARAMS ((char **sp, char *printopt, int *errp)); Modified: head/contrib/less/help.c ============================================================================== --- head/contrib/less/help.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/help.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,4 +1,4 @@ -/* This file was generated by mkhelp.pl from less.hlp at 18:12 on 2019/6/11 */ +/* This file was generated by mkhelp.pl from less.hlp at 3:34 on 2020/6/14 */ #include "less.h" constant char helpdata[] = { '\n', Modified: head/contrib/less/ifile.c ============================================================================== --- head/contrib/less/ifile.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/ifile.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: head/contrib/less/input.c ============================================================================== --- head/contrib/less/input.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/input.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: head/contrib/less/jump.c ============================================================================== --- head/contrib/less/jump.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/jump.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -219,7 +219,7 @@ jump_loc(pos, sline) nline -= sindex; if (nline > 0) forw(nline, position(BOTTOM_PLUS_ONE), 1, 0, 0); - else if (nline < 0) + else back(-nline, position(TOP), 1, 0); #if HILITE_SEARCH if (show_attn) Modified: head/contrib/less/less.h ============================================================================== --- head/contrib/less/less.h Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/less.h Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: head/contrib/less/less.nro ============================================================================== --- head/contrib/less/less.nro Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/less.nro Sat Oct 24 15:58:42 2020 (r367005) @@ -1,4 +1,5 @@ -.TH LESS 1 "Version 551: 11 Jun 2019" +'\" t +.TH LESS 1 "Version 563: 13 Jun 2020" .SH NAME less \- opposite of more .SH SYNOPSIS @@ -21,19 +22,18 @@ less \- opposite of more .B " [\-# \fIshift\/\fP] [+[+]\fIcmd\/\fP] [\-\-] [\fIfilename\/\fP]..." .br (See the OPTIONS section for alternate option syntax with long option names.) - +. .SH DESCRIPTION .I Less is a program similar to -.I more -(1), but which allows backward movement +.IR more (1), +but which allows backward movement in the file as well as forward movement. Also, .I less does not have to read the entire input file before starting, so with large input files it starts up faster than text editors like -.I vi -(1). +.IR vi (1). .I Less uses termcap (or terminfo on some systems), so it can run on a variety of terminals. @@ -48,7 +48,7 @@ and Commands may be preceded by a decimal number, called N in the descriptions below. The number is used by some commands, as indicated. - +. .SH COMMANDS In the following descriptions, ^X means control-X. ESC stands for the ESCAPE key; for example ESC-v means the @@ -229,7 +229,7 @@ that is, do a simple textual comparison. .RE .IP ?pattern Search backward in the file for the N-th line containing the pattern. -The search starts at the last line displayed +The search starts at the last line displayed (but see the \-a and \-j options, which change this). .sp Certain characters are special as in the / command: @@ -376,7 +376,7 @@ this will reset the option to the "opposite" of its de and print a message describing the new setting. This does not work for numeric or string-valued options. .IP \-\-! -Like the \-! command, but takes a long option name +Like the \-!\& command, but takes a long option name rather than a single option letter. .IP _ (Underscore.) @@ -405,7 +405,7 @@ Exits The following four commands may or may not be valid, depending on your particular installation. -.PP +. .IP v Invokes an editor to edit the current file being viewed. The editor is taken from the environment variable VISUAL if defined, @@ -425,7 +425,7 @@ On MS-DOS and OS/2 systems, the shell is the normal co .IP "| shell-command" represents any mark letter. Pipes a section of the input file to the given shell command. -The section of the file to be piped is between the position marked by +The section of the file to be piped is between the position marked by the letter and the current screen. The entire current screen is included, regardless of whether the marked position is before or after the current screen. @@ -434,7 +434,7 @@ If is \&.\& or newline, the current screen is pipe .IP "s filename" Save the input to a file. This only works if the input is a pipe, not an ordinary file. -.PP +. .SH OPTIONS Command line options are described below. Most options may be changed while @@ -518,7 +518,7 @@ This was the default behavior in less versions prior t Specifies the amount of buffer space .I less will use for each file, in units of kilobytes (1024 bytes). -By default 64\ K of buffer space is used for each file +By default 64\ KB of buffer space is used for each file (unless the file is a pipe; see the \-B option). The \-b option specifies instead that \fIn\fP kilobytes of buffer space should be used for each file. @@ -530,7 +530,7 @@ buffers are allocated automatically as needed. If a large amount of data is read from the pipe, this can cause a large amount of memory to be allocated. The \-B option disables this automatic allocation of buffers for pipes, -so that only 64\ K +so that only 64\ KB (or the amount of space specified by the \-b option) is used for the pipe. Warning: use of \-B can result in erroneous display, since only the @@ -563,8 +563,9 @@ A single number \fIN\fP is the same as \fIN.M\fP, where \fIM\fP is the normal background color. The color may start or end with \fBu\fP to use underline (with the normal color, if by itself), if the system supports it (Windows only). -\fBx\fP may also be \fBa\fP to toggle strict ANSI sequence rendering (SGR mode). - +\fBx\fP may also be \fBa\fP to toggle strict ANSI sequence rendering +(SGR mode). +. .IP "\-e or \-\-quit-at-eof" Causes .I less @@ -654,8 +655,8 @@ The status column is also used if the \-w or \-W optio Causes .I less to open and interpret the named file as a -.I lesskey -(1) file. +.IR lesskey (1) +file. Multiple \-k options may be specified. If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or if a lesskey file is found in a standard place (see KEY BINDINGS), @@ -746,7 +747,7 @@ to that string. \-Ph changes the prompt for the help screen. \-P= changes the message printed by the = command. \-Pw changes the message printed while waiting for data (in the F command). - +.sp 1 All prompt strings consist of a sequence of letters and special escape sequences. See the section on PROMPTS for more details. @@ -762,7 +763,7 @@ The default is to ring the terminal bell in all such c .IP "\-Q or \-\-QUIET or \-\-SILENT" Causes totally "quiet" operation: the terminal bell is never rung. -If the terminal has a "visual bell", it is used in all cases +If the terminal has a "visual bell", it is used in all cases where the terminal bell would have been rung. .IP "\-r or \-\-raw-control-chars" Causes "raw" control characters to be displayed. @@ -804,7 +805,7 @@ output. Causes lines longer than the screen width to be chopped (truncated) rather than wrapped. That is, the portion of a long line that does not fit in -the screen width is not shown. +the screen width is not displayed until you press RIGHT-ARROW. The default is to wrap long lines; that is, display the remainder on the next line. .IP "\-t\fItag\fP or \-\-tag=\fItag\fP" @@ -813,12 +814,12 @@ will edit the file containing that tag. For this to work, tag information must be available; for example, there may be a file in the current directory called "tags", which was previously built by -.I ctags -(1) or an equivalent command. +.IR ctags (1) +or an equivalent command. If the environment variable LESSGLOBALTAGS is set, it is taken to be the name of a command compatible with -.I global -(1), and that command is executed to find the tag. +.IR global (1), +and that command is executed to find the tag. (See http://www.gnu.org/software/global/global.html). The \-t option may also be specified from within .I less @@ -870,7 +871,7 @@ If only one \fIn\fP is specified, tab stops are set at If multiple values separated by commas are specified, tab stops are set at those positions, and then continue with the same spacing as the last two. -For example, \fI-x9,17\fP will set tabs at positions 9, 17, 25, 33, etc. +For example, \fI\-x9,17\fP will set tabs at positions 9, 17, 25, 33, etc. The default for \fIn\fP is 8. .IP "\-X or \-\-no-init" Disables sending the termcap initialization and deinitialization strings @@ -944,15 +945,15 @@ will display the contents of that new file. Enables mouse input: scrolling the mouse wheel down moves forward in the file, scrolling the mouse wheel up moves backwards in the file, -and clicking the mouse sets the "#" mark to the line +and clicking the mouse sets the "#" mark to the line where the mouse is clicked. -The number of lines to scroll when the wheel is moved +The number of lines to scroll when the wheel is moved can be set by the \-\-wheel-lines option. Mouse input works only on terminals which support X11 mouse reporting, -and on the Windows version of +and on the Windows version of .IR less . .IP "\-\-MOUSE" -Like \-\-mouse, except the direction scrolled +Like \-\-mouse, except the direction scrolled on mouse wheel movement is reversed. .IP "\-\-no-keypad" Disables sending the keypad initialization and deinitialization strings @@ -961,7 +962,7 @@ This is sometimes useful if the keypad strings make th keypad behave in an undesirable manner. .IP "\-\-no-histdups" This option changes the behavior so that if a search string or -file name is typed in, and the same string is already in the history list, +file name is typed in, and the same string is already in the history list, the existing copy is removed from the history list before the new one is added. Thus, a given string will appear only once in the history list. Normally, a string may appear multiple times. @@ -969,7 +970,7 @@ Normally, a string may appear multiple times. This option changes the character used to mark truncated lines. It may begin with a two-character attribute indicator like LESSBINFMT does. If there is no attribute indicator, standout is used. -If set to "-", truncated lines are not marked. +If set to "\-", truncated lines are not marked. .IP "\-\-save-marks" Save marks in the history file, so marks are retained across different invocations of \fIless\fP. @@ -1001,7 +1002,7 @@ If the option starts with ++, the initial command appl every file being viewed, not just the first one. The + command described previously may also be used to set (or change) an initial command for every file. - +. .SH "LINE EDITING" When entering command line at the bottom of the screen (for example, a filename for the :e command, @@ -1069,13 +1070,12 @@ If you have changed your line-kill character in Unix t other than ^U, that character is used instead of ^U. .IP "^G" Delete the entire command line and return to the main prompt. - +. .SH "KEY BINDINGS" You may define your own .I less commands by using the program -.I lesskey -(1) +.IR lesskey (1) to create a lesskey file. This file specifies a set of command keys and an action associated with each key. @@ -1125,7 +1125,7 @@ was built with a different sysconf directory than /usr that directory is where the sysless file is found.) On MS-DOS and Windows systems, the system-wide lesskey file is c:\e_sysless. On OS/2 systems, the system-wide lesskey file is c:\esysless.ini. - +. .SH "INPUT PREPROCESSOR" You may define an "input preprocessor" for .IR less . @@ -1294,7 +1294,7 @@ Similarly, if the first two characters of LESSOPEN are the input pipe is used on standard input as well as other files. Again, in this case the dash is not considered to be part of the input pipe command. - +. .SH "NATIONAL CHARACTER SETS" There are three types of characters in the input file: .IP "normal characters" @@ -1349,7 +1349,7 @@ In this case, the environment variable LESSCHARDEF can to define a character set. It should be set to a string where each character in the string represents one character in the character set. -The character "." is used for a normal character, "c" for control, +The character ".\&" is used for a normal character, "c" for control, and "b" for binary. A decimal number may be used for repetition. For example, "bccc4b.\&" would mean character 0 is binary, @@ -1361,26 +1361,22 @@ represent any real character set.) .PP This table shows the value of LESSCHARDEF which is equivalent to each of the possible values for LESSCHARSET: -.sp - ascii\ 8bcccbcc18b95.b -.br - dos\ \ \ 8bcccbcc12bc5b95.b. -.br - ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b -.br - \ \ \ \ \ \ 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. -.br - IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc -.br - \ \ \ \ \ \ 191.b -.br - iso8859 8bcccbcc18b95.33b. -.br - koi8-r 8bcccbcc18b95.b128. -.br - latin1 8bcccbcc18b95.33b. -.br - next\ \ 8bcccbcc18b95.bb125.bb +. +.RS 5m +.TS +l l. +ascii 8bcccbcc18b95.b +dos 8bcccbcc12bc5b95.b. +ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b + 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. +IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc + 191.b +iso8859 8bcccbcc18b95.33b. +koi8-r 8bcccbcc18b95.b128. +latin1 8bcccbcc18b95.33b. +next 8bcccbcc18b95.bb125.bb +.TE +.RE .PP If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8" @@ -1429,11 +1425,11 @@ setting ("*x") so specifying one will affect both; LESSUTFBINFMT is read after LESSBINFMT so its setting, if any, will have priority. Problematic octets in a UTF-8 file (octets of a truncated sequence, -octets of a complete but non-shortest form sequence, illegal octets, +octets of a complete but non-shortest form sequence, invalid octets, and stray trailing octets) are displayed individually using LESSBINFMT so as to facilitate diagnostic of how the UTF-8 file is ill-formed. - +. .SH "PROMPTS" The \-P option allows you to tailor the prompt to your preference. The string given to the \-P option replaces the specified prompt string. @@ -1500,7 +1496,8 @@ Causes any trailing spaces to be removed. Usually used at the end of the string, but may appear anywhere. .IP "%T" Normally expands to the word "file". -However if viewing files via a tags list using the \-t option, it expands to the word "tag". +However if viewing files via a tags list using the \-t option, +it expands to the word "tag". .IP "%x" Replaced by the name of the next input file in the list. .PP @@ -1620,7 +1617,7 @@ line number, followed by the shell-escaped file name. If your editor does not accept the "+linenumber" syntax, or has other differences in invocation syntax, the LESSEDIT variable can be changed to modify this default. - +. .SH SECURITY When the environment variable LESSSECURE is set to 1, .I less @@ -1641,14 +1638,14 @@ log files use of lesskey files .IP "\-t" use of tags files -.IP " " +.IP metacharacters in filenames, such as * -.IP " " +.IP filename completion (TAB, ^L) .RE .PP Less can also be compiled to be permanently in "secure" mode. - +. .SH "COMPATIBILITY WITH MORE" If the environment variable LESS_IS_MORE is set to 1, or if the program is invoked via a file link named "more", @@ -1666,7 +1663,7 @@ behaves as if the \-E option were set. .PP The \-m option works differently. If the \-m option is not set, the medium prompt is used, -and it is prefixed with the string "--More--". +and it is prefixed with the string "\-\-More\-\-". If the \-m option is set, the short prompt is used. .PP The \-n option acts like the \-z option. @@ -1678,12 +1675,12 @@ command rather than a search pattern. .PP The LESS environment variable is ignored, and the MORE environment variable is used in its place. - +. .SH "ENVIRONMENT VARIABLES" Environment variables may be specified either in the system environment as usual, or in a -.I lesskey -(1) file. +.IR lesskey (1) +file. If environment variables are defined in more than one place, variables defined in a local lesskey file take precedence over variables defined in the system environment, which take precedence @@ -1738,8 +1735,8 @@ See discussion under PROMPTS. .IP LESSGLOBALTAGS Name of the command used by the \-t option to find global tags. Normally should be set to "global" if your system has the -.I global -(1) command. If not set, global tags are not used. +.IR global (1) +command. If not set, global tags are not used. .IP LESSHISTFILE Name of the history file used to remember search commands and shell commands between invocations of @@ -1752,9 +1749,13 @@ on OS/2 systems. The maximum number of commands to save in the history file. The default is 100. .IP LESSKEY -Name of the default lesskey(1) file. +Name of the default +.IR lesskey (1) +file. .IP LESSKEY_SYSTEM -Name of the default system-wide lesskey(1) file. +Name of the default system-wide +.IR lesskey (1) +file. .IP LESSMETACHARS List of characters which are considered "metacharacters" by the shell. .IP LESSMETAESCAPE @@ -1773,8 +1774,8 @@ String to be appended to a directory name in filename Format for displaying non-printable Unicode code points. .IP LESS_IS_MORE Emulate the -.I more -(1) command. +.IR more (1) +command. .IP LINES Sets the number of lines on the screen. Takes precedence over the number of lines specified by the TERM variable. @@ -1791,19 +1792,19 @@ compatible mode. User's search path (used to find a lesskey file on MS-DOS and OS/2 systems). .IP SHELL -The shell used to execute the ! command, as well as to expand filenames. +The shell used to execute the !\& command, as well as to expand filenames. .IP TERM The type of terminal on which .I less is being run. .IP VISUAL The name of the editor (used for the v command). - +. .SH "SEE ALSO" -lesskey(1) - +.BR lesskey (1) +. .SH COPYRIGHT -Copyright (C) 1984-2019 Mark Nudelman +Copyright (C) 1984-2020 Mark Nudelman .PP less is part of the GNU project and is free software. You can redistribute it and/or modify it @@ -1823,9 +1824,9 @@ less is distributed in the hope that it will be useful WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - +. .SH AUTHOR -.PP +. Mark Nudelman .br Report bugs at https://github.com/gwsw/less/issues. Modified: head/contrib/less/lessecho.c ============================================================================== --- head/contrib/less/lessecho.c Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/lessecho.c Sat Oct 24 15:58:42 2020 (r367005) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2019 Mark Nudelman + * Copyright (C) 1984-2020 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: head/contrib/less/lessecho.nro ============================================================================== --- head/contrib/less/lessecho.nro Sat Oct 24 15:38:04 2020 (r367004) +++ head/contrib/less/lessecho.nro Sat Oct 24 15:58:42 2020 (r367005) @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 551: 11 Jun 2019" +.TH LESSECHO 1 "Version 563: 13 Jun 2020" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS @@ -44,7 +44,7 @@ Specifies "n" to be the escape char for metachars, as Specifies that all arguments are to be quoted. The default is that only arguments containing metacharacters are quoted .SH "SEE ALSO" -less(1) +.BR less (1) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Oct 24 16:05:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95A3B44D780; Sat, 24 Oct 2020 16:05:38 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJQtV3Rdlz3Tv2; Sat, 24 Oct 2020 16:05:38 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 595861B282; Sat, 24 Oct 2020 16:05:38 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OG5c8p087437; Sat, 24 Oct 2020 16:05:38 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OG5c8O087436; Sat, 24 Oct 2020 16:05:38 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202010241605.09OG5c8O087436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Sat, 24 Oct 2020 16:05:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367006 - head/sbin/sysctl X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: head/sbin/sysctl X-SVN-Commit-Revision: 367006 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 16:05:38 -0000 Author: freqlabs Date: Sat Oct 24 16:05:37 2020 New Revision: 367006 URL: https://svnweb.freebsd.org/changeset/base/367006 Log: sysctl: Misc code cleanup * Use defined SYS_SYSCTL names * Use memcmp instead of explicit loop * Use NULL instead of 0 for pointer value * Use __FBSDID * Reformat, improve comments in parse() No functional changes. Reviewed by: imp MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D26832 Modified: head/sbin/sysctl/sysctl.c Modified: head/sbin/sysctl/sysctl.c ============================================================================== --- head/sbin/sysctl/sysctl.c Sat Oct 24 15:58:42 2020 (r367005) +++ head/sbin/sysctl/sysctl.c Sat Oct 24 16:05:37 2020 (r367006) @@ -29,20 +29,9 @@ * SUCH DAMAGE. */ -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); -#ifndef lint -#if 0 -static char sccsid[] = "@(#)from: sysctl.c 8.1 (Berkeley) 6/6/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - #include #include #include @@ -221,7 +210,7 @@ main(int argc, char **argv) if (Nflag && nflag) usage(); if (aflag && argc == 0) - exit(sysctl_all(0, 0)); + exit(sysctl_all(NULL, 0)); if (argc == 0 && conffile == NULL) usage(); @@ -369,6 +358,13 @@ parse(const char *string, int lineno) else line[0] = '\0'; + /* + * Split the string into name and value. + * + * Either = or : may be used as the delimiter. + * Whitespace surrounding the delimiter is trimmed. + * Quotes around the value are stripped. + */ cp = buf; if (snprintf(buf, BUFSIZ, "%s", string) >= BUFSIZ) { warnx("oid too long: '%s'%s", string, line); @@ -381,6 +377,7 @@ parse(const char *string, int lineno) warnx("Can't set variables when using -T or -W"); usage(); } + /* Trim whitespace before the value. */ while (isspace(*cp)) cp++; /* Strip a pair of " or ' if any. */ @@ -394,14 +391,17 @@ parse(const char *string, int lineno) newvalstr = cp; newsize = strlen(cp); } - /* Trim spaces */ + /* Trim whitespace after the name. */ cp = bufp + strlen(bufp) - 1; while (cp >= bufp && isspace((int)*cp)) { *cp = '\0'; cp--; } - len = name2oid(bufp, mib); + /* + * Check the name is a useable oid. + */ + len = name2oid(bufp, mib); if (len < 0) { if (iflag) return (0); @@ -425,6 +425,10 @@ parse(const char *string, int lineno) exit(1); } + /* + * We have a useable oid to work with. If there is no value given, + * show the node and its children. Otherwise, set the new value. + */ if (newvalstr == NULL || dflag) { if ((kind & CTLTYPE) == CTLTYPE_NODE) { if (dflag) { @@ -438,105 +442,109 @@ parse(const char *string, int lineno) if (!i && !bflag) putchar('\n'); } - } else { - if ((kind & CTLTYPE) == CTLTYPE_NODE) { - warnx("oid '%s' isn't a leaf node%s", bufp, line); - return (1); - } + return (0); + } - if (!(kind & CTLFLAG_WR)) { - if (kind & CTLFLAG_TUN) { - warnx("oid '%s' is a read only tunable%s", bufp, line); - warnx("Tunable values are set in /boot/loader.conf"); - } else - warnx("oid '%s' is read only%s", bufp, line); - return (1); - } + /* + * We have a new value to set. Check its validity and parse if numeric. + */ + if ((kind & CTLTYPE) == CTLTYPE_NODE) { + warnx("oid '%s' isn't a leaf node%s", bufp, line); + return (1); + } - switch (kind & CTLTYPE) { - case CTLTYPE_INT: - case CTLTYPE_UINT: - case CTLTYPE_LONG: - case CTLTYPE_ULONG: - case CTLTYPE_S8: - case CTLTYPE_S16: - case CTLTYPE_S32: - case CTLTYPE_S64: - case CTLTYPE_U8: - case CTLTYPE_U16: - case CTLTYPE_U32: - case CTLTYPE_U64: - if (strlen(newvalstr) == 0) { - warnx("empty numeric value"); - return (1); - } - /* FALLTHROUGH */ - case CTLTYPE_STRING: - break; - default: - warnx("oid '%s' is type %d," - " cannot set that%s", bufp, - kind & CTLTYPE, line); + if (!(kind & CTLFLAG_WR)) { + if (kind & CTLFLAG_TUN) { + warnx("oid '%s' is a read only tunable%s", bufp, line); + warnx("Tunable values are set in /boot/loader.conf"); + } else + warnx("oid '%s' is read only%s", bufp, line); + return (1); + } + + switch (kind & CTLTYPE) { + case CTLTYPE_INT: + case CTLTYPE_UINT: + case CTLTYPE_LONG: + case CTLTYPE_ULONG: + case CTLTYPE_S8: + case CTLTYPE_S16: + case CTLTYPE_S32: + case CTLTYPE_S64: + case CTLTYPE_U8: + case CTLTYPE_U16: + case CTLTYPE_U32: + case CTLTYPE_U64: + if (strlen(newvalstr) == 0) { + warnx("empty numeric value"); return (1); } + /* FALLTHROUGH */ + case CTLTYPE_STRING: + break; + default: + warnx("oid '%s' is type %d, cannot set that%s", + bufp, kind & CTLTYPE, line); + return (1); + } - newbuf = NULL; + newbuf = NULL; - switch (kind & CTLTYPE) { - case CTLTYPE_STRING: - newval = newvalstr; - break; - default: - newsize = 0; - while ((cp = strsep(&newvalstr, " ,")) != NULL) { - if (*cp == '\0') - continue; - if (!parse_numeric(cp, fmt, kind, &newbuf, - &newsize)) { - warnx("invalid %s '%s'%s", - ctl_typename[kind & CTLTYPE], - cp, line); - free(newbuf); - return (1); - } - } - newval = newbuf; - break; - } - - i = show_var(mib, len, false); - if (sysctl(mib, len, 0, 0, newval, newsize) == -1) { - free(newbuf); - if (!i && !bflag) - putchar('\n'); - switch (errno) { - case EOPNOTSUPP: - warnx("%s: value is not available%s", - string, line); + switch (kind & CTLTYPE) { + case CTLTYPE_STRING: + newval = newvalstr; + break; + default: + newsize = 0; + while ((cp = strsep(&newvalstr, " ,")) != NULL) { + if (*cp == '\0') + continue; + if (!parse_numeric(cp, fmt, kind, &newbuf, &newsize)) { + warnx("invalid %s '%s'%s", + ctl_typename[kind & CTLTYPE], cp, line); + free(newbuf); return (1); - case ENOTDIR: - warnx("%s: specification is incomplete%s", - string, line); - return (1); - case ENOMEM: - warnx("%s: type is unknown to this program%s", - string, line); - return (1); - default: - warn("%s%s", string, line); - return (1); } } + newval = newbuf; + break; + } + + /* + * Show the current value, then set and show the new value. + */ + i = show_var(mib, len, false); + if (sysctl(mib, len, 0, 0, newval, newsize) == -1) { free(newbuf); - if (!bflag) - printf(" -> "); - i = nflag; - nflag = 1; - j = show_var(mib, len, false); - if (!j && !bflag) + if (!i && !bflag) putchar('\n'); - nflag = i; + switch (errno) { + case EOPNOTSUPP: + warnx("%s: value is not available%s", + string, line); + return (1); + case ENOTDIR: + warnx("%s: specification is incomplete%s", + string, line); + return (1); + case ENOMEM: + warnx("%s: type is unknown to this program%s", + string, line); + return (1); + default: + warn("%s%s", string, line); + return (1); + } } + free(newbuf); + if (!bflag) + printf(" -> "); + i = nflag; + nflag = 1; + j = show_var(mib, len, false); + if (!j && !bflag) + putchar('\n'); + nflag = i; return (0); } @@ -898,8 +906,8 @@ name2oid(const char *name, int *oidp) int i; size_t j; - oid[0] = 0; - oid[1] = 3; + oid[0] = CTL_SYSCTL; + oid[1] = CTL_SYSCTL_NAME2OID; j = CTL_MAXNAME * sizeof(int); i = sysctl(oid, 2, oidp, &j, name, strlen(name)); @@ -917,8 +925,8 @@ oidfmt(int *oid, int len, char *fmt, u_int *kind) int i; size_t j; - qoid[0] = 0; - qoid[1] = 4; + qoid[0] = CTL_SYSCTL; + qoid[1] = CTL_SYSCTL_OIDFMT; memcpy(qoid + 2, oid, len * sizeof(int)); j = sizeof(buf); @@ -964,10 +972,10 @@ show_var(int *oid, int nlen, bool honor_skip) bzero(buf, BUFSIZ); bzero(fmt, BUFSIZ); bzero(name, BUFSIZ); - qoid[0] = 0; + qoid[0] = CTL_SYSCTL; memcpy(qoid + 2, oid, nlen * sizeof(int)); - qoid[1] = 1; + qoid[1] = CTL_SYSCTL_NAME; j = sizeof(name); i = sysctl(qoid, nlen + 2, name, &j, 0, 0); if (i || !j) @@ -1006,7 +1014,7 @@ show_var(int *oid, int nlen, bool honor_skip) printf("%s", prntype); return (0); } - qoid[1] = 5; + qoid[1] = CTL_SYSCTL_OIDDESCR; j = sizeof(buf); i = sysctl(qoid, nlen + 2, buf, &j, 0, 0); printf("%s", buf); @@ -1227,9 +1235,8 @@ sysctl_all(int *oid, int len) if (len < 0 || l2 < (unsigned int)len) return (0); - for (i = 0; i < len; i++) - if (name2[i] != oid[i]) - return (0); + if (memcmp(name2, oid, len * sizeof(int)) != 0) + return (0); i = show_var(name2, l2, honor_skip); if (!i && !bflag) From owner-svn-src-head@freebsd.org Sat Oct 24 16:09:20 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 602A644D738; Sat, 24 Oct 2020 16:09:20 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJQym1Zqvz3V5W; Sat, 24 Oct 2020 16:09:20 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 171A31B10C; Sat, 24 Oct 2020 16:09:20 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OG9J3g087702; Sat, 24 Oct 2020 16:09:19 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OG9Jgd087697; Sat, 24 Oct 2020 16:09:19 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202010241609.09OG9Jgd087697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Sat, 24 Oct 2020 16:09:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367007 - in head/sys/netinet: . cc X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: in head/sys/netinet: . cc X-SVN-Commit-Revision: 367007 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 16:09:20 -0000 Author: rscheff Date: Sat Oct 24 16:09:18 2020 New Revision: 367007 URL: https://svnweb.freebsd.org/changeset/base/367007 Log: tcp: move cwnd and ssthresh updates into cc modules This will pave the way of setting ssthresh differently in TCP CUBIC, according to RFC8312 section 4.7. No functional change, only code movement. Submitted by: chengc_netapp.com Reviewed by: rrs, tuexen, rscheff MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D26807 Modified: head/sys/netinet/cc/cc_cubic.c head/sys/netinet/cc/cc_dctcp.c head/sys/netinet/cc/cc_htcp.c head/sys/netinet/cc/cc_newreno.c head/sys/netinet/tcp_input.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Sat Oct 24 16:05:37 2020 (r367006) +++ head/sys/netinet/cc/cc_cubic.c Sat Oct 24 16:09:18 2020 (r367007) @@ -264,8 +264,10 @@ static void cubic_cong_signal(struct cc_var *ccv, uint32_t type) { struct cubic *cubic_data; + u_int mss; cubic_data = ccv->cc_data; + mss = tcp_maxseg(ccv->ccvc.tcp); switch (type) { case CC_NDUPACK: @@ -292,6 +294,10 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) break; case CC_RTO: + CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd), + CCV(ccv, snd_cwnd)) / 2 / mss, + 2) * mss; + CCV(ccv, snd_cwnd) = mss; /* * Grab the current time and record it so we know when the * most recent congestion event was. Only record it when the Modified: head/sys/netinet/cc/cc_dctcp.c ============================================================================== --- head/sys/netinet/cc/cc_dctcp.c Sat Oct 24 16:05:37 2020 (r367006) +++ head/sys/netinet/cc/cc_dctcp.c Sat Oct 24 16:09:18 2020 (r367007) @@ -235,7 +235,7 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) { dctcp_data = ccv->cc_data; cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); + mss = tcp_maxseg(ccv->ccvc.tcp); switch (type) { case CC_NDUPACK: @@ -282,6 +282,10 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) dctcp_data->ece_curr = 1; break; case CC_RTO: + CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd), + CCV(ccv, snd_cwnd)) / 2 / mss, + 2) * mss; + CCV(ccv, snd_cwnd) = mss; dctcp_update_alpha(ccv); dctcp_data->save_sndnxt += CCV(ccv, t_maxseg); dctcp_data->num_cong_events++; Modified: head/sys/netinet/cc/cc_htcp.c ============================================================================== --- head/sys/netinet/cc/cc_htcp.c Sat Oct 24 16:05:37 2020 (r367006) +++ head/sys/netinet/cc/cc_htcp.c Sat Oct 24 16:09:18 2020 (r367007) @@ -271,8 +271,10 @@ static void htcp_cong_signal(struct cc_var *ccv, uint32_t type) { struct htcp *htcp_data; + u_int mss; htcp_data = ccv->cc_data; + mss = tcp_maxseg(ccv->ccvc.tcp); switch (type) { case CC_NDUPACK: @@ -311,6 +313,10 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type) break; case CC_RTO: + CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd), + CCV(ccv, snd_cwnd)) / 2 / mss, + 2) * mss; + CCV(ccv, snd_cwnd) = mss; /* * Grab the current time and record it so we know when the * most recent congestion event was. Only record it when the Modified: head/sys/netinet/cc/cc_newreno.c ============================================================================== --- head/sys/netinet/cc/cc_newreno.c Sat Oct 24 16:05:37 2020 (r367006) +++ head/sys/netinet/cc/cc_newreno.c Sat Oct 24 16:09:18 2020 (r367007) @@ -237,7 +237,7 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) u_int mss; cwin = CCV(ccv, snd_cwnd); - mss = CCV(ccv, t_maxseg); + mss = tcp_maxseg(ccv->ccvc.tcp); nreno = ccv->cc_data; beta = (nreno == NULL) ? V_newreno_beta : nreno->beta; beta_ecn = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn; @@ -274,6 +274,12 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type) CCV(ccv, snd_cwnd) = cwin; ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } + break; + case CC_RTO: + CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd), + CCV(ccv, snd_cwnd)) / 2 / mss, + 2) * mss; + CCV(ccv, snd_cwnd) = mss; break; } } Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sat Oct 24 16:05:37 2020 (r367006) +++ head/sys/netinet/tcp_input.c Sat Oct 24 16:09:18 2020 (r367007) @@ -429,8 +429,6 @@ cc_conn_init(struct tcpcb *tp) void inline cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type) { - u_int maxseg; - INP_WLOCK_ASSERT(tp->t_inpcb); #ifdef STATS @@ -460,13 +458,9 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, ui } break; case CC_RTO: - maxseg = tcp_maxseg(tp); tp->t_dupacks = 0; tp->t_bytes_acked = 0; EXIT_RECOVERY(tp->t_flags); - tp->snd_ssthresh = max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 / - maxseg) * maxseg; - tp->snd_cwnd = maxseg; if (tp->t_flags2 & TF2_ECN_PERMIT) tp->t_flags2 |= TF2_ECN_SND_CWR; break; From owner-svn-src-head@freebsd.org Sat Oct 24 16:11:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E018A44DAF8; Sat, 24 Oct 2020 16:11:46 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJR1Z5hqWz3VYj; Sat, 24 Oct 2020 16:11:46 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A66021B319; Sat, 24 Oct 2020 16:11:46 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OGBkJA089884; Sat, 24 Oct 2020 16:11:46 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OGBkxg089883; Sat, 24 Oct 2020 16:11:46 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202010241611.09OGBkxg089883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Sat, 24 Oct 2020 16:11:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367008 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 367008 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 16:11:46 -0000 Author: rscheff Date: Sat Oct 24 16:11:46 2020 New Revision: 367008 URL: https://svnweb.freebsd.org/changeset/base/367008 Log: TCP Cubic: improve reaction to (and rollback from) RTO 1. fix compliancy issue of CUBIC RTO handling according to RFC8312 section 4.7 2. add CUBIC CC_RTO_ERR handling Submitted by: chengc_netapp.com Reviewed by: rrs, tuexen, rscheff MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D26808 Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Sat Oct 24 16:09:18 2020 (r367007) +++ head/sys/netinet/cc/cc_cubic.c Sat Oct 24 16:11:46 2020 (r367008) @@ -78,7 +78,7 @@ static void cubic_conn_init(struct cc_var *ccv); static int cubic_mod_init(void); static void cubic_post_recovery(struct cc_var *ccv); static void cubic_record_rtt(struct cc_var *ccv); -static void cubic_ssthresh_update(struct cc_var *ccv); +static void cubic_ssthresh_update(struct cc_var *ccv, uint32_t maxseg); static void cubic_after_idle(struct cc_var *ccv); struct cubic { @@ -90,19 +90,28 @@ struct cubic { unsigned long max_cwnd; /* cwnd at the previous congestion event. */ unsigned long prev_max_cwnd; + /* A copy of prev_max_cwnd. Used for CC_RTO_ERR */ + unsigned long prev_max_cwnd_cp; /* various flags */ uint32_t flags; #define CUBICFLAG_CONG_EVENT 0x00000001 /* congestion experienced */ #define CUBICFLAG_IN_SLOWSTART 0x00000002 /* in slow start */ #define CUBICFLAG_IN_APPLIMIT 0x00000004 /* application limited */ +#define CUBICFLAG_RTO_EVENT 0x00000008 /* RTO experienced */ /* Minimum observed rtt in ticks. */ int min_rtt_ticks; /* Mean observed rtt between congestion epochs. */ int mean_rtt_ticks; /* ACKs since last congestion event. */ int epoch_ack_count; - /* Time of last congestion event in ticks. */ + /* Timestamp (in ticks) of arriving in congestion avoidance from last + * congestion event. + */ int t_last_cong; + /* Timestamp (in ticks) of a previous congestion event. Used for + * CC_RTO_ERR. + */ + int t_last_cong_prev; }; static MALLOC_DEFINE(M_CUBIC, "cubic data", @@ -142,7 +151,14 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) cubic_data->flags |= CUBICFLAG_IN_SLOWSTART; newreno_cc_algo.ack_received(ccv, type); } else { - if (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART | + if ((cubic_data->flags & CUBICFLAG_RTO_EVENT) && + (cubic_data->flags & CUBICFLAG_IN_SLOWSTART)) { + /* RFC8312 Section 4.7 */ + cubic_data->flags &= ~(CUBICFLAG_RTO_EVENT | + CUBICFLAG_IN_SLOWSTART); + cubic_data->max_cwnd = CCV(ccv, snd_cwnd); + cubic_data->K = 0; + } else if (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART | CUBICFLAG_IN_APPLIMIT)) { cubic_data->flags &= ~(CUBICFLAG_IN_SLOWSTART | CUBICFLAG_IN_APPLIMIT); @@ -273,10 +289,10 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) case CC_NDUPACK: if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - cubic_ssthresh_update(ccv); + cubic_ssthresh_update(ccv, mss); cubic_data->flags |= CUBICFLAG_CONG_EVENT; cubic_data->t_last_cong = ticks; - cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg)); + cubic_data->K = cubic_k(cubic_data->max_cwnd / mss); } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -284,37 +300,35 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) case CC_ECN: if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { - cubic_ssthresh_update(ccv); + cubic_ssthresh_update(ccv, mss); cubic_data->flags |= CUBICFLAG_CONG_EVENT; cubic_data->t_last_cong = ticks; - cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg)); + cubic_data->K = cubic_k(cubic_data->max_cwnd / mss); CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } break; case CC_RTO: - CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd), - CCV(ccv, snd_cwnd)) / 2 / mss, - 2) * mss; - CCV(ccv, snd_cwnd) = mss; - /* - * Grab the current time and record it so we know when the - * most recent congestion event was. Only record it when the - * timeout has fired more than once, as there is a reasonable - * chance the first one is a false alarm and may not indicate - * congestion. - * This will put Cubic firmly into the concave / TCP friendly - * region, for a slower ramp-up after two consecutive RTOs. - */ - if (CCV(ccv, t_rxtshift) >= 2) { - cubic_data->flags |= CUBICFLAG_CONG_EVENT; - cubic_data->t_last_cong = ticks; - cubic_data->max_cwnd = CCV(ccv, snd_cwnd_prev); - cubic_data->K = cubic_k(cubic_data->max_cwnd / - CCV(ccv, t_maxseg)); + /* RFC8312 Section 4.7 */ + if (CCV(ccv, t_rxtshift) == 1) { + cubic_data->t_last_cong_prev = cubic_data->t_last_cong; + cubic_data->prev_max_cwnd_cp = cubic_data->prev_max_cwnd; } + cubic_data->flags |= CUBICFLAG_CONG_EVENT | CUBICFLAG_RTO_EVENT; + cubic_data->prev_max_cwnd = cubic_data->max_cwnd; + CCV(ccv, snd_ssthresh) = ((uint64_t)CCV(ccv, snd_cwnd) * + CUBIC_BETA) >> CUBIC_SHIFT; + CCV(ccv, snd_cwnd) = mss; break; + + case CC_RTO_ERR: + cubic_data->flags &= ~(CUBICFLAG_CONG_EVENT | CUBICFLAG_RTO_EVENT); + cubic_data->max_cwnd = cubic_data->prev_max_cwnd; + cubic_data->prev_max_cwnd = cubic_data->prev_max_cwnd_cp; + cubic_data->t_last_cong = cubic_data->t_last_cong_prev; + cubic_data->K = cubic_k(cubic_data->max_cwnd / mss); + break; } } @@ -436,7 +450,7 @@ cubic_record_rtt(struct cc_var *ccv) * Update the ssthresh in the event of congestion. */ static void -cubic_ssthresh_update(struct cc_var *ccv) +cubic_ssthresh_update(struct cc_var *ccv, uint32_t maxseg) { struct cubic *cubic_data; uint32_t ssthresh; @@ -466,7 +480,7 @@ cubic_ssthresh_update(struct cc_var *ccv) ssthresh = ((uint64_t)cwnd * CUBIC_BETA) >> CUBIC_SHIFT; } - CCV(ccv, snd_ssthresh) = max(ssthresh, 2 * CCV(ccv, t_maxseg)); + CCV(ccv, snd_ssthresh) = max(ssthresh, 2 * maxseg); } DECLARE_CC_MODULE(cubic, &cubic_cc_algo); From owner-svn-src-head@freebsd.org Sat Oct 24 16:17:08 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D182144DD8F; Sat, 24 Oct 2020 16:17:08 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJR7m5BhQz3Vpy; Sat, 24 Oct 2020 16:17:08 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B7371B2AB; Sat, 24 Oct 2020 16:17:08 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OGH8rt094678; Sat, 24 Oct 2020 16:17:08 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OGH8ZN094676; Sat, 24 Oct 2020 16:17:08 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202010241617.09OGH8ZN094676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Sat, 24 Oct 2020 16:17:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367009 - in head: sbin/sysctl sys/kern X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: in head: sbin/sysctl sys/kern X-SVN-Commit-Revision: 367009 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 16:17:08 -0000 Author: freqlabs Date: Sat Oct 24 16:17:07 2020 New Revision: 367009 URL: https://svnweb.freebsd.org/changeset/base/367009 Log: sysctl+kern_sysctl: Honor SKIP for descendant nodes Ensure we also skip descendants of SKIP nodes when iterating through children of an explicitly specified node. Reported by: np Reviewed by: np MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D26833 Modified: head/sbin/sysctl/sysctl.c head/sys/kern/kern_sysctl.c Modified: head/sbin/sysctl/sysctl.c ============================================================================== --- head/sbin/sysctl/sysctl.c Sat Oct 24 16:11:46 2020 (r367008) +++ head/sbin/sysctl/sysctl.c Sat Oct 24 16:17:07 2020 (r367009) @@ -952,6 +952,7 @@ oidfmt(int *oid, int len, char *fmt, u_int *kind) static int show_var(int *oid, int nlen, bool honor_skip) { + static int skip_len = 0, skip_oid[CTL_MAXNAME]; u_char buf[BUFSIZ], *val, *oval, *p; char name[BUFSIZ], fmt[BUFSIZ]; const char *sep, *sep1, *prntype; @@ -1021,9 +1022,21 @@ show_var(int *oid, int nlen, bool honor_skip) return (0); } + /* keep track of encountered skip nodes, ignoring descendants */ + if (skip_len == 0 && (kind & CTLFLAG_SKIP) != 0) { + /* Save this oid so we can skip descendants. */ + skip_len = nlen * sizeof(int); + memcpy(skip_oid, oid, skip_len); + } + /* bail before fetching the value if we're honoring skip */ - if (honor_skip && (kind & CTLFLAG_SKIP) != 0) - return (1); + if (honor_skip) { + if (0 < skip_len && skip_len <= nlen * (int)sizeof(int) && + memcmp(skip_oid, oid, skip_len) == 0) + return (1); + /* Not a skip node or descendant of a skip node. */ + skip_len = 0; + } /* don't fetch opaques that we don't know how to print */ if (ctltype == CTLTYPE_OPAQUE) { Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Sat Oct 24 16:11:46 2020 (r367008) +++ head/sys/kern/kern_sysctl.c Sat Oct 24 16:17:07 2020 (r367009) @@ -1126,9 +1126,13 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int * We have reached a node with a full name match and are * looking for the next oid in its children. * + * For CTL_SYSCTL_NEXTNOSKIP we are done. + * * For CTL_SYSCTL_NEXT we skip CTLTYPE_NODE (unless it * has a handler) and move on to the children. */ + if (!honor_skip) + return (0); if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) return (0); if (oidp->oid_handler) @@ -1163,9 +1167,13 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int /* * We have reached the next oid. * + * For CTL_SYSCTL_NEXTNOSKIP we are done. + * * For CTL_SYSCTL_NEXT we skip CTLTYPE_NODE (unless it * has a handler) and move on to the children. */ + if (!honor_skip) + return (0); if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) return (0); if (oidp->oid_handler) From owner-svn-src-head@freebsd.org Sat Oct 24 16:25:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73FD144E0F6; Sat, 24 Oct 2020 16:25:53 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJRKs2R6Gz3Wfg; Sat, 24 Oct 2020 16:25:53 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36F631B66E; Sat, 24 Oct 2020 16:25:53 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OGPrIN001016; Sat, 24 Oct 2020 16:25:53 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OGPrik001015; Sat, 24 Oct 2020 16:25:53 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202010241625.09OGPrik001015@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Sat, 24 Oct 2020 16:25:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367010 - head/sys/contrib/openzfs/module/os/freebsd/spl X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: head/sys/contrib/openzfs/module/os/freebsd/spl X-SVN-Commit-Revision: 367010 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 16:25:53 -0000 Author: freqlabs Date: Sat Oct 24 16:25:52 2020 New Revision: 367010 URL: https://svnweb.freebsd.org/changeset/base/367010 Log: Skip RAW kstat sysctls by default hese kstats are often expensive to compute so we want to avoid them unless specifically requested. The following kstats are affected by this change: kstat.zfs.${pool}.multihost kstat.zfs.${pool}.misc.state kstat.zfs.${pool}.txgs kstat.zfs.misc.fletcher_4_bench kstat.zfs.misc.vdev_raidz_bench kstat.zfs.misc.dbufs kstat.zfs.misc.dbgmsg PR: 249258 Reported by: mjg Reviewed by: mjg, allanjude Obtained from: https://github.com/openzfs/zfs/pull/11099 Sponsored by: iXsystems, Inc. Modified: head/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c Modified: head/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c Sat Oct 24 16:17:07 2020 (r367009) +++ head/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c Sat Oct 24 16:25:52 2020 (r367010) @@ -475,14 +475,14 @@ kstat_install(kstat_t *ksp) if (ksp->ks_raw_ops.data) { root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx, SYSCTL_CHILDREN(ksp->ks_sysctl_root), - OID_AUTO, ksp->ks_name, - CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + OID_AUTO, ksp->ks_name, CTLTYPE_STRING | CTLFLAG_RD + | CTLFLAG_MPSAFE | CTLFLAG_SKIP, ksp, 0, kstat_sysctl_raw, "A", ksp->ks_name); } else { root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx, SYSCTL_CHILDREN(ksp->ks_sysctl_root), - OID_AUTO, ksp->ks_name, - CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE, + OID_AUTO, ksp->ks_name, CTLTYPE_OPAQUE | CTLFLAG_RD + | CTLFLAG_MPSAFE | CTLFLAG_SKIP, ksp, 0, kstat_sysctl_raw, "", ksp->ks_name); } break; From owner-svn-src-head@freebsd.org Sat Oct 24 16:40:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C791644E605; Sat, 24 Oct 2020 16:40:34 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJRfp4xj8z3XWR; Sat, 24 Oct 2020 16:40:34 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D0951B5B3; Sat, 24 Oct 2020 16:40:34 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OGeYIi007229; Sat, 24 Oct 2020 16:40:34 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OGeYfp007228; Sat, 24 Oct 2020 16:40:34 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202010241640.09OGeYfp007228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Sat, 24 Oct 2020 16:40:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367011 - head/usr.bin/getent X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/usr.bin/getent X-SVN-Commit-Revision: 367011 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 16:40:34 -0000 Author: fernape (ports committer) Date: Sat Oct 24 16:40:34 2020 New Revision: 367011 URL: https://svnweb.freebsd.org/changeset/base/367011 Log: getent(1): Add EXAMPLES section Add 3 small examples to the EXAMPLES section. Approved by: manpages (gbe@) Differential Revision: https://reviews.freebsd.org/D26866 Modified: head/usr.bin/getent/getent.1 Modified: head/usr.bin/getent/getent.1 ============================================================================== --- head/usr.bin/getent/getent.1 Sat Oct 24 16:25:52 2020 (r367010) +++ head/usr.bin/getent/getent.1 Sat Oct 24 16:40:34 2020 (r367011) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 4, 2016 +.Dd October 24, 2020 .Dt GETENT 1 .Os .Sh NAME @@ -103,6 +103,24 @@ utility exits 0 on success, .Ar database , or 3 if there is no support for enumeration on .Ar database . +.Sh EXAMPLES +Show entry for user sshd from the passwd database: +.Bd -literal -offset indent +$ getent passwd sshd +sshd:*:22:22:Secure Shell Daemon:/var/empty:/usr/sbin/nologin +.Ed +.Pp +Show entry for TCP from the protocols database: +.Bd -literal -offset indent +$ getent protocols tcp +tcp 6 TCP +.Ed +.Pp +Show entry for the localhost IPv6 address ::1 from the hosts database: +.Bd -literal -offset indent +$ getent hosts ::1 +::1 localhost localhost.my.domain +.Ed .Sh SEE ALSO .Xr getutxent 3 , .Xr ethers 5 , @@ -123,7 +141,4 @@ command appeared in .Nx 3.0 , and was imported into .Fx 7.0 . -It was based on the command of the same name in -.Tn Solaris -and -.Tn Linux . +It was based on the command of the same name in Solaris and Linux. From owner-svn-src-head@freebsd.org Sat Oct 24 16:42:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BAC8344E279; Sat, 24 Oct 2020 16:42:36 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJRj84cjNz3Xj8; Sat, 24 Oct 2020 16:42:36 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81A891B840; Sat, 24 Oct 2020 16:42:36 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OGgamh013001; Sat, 24 Oct 2020 16:42:36 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OGgaos013000; Sat, 24 Oct 2020 16:42:36 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202010241642.09OGgaos013000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Sat, 24 Oct 2020 16:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367012 - head/bin/pwd X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/bin/pwd X-SVN-Commit-Revision: 367012 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 16:42:36 -0000 Author: fernape (ports committer) Date: Sat Oct 24 16:42:35 2020 New Revision: 367012 URL: https://svnweb.freebsd.org/changeset/base/367012 Log: pwd(1): Add EXAMPLES section Small EXAMPLES section. Add reference to realpath(1) due to similarity. Approved by: manpages (gbe@) Differential Revision: https://reviews.freebsd.org/D26862 Modified: head/bin/pwd/pwd.1 Modified: head/bin/pwd/pwd.1 ============================================================================== --- head/bin/pwd/pwd.1 Sat Oct 24 16:40:34 2020 (r367011) +++ head/bin/pwd/pwd.1 Sat Oct 24 16:42:35 2020 (r367012) @@ -32,7 +32,7 @@ .\" @(#)pwd.1 8.2 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd October 5, 2016 +.Dd October 24, 2020 .Dt PWD 1 .Os .Sh NAME @@ -74,10 +74,30 @@ Logical current working directory. .El .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Show current working directory with symbolic links resolved: +.Bd -literal -offset indent +$ /bin/pwd +/usr/home/fernape +.Ed +.Pp +Show the logical current directory. +Then use +.Xr file 1 +to inspect the +.Pa /home +directory: +.Bd -literal -offset indent +$ /bin/pwd -L +/home/fernape +$ file /home +/home: symbolic link to usr/home +.Ed .Sh SEE ALSO .Xr builtin 1 , .Xr cd 1 , .Xr csh 1 , +.Xr realpath 1 , .Xr sh 1 , .Xr getcwd 3 .Sh STANDARDS From owner-svn-src-head@freebsd.org Sat Oct 24 16:44:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6EC244E87F; Sat, 24 Oct 2020 16:44:24 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJRlC5yxvz3Y6G; Sat, 24 Oct 2020 16:44:23 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ed1-f53.google.com with SMTP id l24so4734261edj.8; Sat, 24 Oct 2020 09:44:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Rfy5XXmOD/9UEQzxrx9Q9XvvPvcqMFhpZb8CEkDyz6Y=; b=FzvmFfdYKNePYr0cLVOCHxEPkIkJlbHGJztLb6emvVczr8/j+rUV7JXVHkHv4bxtUA AqJ4kn6ua3EgO4jqvk9L9eufTdr8F9Sf0eQw7rCCvGav1jeLl9QewROCEP23TYoGxfgM SY2ntQfdSimJnkI3+8+QBnzrMoN+4NMyjZWY9v+PoiaW4qYwKIL07kiM2up6FwBnKn8E s/RJf/tTb3x6DyRZPLTiu/LWqrPSEMOEKSjO82j4YRmcPKeKTscRITnJu7SzLcKo/kcj B/2KHY4xuRmo1yWhZ9HsiCccGXln2ysuNQO3VFahdivedAWO0TNXR7nGqJvpw24h39y1 6ftg== X-Gm-Message-State: AOAM5300lfvikLDbFc7N8ZKh8+9bGBzI2SY4cYmMCUDw5oFaVmcqCGLT 9MNVGrXXNfeJdP1cH7hiloQ92NSngFeT4n0D X-Google-Smtp-Source: ABdhPJyBFPTeMVhuAmP/ZQo8eRda8Sm6KGNhNXABycceazcpKugx53VhgoN+kAR0ty4NbtPJ90ebGg== X-Received: by 2002:aa7:d495:: with SMTP id b21mr7603698edr.231.1603557861933; Sat, 24 Oct 2020 09:44:21 -0700 (PDT) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com. [209.85.128.49]) by smtp.gmail.com with ESMTPSA id j1sm1052097eje.118.2020.10.24.09.44.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 24 Oct 2020 09:44:21 -0700 (PDT) Received: by mail-wm1-f49.google.com with SMTP id c194so5683283wme.2; Sat, 24 Oct 2020 09:44:21 -0700 (PDT) X-Received: by 2002:a1c:c28a:: with SMTP id s132mr3019729wmf.13.1603557861172; Sat, 24 Oct 2020 09:44:21 -0700 (PDT) MIME-Version: 1.0 References: <202010241023.09OANMcL075640@repo.freebsd.org> <20201024125206.GB38000@FreeBSD.org> <999a005e-1ef8-3c45-fb07-94a3b6ebce1b@selasky.org> <317231603546378@mail.yandex.ru> In-Reply-To: From: Alexander Richardson Date: Sat, 24 Oct 2020 17:44:10 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r366993 - head/sys/net To: Warner Losh Cc: "Alexander V. Chernikov" , Hans Petter Selasky , Alexey Dokuchaev , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 4CJRlC5yxvz3Y6G X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of arichardsonkde@gmail.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=arichardsonkde@gmail.com X-Spamd-Result: default: False [-2.46 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[freebsd.org]; ARC_NA(0.00)[]; NEURAL_HAM_LONG(-0.96)[-0.964]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.43)[-0.432]; RCPT_COUNT_SEVEN(0.00)[7]; RCVD_IN_DNSWL_NONE(0.00)[209.85.208.53:from]; NEURAL_HAM_MEDIUM(-1.06)[-1.060]; FORGED_SENDER(0.30)[arichardson@freebsd.org,arichardsonkde@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.208.53:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[arichardson@freebsd.org,arichardsonkde@gmail.com]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 16:44:24 -0000 On Sat, 24 Oct 2020, 16:27 Warner Losh, wrote: > > > On Sat, Oct 24, 2020, 7:38 AM Alexander V. Chernikov > wrote: > >> 24.10.2020, 14:08, "Hans Petter Selasky" : >> > On 2020-10-24 14:52, Alexey Dokuchaev wrote: >> >> On Sat, Oct 24, 2020 at 10:23:22AM +0000, Hans Petter Selasky wrote: >> >>> New Revision: 366993 >> >>> URL: https://svnweb.freebsd.org/changeset/base/366993 >> >>> >> >>> Log: >> >>> Run code through "clang-format -style=file" with some additional >> fixes. >> >>> No functional change. >> >>> >> >>> ... >> >>> @@ -99,8 +97,8 @@ infiniband_ipv4_multicast_map(uint32_t addr, >> >>> >> >>> #ifdef INET6 >> >>> static inline void >> >>> -infiniband_ipv6_multicast_map(const struct in6_addr *addr, >> >>> - const uint8_t *broadcast, uint8_t *buf) >> >>> +infiniband_ipv6_multicast_map( >> >>> + const struct in6_addr *addr, const uint8_t *broadcast, uint8_t >> *buf) >> >>> { >> >> >> >> This is not how we format these in FreeBSD, please revert. It was >> correct >> >> before and no "fix" is need here. >> Given we already have nice .clang-format, that does most of the job, >> maybe it's worth considering looking into tweaking it further to fix this >> part? >> It would be nice if we could finally offload all formatting issues to the >> tool and focus on the actual code :-) >> > > It would be nice if it produced one of the style(9) acceptable formats > without disrupting things already acceptable. That's been the big problem > with the tweaks to date... some things are fixed, others break. It's > getting a lot closer, though > I've upstreamed a few fixes, but haven't got to the line wrapping/continuation indentation stuff yet. That part of clang format is not particularly easy to modify without breaking other stuff and I'm also rather short on time right now, so probably won't get to it any time soon. Alex From owner-svn-src-head@freebsd.org Sat Oct 24 17:09:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9107244F24A; Sat, 24 Oct 2020 17:09:02 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJSHf3bN3z3Zf1; Sat, 24 Oct 2020 17:09:02 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E5251BE0D; Sat, 24 Oct 2020 17:09:02 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OH921w025673; Sat, 24 Oct 2020 17:09:02 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OH8xtM025653; Sat, 24 Oct 2020 17:08:59 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202010241708.09OH8xtM025653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Sat, 24 Oct 2020 17:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367013 - in head: . contrib/mandoc etc/mtree lib lib/flua lib/flua/libjail share/examples share/examples/flua share/man share/man/man3lua usr.bin/man X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: in head: . contrib/mandoc etc/mtree lib lib/flua lib/flua/libjail share/examples share/examples/flua share/man share/man/man3lua usr.bin/man X-SVN-Commit-Revision: 367013 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 17:09:02 -0000 Author: freqlabs Date: Sat Oct 24 17:08:59 2020 New Revision: 367013 URL: https://svnweb.freebsd.org/changeset/base/367013 Log: flua: Add a libjail module libjail is pretty small, so it makes for a good proof of concept demonstrating how a system library can be wrapped to create a loadable Lua module for flua. * Introduce 3lua section for man pages * Add libjail module Reviewed by: kevans, manpages Relnotes: yes Differential Revision: https://reviews.freebsd.org/D26080 Added: head/lib/flua/ head/lib/flua/Makefile (contents, props changed) head/lib/flua/libjail/ head/lib/flua/libjail/Makefile (contents, props changed) head/lib/flua/libjail/jail.3lua (contents, props changed) head/lib/flua/libjail/lua_jail.c (contents, props changed) head/share/examples/flua/ head/share/examples/flua/libjail.lua (contents, props changed) head/share/man/man3lua/ head/share/man/man3lua/Makefile (contents, props changed) head/share/man/man3lua/intro.3lua (contents, props changed) Modified: head/Makefile.inc1 head/contrib/mandoc/msec.in head/etc/mtree/BSD.usr.dist head/lib/Makefile head/share/examples/Makefile head/share/man/Makefile head/usr.bin/man/man.1 head/usr.bin/man/man.sh Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sat Oct 24 16:42:35 2020 (r367012) +++ head/Makefile.inc1 Sat Oct 24 17:08:59 2020 (r367013) @@ -2829,6 +2829,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ lib/libelf lib/libexpat \ lib/libfigpar \ ${_lib_libgssapi} \ + lib/libjail \ lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ lib/libzstd \ ${_lib_casper} \ Modified: head/contrib/mandoc/msec.in ============================================================================== --- head/contrib/mandoc/msec.in Sat Oct 24 16:42:35 2020 (r367012) +++ head/contrib/mandoc/msec.in Sat Oct 24 17:08:59 2020 (r367013) @@ -25,6 +25,7 @@ LINE("1", "FreeBSD General Commands Manual") LINE("2", "FreeBSD System Calls Manual") LINE("3", "FreeBSD Library Functions Manual") +LINE("3lua", "Lua Library Functions Manual") LINE("3p", "Perl Library Functions Manual") LINE("4", "FreeBSD Kernel Interfaces Manual") LINE("5", "FreeBSD File Formats Manual") Modified: head/etc/mtree/BSD.usr.dist ============================================================================== --- head/etc/mtree/BSD.usr.dist Sat Oct 24 16:42:35 2020 (r367012) +++ head/etc/mtree/BSD.usr.dist Sat Oct 24 17:08:59 2020 (r367013) @@ -281,6 +281,8 @@ .. find_interface .. + flua + .. hast .. hostapd @@ -856,6 +858,8 @@ man2 .. man3 + .. + man3lua .. man4 aarch64 Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Sat Oct 24 16:42:35 2020 (r367012) +++ head/lib/Makefile Sat Oct 24 17:08:59 2020 (r367013) @@ -142,6 +142,11 @@ SUBDIR_DEPEND_liblzma= ${_libthr} SUBDIR_DEPEND_libpcap= ofed .endif +.if !defined(COMPAT_32BIT) +SUBDIR+= flua +SUBDIR_DEPEND_flua= libjail +.endif + # NB: keep these sorted by MK_* knobs SUBDIR.${MK_ATM}+= libngatm Added: head/lib/flua/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/flua/Makefile Sat Oct 24 17:08:59 2020 (r367013) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= libjail + +.include Added: head/lib/flua/libjail/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/flua/libjail/Makefile Sat Oct 24 17:08:59 2020 (r367013) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +SHLIB_NAME= jail.so +SHLIBDIR= ${LIBDIR}/flua + +SRCS+= lua_jail.c + +CFLAGS+= \ + -I${SRCTOP}/contrib/lua/src \ + -I${SRCTOP}/lib/liblua \ + +LIBADD+= jail + +MAN= jail.3lua + +.include Added: head/lib/flua/libjail/jail.3lua ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/flua/libjail/jail.3lua Sat Oct 24 17:08:59 2020 (r367013) @@ -0,0 +1,210 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2020, Ryan Moeller +.\" +.\" 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 October 24, 2020 +.Dt JAIL 3lua +.Os +.Sh NAME +.Nm getid , +.Nm getname , +.Nm allparams , +.Nm getparams , +.Nm setparams , +.Nm CREATE , +.Nm UPDATE , +.Nm ATTACH , +.Nm DYING +.Nd Lua binding to +.Xr jail 3 +.Sh SYNOPSIS +.Bd -literal +local jail = require('jail') +.Ed +.Pp +.Bl -tag -width XXXX -compact +.It Dv jid, err = jail.getid(name) +.It Dv name, err = jail.getname(jid) +.It Dv params, err = jail.allparams() +.It Dv jid, res = jail.getparams(jid|name, params [, flags ] ) +.It Dv jid, err = jail.setparams(jid|name, params, flags ) +.It Dv jail.CREATE +.It Dv jail.UPDATE +.It Dv jail.ATTACH +.It Dv jail.DYING +.El +.Sh DESCRIPTION +The +.Nm jail +module is a binding to the +.Xr jail 3 +library. +It provides a string-oriented interface for the +.Xr jail_get 2 +and +.Xr jail_set 2 +system calls. +.Bl -tag -width XXXX +.It Dv jid, err = jail.getid(name) +Get the jail identifier +.Pq jid +as an integer. +.Fa name +is the name of a jail or a jid in the form of a string. +.It Dv name, err = jail.getname(jid) +Get the name of a jail as a string for the given +.Fa jid +.Pq an integer . +.It Dv params, err = jail.allparams() +Get a list of all supported parameter names +.Pq as strings . +See +.Xr jail 8 +for descriptions of the core jail parameters. +.It Dv jid, res = jail.getparams(jid|name, params [, flags ] ) +Get a table of the requested parameters for the given jail. +.Nm jid|name +can either be the jid as an integer or the jid or name as a string. +.Nm params +is a list of parameter names. +.Nm flags +is an optional integer representing the flag bits to apply for the operation. +See the list of flags below. +Only the +.Dv DYING +flag is valid to set. +.It Dv jid, err = jail.setparams(jid|name, params [, flags ] ) +Set parameters for a given jail. +This is used to create, update, attach to, or destroy a jail. +.Nm jid|name +can either be the jid as an integer or the jid or name as a string. +.Nm params +is a table of parameters to apply to the jail, where each key in the table +is a parameter name as a string and each value is a string that will be +converted to the internal value type by +.Xr jailparam_import 3 . +.Nm flags +is an optional integer representing the flag bits to apply for the operation. +See the list of flags below. +.El +.Pp +The +.Nm flags +arguments are an integer bitwise-or combination of one or more of the following +flags: +.Bl -tag -width XXXX +.It Dv jail.CREATE +Used with +.Fn setparams +to create a new jail. +The jail must not already exist, unless combined with +.Dv UPDATE . +.It Dv jail.UPDATE +Used with +.Fn setparams +to modify an existing jail. +The jail must already exist, unless combined with +.Dv CREATE . +.It Dv jail.ATTACH +Used with +.Fn setparams +in combination with +.Dv CREATE +or +.Dv UPDATE +to attach the current process to a jail. +.It Dv jail.DYING +Allow operating on a jail that is in the process of being removed. +.El +.Sh RETURN VALUES +The +.Fn getid +and +.Fn setparams +functions return a jail identifier integer on success, or +.Dv nil +and an error message string if an error occurred. +.Pp +The +.Fn getname +function returns a jail name string on success, or +.Dv nil +and an error message string if an error occurred. +.Pp +The +.Fn allparams +function returns a list of parameter name strings on success, or +.Dv nil +and an error message string if an error occurred. +.Pp +The +.Fn getparams +function returns a jail identifier integer and a table of jail parameters +with parameter name strings as keys and strings for values on success, or +.Dv nil +and an error message string if an error occurred. +.Sh EXAMPLES +Set the hostname of jail +.Dq foo +to +.Dq foo.bar : +.Bd -literal -offset indent +local jail = require('jail') + +jid, err = jail.setparams("foo", {["host.hostname"]="foo.bar"}, + jail.UPDATE) +if not jid then + error(err) +end +.Ed +.Pp +Retrieve the hostname of jail +.Dq foo : +.Bd -literal -offset indent +local jail = require('jail') + +jid, res = jail.getparams("foo", {"host.hostname"}) +if not jid then + error(res) +end +print(res["host.hostname"]) +.Ed +.Sh SEE ALSO +.Xr jail 2 , +.Xr jail 3 , +.Xr jail 8 +.Sh HISTORY +The +.Nm jail +Lua module for flua first appeared in +.Fx 13.0 . +.Sh AUTHORS +.An Ryan Moeller , +with inspiration from +.Nx +gpio(3lua), by +.An Mark Balmer . Added: head/lib/flua/libjail/lua_jail.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/flua/libjail/lua_jail.c Sat Oct 24 17:08:59 2020 (r367013) @@ -0,0 +1,391 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020, Ryan Moeller + * + * 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 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. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +int luaopen_jail(lua_State *); + +static int +l_getid(lua_State *L) +{ + const char *name; + int jid; + + name = luaL_checkstring(L, 1); + jid = jail_getid(name); + if (jid == -1) { + lua_pushnil(L); + lua_pushstring(L, jail_errmsg); + return (2); + } + lua_pushinteger(L, jid); + return (1); +} + +static int +l_getname(lua_State *L) +{ + char *name; + int jid; + + jid = luaL_checkinteger(L, 1); + name = jail_getname(jid); + if (name == NULL) { + lua_pushnil(L); + lua_pushstring(L, jail_errmsg); + return (2); + } + lua_pushstring(L, name); + free(name); + return (1); +} + +static int +l_allparams(lua_State *L) +{ + struct jailparam *params; + int params_count; + + params_count = jailparam_all(¶ms); + if (params_count == -1) { + lua_pushnil(L); + lua_pushstring(L, jail_errmsg); + return (2); + } + lua_newtable(L); + for (int i = 0; i < params_count; ++i) { + lua_pushstring(L, params[i].jp_name); + lua_rawseti(L, -2, i + 1); + } + jailparam_free(params, params_count); + free(params); + return (1); +} + +static int +l_getparams(lua_State *L) +{ + const char *name; + struct jailparam *params; + size_t params_count, skipped; + int flags, jid, type; + + type = lua_type(L, 1); + luaL_argcheck(L, type == LUA_TSTRING || type == LUA_TNUMBER, 1, + "expected a jail name (string) or id (integer)"); + luaL_checktype(L, 2, LUA_TTABLE); + params_count = 1 + lua_rawlen(L, 2); + luaL_argcheck(L, params_count > 1, 2, "expected #params > 0"); + flags = luaL_optinteger(L, 3, 0); + + params = malloc(params_count * sizeof(struct jailparam)); + if (params == NULL) + return (luaL_error(L, "malloc: %s", strerror(errno))); + + /* + * Set the jail name or id param as determined by the first arg. + */ + + if (type == LUA_TSTRING) { + if (jailparam_init(¶ms[0], "name") == -1) { + free(params); + return (luaL_error(L, "jailparam_init: %s", + jail_errmsg)); + } + name = lua_tostring(L, 1); + if (jailparam_import(¶ms[0], name) == -1) { + jailparam_free(params, 1); + free(params); + return (luaL_error(L, "jailparam_import: %s", + jail_errmsg)); + } + } else /* type == LUA_TNUMBER */ { + if (jailparam_init(¶ms[0], "jid") == -1) { + free(params); + return (luaL_error(L, "jailparam_init: %s", + jail_errmsg)); + } + jid = lua_tointeger(L, 1); + if (jailparam_import_raw(¶ms[0], &jid, sizeof(jid)) == -1) { + jailparam_free(params, 1); + free(params); + return (luaL_error(L, "jailparam_import_raw: %s", + jail_errmsg)); + } + } + + /* + * Set the remaining param names being requested. + */ + + skipped = 0; + for (size_t i = 1; i < params_count; ++i) { + const char *param_name; + + lua_rawgeti(L, -1, i); + param_name = lua_tostring(L, -1); + if (param_name == NULL) { + jailparam_free(params, i - skipped); + free(params); + return (luaL_argerror(L, 2, + "param names must be strings")); + } + lua_pop(L, 1); + /* Skip name or jid, whichever was given. */ + if (type == LUA_TSTRING) { + if (strcmp(param_name, "name") == 0) { + ++skipped; + continue; + } + } else /* type == LUA_TNUMBER */ { + if (strcmp(param_name, "jid") == 0) { + ++skipped; + continue; + } + } + if (jailparam_init(¶ms[i - skipped], param_name) == -1) { + jailparam_free(params, i - skipped); + free(params); + return (luaL_error(L, "jailparam_init: %s", + jail_errmsg)); + } + } + params_count -= skipped; + + /* + * Get the values and convert to a table. + */ + + jid = jailparam_get(params, params_count, flags); + if (jid == -1) { + jailparam_free(params, params_count); + free(params); + lua_pushnil(L); + lua_pushstring(L, jail_errmsg); + return (2); + } + lua_pushinteger(L, jid); + + lua_newtable(L); + for (size_t i = 0; i < params_count; ++i) { + char *value; + + value = jailparam_export(¶ms[i]); + lua_pushstring(L, value); + free(value); + lua_setfield(L, -2, params[i].jp_name); + } + + jailparam_free(params, params_count); + free(params); + + return (2); +} + +static int +l_setparams(lua_State *L) +{ + const char *name; + struct jailparam *params; + size_t params_count; + int flags, jid, type; + + type = lua_type(L, 1); + luaL_argcheck(L, type == LUA_TSTRING || type == LUA_TNUMBER, 1, + "expected a jail name (string) or id (integer)"); + luaL_checktype(L, 2, LUA_TTABLE); + + lua_pushnil(L); + for (params_count = 1; lua_next(L, 2) != 0; ++params_count) + lua_pop(L, 1); + luaL_argcheck(L, params_count > 1, 2, "expected #params > 0"); + + flags = luaL_optinteger(L, 3, 0); + + params = malloc(params_count * sizeof(struct jailparam)); + if (params == NULL) + return (luaL_error(L, "malloc: %s", strerror(errno))); + + /* + * Set the jail name or id param as determined by the first arg. + */ + + if (type == LUA_TSTRING) { + if (jailparam_init(¶ms[0], "name") == -1) { + free(params); + return (luaL_error(L, "jailparam_init: %s", + jail_errmsg)); + } + name = lua_tostring(L, 1); + if (jailparam_import(¶ms[0], name) == -1) { + jailparam_free(params, 1); + free(params); + return (luaL_error(L, "jailparam_import: %s", + jail_errmsg)); + } + } else /* type == LUA_TNUMBER */ { + if (jailparam_init(¶ms[0], "jid") == -1) { + free(params); + return (luaL_error(L, "jailparam_init: %s", + jail_errmsg)); + } + jid = lua_tointeger(L, 1); + if (jailparam_import_raw(¶ms[0], &jid, sizeof(jid)) == -1) { + jailparam_free(params, 1); + free(params); + return (luaL_error(L, "jailparam_import_raw: %s", + jail_errmsg)); + } + } + + /* + * Set the rest of the provided params. + */ + + lua_pushnil(L); + for (size_t i = 1; i < params_count && lua_next(L, 2) != 0; ++i) { + const char *value; + + name = lua_tostring(L, -2); + if (name == NULL) { + jailparam_free(params, i); + free(params); + return (luaL_argerror(L, 2, + "param names must be strings")); + } + if (jailparam_init(¶ms[i], name) == -1) { + jailparam_free(params, i); + free(params); + return (luaL_error(L, "jailparam_init: %s", + jail_errmsg)); + } + + value = lua_tostring(L, -1); + if (value == NULL) { + jailparam_free(params, i + 1); + free(params); + return (luaL_argerror(L, 2, + "param values must be strings")); + } + if (jailparam_import(¶ms[i], value) == -1) { + jailparam_free(params, i + 1); + free(params); + return (luaL_error(L, "jailparam_import: %s", + jail_errmsg)); + } + + lua_pop(L, 1); + } + + /* + * Attempt to set the params. + */ + + jid = jailparam_set(params, params_count, flags); + if (jid == -1) { + jailparam_free(params, params_count); + free(params); + lua_pushnil(L); + lua_pushstring(L, jail_errmsg); + return (2); + } + lua_pushinteger(L, jid); + + jailparam_free(params, params_count); + free(params); + return (1); +} + +static const struct luaL_Reg l_jail[] = { + /** Get id of a jail by name. + * @param name jail name (string) + * @return jail id (integer) + * or nil, error (string) on error + */ + {"getid", l_getid}, + /** Get name of a jail by id. + * @param jid jail id (integer) + * @return jail name (string) + * or nil, error (string) on error + */ + {"getname", l_getname}, + /** Get a list of all known jail parameters. + * @return list of jail parameter names (table of strings) + * or nil, error (string) on error + */ + {"allparams", l_allparams}, + /** Get the listed params for a given jail. + * @param jail jail name (string) or id (integer) + * @param params list of parameter names (table of strings) + * @param flags optional flags (integer) + * @return jid (integer), params (table of [string] = string) + * or nil, error (string) on error + */ + {"getparams", l_getparams}, + /** Set params for a given jail. + * @param jail jail name (string) or id (integer) + * @param params params and values (table of [string] = string) + * @param flags optional flags (integer) + * @return jid (integer) + * or nil, error (string) on error + */ + {"setparams", l_setparams}, + {NULL, NULL} +}; + +int +luaopen_jail(lua_State *L) +{ + lua_newtable(L); + + luaL_setfuncs(L, l_jail, 0); + + lua_pushinteger(L, JAIL_CREATE); + lua_setfield(L, -2, "CREATE"); + lua_pushinteger(L, JAIL_UPDATE); + lua_setfield(L, -2, "UPDATE"); + lua_pushinteger(L, JAIL_ATTACH); + lua_setfield(L, -2, "ATTACH"); + lua_pushinteger(L, JAIL_DYING); + lua_setfield(L, -2, "DYING"); + + return (1); +} Modified: head/share/examples/Makefile ============================================================================== --- head/share/examples/Makefile Sat Oct 24 16:42:35 2020 (r367012) +++ head/share/examples/Makefile Sat Oct 24 17:08:59 2020 (r367013) @@ -16,6 +16,7 @@ LDIRS= BSD_daemon \ drivers \ etc \ find_interface \ + flua \ indent \ ipfw \ jails \ @@ -97,6 +98,9 @@ SE_FIND_INTERFACE= \ Makefile \ README \ find_interface.c + +SE_DIRS+= flua +SE_FLUA= libjail.lua SE_DIRS+= indent SE_INDENT= indent.pro Added: head/share/examples/flua/libjail.lua ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/examples/flua/libjail.lua Sat Oct 24 17:08:59 2020 (r367013) @@ -0,0 +1,60 @@ +#!/usr/libexec/flua +--[[ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020, Ryan Moeller + * + * 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 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. + * + * $FreeBSD$ + */ +]]-- + +jail = require("jail") +ucl = require("ucl") + +name = "demo" + +-- Create a persistent jail named "demo" with all other parameters default. +jid, err = jail.setparams(name, {persist = "true"}, jail.CREATE) +if not jid then + error(err) +end + +-- Get a list of all known jail parameter names. +allparams = jail.allparams() + +-- Get all the parameters of the jail we created. +jid, res = jail.getparams(name, allparams) +if not jid then + error(res) +end + +-- Display the jail's parameters as a pretty-printed JSON object. +print(ucl.to_json(res)) + +-- Update the "persist" parameter to "false" to remove the jail. +jid, err = jail.setparams(name, {persist = "false"}, jail.UPDATE) +if not jid then + error(err) +end Modified: head/share/man/Makefile ============================================================================== --- head/share/man/Makefile Sat Oct 24 16:42:35 2020 (r367012) +++ head/share/man/Makefile Sat Oct 24 17:08:59 2020 (r367013) @@ -4,7 +4,7 @@ .include # XXX MISSING: man3f -SUBDIR= man1 man3 man4 man5 man6 man7 man8 man9 +SUBDIR= man1 man3 man3lua man4 man5 man6 man7 man8 man9 SUBDIR_PARALLEL= MAKEWHATIS?= makewhatis Added: head/share/man/man3lua/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man3lua/Makefile Sat Oct 24 17:08:59 2020 (r367013) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +.include + +MAN= intro.3lua + +.include Added: head/share/man/man3lua/intro.3lua ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man3lua/intro.3lua Sat Oct 24 17:08:59 2020 (r367013) @@ -0,0 +1,65 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2020, Ryan Moeller +.\" +.\" 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 October 24, 2020 +.Dt INTRO 3lua +.Os +.Sh NAME +.Nm intro +.Nd introduction to the Lua modules for flua +.Po +.Fx +Lua +.Pc +.Sh DESCRIPTION +This section describes +.Em flua +.Po +.Fx +Lua +.Pc +and the Lua modules provided in the +.Fx +base system. +.Pp +The Lua modules provided by +.Fx +are: +.Bl -tag -width jail +.It Xr jail 3lua +Wrapper for +.Xr jail 3 . +.El +.Sh SEE ALSO +.Xr jail 3lua +.Sh AUTHORS +.An Ryan Moeller , +with inspiration from +.Nx +intro(3lua), by +.An Marc Balmer . Modified: head/usr.bin/man/man.1 ============================================================================== --- head/usr.bin/man/man.1 Sat Oct 24 16:42:35 2020 (r367012) +++ head/usr.bin/man/man.1 Sat Oct 24 17:08:59 2020 (r367013) @@ -365,6 +365,7 @@ Local configuration files. .Xr whatis 1 , .Xr intro 2 , .Xr intro 3 , +.Xr intro 3lua , .Xr intro 4 , .Xr intro 5 , .Xr man.conf 5 , Modified: head/usr.bin/man/man.sh ============================================================================== --- head/usr.bin/man/man.sh Sat Oct 24 16:42:35 2020 (r367012) +++ head/usr.bin/man/man.sh Sat Oct 24 17:08:59 2020 (r367013) @@ -1012,7 +1012,7 @@ STTY=/bin/stty SYSCTL=/sbin/sysctl debug=0 -man_default_sections='1:8:2:3:n:4:5:6:7:9:l' +man_default_sections='1:8:2:3:3lua:n:4:5:6:7:9:l' man_default_path='/usr/share/man:/usr/share/openssl/man:/usr/local/share/man:/usr/local/man' cattool='/usr/bin/zcat -f' From owner-svn-src-head@freebsd.org Sat Oct 24 17:25:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA55D44F134; Sat, 24 Oct 2020 17:25:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJSf456Fqz3bJZ; Sat, 24 Oct 2020 17:25:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 09OHOqDi043466 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 24 Oct 2020 20:24:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 09OHOqDi043466 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 09OHOqCj043465; Sat, 24 Oct 2020 20:24:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 24 Oct 2020 20:24:52 +0300 From: Konstantin Belousov To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366997 - head/sys/kern Message-ID: <20201024172452.GD2643@kib.kiev.ua> References: <202010241330.09ODUb6x089521@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202010241330.09ODUb6x089521@repo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CJSf456Fqz3bJZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 17:25:01 -0000 On Sat, Oct 24, 2020 at 01:30:37PM +0000, Mateusz Guzik wrote: > Author: mjg > Date: Sat Oct 24 13:30:37 2020 > New Revision: 366997 > URL: https://svnweb.freebsd.org/changeset/base/366997 > > Log: > vfs: fix a race where reclaim vholds freed vnodes A description of the race in the commit message would be respectful to other readers of the code, so that we do not need to reverse-eng the change to understand what and why was fixed. > > Reported by: pho > Tested by: pho (previous version) > Fixes: r366974 ("vfs: stop taking the interlock in vnode reclaim") > > Modified: > head/sys/kern/vfs_subr.c > > Modified: head/sys/kern/vfs_subr.c > ============================================================================== > --- head/sys/kern/vfs_subr.c Sat Oct 24 13:16:10 2020 (r366996) > +++ head/sys/kern/vfs_subr.c Sat Oct 24 13:30:37 2020 (r366997) > @@ -109,6 +109,7 @@ static void syncer_shutdown(void *arg, int howto); > static int vtryrecycle(struct vnode *vp); > static void v_init_counters(struct vnode *); > static void vgonel(struct vnode *); > +static bool vhold_recycle(struct vnode *); > static void vfs_knllock(void *arg); > static void vfs_knlunlock(void *arg); > static void vfs_knl_assert_locked(void *arg); > @@ -1126,7 +1127,8 @@ restart: > goto next_iter; > } > > - vhold(vp); > + if (!vhold_recycle(vp)) > + goto next_iter; > TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); > TAILQ_INSERT_AFTER(&vnode_list, vp, mvp, v_vnodelist); > mtx_unlock(&vnode_list_mtx); > @@ -1231,7 +1233,8 @@ restart: > if (__predict_false(vp->v_type == VBAD || vp->v_type == VNON)) { > continue; > } > - vhold(vp); > + if (!vhold_recycle(vp)) > + continue; > count--; > mtx_unlock(&vnode_list_mtx); > vtryrecycle(vp); > @@ -3248,13 +3251,11 @@ vholdnz(struct vnode *vp) > * However, while this is more performant, it hinders debugging by eliminating > * the previously mentioned invariant. > */ > -bool > -vhold_smr(struct vnode *vp) > +static bool __always_inline > +_vhold_cond(struct vnode *vp) > { > int count; > > - VFS_SMR_ASSERT_ENTERED(); > - > count = atomic_load_int(&vp->v_holdcnt); > for (;;) { > if (count & VHOLD_NO_SMR) { > @@ -3270,6 +3271,28 @@ vhold_smr(struct vnode *vp) > return (true); > } > } > +} > + > +bool > +vhold_smr(struct vnode *vp) > +{ > + > + VFS_SMR_ASSERT_ENTERED(); > + return (_vhold_cond(vp)); > +} > + > +/* > + * Special case for vnode recycling. > + * > + * Vnodes are present on the global list until UMA takes them out. > + * Attempts to recycle only need the relevant lock and have no use for SMR. > + */ > +static bool > +vhold_recycle(struct vnode *vp) > +{ > + > + mtx_assert(&vnode_list_mtx, MA_OWNED); > + return (_vhold_cond(vp)); > } > > static void __noinline From owner-svn-src-head@freebsd.org Sat Oct 24 17:56:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D2464501B9; Sat, 24 Oct 2020 17:56:38 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJTLX662mz3csd; Sat, 24 Oct 2020 17:56:36 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id WNmLksCpQRAWfWNmMkGXpq; Sat, 24 Oct 2020 11:56:34 -0600 X-Authority-Analysis: v=2.4 cv=P9aEOgMu c=1 sm=1 tr=0 ts=5f946ad3 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=afefHYAZSVUA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=6kwmjJUdz6EiHvdRlJ0A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 18ADB3B6; Sat, 24 Oct 2020 10:56:32 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 09OHuVh9006254; Sat, 24 Oct 2020 10:56:32 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202010241756.09OHuVh9006254@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Konstantin Belousov cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366997 - head/sys/kern In-reply-to: <20201024172452.GD2643@kib.kiev.ua> References: <202010241330.09ODUb6x089521@repo.freebsd.org> <20201024172452.GD2643@kib.kiev.ua> Comments: In-reply-to Konstantin Belousov message dated "Sat, 24 Oct 2020 20:24:52 +0300." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 24 Oct 2020 10:56:31 -0700 X-CMAE-Envelope: MS4xfEV2jF+1S0i6F4+hO3+9UJ/jaMI5UCZO9gBYlNpFSDBsrNVs9beuKxmTQ6F0j1/boMe811Cgu51/onFgQUDKgnjFW7L/iYmytuAggXfe7cMC6D7eZC79 OQODfk0kRC2WmpVYc/Tv6dvLYJHmWpIdcQkY953IkbFE5+rcZHrfHW5IQCLqeKLq3M1/IMUaYvOEDfZir+iJVRhtcgMXEsaN0YfYqfkvnPBlgf4W6brDSfD5 DRyXmfIDjncRbYUTfME6yxRBJoOd2fi8ehIDRG6nNdlzRWNCx4YCjWvbNGIclyGEXHnKj6PvPIGgW3Qtynqm7pPB1PaRWk8QPrIa+WWSo/E= X-Rspamd-Queue-Id: 4CJTLX662mz3csd X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.136.138) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-0.24 / 15.00]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-0.23)[-0.230]; FREEMAIL_TO(0.00)[gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[70.67.229.168:received]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; MIME_TRACE(0.00)[0:+]; RCVD_IN_DNSWL_LOW(-0.10)[64.59.136.138:from]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.89)[-0.891]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.42)[-0.419]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; AUTH_NA(1.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_SPF_NA(0.00)[no SPF record]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 17:56:38 -0000 In message <20201024172452.GD2643@kib.kiev.ua>, Konstantin Belousov writes: > On Sat, Oct 24, 2020 at 01:30:37PM +0000, Mateusz Guzik wrote: > > Author: mjg > > Date: Sat Oct 24 13:30:37 2020 > > New Revision: 366997 > > URL: https://svnweb.freebsd.org/changeset/base/366997 > > > > Log: > > vfs: fix a race where reclaim vholds freed vnodes > A description of the race in the commit message would be respectful to > other readers of the code, so that we do not need to reverse-eng the > change to understand what and why was fixed. +1 -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Sat Oct 24 20:09:28 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CD20453618; Sat, 24 Oct 2020 20:09:28 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJXHr387Nz435K; Sat, 24 Oct 2020 20:09:28 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F1C91E18B; Sat, 24 Oct 2020 20:09:28 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OK9SCk037933; Sat, 24 Oct 2020 20:09:28 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OK9RKo037929; Sat, 24 Oct 2020 20:09:27 GMT (envelope-from br@FreeBSD.org) Message-Id: <202010242009.09OK9RKo037929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sat, 24 Oct 2020 20:09:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367016 - in head/sys: dev/iommu kern X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: dev/iommu kern X-SVN-Commit-Revision: 367016 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 20:09:28 -0000 Author: br Date: Sat Oct 24 20:09:27 2020 New Revision: 367016 URL: https://svnweb.freebsd.org/changeset/base/367016 Log: o Add iommu de-initialization method for MSI interface. o Add iommu_unmap_msi() to release the msi GAS entry. o Provide default implementations for iommu init/deinit methods. Reviewed by: kib Sponsored by: Innovate DSbD Differential Revision: https://reviews.freebsd.org/D26906 Modified: head/sys/dev/iommu/iommu_gas.c head/sys/dev/iommu/iommu_msi.h head/sys/kern/msi_if.m head/sys/kern/subr_intr.c Modified: head/sys/dev/iommu/iommu_gas.c ============================================================================== --- head/sys/dev/iommu/iommu_gas.c Sat Oct 24 17:47:43 2020 (r367015) +++ head/sys/dev/iommu/iommu_gas.c Sat Oct 24 20:09:27 2020 (r367016) @@ -727,6 +727,31 @@ iommu_map(struct iommu_domain *domain, return (error); } +void +iommu_unmap_msi(struct iommu_ctx *ctx) +{ + struct iommu_map_entry *entry; + struct iommu_domain *domain; + + domain = ctx->domain; + entry = domain->msi_entry; + if (entry == NULL) + return; + + domain->ops->unmap(domain, entry->start, entry->end - + entry->start, IOMMU_PGF_WAITOK); + + IOMMU_DOMAIN_LOCK(domain); + iommu_gas_free_space(domain, entry); + IOMMU_DOMAIN_UNLOCK(domain); + + iommu_gas_free_entry(domain, entry); + + domain->msi_entry = NULL; + domain->msi_base = 0; + domain->msi_phys = 0; +} + int iommu_map_msi(struct iommu_ctx *ctx, iommu_gaddr_t size, int offset, u_int eflags, u_int flags, vm_page_t *ma) Modified: head/sys/dev/iommu/iommu_msi.h ============================================================================== --- head/sys/dev/iommu/iommu_msi.h Sat Oct 24 17:47:43 2020 (r367015) +++ head/sys/dev/iommu/iommu_msi.h Sat Oct 24 20:09:27 2020 (r367016) @@ -42,5 +42,6 @@ struct iommu_ctx; void iommu_translate_msi(struct iommu_domain *domain, uint64_t *addr); int iommu_map_msi(struct iommu_ctx *ctx, iommu_gaddr_t size, int offset, u_int eflags, u_int flags, vm_page_t *ma); +void iommu_unmap_msi(struct iommu_ctx *ctx); #endif /* !_DEV_IOMMU_IOMMU_MSI_H_ */ Modified: head/sys/kern/msi_if.m ============================================================================== --- head/sys/kern/msi_if.m Sat Oct 24 17:47:43 2020 (r367015) +++ head/sys/kern/msi_if.m Sat Oct 24 20:09:27 2020 (r367016) @@ -38,6 +38,22 @@ HEADER { struct intr_irqsrc; }; +# +# Default implementations of some methods. +# +CODE { + static int + iommu_init(device_t dev, device_t child, struct iommu_domain **domain) + { + *domain = NULL; + return (0); + } + static void + iommu_deinit(device_t dev, device_t child) + { + } +}; + METHOD int alloc_msi { device_t dev; device_t child; @@ -79,4 +95,9 @@ METHOD int iommu_init { device_t dev; device_t child; struct iommu_domain **domain; -}; +} DEFAULT iommu_init; + +METHOD void iommu_deinit { + device_t dev; + device_t child; +} DEFAULT iommu_deinit; Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Sat Oct 24 17:47:43 2020 (r367015) +++ head/sys/kern/subr_intr.c Sat Oct 24 20:09:27 2020 (r367016) @@ -1297,9 +1297,7 @@ int intr_alloc_msi(device_t pci, device_t child, intptr_t xref, int count, int maxcount, int *irqs) { -#ifdef IOMMU struct iommu_domain *domain; -#endif struct intr_irqsrc **isrc; struct intr_pic *pic; device_t pdev; @@ -1314,7 +1312,6 @@ intr_alloc_msi(device_t pci, device_t child, intptr_t ("%s: Found a non-MSI controller: %s", __func__, device_get_name(pic->pic_dev))); -#ifdef IOMMU /* * If this is the first time we have used this context ask the * interrupt controller to map memory the msi source will need. @@ -1322,7 +1319,6 @@ intr_alloc_msi(device_t pci, device_t child, intptr_t err = MSI_IOMMU_INIT(pic->pic_dev, child, &domain); if (err != 0) return (err); -#endif isrc = malloc(sizeof(*isrc) * count, M_INTRNG, M_WAITOK); err = MSI_ALLOC_MSI(pic->pic_dev, child, count, maxcount, &pdev, isrc); @@ -1332,9 +1328,7 @@ intr_alloc_msi(device_t pci, device_t child, intptr_t } for (i = 0; i < count; i++) { -#ifdef IOMMU isrc[i]->isrc_iommu = domain; -#endif msi = (struct intr_map_data_msi *)intr_alloc_map_data( INTR_MAP_DATA_MSI, sizeof(*msi), M_WAITOK | M_ZERO); msi-> isrc = isrc[i]; @@ -1375,6 +1369,8 @@ intr_release_msi(device_t pci, device_t child, intptr_ isrc[i] = msi->isrc; } + MSI_IOMMU_DEINIT(pic->pic_dev, child); + err = MSI_RELEASE_MSI(pic->pic_dev, child, count, isrc); for (i = 0; i < count; i++) { @@ -1389,9 +1385,7 @@ intr_release_msi(device_t pci, device_t child, intptr_ int intr_alloc_msix(device_t pci, device_t child, intptr_t xref, int *irq) { -#ifdef IOMMU struct iommu_domain *domain; -#endif struct intr_irqsrc *isrc; struct intr_pic *pic; device_t pdev; @@ -1406,7 +1400,6 @@ intr_alloc_msix(device_t pci, device_t child, intptr_t ("%s: Found a non-MSI controller: %s", __func__, device_get_name(pic->pic_dev))); -#ifdef IOMMU /* * If this is the first time we have used this context ask the * interrupt controller to map memory the msi source will need. @@ -1414,15 +1407,12 @@ intr_alloc_msix(device_t pci, device_t child, intptr_t err = MSI_IOMMU_INIT(pic->pic_dev, child, &domain); if (err != 0) return (err); -#endif err = MSI_ALLOC_MSIX(pic->pic_dev, child, &pdev, &isrc); if (err != 0) return (err); -#ifdef IOMMU isrc->isrc_iommu = domain; -#endif msi = (struct intr_map_data_msi *)intr_alloc_map_data( INTR_MAP_DATA_MSI, sizeof(*msi), M_WAITOK | M_ZERO); msi->isrc = isrc; @@ -1456,6 +1446,8 @@ intr_release_msix(device_t pci, device_t child, intptr intr_unmap_irq(irq); return (EINVAL); } + + MSI_IOMMU_DEINIT(pic->pic_dev, child); err = MSI_RELEASE_MSIX(pic->pic_dev, child, isrc); intr_unmap_irq(irq); From owner-svn-src-head@freebsd.org Sat Oct 24 20:57:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D252454639; Sat, 24 Oct 2020 20:57:14 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJYLy3jdlz45Vk; Sat, 24 Oct 2020 20:57:14 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 629CC1E997; Sat, 24 Oct 2020 20:57:14 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OKvE7T068856; Sat, 24 Oct 2020 20:57:14 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OKvD5D068852; Sat, 24 Oct 2020 20:57:13 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202010242057.09OKvD5D068852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Sat, 24 Oct 2020 20:57:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367020 - in head/sys/riscv: include riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head/sys/riscv: include riscv X-SVN-Commit-Revision: 367020 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 20:57:14 -0000 Author: mhorne Date: Sat Oct 24 20:57:13 2020 New Revision: 367020 URL: https://svnweb.freebsd.org/changeset/base/367020 Log: riscv: improve exception code naming The existing names were inherited from arm64, but we should prefer RISC-V terminology. Change the prefix to SCAUSE, and further change the names to better match the RISC-V spec and be more consistent with one another. Also, remove two codes that are not defined for S-mode (machine and hypervisor ecall). While here, apply style(9) to some condition checks. Reviewed by: kp Discussed with: jrtc27 Differential Revision: https://reviews.freebsd.org/D26918 Modified: head/sys/riscv/include/db_machdep.h head/sys/riscv/include/riscvreg.h head/sys/riscv/riscv/db_trace.c head/sys/riscv/riscv/intr_machdep.c head/sys/riscv/riscv/trap.c Modified: head/sys/riscv/include/db_machdep.h ============================================================================== --- head/sys/riscv/include/db_machdep.h Sat Oct 24 20:52:05 2020 (r367019) +++ head/sys/riscv/include/db_machdep.h Sat Oct 24 20:57:13 2020 (r367020) @@ -41,7 +41,7 @@ #include #include -#define T_BREAKPOINT (EXCP_BREAKPOINT) +#define T_BREAKPOINT (SCAUSE_BREAKPOINT) #define T_WATCHPOINT (0) typedef vm_offset_t db_addr_t; Modified: head/sys/riscv/include/riscvreg.h ============================================================================== --- head/sys/riscv/include/riscvreg.h Sat Oct 24 20:52:05 2020 (r367019) +++ head/sys/riscv/include/riscvreg.h Sat Oct 24 20:57:13 2020 (r367020) @@ -37,23 +37,21 @@ #ifndef _MACHINE_RISCVREG_H_ #define _MACHINE_RISCVREG_H_ -#define EXCP_MASK (~EXCP_INTR) -#define EXCP_MISALIGNED_FETCH 0 -#define EXCP_FAULT_FETCH 1 -#define EXCP_ILLEGAL_INSTRUCTION 2 -#define EXCP_BREAKPOINT 3 -#define EXCP_MISALIGNED_LOAD 4 -#define EXCP_FAULT_LOAD 5 -#define EXCP_MISALIGNED_STORE 6 -#define EXCP_FAULT_STORE 7 -#define EXCP_USER_ECALL 8 -#define EXCP_SUPERVISOR_ECALL 9 -#define EXCP_HYPERVISOR_ECALL 10 -#define EXCP_MACHINE_ECALL 11 -#define EXCP_INST_PAGE_FAULT 12 -#define EXCP_LOAD_PAGE_FAULT 13 -#define EXCP_STORE_PAGE_FAULT 15 -#define EXCP_INTR (1ul << 63) +#define SCAUSE_INTR (1ul << 63) +#define SCAUSE_CODE (~SCAUSE_INTR) +#define SCAUSE_INST_MISALIGNED 0 +#define SCAUSE_INST_ACCESS_FAULT 1 +#define SCAUSE_ILLEGAL_INSTRUCTION 2 +#define SCAUSE_BREAKPOINT 3 +#define SCAUSE_LOAD_MISALIGNED 4 +#define SCAUSE_LOAD_ACCESS_FAULT 5 +#define SCAUSE_STORE_MISALIGNED 6 +#define SCAUSE_STORE_ACCESS_FAULT 7 +#define SCAUSE_ECALL_USER 8 +#define SCAUSE_ECALL_SUPERVISOR 9 +#define SCAUSE_INST_PAGE_FAULT 12 +#define SCAUSE_LOAD_PAGE_FAULT 13 +#define SCAUSE_STORE_PAGE_FAULT 15 #define SSTATUS_UIE (1 << 0) #define SSTATUS_SIE (1 << 1) Modified: head/sys/riscv/riscv/db_trace.c ============================================================================== --- head/sys/riscv/riscv/db_trace.c Sat Oct 24 20:52:05 2020 (r367019) +++ head/sys/riscv/riscv/db_trace.c Sat Oct 24 20:57:13 2020 (r367020) @@ -101,12 +101,12 @@ db_stack_trace_cmd(struct unwind_state *frame) tf = (struct trapframe *)(uintptr_t)frame->sp; - if (tf->tf_scause & EXCP_INTR) + if ((tf->tf_scause & SCAUSE_INTR) != 0) db_printf("--- interrupt %ld\n", - tf->tf_scause & EXCP_MASK); + tf->tf_scause & SCAUSE_CODE); else db_printf("--- exception %ld, tval = %#lx\n", - tf->tf_scause & EXCP_MASK, + tf->tf_scause & SCAUSE_CODE, tf->tf_stval); frame->sp = tf->tf_sp; frame->fp = tf->tf_s[0]; Modified: head/sys/riscv/riscv/intr_machdep.c ============================================================================== --- head/sys/riscv/riscv/intr_machdep.c Sat Oct 24 20:52:05 2020 (r367019) +++ head/sys/riscv/riscv/intr_machdep.c Sat Oct 24 20:57:13 2020 (r367020) @@ -158,10 +158,10 @@ riscv_cpu_intr(struct trapframe *frame) struct intr_irqsrc *isrc; int active_irq; - KASSERT(frame->tf_scause & EXCP_INTR, + KASSERT((frame->tf_scause & SCAUSE_INTR) != 0, ("riscv_cpu_intr: wrong frame passed")); - active_irq = frame->tf_scause & EXCP_MASK; + active_irq = frame->tf_scause & SCAUSE_CODE; switch (active_irq) { case IRQ_SOFTWARE_USER: Modified: head/sys/riscv/riscv/trap.c ============================================================================== --- head/sys/riscv/riscv/trap.c Sat Oct 24 20:52:05 2020 (r367019) +++ head/sys/riscv/riscv/trap.c Sat Oct 24 20:57:13 2020 (r367020) @@ -217,9 +217,9 @@ page_fault_handler(struct trapframe *frame, int usermo va = trunc_page(stval); - if (frame->tf_scause == EXCP_STORE_PAGE_FAULT) { + if (frame->tf_scause == SCAUSE_STORE_PAGE_FAULT) { ftype = VM_PROT_WRITE; - } else if (frame->tf_scause == EXCP_INST_PAGE_FAULT) { + } else if (frame->tf_scause == SCAUSE_INST_PAGE_FAULT) { ftype = VM_PROT_EXECUTE; } else { ftype = VM_PROT_READ; @@ -232,7 +232,7 @@ page_fault_handler(struct trapframe *frame, int usermo if (error != KERN_SUCCESS) { if (usermode) { call_trapsignal(td, sig, ucode, (void *)stval, - frame->tf_scause & EXCP_MASK); + frame->tf_scause & SCAUSE_CODE); } else { if (pcb->pcb_onfault != 0) { frame->tf_a[0] = error; @@ -262,8 +262,8 @@ do_trap_supervisor(struct trapframe *frame) KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == SSTATUS_SPP, ("Came from S mode with interrupts enabled")); - exception = frame->tf_scause & EXCP_MASK; - if (frame->tf_scause & EXCP_INTR) { + exception = frame->tf_scause & SCAUSE_CODE; + if ((frame->tf_scause & SCAUSE_INTR) != 0) { /* Interrupt */ riscv_cpu_intr(frame); return; @@ -278,18 +278,18 @@ do_trap_supervisor(struct trapframe *frame) curthread, frame->tf_sepc, frame); switch (exception) { - case EXCP_FAULT_LOAD: - case EXCP_FAULT_STORE: - case EXCP_FAULT_FETCH: + case SCAUSE_LOAD_ACCESS_FAULT: + case SCAUSE_STORE_ACCESS_FAULT: + case SCAUSE_INST_ACCESS_FAULT: dump_regs(frame); panic("Memory access exception at 0x%016lx\n", frame->tf_sepc); break; - case EXCP_STORE_PAGE_FAULT: - case EXCP_LOAD_PAGE_FAULT: - case EXCP_INST_PAGE_FAULT: + case SCAUSE_STORE_PAGE_FAULT: + case SCAUSE_LOAD_PAGE_FAULT: + case SCAUSE_INST_PAGE_FAULT: page_fault_handler(frame, 0); break; - case EXCP_BREAKPOINT: + case SCAUSE_BREAKPOINT: #ifdef KDTRACE_HOOKS if (dtrace_invop_jump_addr != NULL && dtrace_invop_jump_addr(frame) == 0) @@ -302,7 +302,7 @@ do_trap_supervisor(struct trapframe *frame) panic("No debugger in kernel.\n"); #endif break; - case EXCP_ILLEGAL_INSTRUCTION: + case SCAUSE_ILLEGAL_INSTRUCTION: dump_regs(frame); panic("Illegal instruction at 0x%016lx\n", frame->tf_sepc); break; @@ -330,8 +330,8 @@ do_trap_user(struct trapframe *frame) KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == 0, ("Came from U mode with interrupts enabled")); - exception = frame->tf_scause & EXCP_MASK; - if (frame->tf_scause & EXCP_INTR) { + exception = frame->tf_scause & SCAUSE_CODE; + if ((frame->tf_scause & SCAUSE_INTR) != 0) { /* Interrupt */ riscv_cpu_intr(frame); return; @@ -342,23 +342,23 @@ do_trap_user(struct trapframe *frame) curthread, frame->tf_sepc, frame); switch (exception) { - case EXCP_FAULT_LOAD: - case EXCP_FAULT_STORE: - case EXCP_FAULT_FETCH: + case SCAUSE_LOAD_ACCESS_FAULT: + case SCAUSE_STORE_ACCESS_FAULT: + case SCAUSE_INST_ACCESS_FAULT: call_trapsignal(td, SIGBUS, BUS_ADRERR, (void *)frame->tf_sepc, exception); userret(td, frame); break; - case EXCP_STORE_PAGE_FAULT: - case EXCP_LOAD_PAGE_FAULT: - case EXCP_INST_PAGE_FAULT: + case SCAUSE_STORE_PAGE_FAULT: + case SCAUSE_LOAD_PAGE_FAULT: + case SCAUSE_INST_PAGE_FAULT: page_fault_handler(frame, 1); break; - case EXCP_USER_ECALL: + case SCAUSE_ECALL_USER: frame->tf_sepc += 4; /* Next instruction */ ecall_handler(); break; - case EXCP_ILLEGAL_INSTRUCTION: + case SCAUSE_ILLEGAL_INSTRUCTION: #ifdef FPE if ((pcb->pcb_fpflags & PCB_FP_STARTED) == 0) { /* @@ -376,7 +376,7 @@ do_trap_user(struct trapframe *frame) exception); userret(td, frame); break; - case EXCP_BREAKPOINT: + case SCAUSE_BREAKPOINT: call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_sepc, exception); userret(td, frame); From owner-svn-src-head@freebsd.org Sat Oct 24 21:01:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D01E44544F3; Sat, 24 Oct 2020 21:01:19 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJYRg5F8Cz45hd; Sat, 24 Oct 2020 21:01:19 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96D7D1E759; Sat, 24 Oct 2020 21:01:19 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OL1JIo072301; Sat, 24 Oct 2020 21:01:19 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OL1Imw072298; Sat, 24 Oct 2020 21:01:18 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202010242101.09OL1Imw072298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Sat, 24 Oct 2020 21:01:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367021 - in head/sbin: ping ping6 X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: in head/sbin: ping ping6 X-SVN-Commit-Revision: 367021 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 21:01:19 -0000 Author: rscheff Date: Sat Oct 24 21:01:18 2020 New Revision: 367021 URL: https://svnweb.freebsd.org/changeset/base/367021 Log: Make use of IP_VLAN_PCP setsockopt in ping and ping6. In order to validate the proper marking and use of a different ethernet priority class, add the new session-specific PCP feature to the ping/ping6 utilities. Reviewed by: mav, bcr Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D26627 Modified: head/sbin/ping/ping.8 head/sbin/ping/ping.c head/sbin/ping6/ping6.8 head/sbin/ping6/ping6.c Modified: head/sbin/ping/ping.8 ============================================================================== --- head/sbin/ping/ping.8 Sat Oct 24 20:57:13 2020 (r367020) +++ head/sbin/ping/ping.8 Sat Oct 24 21:01:18 2020 (r367021) @@ -28,7 +28,7 @@ .\" @(#)ping.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd August 22, 2019 +.Dd October 2, 2020 .Dt PING 8 .Os .Sh NAME @@ -39,6 +39,7 @@ packets to network hosts .Sh SYNOPSIS .Nm .Op Fl AaDdfHnoQqRrv +.Op Fl C Ar pcp .Op Fl c Ar count .Op Fl G Ar sweepmaxsize .Op Fl g Ar sweepminsize @@ -57,6 +58,7 @@ packets to network hosts .Ar host .Nm .Op Fl AaDdfHLnoQqRrv +.Op Fl C Ar pcp .Op Fl c Ar count .Op Fl I Ar iface .Op Fl i Ar wait @@ -112,6 +114,9 @@ Include a bell character in the output when any packet is received. This option is ignored if other format options are present. +.It Fl C Ar pcp +Add an 802.1p Ethernet Priority Code Point when sending a packet. +0..7 uses that specific PCP, -1 uses the interface default PCP (or none). .It Fl c Ar count Stop after sending (and receiving) Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Sat Oct 24 20:57:13 2020 (r367020) +++ head/sbin/ping/ping.c Sat Oct 24 21:01:18 2020 (r367021) @@ -155,6 +155,7 @@ static int options; #define F_TIME 0x100000 #define F_SWEEP 0x200000 #define F_WAITTIME 0x400000 +#define F_IP_VLAN_PCP 0x800000 /* * MAX_DUP_CHK is the number of bits in received table, i.e. the maximum @@ -247,7 +248,7 @@ main(int argc, char *const *argv) u_long alarmtimeout; long ltmp; int almost_done, ch, df, hold, i, icmp_len, mib[4], preload; - int ssend_errno, srecv_errno, tos, ttl; + int ssend_errno, srecv_errno, tos, ttl, pcp; char ctrl[CMSG_SPACE(sizeof(struct timespec))]; char hnamebuf[MAXHOSTNAMELEN], snamebuf[MAXHOSTNAMELEN]; #ifdef IP_OPTIONS @@ -295,11 +296,11 @@ main(int argc, char *const *argv) err(EX_OSERR, "srecv socket"); } - alarmtimeout = df = preload = tos = 0; + alarmtimeout = df = preload = tos = pcp = 0; outpack = outpackhdr + sizeof(struct ip); while ((ch = getopt(argc, argv, - "Aac:DdfG:g:Hh:I:i:Ll:M:m:nop:QqRrS:s:T:t:vW:z:" + "AaC:c:DdfG:g:Hh:I:i:Ll:M:m:nop:QqRrS:s:T:t:vW:z:" #ifdef IPSEC #ifdef IPSEC_POLICY_IPSEC "P:" @@ -314,6 +315,13 @@ main(int argc, char *const *argv) case 'a': options |= F_AUDIBLE; break; + case 'C': + options |= F_IP_VLAN_PCP; + ltmp = strtol(optarg, &ep, 0); + if (*ep || ep == optarg || ltmp > 7 || ltmp < -1) + errx(EX_USAGE, "invalid PCP: `%s'", optarg); + pcp = ltmp; + break; case 'c': ltmp = strtol(optarg, &ep, 0); if (*ep || ep == optarg || ltmp <= 0) @@ -665,6 +673,10 @@ main(int argc, char *const *argv) if (options & F_SO_DONTROUTE) (void)setsockopt(ssend, SOL_SOCKET, SO_DONTROUTE, (char *)&hold, sizeof(hold)); + if (options & F_IP_VLAN_PCP) { + (void)setsockopt(ssend, IPPROTO_IP, IP_VLAN_PCP, (char *)&pcp, + sizeof(pcp)); + } #ifdef IPSEC #ifdef IPSEC_POLICY_IPSEC if (options & F_POLICY) { @@ -1762,11 +1774,11 @@ usage(void) { (void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", -"usage: ping [-AaDdfHnoQqRrv] [-c count] [-G sweepmaxsize] [-g sweepminsize]", +"usage: ping [-AaDdfHnoQqRrv] [-C pcp] [-c count] [-G sweepmaxsize] [-g sweepminsize]", " [-h sweepincrsize] [-i wait] [-l preload] [-M mask | time] [-m ttl]", " " SECOPT " [-p pattern] [-S src_addr] [-s packetsize] [-t timeout]", " [-W waittime] [-z tos] host", -" ping [-AaDdfHLnoQqRrv] [-c count] [-I iface] [-i wait] [-l preload]", +" ping [-AaDdfHLnoQqRrv] [-C pcp] [-c count] [-I iface] [-i wait] [-l preload]", " [-M mask | time] [-m ttl]" SECOPT " [-p pattern] [-S src_addr]", " [-s packetsize] [-T ttl] [-t timeout] [-W waittime]", " [-z tos] mcast-group"); Modified: head/sbin/ping6/ping6.8 ============================================================================== --- head/sbin/ping6/ping6.8 Sat Oct 24 20:57:13 2020 (r367020) +++ head/sbin/ping6/ping6.8 Sat Oct 24 21:01:18 2020 (r367021) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 10, 2020 +.Dd October 2, 2020 .Dt PING6 8 .Os .Sh NAME @@ -47,6 +47,9 @@ packets to network hosts .Op Fl b Ar bufsiz .Ek .Bk -words +.Op Fl C Ar pcp +.Ek +.Bk -words .Op Fl c Ar count .Ek .Bk -words @@ -144,6 +147,9 @@ This is an experimental option. .El .It Fl b Ar bufsiz Set socket buffer size. +.It Fl C Ar pcp +Add an 802.1p Ethernet Priority Code Point when sending a packet. +0..7 uses that specific PCP, -1 uses the interface default PCP (or none). .It Fl c Ar count Stop after sending (and receiving) Modified: head/sbin/ping6/ping6.c ============================================================================== --- head/sbin/ping6/ping6.c Sat Oct 24 20:57:13 2020 (r367020) +++ head/sbin/ping6/ping6.c Sat Oct 24 21:01:18 2020 (r367021) @@ -230,6 +230,7 @@ static int ident; /* process id to identify our packe static u_int8_t nonce[8]; /* nonce field for node information */ static int hoplimit = -1; /* hoplimit */ static int tclass = -1; /* traffic class */ +static int pcp = -2; /* vlan priority code point */ static u_char *packet = NULL; static cap_channel_t *capdns; @@ -353,7 +354,7 @@ main(int argc, char *argv[]) #endif /*IPSEC_POLICY_IPSEC*/ #endif while ((ch = getopt(argc, argv, - "k:b:c:DdfHe:m:I:i:l:unNop:qaAS:s:OvyYW:t:z:" ADDOPTS)) != -1) { + "k:b:C:c:DdfHe:m:I:i:l:unNop:qaAS:s:OvyYW:t:z:" ADDOPTS)) != -1) { #undef ADDOPTS switch (ch) { case 'k': @@ -413,6 +414,13 @@ main(int argc, char *argv[]) "-b option ignored: SO_SNDBUF/SO_RCVBUF socket options not supported"); #endif break; + case 'C': /* vlan priority code point */ + pcp = strtol(optarg, &e, 10); + if (*optarg == '\0' || *e != '\0') + errx(1, "illegal vlan pcp %s", optarg); + if (7 < pcp || pcp < -1) + errx(1, "illegal vlan pcp -- %s", optarg); + break; case 'c': npackets = strtol(optarg, &e, 10); if (npackets <= 0 || *optarg == '\0' || *e != '\0') @@ -950,6 +958,12 @@ main(int argc, char *argv[]) if (setsockopt(ssend, IPPROTO_IPV6, IPV6_TCLASS, &tclass, sizeof(tclass)) == -1) err(1, "setsockopt(IPV6_TCLASS)"); + } + + if (pcp != -2) { + if (setsockopt(ssend, IPPROTO_IPV6, IPV6_VLAN_PCP, + &pcp, sizeof(pcp)) == -1) + err(1, "setsockopt(IPV6_VLAN_PCP)"); } if (argc > 1) { /* some intermediate addrs are specified */ From owner-svn-src-head@freebsd.org Sat Oct 24 21:07:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2109D454B11; Sat, 24 Oct 2020 21:07:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJYZS03vmz45pm; Sat, 24 Oct 2020 21:07:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9AB41EB3D; Sat, 24 Oct 2020 21:07:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OL7BIx075001; Sat, 24 Oct 2020 21:07:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OL7BMf074998; Sat, 24 Oct 2020 21:07:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202010242107.09OL7BMf074998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 24 Oct 2020 21:07:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367022 - in head/sys: geom kern sys X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys: geom kern sys X-SVN-Commit-Revision: 367022 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 21:07:12 -0000 Author: mav Date: Sat Oct 24 21:07:10 2020 New Revision: 367022 URL: https://svnweb.freebsd.org/changeset/base/367022 Log: Fix asymmetry in devstat(9) calls by GEOM. Before this GEOM passed bio pointer to transaction start, but not end. It was irrelevant until devstat(9) got DTrace hooks, that appeared to provide bio pointer on I/O completion, but not on submission. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/geom_io.c head/sys/kern/subr_devstat.c head/sys/sys/devicestat.h Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Sat Oct 24 21:01:18 2020 (r367021) +++ head/sys/geom/geom_io.c Sat Oct 24 21:07:10 2020 (r367022) @@ -552,9 +552,9 @@ g_io_request(struct bio *bp, struct g_consumer *cp) else getbinuptime(&bp->bio_t0); if (g_collectstats & G_STATS_CONSUMERS) - devstat_start_transaction(cp->stat, &bp->bio_t0); + devstat_start_transaction_bio_t0(cp->stat, bp); if (g_collectstats & G_STATS_PROVIDERS) - devstat_start_transaction(pp->stat, &bp->bio_t0); + devstat_start_transaction_bio_t0(pp->stat, bp); #ifdef INVARIANTS atomic_add_int(&cp->nstart, 1); #endif Modified: head/sys/kern/subr_devstat.c ============================================================================== --- head/sys/kern/subr_devstat.c Sat Oct 24 21:01:18 2020 (r367021) +++ head/sys/kern/subr_devstat.c Sat Oct 24 21:07:10 2020 (r367022) @@ -256,6 +256,17 @@ devstat_start_transaction_bio(struct devstat *ds, stru return; binuptime(&bp->bio_t0); + devstat_start_transaction_bio_t0(ds, bp); +} + +void +devstat_start_transaction_bio_t0(struct devstat *ds, struct bio *bp) +{ + + /* sanity check */ + if (ds == NULL) + return; + devstat_start_transaction(ds, &bp->bio_t0); DTRACE_DEVSTAT_BIO_START(); } Modified: head/sys/sys/devicestat.h ============================================================================== --- head/sys/sys/devicestat.h Sat Oct 24 21:01:18 2020 (r367021) +++ head/sys/sys/devicestat.h Sat Oct 24 21:07:10 2020 (r367022) @@ -196,6 +196,7 @@ struct devstat *devstat_new_entry(const void *dev_name void devstat_remove_entry(struct devstat *ds); void devstat_start_transaction(struct devstat *ds, const struct bintime *now); void devstat_start_transaction_bio(struct devstat *ds, struct bio *bp); +void devstat_start_transaction_bio_t0(struct devstat *ds, struct bio *bp); void devstat_end_transaction(struct devstat *ds, u_int32_t bytes, devstat_tag_type tag_type, devstat_trans_flags flags, From owner-svn-src-head@freebsd.org Sat Oct 24 21:07:16 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3652D454B14; Sat, 24 Oct 2020 21:07:16 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJYZW2w2Yz46Jt; Sat, 24 Oct 2020 21:07:15 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 300691E8C7; Sat, 24 Oct 2020 21:07:15 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OL7Fbq075055; Sat, 24 Oct 2020 21:07:15 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OL7Dcr075046; Sat, 24 Oct 2020 21:07:13 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202010242107.09OL7Dcr075046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Sat, 24 Oct 2020 21:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367023 - in head: sys/dev/iscsi usr.bin/iscsictl usr.sbin/iscsid X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: in head: sys/dev/iscsi usr.bin/iscsictl usr.sbin/iscsid X-SVN-Commit-Revision: 367023 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 21:07:16 -0000 Author: rscheff Date: Sat Oct 24 21:07:13 2020 New Revision: 367023 URL: https://svnweb.freebsd.org/changeset/base/367023 Log: Add network QoS support for PCP to iscsi initiator. Make the Ethernet PCP codepoint configurable for L2 local traffic, to allow lower latency for iSCSI block IO. This addresses the initiator side only. Reviewed by: mav, trasz, bcr Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D26739 Modified: head/sys/dev/iscsi/iscsi_ioctl.h head/usr.bin/iscsictl/iscsi.conf.5 head/usr.bin/iscsictl/iscsictl.c head/usr.bin/iscsictl/iscsictl.h head/usr.bin/iscsictl/parse.y head/usr.bin/iscsictl/token.l head/usr.sbin/iscsid/iscsid.c Modified: head/sys/dev/iscsi/iscsi_ioctl.h ============================================================================== --- head/sys/dev/iscsi/iscsi_ioctl.h Sat Oct 24 21:07:10 2020 (r367022) +++ head/sys/dev/iscsi/iscsi_ioctl.h Sat Oct 24 21:07:13 2020 (r367023) @@ -71,7 +71,8 @@ struct iscsi_session_conf { char isc_offload[ISCSI_OFFLOAD_LEN]; int isc_enable; int isc_dscp; - int isc_spare[3]; + int isc_pcp; + int isc_spare[2]; }; /* Modified: head/usr.bin/iscsictl/iscsi.conf.5 ============================================================================== --- head/usr.bin/iscsictl/iscsi.conf.5 Sat Oct 24 21:07:10 2020 (r367022) +++ head/usr.bin/iscsictl/iscsi.conf.5 Sat Oct 24 21:07:13 2020 (r367023) @@ -155,6 +155,13 @@ and codepoints. Default is no specified dscp codepoint, which means the default of the outgoing interface is used. +.It Cm pcp +The 802.1Q Priority CodePoint used for sending packets. +The PCP can be set to a value in the range between +.Qq Ar 0 +to +.Qq Ar 7 . +When omitted, the default for the outgoing interface is used. .El .Sh FILES .Bl -tag -width indent Modified: head/usr.bin/iscsictl/iscsictl.c ============================================================================== --- head/usr.bin/iscsictl/iscsictl.c Sat Oct 24 21:07:10 2020 (r367022) +++ head/usr.bin/iscsictl/iscsictl.c Sat Oct 24 21:07:13 2020 (r367023) @@ -88,6 +88,7 @@ target_new(struct conf *conf) xo_err(1, "calloc"); targ->t_conf = conf; targ->t_dscp = -1; + targ->t_pcp = -1; TAILQ_INSERT_TAIL(&conf->conf_targets, targ, t_next); return (targ); @@ -360,6 +361,7 @@ conf_from_target(struct iscsi_session_conf *conf, else conf->isc_data_digest = ISCSI_DIGEST_NONE; conf->isc_dscp = targ->t_dscp; + conf->isc_pcp = targ->t_pcp; } static int @@ -540,6 +542,9 @@ kernel_list(int iscsi_fd, const struct target *targ __ if (conf->isc_dscp != -1) xo_emit("{L:/%-26s}{V:dscp/0x%02x}\n", "Target DSCP:", conf->isc_dscp); + if (conf->isc_pcp != -1) + xo_emit("{L:/%-26s}{V:pcp/0x%02x}\n", + "Target PCP:", conf->isc_pcp); xo_close_container("target"); xo_open_container("auth"); Modified: head/usr.bin/iscsictl/iscsictl.h ============================================================================== --- head/usr.bin/iscsictl/iscsictl.h Sat Oct 24 21:07:10 2020 (r367022) +++ head/usr.bin/iscsictl/iscsictl.h Sat Oct 24 21:07:13 2020 (r367023) @@ -79,6 +79,7 @@ struct target { int t_enable; int t_protocol; int t_dscp; + int t_pcp; char *t_offload; char *t_user; char *t_secret; Modified: head/usr.bin/iscsictl/parse.y ============================================================================== --- head/usr.bin/iscsictl/parse.y Sat Oct 24 21:07:10 2020 (r367022) +++ head/usr.bin/iscsictl/parse.y Sat Oct 24 21:07:13 2020 (r367023) @@ -133,6 +133,8 @@ target_entry: ignored | dscp + | + pcp ; target_name: TARGET_NAME EQUALS STR @@ -306,6 +308,8 @@ dscp: DSCP EQUALS STR { uint64_t tmp; + if (target->t_dscp != -1) + xo_errx(1, "duplicated dscp at line %d", lineno); if (strcmp($3, "0x") == 0) { tmp = strtol($3 + 2, NULL, 16); } else if (expand_number($3, &tmp) != 0) { @@ -342,6 +346,27 @@ dscp: DSCP EQUALS STR | DSCP EQUALS AF41 { target->t_dscp = IPTOS_DSCP_AF41 >> 2 ; } | DSCP EQUALS AF42 { target->t_dscp = IPTOS_DSCP_AF42 >> 2 ; } | DSCP EQUALS AF43 { target->t_dscp = IPTOS_DSCP_AF43 >> 2 ; } + ; + +pcp: PCP EQUALS STR + { + uint64_t tmp; + + if (target->t_pcp != -1) + xo_errx(1, "duplicated pcp at line %d", lineno); + + if (expand_number($3, &tmp) != 0) { + yyerror("invalid numeric value"); + free($3); + return(1); + } + if (!((tmp >=0) && (tmp <= 7))) { + yyerror("invalid pcp value"); + return(1); + } + + target->t_pcp = tmp; + } ; %% Modified: head/usr.bin/iscsictl/token.l ============================================================================== --- head/usr.bin/iscsictl/token.l Sat Oct 24 21:07:10 2020 (r367022) +++ head/usr.bin/iscsictl/token.l Sat Oct 24 21:07:13 2020 (r367023) @@ -69,6 +69,7 @@ protocol { return PROTOCOL; } offload { return OFFLOAD; } port { return IGNORED; } dscp { return DSCP; } +pcp { return PCP; } MaxConnections { return IGNORED; } TargetAlias { return IGNORED; } TargetPortalGroupTag { return IGNORED; } Modified: head/usr.sbin/iscsid/iscsid.c ============================================================================== --- head/usr.sbin/iscsid/iscsid.c Sat Oct 24 21:07:10 2020 (r367022) +++ head/usr.sbin/iscsid/iscsid.c Sat Oct 24 21:07:13 2020 (r367023) @@ -297,6 +297,25 @@ connection_new(int iscsi_fd, const struct iscsi_daemon from_addr); } } + if (conn->conn_conf.isc_pcp != -1) { + int pcp = conn->conn_conf.isc_pcp; + if (to_ai->ai_family == AF_INET) { + if (setsockopt(conn->conn_socket, + IPPROTO_IP, IP_VLAN_PCP, + &pcp, sizeof(pcp)) == -1) + log_warn("setsockopt(IP_VLAN_PCP) " + "failed for %s", + from_addr); + } else + if (to_ai->ai_family == AF_INET6) { + if (setsockopt(conn->conn_socket, + IPPROTO_IPV6, IPV6_VLAN_PCP, + &pcp, sizeof(pcp)) == -1) + log_warn("setsockopt(IPV6_VLAN_PCP) " + "failed for %s", + from_addr); + } + } if (from_ai != NULL) { error = bind(conn->conn_socket, from_ai->ai_addr, from_ai->ai_addrlen); From owner-svn-src-head@freebsd.org Sat Oct 24 21:10:54 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8CDB454D05; Sat, 24 Oct 2020 21:10:54 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJYfk5vZmz46JS; Sat, 24 Oct 2020 21:10:54 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADEF01EC8E; Sat, 24 Oct 2020 21:10:54 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OLAsfi079079; Sat, 24 Oct 2020 21:10:54 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OLAreS079074; Sat, 24 Oct 2020 21:10:53 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202010242110.09OLAreS079074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Sat, 24 Oct 2020 21:10:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367024 - head/usr.sbin/ctld X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: head/usr.sbin/ctld X-SVN-Commit-Revision: 367024 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 21:10:55 -0000 Author: rscheff Date: Sat Oct 24 21:10:53 2020 New Revision: 367024 URL: https://svnweb.freebsd.org/changeset/base/367024 Log: Add network QoS support for PCP to iscsi target. Mak the Ethernet PCP codepoint configurable for L2 local traffic, to allow lower latency for iSCSI block IO. This addresses the target side only. Reviewed by: mav, trasz, bcr Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D26740 Modified: head/usr.sbin/ctld/ctl.conf.5 head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/token.l head/usr.sbin/ctld/uclparse.c Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Sat Oct 24 21:07:13 2020 (r367023) +++ head/usr.sbin/ctld/ctl.conf.5 Sat Oct 24 21:10:53 2020 (r367024) @@ -258,6 +258,13 @@ well-defined and .Qq Ar AFxx codepoints. +.It Ic pcp Ar value +The 802.1Q Priority CodePoint used for sending packets. +The PCP can be set to a value in the range between +.Qq Ar 0 +to +.Qq Ar 7 . +When omitted, the default for the outgoing interface is used. .El .Ss target Context .Bl -tag -width indent Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Sat Oct 24 21:07:13 2020 (r367023) +++ head/usr.sbin/ctld/ctld.c Sat Oct 24 21:10:53 2020 (r367024) @@ -626,6 +626,7 @@ portal_group_new(struct conf *conf, const char *name) pg->pg_conf = conf; pg->pg_tag = 0; /* Assigned later in conf_apply(). */ pg->pg_dscp = -1; + pg->pg_pcp = -1; TAILQ_INSERT_TAIL(&conf->conf_portal_groups, pg, pg_next); return (pg); @@ -2210,6 +2211,32 @@ conf_apply(struct conf *oldconf, struct conf *newconf) IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)) == -1) log_warn("setsockopt(IPV6_TCLASS) " + "failed for %s", + newp->p_listen); + } + } + if (newpg->pg_pcp != -1) { + struct sockaddr sa; + int len = sizeof(sa); + getsockname(newp->p_socket, &sa, &len); + /* + * Only allow the 6-bit DSCP + * field to be modified + */ + int pcp = newpg->pg_pcp; + if (sa.sa_family == AF_INET) { + if (setsockopt(newp->p_socket, + IPPROTO_IP, IP_VLAN_PCP, + &pcp, sizeof(pcp)) == -1) + log_warn("setsockopt(IP_VLAN_PCP) " + "failed for %s", + newp->p_listen); + } else + if (sa.sa_family == AF_INET6) { + if (setsockopt(newp->p_socket, + IPPROTO_IPV6, IPV6_VLAN_PCP, + &pcp, sizeof(pcp)) == -1) + log_warn("setsockopt(IPV6_VLAN_PCP) " "failed for %s", newp->p_listen); } Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Sat Oct 24 21:07:13 2020 (r367023) +++ head/usr.sbin/ctld/ctld.h Sat Oct 24 21:10:53 2020 (r367024) @@ -128,6 +128,7 @@ struct portal_group { char *pg_offload; char *pg_redirection; int pg_dscp; + int pg_pcp; uint16_t pg_tag; }; Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Sat Oct 24 21:07:13 2020 (r367023) +++ head/usr.sbin/ctld/parse.y Sat Oct 24 21:10:53 2020 (r367024) @@ -65,8 +65,8 @@ extern void yyrestart(FILE *); %token DISCOVERY_AUTH_GROUP DISCOVERY_FILTER DSCP FOREIGN %token INITIATOR_NAME INITIATOR_PORTAL ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT %token LISTEN LISTEN_ISER LUN MAXPROC OFFLOAD OPENING_BRACKET OPTION -%token PATH PIDFILE PORT PORTAL_GROUP REDIRECT SEMICOLON SERIAL SIZE STR -%token TAG TARGET TIMEOUT +%token PATH PCP PIDFILE PORT PORTAL_GROUP REDIRECT SEMICOLON SERIAL +%token SIZE STR TAG TARGET TIMEOUT %token AF11 AF12 AF13 AF21 AF22 AF23 AF31 AF32 AF33 AF41 AF42 AF43 %token BE EF CS0 CS1 CS2 CS3 CS4 CS5 CS6 CS7 @@ -359,6 +359,8 @@ portal_group_entry: portal_group_tag | portal_group_dscp + | + portal_group_pcp ; portal_group_discovery_auth_group: DISCOVERY_AUTH_GROUP STR @@ -512,6 +514,24 @@ portal_group_dscp | DSCP AF43 { portal_group->pg_dscp = IPTOS_DSCP_AF43 >> 2 ; } ; +portal_group_pcp: PCP STR + { + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + yyerror("invalid numeric value"); + free($2); + return (1); + } + if (!((tmp >= 0) && (tmp <= 7))) { + yyerror("invalid pcp value"); + free($2); + return (1); + } + + portal_group->pg_pcp = tmp; + } + ; lun: LUN lun_name OPENING_BRACKET lun_entries CLOSING_BRACKET Modified: head/usr.sbin/ctld/token.l ============================================================================== --- head/usr.sbin/ctld/token.l Sat Oct 24 21:07:13 2020 (r367023) +++ head/usr.sbin/ctld/token.l Sat Oct 24 21:10:53 2020 (r367024) @@ -64,6 +64,7 @@ device-type { return DEVICE_TYPE; } discovery-auth-group { return DISCOVERY_AUTH_GROUP; } discovery-filter { return DISCOVERY_FILTER; } dscp { return DSCP; } +pcp { return PCP; } foreign { return FOREIGN; } initiator-name { return INITIATOR_NAME; } initiator-portal { return INITIATOR_PORTAL; } Modified: head/usr.sbin/ctld/uclparse.c ============================================================================== --- head/usr.sbin/ctld/uclparse.c Sat Oct 24 21:07:13 2020 (r367023) +++ head/usr.sbin/ctld/uclparse.c Sat Oct 24 21:10:53 2020 (r367024) @@ -672,6 +672,19 @@ uclparse_portal_group(const char *name, const ucl_obje } } } + + if (!strcmp(key, "pcp")) { + if (obj->type != UCL_INT) { + log_warnx("\"pcp\" property of portal group " + "\"%s\" is not an integer", portal_group->pg_name); + return(1); + } + portal_group->pg_pcp = ucl_object_toint(obj); + if (!((portal_group->pg_pcp >= 0) && (portal_group->pg_pcp <= 7))) { + log_warnx("invalid \"pcp\" value %d, using default", portal_group->pg_pcp); + portal_group->pg_pcp = -1; + } + } } return (0); From owner-svn-src-head@freebsd.org Sat Oct 24 22:36:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CBCA4563D7; Sat, 24 Oct 2020 22:36:21 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJbYJ6crXz4CqB; Sat, 24 Oct 2020 22:36:20 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6AD81FAAB; Sat, 24 Oct 2020 22:36:20 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OMaK7d030013; Sat, 24 Oct 2020 22:36:20 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OMaKc9030012; Sat, 24 Oct 2020 22:36:20 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202010242236.09OMaKc9030012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Sat, 24 Oct 2020 22:36:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367025 - head/usr.bin/sockstat X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: head/usr.bin/sockstat X-SVN-Commit-Revision: 367025 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 22:36:21 -0000 Author: freqlabs Date: Sat Oct 24 22:36:20 2020 New Revision: 367025 URL: https://svnweb.freebsd.org/changeset/base/367025 Log: sockstat: Fix error message when jail_attach fails jail_errmsg is for libjail, jail_attach() is a system call. Modified: head/usr.bin/sockstat/sockstat.c Modified: head/usr.bin/sockstat/sockstat.c ============================================================================== --- head/usr.bin/sockstat/sockstat.c Sat Oct 24 21:10:53 2020 (r367024) +++ head/usr.bin/sockstat/sockstat.c Sat Oct 24 22:36:20 2020 (r367025) @@ -1372,7 +1372,7 @@ main(int argc, char *argv[]) errx(2, "%s", jail_errmsg); case JAIL_SYS_NEW: if (jail_attach(opt_j) < 0) - errx(3, "%s", jail_errmsg); + err(3, "jail_attach()"); /* Set back to -1 for normal output in vnet jail. */ opt_j = -1; break; From owner-svn-src-head@freebsd.org Sat Oct 24 22:48:28 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBB74456A80; Sat, 24 Oct 2020 22:48:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJbqJ5ZbMz4D5D; Sat, 24 Oct 2020 22:48:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F5EC20080; Sat, 24 Oct 2020 22:48:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OMmSq2036700; Sat, 24 Oct 2020 22:48:28 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OMmSfj036699; Sat, 24 Oct 2020 22:48:28 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202010242248.09OMmSfj036699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 24 Oct 2020 22:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367026 - head/usr.sbin/mountd X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/usr.sbin/mountd X-SVN-Commit-Revision: 367026 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 22:48:28 -0000 Author: rmacklem Date: Sat Oct 24 22:48:28 2020 New Revision: 367026 URL: https://svnweb.freebsd.org/changeset/base/367026 Log: Add "-R" option to tell mountd to not register with rpcbind. rpcbind is now considered a security risk for some sites. Since an NFSv4 only NFS server does not need rpcbind, it makes sense to have an option that implements this. This patch adds a "-R" option that disables the Mount protocol (not used by NFSv4) and does not register with rpcbind. Changes are required to /etc/rc.d/mountd and /etc/rc.d/nfsd. Those will be in a separate commit. Reviewed by: freqlabs, asomers MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26746 Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Sat Oct 24 22:36:20 2020 (r367025) +++ head/usr.sbin/mountd/mountd.c Sat Oct 24 22:48:28 2020 (r367026) @@ -427,8 +427,10 @@ main(int argc, char **argv) uint64_t curtime, nexttime; struct timeval tv; struct timespec tp; - sigset_t sighup_mask; + sigset_t sig_mask, sighup_mask; + int enable_rpcbind; + enable_rpcbind = 1; /* Check that another mountd isn't already running. */ pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &otherpid); if (pfh == NULL) { @@ -443,7 +445,7 @@ main(int argc, char **argv) else close(s); - while ((c = getopt(argc, argv, "2deh:lnp:rS")) != -1) + while ((c = getopt(argc, argv, "2deh:lnp:RrS")) != -1) switch (c) { case '2': force_v2 = 1; @@ -454,6 +456,10 @@ main(int argc, char **argv) case 'n': resvport_only = 0; break; + case 'R': + /* Do not support Mount protocol */ + enable_rpcbind = 0; + break; case 'r': dir_only = 0; break; @@ -498,6 +504,21 @@ main(int argc, char **argv) default: usage(); } + if (enable_rpcbind == 0) { + if (svcport_str != NULL) { + warnx("-p option not compatible with -R, ignored"); + free(svcport_str); + svcport_str = NULL; + } + if (nhosts > 0) { + warnx("-h option not compatible with -R, ignored"); + for (k = 0; k < nhosts; k++) + free(hosts[k]); + free(hosts); + hosts = NULL; + nhosts = 0; + } + } if (modfind("nfsd") < 0) { /* Not present in kernel, try loading it */ @@ -531,58 +552,61 @@ main(int argc, char **argv) pidfile_write(pfh); - rpcb_unset(MOUNTPROG, MOUNTVERS, NULL); - rpcb_unset(MOUNTPROG, MOUNTVERS3, NULL); - rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); + if (enable_rpcbind != 0) { + rpcb_unset(MOUNTPROG, MOUNTVERS, NULL); + rpcb_unset(MOUNTPROG, MOUNTVERS3, NULL); + rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); - if (!resvport_only) { - if (sysctlbyname("vfs.nfsd.nfs_privport", NULL, NULL, - &resvport_only, sizeof(resvport_only)) != 0 && - errno != ENOENT) { - syslog(LOG_ERR, "sysctl: %m"); - exit(1); + if (!resvport_only) { + if (sysctlbyname("vfs.nfsd.nfs_privport", NULL, NULL, + &resvport_only, sizeof(resvport_only)) != 0 && + errno != ENOENT) { + syslog(LOG_ERR, "sysctl: %m"); + exit(1); + } } - } - /* - * If no hosts were specified, add a wildcard entry to bind to - * INADDR_ANY. Otherwise make sure 127.0.0.1 and ::1 are added to the - * list. - */ - if (nhosts == 0) { - hosts = malloc(sizeof(char *)); - if (hosts == NULL) - out_of_mem(); - hosts[0] = "*"; - nhosts = 1; - } else { - hosts_bak = hosts; - if (have_v6) { - hosts_bak = realloc(hosts, (nhosts + 2) * - sizeof(char *)); - if (hosts_bak == NULL) { - for (k = 0; k < nhosts; k++) - free(hosts[k]); - free(hosts); - out_of_mem(); - } else - hosts = hosts_bak; - nhosts += 2; - hosts[nhosts - 2] = "::1"; - } else { - hosts_bak = realloc(hosts, (nhosts + 1) * sizeof(char *)); - if (hosts_bak == NULL) { - for (k = 0; k < nhosts; k++) - free(hosts[k]); - free(hosts); + /* + * If no hosts were specified, add a wildcard entry to bind to + * INADDR_ANY. Otherwise make sure 127.0.0.1 and ::1 are added + * to the list. + */ + if (nhosts == 0) { + hosts = malloc(sizeof(char *)); + if (hosts == NULL) out_of_mem(); + hosts[0] = "*"; + nhosts = 1; + } else { + hosts_bak = hosts; + if (have_v6) { + hosts_bak = realloc(hosts, (nhosts + 2) * + sizeof(char *)); + if (hosts_bak == NULL) { + for (k = 0; k < nhosts; k++) + free(hosts[k]); + free(hosts); + out_of_mem(); + } else + hosts = hosts_bak; + nhosts += 2; + hosts[nhosts - 2] = "::1"; } else { - nhosts += 1; - hosts = hosts_bak; + hosts_bak = realloc(hosts, (nhosts + 1) * + sizeof(char *)); + if (hosts_bak == NULL) { + for (k = 0; k < nhosts; k++) + free(hosts[k]); + free(hosts); + out_of_mem(); + } else { + nhosts += 1; + hosts = hosts_bak; + } } - } - hosts[nhosts - 1] = "127.0.0.1"; + hosts[nhosts - 1] = "127.0.0.1"; + } } attempt_cnt = 1; @@ -590,96 +614,109 @@ main(int argc, char **argv) sock_fd = NULL; port_list = NULL; port_len = 0; - nc_handle = setnetconfig(); - while ((nconf = getnetconfig(nc_handle))) { - if (nconf->nc_flag & NC_VISIBLE) { - if (have_v6 == 0 && strcmp(nconf->nc_protofmly, - "inet6") == 0) { - /* DO NOTHING */ - } else { - ret = create_service(nconf); - if (ret == 1) - /* Ignore this call */ - continue; - if (ret < 0) { - /* - * Failed to bind port, so close off - * all sockets created and try again - * if the port# was dynamically - * assigned via bind(2). - */ - clearout_service(); - if (mallocd_svcport != 0 && - attempt_cnt < GETPORT_MAXTRY) { - free(svcport_str); + if (enable_rpcbind != 0) { + nc_handle = setnetconfig(); + while ((nconf = getnetconfig(nc_handle))) { + if (nconf->nc_flag & NC_VISIBLE) { + if (have_v6 == 0 && strcmp(nconf->nc_protofmly, + "inet6") == 0) { + /* DO NOTHING */ + } else { + ret = create_service(nconf); + if (ret == 1) + /* Ignore this call */ + continue; + if (ret < 0) { + /* + * Failed to bind port, so close + * off all sockets created and + * try again if the port# was + * dynamically assigned via + * bind(2). + */ + clearout_service(); + if (mallocd_svcport != 0 && + attempt_cnt < + GETPORT_MAXTRY) { + free(svcport_str); + svcport_str = NULL; + mallocd_svcport = 0; + } else { + errno = EADDRINUSE; + syslog(LOG_ERR, + "bindresvport_sa:" + " %m"); + exit(1); + } + + /* + * Start over at the first + * service. + */ + free(sock_fd); + sock_fdcnt = 0; + sock_fd = NULL; + nc_handle = setnetconfig(); + attempt_cnt++; + } else if (mallocd_svcport != 0 && + attempt_cnt == GETPORT_MAXTRY) { + /* + * For the last attempt, allow + * different port #s for each + * nconf by saving the + * svcport_str setting it back + * to NULL. + */ + port_list = realloc(port_list, + (port_len + 1) * + sizeof(char *)); + if (port_list == NULL) + out_of_mem(); + port_list[port_len++] = + svcport_str; svcport_str = NULL; mallocd_svcport = 0; - } else { - errno = EADDRINUSE; - syslog(LOG_ERR, - "bindresvport_sa: %m"); - exit(1); } - - /* Start over at the first service. */ - free(sock_fd); - sock_fdcnt = 0; - sock_fd = NULL; - nc_handle = setnetconfig(); - attempt_cnt++; - } else if (mallocd_svcport != 0 && - attempt_cnt == GETPORT_MAXTRY) { - /* - * For the last attempt, allow - * different port #s for each nconf - * by saving the svcport_str and - * setting it back to NULL. - */ - port_list = realloc(port_list, - (port_len + 1) * sizeof(char *)); - if (port_list == NULL) - out_of_mem(); - port_list[port_len++] = svcport_str; - svcport_str = NULL; - mallocd_svcport = 0; } } } - } - /* - * Successfully bound the ports, so call complete_service() to - * do the rest of the setup on the service(s). - */ - sock_fdpos = 0; - port_pos = 0; - nc_handle = setnetconfig(); - while ((nconf = getnetconfig(nc_handle))) { - if (nconf->nc_flag & NC_VISIBLE) { - if (have_v6 == 0 && strcmp(nconf->nc_protofmly, - "inet6") == 0) { - /* DO NOTHING */ - } else if (port_list != NULL) { - if (port_pos >= port_len) { - syslog(LOG_ERR, "too many port#s"); - exit(1); - } - complete_service(nconf, port_list[port_pos++]); - } else - complete_service(nconf, svcport_str); + /* + * Successfully bound the ports, so call complete_service() to + * do the rest of the setup on the service(s). + */ + sock_fdpos = 0; + port_pos = 0; + nc_handle = setnetconfig(); + while ((nconf = getnetconfig(nc_handle))) { + if (nconf->nc_flag & NC_VISIBLE) { + if (have_v6 == 0 && strcmp(nconf->nc_protofmly, + "inet6") == 0) { + /* DO NOTHING */ + } else if (port_list != NULL) { + if (port_pos >= port_len) { + syslog(LOG_ERR, "too many" + " port#s"); + exit(1); + } + complete_service(nconf, + port_list[port_pos++]); + } else + complete_service(nconf, svcport_str); + } } - } - endnetconfig(nc_handle); - free(sock_fd); - if (port_list != NULL) { - for (port_pos = 0; port_pos < port_len; port_pos++) - free(port_list[port_pos]); - free(port_list); - } + endnetconfig(nc_handle); + free(sock_fd); + if (port_list != NULL) { + for (port_pos = 0; port_pos < port_len; port_pos++) + free(port_list[port_pos]); + free(port_list); + } - if (xcreated == 0) { - syslog(LOG_ERR, "could not create any services"); - exit(1); + if (xcreated == 0) { + syslog(LOG_ERR, "could not create any services"); + exit(1); + } } /* Expand svc_run() here so that we can call get_exportlist(). */ @@ -690,7 +727,7 @@ main(int argc, char **argv) clock_gettime(CLOCK_MONOTONIC, &tp); curtime = tp.tv_sec; curtime = curtime * 1000000 + tp.tv_nsec / 1000; - sigprocmask(SIG_BLOCK, &sighup_mask, NULL); + sigprocmask(SIG_BLOCK, &sighup_mask, &sig_mask); if (got_sighup && curtime >= nexttime) { got_sighup = 0; sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL); @@ -713,22 +750,28 @@ main(int argc, char **argv) tv.tv_usec = 0; else tv.tv_usec = RELOADDELAY; - readfds = svc_fdset; - switch (select(svc_maxfd + 1, &readfds, NULL, NULL, &tv)) { - case -1: - if (errno == EINTR) { + if (enable_rpcbind != 0) { + readfds = svc_fdset; + switch (select(svc_maxfd + 1, &readfds, NULL, NULL, + &tv)) { + case -1: + if (errno == EINTR) { + /* Allow a reload now. */ + nexttime = 0; + continue; + } + syslog(LOG_ERR, "mountd died: select: %m"); + exit(1); + case 0: /* Allow a reload now. */ nexttime = 0; continue; + default: + svc_getreqset(&readfds); } - syslog(LOG_ERR, "mountd died: select: %m"); - exit(1); - case 0: - /* Allow a reload now. */ - nexttime = 0; - continue; - default: - svc_getreqset(&readfds); + } else { + /* Simply wait for a signal. */ + sigsuspend(&sig_mask); } } } From owner-svn-src-head@freebsd.org Sat Oct 24 22:52:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C379456852; Sat, 24 Oct 2020 22:52:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJbvy2FG2z4Dps; Sat, 24 Oct 2020 22:52:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 305601FEB7; Sat, 24 Oct 2020 22:52:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09OMqUWd042328; Sat, 24 Oct 2020 22:52:30 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09OMqUw8042327; Sat, 24 Oct 2020 22:52:30 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202010242252.09OMqUw8042327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 24 Oct 2020 22:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367027 - head/usr.sbin/mountd X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/usr.sbin/mountd X-SVN-Commit-Revision: 367027 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 22:52:30 -0000 Author: rmacklem Date: Sat Oct 24 22:52:29 2020 New Revision: 367027 URL: https://svnweb.freebsd.org/changeset/base/367027 Log: Update man page for -R option added by r376026. This is a content change. Reviewed by: bcr MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26746 Modified: head/usr.sbin/mountd/mountd.8 Modified: head/usr.sbin/mountd/mountd.8 ============================================================================== --- head/usr.sbin/mountd/mountd.8 Sat Oct 24 22:48:28 2020 (r367026) +++ head/usr.sbin/mountd/mountd.8 Sat Oct 24 22:52:29 2020 (r367027) @@ -28,7 +28,7 @@ .\" @(#)mountd.8 8.4 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd August 1, 2019 +.Dd October 11, 2020 .Dt MOUNTD 8 .Os .Sh NAME @@ -38,7 +38,7 @@ mount requests .Sh SYNOPSIS .Nm -.Op Fl 2delnrS +.Op Fl 2delnRrS .Op Fl h Ar bindip .Op Fl p Ar port .Op Ar exportsfile ... @@ -112,6 +112,17 @@ If .Nm cannot bind to this port, an appropriate error will be recorded in the system log, and the daemon will then exit. +.It Fl R +Do not support the Mount protocol and do not register with +.Xr rpcbind 8 . +This can be done for NFSv4 only servers, since the Mount protocol is not +used by NFSv4. +Useful for NFSv4 only servers that do not wish to run +.Xr rpcbind 8 . +.Xr showmount 8 +will not work, however since NFSv4 mounts are not shown by +.Xr showmount 8 , +this should not be an issue for an NFSv4 only server. .It Fl r Allow mount RPCs requests for regular files to be served. Although this seems to violate the mount protocol specification, From owner-svn-src-head@freebsd.org Sat Oct 24 23:21:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1EC54573AD; Sat, 24 Oct 2020 23:21:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJcXz4p1Rz4G3j; Sat, 24 Oct 2020 23:21:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 880CB1FFD7; Sat, 24 Oct 2020 23:21:07 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09ONL7Fh055702; Sat, 24 Oct 2020 23:21:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09ONL78e055700; Sat, 24 Oct 2020 23:21:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202010242321.09ONL78e055700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 24 Oct 2020 23:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367028 - in head: include sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: include sys/sys X-SVN-Commit-Revision: 367028 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 23:21:07 -0000 Author: imp Date: Sat Oct 24 23:21:06 2020 New Revision: 367028 URL: https://svnweb.freebsd.org/changeset/base/367028 Log: Remove obsolete check for GCC < 3 and support for Intel Compiler We no longer support old versions of GCC. Remove this check by assuming it's false. That will make the entire expression false. Also remove support for Intel compiler, it's badly bitrotted. Technically, this removes support for C89 and K&R from compilers that don't define _Bool in those compilation environments as well. I'm unaware of any working compiler today for which that would be relevant (pcc has it and tcc sadly isn't working for other reasons), though if one pops up in ports, I'll work to resolve the issue. Modified: head/include/stdbool.h head/include/stdlib.h head/sys/sys/types.h Modified: head/include/stdbool.h ============================================================================== --- head/include/stdbool.h Sat Oct 24 22:52:29 2020 (r367027) +++ head/include/stdbool.h Sat Oct 24 23:21:06 2020 (r367028) @@ -37,9 +37,6 @@ #define true 1 #define bool _Bool -#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER) -typedef int _Bool; -#endif #endif /* !__cplusplus */ #endif /* __bool_true_false_are_defined */ Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Sat Oct 24 22:52:29 2020 (r367027) +++ head/include/stdlib.h Sat Oct 24 23:21:06 2020 (r367028) @@ -253,7 +253,7 @@ extern void (*malloc_message)(void *, const char *); * On platforms where alloca() is not in libc, programs which use it * will fail to link when compiled with non-GNU compilers. */ -#if __GNUC__ >= 2 || defined(__INTEL_COMPILER) +#if __GNUC__ >= 2 #undef alloca /* some GNU bits try to get cute and define this on their own */ #define alloca(sz) __builtin_alloca(sz) #endif Modified: head/sys/sys/types.h ============================================================================== --- head/sys/sys/types.h Sat Oct 24 22:52:29 2020 (r367027) +++ head/sys/sys/types.h Sat Oct 24 23:21:06 2020 (r367028) @@ -300,9 +300,6 @@ typedef struct vm_page *vm_page_t; #define __bool_true_false_are_defined 1 #define false 0 #define true 1 -#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER) -typedef int _Bool; -#endif typedef _Bool bool; #endif /* !__bool_true_false_are_defined && !__cplusplus */ #endif /* KERNEL || _STANDALONE */ From owner-svn-src-head@freebsd.org Sat Oct 24 23:21:20 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DA4C45748A; Sat, 24 Oct 2020 23:21:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJcYC5GtSz4Fy0; Sat, 24 Oct 2020 23:21:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7330C20491; Sat, 24 Oct 2020 23:21:19 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09ONLJGf055761; Sat, 24 Oct 2020 23:21:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09ONLJEf055760; Sat, 24 Oct 2020 23:21:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202010242321.09ONLJEf055760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 24 Oct 2020 23:21:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367029 - head/sys/dev/bxe X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/bxe X-SVN-Commit-Revision: 367029 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 23:21:20 -0000 Author: imp Date: Sat Oct 24 23:21:18 2020 New Revision: 367029 URL: https://svnweb.freebsd.org/changeset/base/367029 Log: Remove support for ancient compilers We don't support building the kernel from such old compilers, nor with the Intel Compiler specifically. Remove support for this old construct that was copied from stdbool.h and not relevant here. Modified: head/sys/dev/bxe/ecore_sp.h Modified: head/sys/dev/bxe/ecore_sp.h ============================================================================== --- head/sys/dev/bxe/ecore_sp.h Sat Oct 24 23:21:06 2020 (r367028) +++ head/sys/dev/bxe/ecore_sp.h Sat Oct 24 23:21:18 2020 (r367029) @@ -75,9 +75,6 @@ typedef volatile int ecore_atomic_t; #ifndef __bool_true_false_are_defined #ifndef __cplusplus #define bool _Bool -#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER) -typedef _Bool bool; -#endif #endif /* !__cplusplus */ #endif /* !__bool_true_false_are_defined$ */ From owner-svn-src-head@freebsd.org Sat Oct 24 23:21:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCDCA457425; Sat, 24 Oct 2020 23:21:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJcYH4YQ3z4G53; Sat, 24 Oct 2020 23:21:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6993C2050D; Sat, 24 Oct 2020 23:21:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09ONLNWW055817; Sat, 24 Oct 2020 23:21:23 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09ONLNYu055816; Sat, 24 Oct 2020 23:21:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202010242321.09ONLNYu055816@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 24 Oct 2020 23:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367030 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 367030 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 23:21:23 -0000 Author: imp Date: Sat Oct 24 23:21:22 2020 New Revision: 367030 URL: https://svnweb.freebsd.org/changeset/base/367030 Log: Remove intel compiler support from math.h The intel compiler support has badly decayed over the years. Stop pretending that we support it. Note, I've stopped short of requiring gcc builtin support with this commit since other compilers may be used to build non-base software and we need to support those so more investigation is needed before simplifying further. Modified: head/lib/msun/src/math.h Modified: head/lib/msun/src/math.h ============================================================================== --- head/lib/msun/src/math.h Sat Oct 24 23:21:18 2020 (r367029) +++ head/lib/msun/src/math.h Sat Oct 24 23:21:22 2020 (r367030) @@ -34,11 +34,11 @@ extern const union __nan_un { float __uf; } __nan; -#if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) +#if __GNUC_PREREQ__(3, 3) #define __MATH_BUILTIN_CONSTANTS #endif -#if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER) +#if __GNUC_PREREQ__(3, 0) #define __MATH_BUILTIN_RELOPS #endif From owner-svn-src-head@freebsd.org Sat Oct 24 23:21:31 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 465974573D2; Sat, 24 Oct 2020 23:21:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJcYP6lVvz4GF2; Sat, 24 Oct 2020 23:21:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BADE32017A; Sat, 24 Oct 2020 23:21:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09ONLRYk055870; Sat, 24 Oct 2020 23:21:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09ONLRfJ055868; Sat, 24 Oct 2020 23:21:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202010242321.09ONLRfJ055868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 24 Oct 2020 23:21:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367031 - in head/sys/i386: i386 include X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/i386: i386 include X-SVN-Commit-Revision: 367031 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 23:21:31 -0000 Author: imp Date: Sat Oct 24 23:21:27 2020 New Revision: 367031 URL: https://svnweb.freebsd.org/changeset/base/367031 Log: Remove support for intel compiler from i386 in_cksum We no longer support building the kernel with the old intel compiler. Remove support for it from in_cksum. Should there be interest in reviving it, this is as likely to get in the way as to help anyway. Modified: head/sys/i386/i386/in_cksum.c head/sys/i386/include/in_cksum.h Modified: head/sys/i386/i386/in_cksum.c ============================================================================== --- head/sys/i386/i386/in_cksum.c Sat Oct 24 23:21:22 2020 (r367030) +++ head/sys/i386/i386/in_cksum.c Sat Oct 24 23:21:27 2020 (r367031) @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); * icc needs to be special cased here, as the asm code below results * in broken code if compiled with icc. */ -#if !defined(__GNUCLIKE_ASM) || defined(__INTEL_COMPILER) +#if !defined(__GNUCLIKE_ASM) /* non gcc parts stolen from sys/alpha/alpha/in_cksum.c */ #define REDUCE32 \ { \ @@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$"); #endif #define REDUCE {sum = (sum & 0xffff) + (sum >> 16); ADDCARRY(sum);} -#if !defined(__GNUCLIKE_ASM) || defined(__INTEL_COMPILER) +#if !defined(__GNUCLIKE_ASM) static const u_int32_t in_masks[] = { /*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/ 0x00000000, 0x000000FF, 0x0000FFFF, 0x00FFFFFF, /* offset 0 */ Modified: head/sys/i386/include/in_cksum.h ============================================================================== --- head/sys/i386/include/in_cksum.h Sat Oct 24 23:21:22 2020 (r367030) +++ head/sys/i386/include/in_cksum.h Sat Oct 24 23:21:27 2020 (r367031) @@ -55,7 +55,7 @@ * in the normal case (where there are no options and the header length is * therefore always exactly five 32-bit words. */ -#if defined(__GNUCLIKE_ASM) && !defined(__INTEL_COMPILER) +#if defined(__GNUCLIKE_ASM) #if defined(IPVERSION) && (IPVERSION == 4) static __inline u_int in_cksum_hdr(const struct ip *ip) @@ -137,7 +137,7 @@ in_pseudo(u_int sum, u_int b, u_int c) #endif #ifdef _KERNEL -#if !defined(__GNUCLIKE_ASM) || defined(__INTEL_COMPILER) +#if !defined(__GNUCLIKE_ASM) #if defined(IPVERSION) && (IPVERSION == 4) u_int in_cksum_hdr(const struct ip *ip); #endif From owner-svn-src-head@freebsd.org Sat Oct 24 23:21:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA202457438; Sat, 24 Oct 2020 23:21:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJcYV32kqz4Fyv; Sat, 24 Oct 2020 23:21:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAC4720495; Sat, 24 Oct 2020 23:21:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09ONLVA5055923; Sat, 24 Oct 2020 23:21:31 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09ONLVg8055922; Sat, 24 Oct 2020 23:21:31 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202010242321.09ONLVg8055922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 24 Oct 2020 23:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367032 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 367032 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 23:21:35 -0000 Author: imp Date: Sat Oct 24 23:21:31 2020 New Revision: 367032 URL: https://svnweb.freebsd.org/changeset/base/367032 Log: cdefs.h: remove intel_compiler support The age of the intel compiler support is so old as to be uninteresting. No recent recports of intel compiler support have been received. Remove all the special case workarounds for the Intel compiler. Should there be interest in supporting the compiler, contact me and I'll work with people to make it happen, though I suspect these instances are more likely to be in the way than to be helpful. Reviewed by: cem, emaste, vangyzen, dim Differential Revision: https://reviews.freebsd.org/D26817 Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Sat Oct 24 23:21:27 2020 (r367031) +++ head/sys/sys/cdefs.h Sat Oct 24 23:21:31 2020 (r367032) @@ -75,9 +75,9 @@ * having a compiler-agnostic source tree. */ -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#if defined(__GNUC__) -#if __GNUC__ >= 3 || defined(__INTEL_COMPILER) +#if __GNUC__ >= 3 #define __GNUCLIKE_ASM 3 #define __GNUCLIKE_MATH_BUILTIN_CONSTANTS #else @@ -87,15 +87,9 @@ #define __GNUCLIKE___OFFSETOF 1 #define __GNUCLIKE___SECTION 1 -#ifndef __INTEL_COMPILER #define __GNUCLIKE_CTOR_SECTION_HANDLING 1 -#endif #define __GNUCLIKE_BUILTIN_CONSTANT_P 1 -#if defined(__INTEL_COMPILER) && defined(__cplusplus) && \ - __INTEL_COMPILER < 800 -#undef __GNUCLIKE_BUILTIN_CONSTANT_P -#endif #if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) #define __GNUCLIKE_BUILTIN_VARARGS 1 @@ -114,10 +108,8 @@ #define __compiler_membar() __asm __volatile(" " : : : "memory") #endif -#ifndef __INTEL_COMPILER #define __GNUCLIKE_BUILTIN_NEXT_ARG 1 #define __GNUCLIKE_MATH_BUILTIN_RELOPS -#endif #define __GNUCLIKE_BUILTIN_MEMCPY 1 @@ -133,12 +125,12 @@ #define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1 -#endif /* __GNUC__ || __INTEL_COMPILER */ +#endif /* __GNUC__ */ /* * Macro to test if we're using a specific version of gcc or later. */ -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) +#if defined(__GNUC__) #define __GNUC_PREREQ__(ma, mi) \ (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)) #else @@ -212,18 +204,18 @@ * a feature that we cannot live without. */ #define __weak_symbol __attribute__((__weak__)) -#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER) +#if !__GNUC_PREREQ__(2, 5) #define __dead2 #define __pure2 #define __unused #endif -#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER) +#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused /* XXX Find out what to do for __packed, __aligned and __section */ #endif -#if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER) +#if __GNUC_PREREQ__(2, 7) #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused __attribute__((__unused__)) @@ -360,7 +352,7 @@ #define __pure #endif -#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) +#if __GNUC_PREREQ__(3, 1) #define __always_inline __attribute__((__always_inline__)) #else #define __always_inline @@ -393,11 +385,11 @@ #endif /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ -#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) +#if !__GNUC_PREREQ__(2, 7) #define __func__ NULL #endif -#if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 +#if (defined(__GNUC__) && __GNUC__ >= 2) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 #define __LONG_LONG_SUPPORTED #endif @@ -514,7 +506,7 @@ * that are known to support the features properly (old versions of gcc-2 * didn't permit keeping the keywords out of the application namespace). */ -#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) +#if !__GNUC_PREREQ__(2, 7) #define __printflike(fmtarg, firstvararg) #define __scanflike(fmtarg, firstvararg) #define __format_arg(fmtarg) @@ -534,18 +526,16 @@ /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ #if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \ - defined(__GNUC__) && !defined(__INTEL_COMPILER) + defined(__GNUC__) #define __printf0like(fmtarg, firstvararg) \ __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) #else #define __printf0like(fmtarg, firstvararg) #endif -#if defined(__GNUC__) || defined(__INTEL_COMPILER) -#ifndef __INTEL_COMPILER +#if defined(__GNUC__) #define __strong_reference(sym,aliassym) \ extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))) -#endif #ifdef __STDC__ #define __weak_reference(sym,alias) \ __asm__(".weak " #alias); \ @@ -571,12 +561,12 @@ #define __sym_default(impl,sym,verid) \ __asm__(".symver impl, sym@@@verid") #endif /* __STDC__ */ -#endif /* __GNUC__ || __INTEL_COMPILER */ +#endif /* __GNUC__ */ #define __GLOBL1(sym) __asm__(".globl " #sym) #define __GLOBL(sym) __GLOBL1(sym) -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#if defined(__GNUC__) #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") #else /* From owner-svn-src-head@freebsd.org Sat Oct 24 23:21:58 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 005C54573E3; Sat, 24 Oct 2020 23:21:57 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CJcYv4T2Gz4GBG; Sat, 24 Oct 2020 23:21:55 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18EB520511; Sat, 24 Oct 2020 23:21:52 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09ONLpS8058300; Sat, 24 Oct 2020 23:21:51 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09ONLpsZ058299; Sat, 24 Oct 2020 23:21:51 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202010242321.09ONLpsZ058299@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Sat, 24 Oct 2020 23:21:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367033 - head/sys/cddl/dev/dtrace/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/cddl/dev/dtrace/riscv X-SVN-Commit-Revision: 367033 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sat, 24 Oct 2020 23:21:58 -0000 Author: mhorne Date: Sat Oct 24 23:21:51 2020 New Revision: 367033 URL: https://svnweb.freebsd.org/changeset/base/367033 Log: Fix build after r367020 DTrace also relies on these definitions. Reported by: jenkins Modified: head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Modified: head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Sat Oct 24 23:21:31 2020 (r367032) +++ head/sys/cddl/dev/dtrace/riscv/dtrace_subr.c Sat Oct 24 23:21:51 2020 (r367033) @@ -202,9 +202,9 @@ dtrace_trap(struct trapframe *frame, u_int type) * All the rest will be handled in the usual way. */ switch (type) { - case EXCP_FAULT_LOAD: - case EXCP_FAULT_STORE: - case EXCP_FAULT_FETCH: + case SCAUSE_LOAD_ACCESS_FAULT: + case SCAUSE_STORE_ACCESS_FAULT: + case SCAUSE_INST_ACCESS_FAULT: /* Flag a bad address. */ cpu_core[curcpu].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR; cpu_core[curcpu].cpuc_dtrace_illval = 0;