From owner-dev-commits-src-all@freebsd.org Mon Jan 4 01:07:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 83CD54C6765; Mon, 4 Jan 2021 01:07:05 +0000 (UTC) (envelope-from git@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 4D8HXT3Fh0z3HlR; Mon, 4 Jan 2021 01:07:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E12711579; Mon, 4 Jan 2021 01:07:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104175mu040412; Mon, 4 Jan 2021 01:07:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104175Ps040411; Mon, 4 Jan 2021 01:07:05 GMT (envelope-from git) Date: Mon, 4 Jan 2021 01:07:05 GMT Message-Id: <202101040107.104175Ps040411@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Oleksandr Tymoshenko Subject: git: d03fd8ede2c4 - main - rockchip: add audio-related clocks to the CRU driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gonzo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d03fd8ede2c493d0c5a74b625a93a48e018515e1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 01:07:05 -0000 The branch main has been updated by gonzo: URL: https://cgit.FreeBSD.org/src/commit/?id=d03fd8ede2c493d0c5a74b625a93a48e018515e1 commit d03fd8ede2c493d0c5a74b625a93a48e018515e1 Author: Oleksandr Tymoshenko AuthorDate: 2020-12-30 00:25:52 +0000 Commit: Oleksandr Tymoshenko CommitDate: 2021-01-04 00:50:42 +0000 rockchip: add audio-related clocks to the CRU driver - Add I2S and CODEC clocks to CRU driver - Add support for gate selection to frac clock - Add setfreq support to mux clock Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D27831 --- sys/arm64/rockchip/clk/rk3328_cru.c | 275 ++++++++++++++++++++++++++++++++++ sys/arm64/rockchip/clk/rk3399_cru.c | 6 +- sys/arm64/rockchip/clk/rk_clk_fract.c | 35 +++++ sys/arm64/rockchip/clk/rk_clk_fract.h | 4 + sys/arm64/rockchip/clk/rk_clk_mux.c | 61 ++++++++ sys/arm64/rockchip/clk/rk_clk_mux.h | 1 + 6 files changed, 379 insertions(+), 3 deletions(-) diff --git a/sys/arm64/rockchip/clk/rk3328_cru.c b/sys/arm64/rockchip/clk/rk3328_cru.c index 69ad2dac873c..e110564f773d 100644 --- a/sys/arm64/rockchip/clk/rk3328_cru.c +++ b/sys/arm64/rockchip/clk/rk3328_cru.c @@ -56,6 +56,11 @@ __FBSDID("$FreeBSD$"); /* GATES */ +#define SCLK_I2S0 41 +#define SCLK_I2S1 42 +#define SCLK_I2S2 43 +#define SCLK_I2S1_OUT 44 +#define SCLK_I2S2_OUT 45 #define SCLK_MAC2PHY_RXTX 83 #define SCLK_MAC2PHY_SRC 84 #define SCLK_MAC2PHY_REF 85 @@ -90,6 +95,10 @@ __FBSDID("$FreeBSD$"); #define PCLK_USB3PHY_OTG 224 #define PCLK_USB3PHY_PIPE 225 #define PCLK_USB3_GRF 226 +#define PCLK_ACODECPHY 235 +#define HCLK_I2S0_8CH 311 +#define HCLK_I2S1_8CH 312 +#define HCLK_I2S2_2CH 313 #define HCLK_SDMMC 317 #define HCLK_SDIO 318 #define HCLK_EMMC 319 @@ -102,6 +111,11 @@ static struct rk_cru_gate rk3328_gates[] = { CRU_GATE(0, "gpll_core", "gpll", 0x200, 2) CRU_GATE(0, "npll_core", "npll", 0x200, 12) + /* CRU_CLKGATE_CON1 */ + CRU_GATE(SCLK_I2S0, "clk_i2s0", "clk_i2s0_mux", 0x204, 3) + CRU_GATE(SCLK_I2S1, "clk_i2s1", "clk_i2s1_mux", 0x204, 6) + CRU_GATE(SCLK_I2S1, "clk_i2s2", "clk_i2s2_mux", 0x204, 10) + /* CRU_CLKGATE_CON4 */ CRU_GATE(0, "gpll_peri", "gpll", 0x210, 0) CRU_GATE(0, "cpll_peri", "cpll", 0x210, 1) @@ -123,6 +137,9 @@ static struct rk_cru_gate rk3328_gates[] = { CRU_GATE(ACLK_PERI, "aclk_peri", "aclk_peri_pre", 0x228, 0) /* CRU_CLKGATE_CON15*/ + CRU_GATE(HCLK_I2S0_8CH, "hclk_i2s0_8ch", "hclk_bus_pre", 0x23C, 3) + CRU_GATE(HCLK_I2S1_8CH, "hclk_i2s1_8ch", "hclk_bus_pre", 0x23C, 4) + CRU_GATE(HCLK_I2S2_2CH, "hclk_i2s2_2ch", "hclk_bus_pre", 0x23C, 5) CRU_GATE(PCLK_I2C0, "pclk_i2c0", "pclk_bus", 0x23C, 10) /* CRU_CLKGATE_CON16 */ @@ -138,6 +155,7 @@ static struct rk_cru_gate rk3328_gates[] = { /* CRU_CLKGATE_CON17 */ CRU_GATE(PCLK_USB3_GRF, "pclk_usb3_grf", "pclk_phy_pre", 0x244, 2) + CRU_GATE(PCLK_ACODECPHY, "pclk_acodecphy", "pclk_phy_pre", 0x244, 5) /* CRU_CLKGATE_CON19 */ CRU_GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 0x24C, 0) @@ -1115,6 +1133,215 @@ static struct rk_clk_composite_def ref_usb3otg_src = { .flags = RK_CLK_COMPOSITE_HAVE_GATE, }; +/* I2S0 */ +static const char *i2s0_div_parents[] = { "cpll", "gpll" }; +static struct rk_clk_composite_def i2s0_div = { + .clkdef = { + .id = 0, + .name = "clk_i2s0_div", + .parent_names = i2s0_div_parents, + .parent_cnt = nitems(i2s0_div_parents), + }, + /* CRU_CLKSEL_CON6 */ + .muxdiv_offset = 0x118, + + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 0, + .div_width = 7, + + /* CRU_CLKGATE_CON1 */ + .gate_offset = 0x204, + .gate_shift = 1, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static const char *i2s0_frac_parents[] = { "clk_i2s0_div" }; +static struct rk_clk_fract_def i2s0_frac = { + .clkdef = { + .id = 0, + .name = "clk_i2s0_frac", + .parent_names = i2s0_frac_parents, + .parent_cnt = nitems(i2s0_frac_parents), + }, + /* CRU_CLKSEL_CON7 */ + .offset = 0x11c, + + /* CRU_CLKGATE_CON1 */ + .gate_offset = 0x204, + .gate_shift = 2, + + .flags = RK_CLK_FRACT_HAVE_GATE, +}; + +static const char *i2s0_mux_parents[] = { "clk_i2s0_div", "clk_i2s0_frac", "xin12m", "xin12m" }; +static struct rk_clk_mux_def i2s0_mux = { + .clkdef = { + .id = 0, + .name = "clk_i2s0_mux", + .parent_names = i2s0_mux_parents, + .parent_cnt = nitems(i2s0_mux_parents), + }, + .offset = 0x118, + + .shift = 8, + .width = 2, + + .mux_flags = RK_CLK_MUX_REPARENT, +}; + +/* I2S1 */ +static const char *i2s1_div_parents[] = { "cpll", "gpll" }; +static struct rk_clk_composite_def i2s1_div = { + .clkdef = { + .id = 0, + .name = "clk_i2s1_div", + .parent_names = i2s1_div_parents, + .parent_cnt = nitems(i2s1_div_parents), + }, + /* CRU_CLKSEL_CON8 */ + .muxdiv_offset = 0x120, + + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 0, + .div_width = 7, + + /* CRU_CLKGATE_CON1 */ + .gate_offset = 0x204, + .gate_shift = 4, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static const char *i2s1_frac_parents[] = { "clk_i2s1_div" }; +static struct rk_clk_fract_def i2s1_frac = { + .clkdef = { + .id = 0, + .name = "clk_i2s1_frac", + .parent_names = i2s1_frac_parents, + .parent_cnt = nitems(i2s1_frac_parents), + }, + /* CRU_CLKSEL_CON9 */ + .offset = 0x124, + + /* CRU_CLKGATE_CON1 */ + .gate_offset = 0x204, + .gate_shift = 5, + + .flags = RK_CLK_FRACT_HAVE_GATE, +}; + +static const char *i2s1_mux_parents[] = { "clk_i2s1_div", "clk_i2s1_frac", "clkin_i2s1", "xin12m" }; +static struct rk_clk_mux_def i2s1_mux = { + .clkdef = { + .id = 0, + .name = "clk_i2s1_mux", + .parent_names = i2s1_mux_parents, + .parent_cnt = nitems(i2s1_mux_parents), + }, + .offset = 0x120, + + .shift = 8, + .width = 2, + .mux_flags = RK_CLK_MUX_REPARENT, +}; + +static struct clk_fixed_def clkin_i2s1 = { + .clkdef = { + .id = 0, + .name = "clkin_i2s1", + .parent_names = NULL, + .parent_cnt = 0 + }, + + .freq = 0, +}; + +/* I2S2 */ +static const char *i2s2_div_parents[] = { "cpll", "gpll" }; +static struct rk_clk_composite_def i2s2_div = { + .clkdef = { + .id = 0, + .name = "clk_i2s2_div", + .parent_names = i2s2_div_parents, + .parent_cnt = nitems(i2s2_div_parents), + }, + /* CRU_CLKSEL_CON10 */ + .muxdiv_offset = 0x128, + + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 0, + .div_width = 7, + + /* CRU_CLKGATE_CON1 */ + .gate_offset = 0x204, + .gate_shift = 8, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static const char *i2s2_frac_parents[] = { "clk_i2s2_div" }; +static struct rk_clk_fract_def i2s2_frac = { + .clkdef = { + .id = 0, + .name = "clk_i2s2_frac", + .parent_names = i2s2_frac_parents, + .parent_cnt = nitems(i2s2_frac_parents), + }, + /* CRU_CLKSEL_CON11 */ + .offset = 0x12c, + + /* CRU_CLKGATE_CON1 */ + .gate_offset = 0x204, + .gate_shift = 9, + + .flags = RK_CLK_FRACT_HAVE_GATE, +}; + +static const char *i2s2_mux_parents[] = { "clk_i2s2_div", "clk_i2s2_frac", "clkin_i2s2", "xin12m" }; +static struct rk_clk_mux_def i2s2_mux = { + .clkdef = { + .id = 0, + .name = "clk_i2s2_mux", + .parent_names = i2s2_mux_parents, + .parent_cnt = nitems(i2s2_mux_parents), + }, + .offset = 0x128, + + .shift = 8, + .width = 2, + + .mux_flags = RK_CLK_MUX_REPARENT, +}; + +static struct clk_fixed_def clkin_i2s2 = { + .clkdef = { + .id = 0, + .name = "clkin_i2s2", + .parent_names = NULL, + .parent_cnt = 0 + }, + + .freq = 0, +}; + +static struct clk_fixed_def xin12m = { + .clkdef = { + .id = 0, + .name = "xin12m", + .parent_names = NULL, + .parent_cnt = 0 + }, + + .freq = 12000000, +}; + static const char *mac2io_src_parents[] = { "cpll", "gpll" }; static struct rk_clk_composite_def mac2io_src = { @@ -1417,6 +1644,54 @@ static struct rk_clk rk3328_clks[] = { .type = RK_CLK_COMPOSITE, .clk.composite = &usb3otg_suspend }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &i2s0_div + }, + { + .type = RK_CLK_FRACT, + .clk.fract = &i2s0_frac + }, + { + .type = RK_CLK_MUX, + .clk.mux = &i2s0_mux + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &i2s1_div + }, + { + .type = RK_CLK_FRACT, + .clk.fract = &i2s1_frac + }, + { + .type = RK_CLK_MUX, + .clk.mux = &i2s1_mux + }, + { + .type = RK_CLK_FIXED, + .clk.fixed = &clkin_i2s1 + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &i2s2_div + }, + { + .type = RK_CLK_FRACT, + .clk.fract = &i2s2_frac + }, + { + .type = RK_CLK_MUX, + .clk.mux = &i2s2_mux + }, + { + .type = RK_CLK_FIXED, + .clk.fixed = &clkin_i2s2 + }, + { + .type = RK_CLK_FIXED, + .clk.fixed = &xin12m + }, { .type = RK_CLK_COMPOSITE, .clk.composite = &mac2io_src diff --git a/sys/arm64/rockchip/clk/rk3399_cru.c b/sys/arm64/rockchip/clk/rk3399_cru.c index 77686ecb66b8..595085862e13 100644 --- a/sys/arm64/rockchip/clk/rk3399_cru.c +++ b/sys/arm64/rockchip/clk/rk3399_cru.c @@ -964,19 +964,19 @@ static struct rk_clk rk3399_clks[] = { 27, 0, 10, 15, 1), /* CRU_CLKSEL_CON28 */ - MUX(0, "clk_i2s0_mux", i2s0_p, 0, + MUX(0, "clk_i2s0_mux", i2s0_p, RK_CLK_MUX_REPARENT, 28, 8, 2), COMP(0, "clk_i2s0_div_c", pll_src_cpll_gpll_p, 0, 28, 0, 7, 7, 1), /* CRU_CLKSEL_CON29 */ - MUX(0, "clk_i2s1_mux", i2s1_p, 0, + MUX(0, "clk_i2s1_mux", i2s1_p, RK_CLK_MUX_REPARENT, 29, 8, 2), COMP(0, "clk_i2s1_div_c", pll_src_cpll_gpll_p, 0, 29, 0, 7, 7, 1), /* CRU_CLKSEL_CON30 */ - MUX(0, "clk_i2s2_mux", i2s2_p, 0, + MUX(0, "clk_i2s2_mux", i2s2_p, RK_CLK_MUX_REPARENT, 30, 8, 2), COMP(0, "clk_i2s2_div_c", pll_src_cpll_gpll_p, 0, 30, 0, 7, 7, 1), diff --git a/sys/arm64/rockchip/clk/rk_clk_fract.c b/sys/arm64/rockchip/clk/rk_clk_fract.c index 9bb4e169fb97..afdf56cfade7 100644 --- a/sys/arm64/rockchip/clk/rk_clk_fract.c +++ b/sys/arm64/rockchip/clk/rk_clk_fract.c @@ -49,21 +49,27 @@ __FBSDID("$FreeBSD$"); #define DEVICE_UNLOCK(_clk) \ CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) +#define RK_CLK_FRACT_MASK_SHIFT 16 + static int rk_clk_fract_init(struct clknode *clk, device_t dev); static int rk_clk_fract_recalc(struct clknode *clk, uint64_t *req); static int rk_clk_fract_set_freq(struct clknode *clknode, uint64_t fin, uint64_t *fout, int flag, int *stop); +static int rk_clk_fract_set_gate(struct clknode *clk, bool enable); struct rk_clk_fract_sc { uint32_t flags; uint32_t offset; uint32_t numerator; uint32_t denominator; + uint32_t gate_offset; + uint32_t gate_shift; }; static clknode_method_t rk_clk_fract_methods[] = { /* Device interface */ CLKNODEMETHOD(clknode_init, rk_clk_fract_init), + CLKNODEMETHOD(clknode_set_gate, rk_clk_fract_set_gate), CLKNODEMETHOD(clknode_recalc_freq, rk_clk_fract_recalc), CLKNODEMETHOD(clknode_set_freq, rk_clk_fract_set_freq), CLKNODEMETHOD_END @@ -149,6 +155,33 @@ rk_clk_fract_init(struct clknode *clk, device_t dev) return(0); } +static int +rk_clk_fract_set_gate(struct clknode *clk, bool enable) +{ + struct rk_clk_fract_sc *sc; + uint32_t val = 0; + + sc = clknode_get_softc(clk); + + if ((sc->flags & RK_CLK_FRACT_HAVE_GATE) == 0) + return (0); + + RD4(clk, sc->gate_offset, &val); + + val = 0; + if (!enable) + val |= 1 << sc->gate_shift; + val |= (1 << sc->gate_shift) << RK_CLK_FRACT_MASK_SHIFT; + DEVICE_LOCK(clk); + WR4(clk, sc->gate_offset, val); + DEVICE_UNLOCK(clk); + + return (0); +} + +static int +rk_clk_fract_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout, + int flags, int *stop); static int rk_clk_fract_recalc(struct clknode *clk, uint64_t *freq) { @@ -240,6 +273,8 @@ rk_clk_fract_register(struct clkdom *clkdom, struct rk_clk_fract_def *clkdef) sc = clknode_get_softc(clk); sc->flags = clkdef->flags; sc->offset = clkdef->offset; + sc->gate_offset = clkdef->gate_offset; + sc->gate_shift = clkdef->gate_shift; clknode_register(clkdom, clk); return (0); diff --git a/sys/arm64/rockchip/clk/rk_clk_fract.h b/sys/arm64/rockchip/clk/rk_clk_fract.h index 2fe8f47586e5..03fab3fd2884 100644 --- a/sys/arm64/rockchip/clk/rk_clk_fract.h +++ b/sys/arm64/rockchip/clk/rk_clk_fract.h @@ -35,9 +35,13 @@ struct rk_clk_fract_def { struct clknode_init_def clkdef; uint32_t offset; + uint32_t gate_offset; + uint32_t gate_shift; uint32_t flags; }; +#define RK_CLK_FRACT_HAVE_GATE 0x0001 + int rk_clk_fract_register(struct clkdom *clkdom, struct rk_clk_fract_def *clkdef); diff --git a/sys/arm64/rockchip/clk/rk_clk_mux.c b/sys/arm64/rockchip/clk/rk_clk_mux.c index 94d31d34c47b..2280051b5a0c 100644 --- a/sys/arm64/rockchip/clk/rk_clk_mux.c +++ b/sys/arm64/rockchip/clk/rk_clk_mux.c @@ -55,8 +55,17 @@ __FBSDID("$FreeBSD$"); #define DEVICE_UNLOCK(_clk) \ CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) +#if 0 +#define dprintf(format, arg...) \ + printf("%s:(%s)" format, __func__, clknode_get_name(clk), arg) +#else +#define dprintf(format, arg...) +#endif + static int rk_clk_mux_init(struct clknode *clk, device_t dev); static int rk_clk_mux_set_mux(struct clknode *clk, int idx); +static int rk_clk_mux_set_freq(struct clknode *clk, uint64_t fparent, + uint64_t *fout, int flags, int *stop); struct rk_clk_mux_sc { uint32_t offset; @@ -69,6 +78,7 @@ static clknode_method_t rk_clk_mux_methods[] = { /* Device interface */ CLKNODEMETHOD(clknode_init, rk_clk_mux_init), CLKNODEMETHOD(clknode_set_mux, rk_clk_mux_set_mux), + CLKNODEMETHOD(clknode_set_freq, rk_clk_mux_set_freq), CLKNODEMETHOD_END }; DEFINE_CLASS_1(rk_clk_mux, rk_clk_mux_class, rk_clk_mux_methods, @@ -116,6 +126,57 @@ rk_clk_mux_set_mux(struct clknode *clk, int idx) return(0); } +static int +rk_clk_mux_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout, + int flags, int *stop) +{ + struct rk_clk_mux_sc *sc; + struct clknode *p_clk, *p_best_clk; + const char **p_names; + int p_idx, best_parent; + int rv; + + sc = clknode_get_softc(clk); + + if ((sc->mux_flags & RK_CLK_MUX_REPARENT) == 0) + return (0); + + dprintf("Finding best parent for target freq of %ju\n", *fout); + p_names = clknode_get_parent_names(clk); + for (p_idx = 0; p_idx != clknode_get_parents_num(clk); p_idx++) { + p_clk = clknode_find_by_name(p_names[p_idx]); + dprintf("Testing with parent %s (%d)\n", + clknode_get_name(p_clk), p_idx); + + rv = clknode_set_freq(p_clk, *fout, flags | CLK_SET_DRYRUN, 0); + dprintf("Testing with parent %s (%d) rv=%d\n", + clknode_get_name(p_clk), p_idx, rv); + if (rv == 0) { + best_parent = p_idx; + p_best_clk = p_clk; + *stop = 1; + } + } + + if (!*stop) + return (0); + + if ((flags & CLK_SET_DRYRUN) != 0) + return (0); + + p_idx = clknode_get_parent_idx(clk); + if (p_idx != best_parent) { + dprintf("Switching parent index from %d to %d\n", p_idx, + best_parent); + clknode_set_parent_by_idx(clk, best_parent); + } + + clknode_set_freq(p_best_clk, *fout, flags, 0); + clknode_get_freq(p_best_clk, fout); + + return (0); +} + int rk_clk_mux_register(struct clkdom *clkdom, struct rk_clk_mux_def *clkdef) { diff --git a/sys/arm64/rockchip/clk/rk_clk_mux.h b/sys/arm64/rockchip/clk/rk_clk_mux.h index f44443790b18..7825f8892ac3 100644 --- a/sys/arm64/rockchip/clk/rk_clk_mux.h +++ b/sys/arm64/rockchip/clk/rk_clk_mux.h @@ -41,6 +41,7 @@ struct rk_clk_mux_def { }; #define RK_CLK_MUX_MASK 0xFFFF0000 +#define RK_CLK_MUX_REPARENT (1 << 0) int rk_clk_mux_register(struct clkdom *clkdom, struct rk_clk_mux_def *clkdef); From owner-dev-commits-src-all@freebsd.org Mon Jan 4 06:54:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0C9064CCB34; Mon, 4 Jan 2021 06:54:06 +0000 (UTC) (envelope-from git@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 4D8RDs6qyhz3qpP; Mon, 4 Jan 2021 06:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DDE1115E34; Mon, 4 Jan 2021 06:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1046s5jv093133; Mon, 4 Jan 2021 06:54:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1046s5jp093132; Mon, 4 Jan 2021 06:54:05 GMT (envelope-from git) Date: Mon, 4 Jan 2021 06:54:05 GMT Message-Id: <202101040654.1046s5jp093132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: fd340a122259 - main - sbin/camcontrol: use calloc/strlcpy where appropriate. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd340a122259d44a7d01a72890ff40411f87d79c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 06:54:06 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=fd340a122259d44a7d01a72890ff40411f87d79c commit fd340a122259d44a7d01a72890ff40411f87d79c Author: Xin LI AuthorDate: 2021-01-04 06:52:28 +0000 Commit: Xin LI CommitDate: 2021-01-04 06:52:28 +0000 sbin/camcontrol: use calloc/strlcpy where appropriate. MFC after: 2 weeks --- sbin/camcontrol/camcontrol.c | 5 ++--- sbin/camcontrol/modeedit.c | 5 ++--- sbin/camcontrol/util.c | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index 079aefb12269..cc21a109343c 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -2458,11 +2458,10 @@ atasecurity_notify(u_int8_t command, struct ata_security_password *pwd) printf("Issuing %s", ata_op_string(&cmd)); if (pwd != NULL) { + /* pwd->password may not be null terminated */ char pass[sizeof(pwd->password)+1]; - /* pwd->password may not be null terminated */ - pass[sizeof(pwd->password)] = '\0'; - strncpy(pass, pwd->password, sizeof(pwd->password)); + strlcpy(pass, pwd->password, sizeof(pass)); printf(" password='%s', user='%s'", pass, (pwd->ctrl & ATA_SECURITY_PASSWORD_MASTER) ? diff --git a/sbin/camcontrol/modeedit.c b/sbin/camcontrol/modeedit.c index c35ad143e1da..15e5c6608f47 100644 --- a/sbin/camcontrol/modeedit.c +++ b/sbin/camcontrol/modeedit.c @@ -329,10 +329,9 @@ editentry_set(char *name, char *newvalue, int editonly) case 'c': /* Character array. */ case 'z': /* Null-padded string. */ - if ((cval = malloc(dest->size + 1)) == NULL) + if ((cval = calloc(1, dest->size + 1)) == NULL) err(EX_OSERR, NULL); - bzero(cval, dest->size + 1); - strncpy(cval, newvalue, dest->size); + strlcpy(cval, newvalue, dest->size + 1); if (dest->type == 'z') { /* Convert trailing spaces to nulls. */ char *convertend2; diff --git a/sbin/camcontrol/util.c b/sbin/camcontrol/util.c index c22f3a05e746..58fc93746fc7 100644 --- a/sbin/camcontrol/util.c +++ b/sbin/camcontrol/util.c @@ -126,14 +126,13 @@ arg_put(void *hook __unused, int letter, void *arg, int count, char *name) { char *p; - p = malloc(count + 1); + p = calloc(1, count + 1); if (p == NULL) { fprintf(stderr, "can't malloc memory for p\n"); exit(1); } - bzero(p, count +1); - strncpy(p, (char *)arg, count); + strlcpy(p, (char *)arg, count + 1); if (letter == 'z') { int i; From owner-dev-commits-src-all@freebsd.org Mon Jan 4 13:16:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5FA834D5F0C; Mon, 4 Jan 2021 13:16:59 +0000 (UTC) (envelope-from git@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 4D8bkg2FWrz4hmk; Mon, 4 Jan 2021 13:16:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4019D1AA90; Mon, 4 Jan 2021 13:16:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104DGx42087823; Mon, 4 Jan 2021 13:16:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104DGxNQ087822; Mon, 4 Jan 2021 13:16:59 GMT (envelope-from git) Date: Mon, 4 Jan 2021 13:16:59 GMT Message-Id: <202101041316.104DGxNQ087822@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: 3d4ce4edd86d - main - Remove -g option support which was removed from bhyve in c4df8cbfde53c376d93f439eac3f45a7b4fc705e MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d4ce4edd86de8359267792be65d6ca20e1cf619 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 13:16:59 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=3d4ce4edd86de8359267792be65d6ca20e1cf619 commit 3d4ce4edd86de8359267792be65d6ca20e1cf619 Author: Poul-Henning Kamp AuthorDate: 2021-01-04 13:15:50 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-01-04 13:15:50 +0000 Remove -g option support which was removed from bhyve in c4df8cbfde53c376d93f439eac3f45a7b4fc705e --- share/examples/bhyve/vmrun.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/share/examples/bhyve/vmrun.sh b/share/examples/bhyve/vmrun.sh index 607597015e62..bfc2aad2cb8c 100755 --- a/share/examples/bhyve/vmrun.sh +++ b/share/examples/bhyve/vmrun.sh @@ -58,7 +58,7 @@ usage() { "[-d ]" echo " [-e ] [-f ]" \ "[-F ]" - echo " [-g ] [-H ]" + echo " [-H ]" echo " [-I ] [-l ]" echo " [-L ]" echo " [-m ]" \ @@ -76,7 +76,6 @@ usage() { echo " -f: Use a specific UEFI firmware" echo " -F: Use a custom UEFI GOP framebuffer size" \ "(default: ${DEFAULT_VNCSIZE})" - echo " -g: listen for connection from kgdb at " echo " -H: host filesystem to export to the loader" echo " -i: force boot of the Installation CDROM image" echo " -I: Installation CDROM image location" \ @@ -120,7 +119,6 @@ nic=${DEFAULT_NIC} tap_total=0 disk_total=0 disk_emulation=${DEFAULT_DISK} -gdbport=0 loader_opt="" bhyverun_opt="-H -A -P" pass_total=0 @@ -167,9 +165,6 @@ while getopts aAc:C:d:e:Ef:F:g:hH:iI:l:L:m:n:p:P:t:Tuvw c ; do F) vncsize="${OPTARG}" ;; - g) - gdbport=${OPTARG} - ;; H) host_base=`realpath ${OPTARG}` ;; @@ -367,7 +362,6 @@ while [ 1 ]; do fi ${FBSDRUN} -c ${cpus} -m ${memsize} ${bhyverun_opt} \ - -g ${gdbport} \ -s 0:0,hostbridge \ -s 1:0,lpc \ ${efiargs} \ From owner-dev-commits-src-all@freebsd.org Mon Jan 4 13:19:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DC5964D5D6E; Mon, 4 Jan 2021 13:19:41 +0000 (UTC) (envelope-from git@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 4D8bnn5xnlz4hwY; Mon, 4 Jan 2021 13:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAD291A865; Mon, 4 Jan 2021 13:19:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104DJfx1088476; Mon, 4 Jan 2021 13:19:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104DJfhT088475; Mon, 4 Jan 2021 13:19:41 GMT (envelope-from git) Date: Mon, 4 Jan 2021 13:19:41 GMT Message-Id: <202101041319.104DJfhT088475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: ea70ab2387e5 - main - Use the actual credentials to create the /dev/nmdm* devices. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ea70ab2387e5749450ddeb150d40074bc940c695 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 13:19:41 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=ea70ab2387e5749450ddeb150d40074bc940c695 commit ea70ab2387e5749450ddeb150d40074bc940c695 Author: Poul-Henning Kamp AuthorDate: 2021-01-04 13:18:47 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-01-04 13:18:47 +0000 Use the actual credentials to create the /dev/nmdm* devices. This lets plain users create nmdm pairs, which is useful amongst other things for running retro-computing emulators etc. --- sys/dev/nmdm/nmdm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index 19402f8c946b..61de05d4a41f 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -195,7 +195,7 @@ nmdm_clone(void *arg, struct ucred *cred, char *name, int nameen, tp = ns->ns_part1.np_tty = tty_alloc_mutex(&nmdm_class, &ns->ns_part1, &ns->ns_mtx); *end = 'A'; - error = tty_makedevf(tp, NULL, endc == 'A' ? TTYMK_CLONING : 0, + error = tty_makedevf(tp, cred, endc == 'A' ? TTYMK_CLONING : 0, "%s", name); if (error) { *end = endc; @@ -207,7 +207,7 @@ nmdm_clone(void *arg, struct ucred *cred, char *name, int nameen, tp = ns->ns_part2.np_tty = tty_alloc_mutex(&nmdm_class, &ns->ns_part2, &ns->ns_mtx); *end = 'B'; - error = tty_makedevf(tp, NULL, endc == 'B' ? TTYMK_CLONING : 0, + error = tty_makedevf(tp, cred, endc == 'B' ? TTYMK_CLONING : 0, "%s", name); if (error) { *end = endc; From owner-dev-commits-src-all@freebsd.org Mon Jan 4 13:35:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8ECCF4D698D; Mon, 4 Jan 2021 13:35:46 +0000 (UTC) (envelope-from git@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 4D8c8L3fcVz4kFv; Mon, 4 Jan 2021 13:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 704BB1ADB2; Mon, 4 Jan 2021 13:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104DZkB0014475; Mon, 4 Jan 2021 13:35:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104DZkjE014474; Mon, 4 Jan 2021 13:35:46 GMT (envelope-from git) Date: Mon, 4 Jan 2021 13:35:46 GMT Message-Id: <202101041335.104DZkjE014474@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: caf552a60719 - main - mvneta: Fix 64-bit MIB reads MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: caf552a607191ffc798e3edb697ae99d5b15711a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 13:35:46 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=caf552a607191ffc798e3edb697ae99d5b15711a commit caf552a607191ffc798e3edb697ae99d5b15711a Author: Mark Johnston AuthorDate: 2021-01-04 13:22:21 +0000 Commit: Mark Johnston CommitDate: 2021-01-04 13:32:54 +0000 mvneta: Fix 64-bit MIB reads It appears we must read MIB values as 2 4-byte words, lower address first. A single 8-byte MIB read returns the value with the lower 4 bytes copied into the upper 4 bytes, resulting in bogus byte counter values. Reviewed by: mw MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D27870 --- sys/dev/neta/if_mvneta.c | 36 ++++++++++++++++++------------------ sys/dev/neta/if_mvnetavar.h | 4 +--- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index c5cdf8bcb9ee..da364900f120 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -186,6 +186,7 @@ STATIC void sysctl_mvneta_init(struct mvneta_softc *); /* MIB */ STATIC void mvneta_clear_mib(struct mvneta_softc *); +STATIC uint64_t mvneta_read_mib(struct mvneta_softc *, int); STATIC void mvneta_update_mib(struct mvneta_softc *); /* Switch */ @@ -1102,7 +1103,7 @@ STATIC int mvneta_initreg(struct ifnet *ifp) { struct mvneta_softc *sc; - int q, i; + int q; uint32_t reg; sc = ifp->if_softc; @@ -1189,14 +1190,7 @@ mvneta_initreg(struct ifnet *ifp) MVNETA_WRITE(sc, MVNETA_PXCX, reg); /* clear MIB counter registers(clear by read) */ - for (i = 0; i < nitems(mvneta_mib_list); i++) { - if (mvneta_mib_list[i].reg64) - MVNETA_READ_MIB_8(sc, mvneta_mib_list[i].regnum); - else - MVNETA_READ_MIB_4(sc, mvneta_mib_list[i].regnum); - } - MVNETA_READ(sc, MVNETA_PDFC); - MVNETA_READ(sc, MVNETA_POFC); + mvneta_clear_mib(sc); /* Set SDC register except IPGINT bits */ reg = MVNETA_SDC_RXBSZ_16_64BITWORDS; @@ -3538,6 +3532,19 @@ sysctl_mvneta_init(struct mvneta_softc *sc) /* * MIB */ +STATIC uint64_t +mvneta_read_mib(struct mvneta_softc *sc, int index) +{ + struct mvneta_mib_def *mib; + uint64_t val; + + mib = &mvneta_mib_list[index]; + val = MVNETA_READ_MIB(sc, mib->regnum); + if (mib->reg64) + val |= (uint64_t)MVNETA_READ_MIB(sc, mib->regnum + 4) << 32; + return (val); +} + STATIC void mvneta_clear_mib(struct mvneta_softc *sc) { @@ -3546,10 +3553,7 @@ mvneta_clear_mib(struct mvneta_softc *sc) KASSERT_SC_MTX(sc); for (i = 0; i < nitems(mvneta_mib_list); i++) { - if (mvneta_mib_list[i].reg64) - MVNETA_READ_MIB_8(sc, mvneta_mib_list[i].regnum); - else - MVNETA_READ_MIB_4(sc, mvneta_mib_list[i].regnum); + (void)mvneta_read_mib(sc, i); sc->sysctl_mib[i].counter = 0; } MVNETA_READ(sc, MVNETA_PDFC); @@ -3569,11 +3573,7 @@ mvneta_update_mib(struct mvneta_softc *sc) for (i = 0; i < nitems(mvneta_mib_list); i++) { - if (mvneta_mib_list[i].reg64) - val = MVNETA_READ_MIB_8(sc, mvneta_mib_list[i].regnum); - else - val = MVNETA_READ_MIB_4(sc, mvneta_mib_list[i].regnum); - + val = mvneta_read_mib(sc, i); if (val == 0) continue; diff --git a/sys/dev/neta/if_mvnetavar.h b/sys/dev/neta/if_mvnetavar.h index e78a9ca0f3ee..00bfd1f0848c 100644 --- a/sys/dev/neta/if_mvnetavar.h +++ b/sys/dev/neta/if_mvnetavar.h @@ -69,10 +69,8 @@ #define MVNETA_WRITE_REGION(sc, reg, val, c) \ bus_write_region_4((sc)->res[0], (reg), (val), (c)) -#define MVNETA_READ_MIB_4(sc, reg) \ +#define MVNETA_READ_MIB(sc, reg) \ bus_read_4((sc)->res[0], MVNETA_PORTMIB_BASE + (reg)) -#define MVNETA_READ_MIB_8(sc, reg) \ - bus_read_8((sc)->res[0], MVNETA_PORTMIB_BASE + (reg)) #define MVNETA_IS_LINKUP(sc) \ (MVNETA_READ((sc), MVNETA_PSR) & MVNETA_PSR_LINKUP) From owner-dev-commits-src-all@freebsd.org Mon Jan 4 13:35:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AF9BE4D67CE; Mon, 4 Jan 2021 13:35:46 +0000 (UTC) (envelope-from git@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 4D8c8L4V84z4k5N; Mon, 4 Jan 2021 13:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BBB71AD47; Mon, 4 Jan 2021 13:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104DZkJa014492; Mon, 4 Jan 2021 13:35:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104DZkhF014491; Mon, 4 Jan 2021 13:35:46 GMT (envelope-from git) Date: Mon, 4 Jan 2021 13:35:46 GMT Message-Id: <202101041335.104DZkhF014491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c4cceb1d0d6f - main - md: Fix a race in mdstart_swap() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c4cceb1d0d6f59789524feab3ddf7e3110d10d75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 13:35:46 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c4cceb1d0d6f59789524feab3ddf7e3110d10d75 commit c4cceb1d0d6f59789524feab3ddf7e3110d10d75 Author: Mark Johnston AuthorDate: 2021-01-04 13:21:57 +0000 Commit: Mark Johnston CommitDate: 2021-01-04 13:26:14 +0000 md: Fix a race in mdstart_swap() Release a grabbed page's busy state only after marking it as referenced. Otherwise there exists a narrow window where the page could be freed before the update. Before r356902 this was not a problem since the object lock was held. Discussed with: kib Sponsored by: The FreeBSD Foundation --- sys/dev/md/md.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 1b4b583b3c09..5c2cb2f25d2e 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -1146,8 +1146,6 @@ mdstart_swap(struct md_s *sc, struct bio *bp) VM_OBJECT_WUNLOCK(sc->object); } if (m != NULL) { - vm_page_xunbusy(m); - /* * The page may be deactivated prior to setting * PGA_REFERENCED, but in this case it will be @@ -1157,6 +1155,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) vm_page_reference(m); else vm_page_activate(m); + vm_page_xunbusy(m); } /* Actions on further pages start at offset 0 */ From owner-dev-commits-src-all@freebsd.org Mon Jan 4 14:38:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 990434D7CCB; Mon, 4 Jan 2021 14:38:41 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) (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 4D8dXx3jr6z4nhd; Mon, 4 Jan 2021 14:38:41 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by mail-qk1-x731.google.com with SMTP id h4so23541293qkk.4; Mon, 04 Jan 2021 06:38:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=nYfPm3qdzO7zPYHIfPfYxAeBt3kKoEwf6KaTzcFG6A0=; b=tMKO2QJ6rA1jCwcAM42Iv8qQj8c0a/t5UyzOGnSwQDefX9ODo9e6SAeMzcmCwZJZZw BPmwhp0KKZIFeQ3xMNJIgclUguAedbTCPTbHOi5Sno0+vb9rYAbNUTwWZ5q55+8GWWsJ twCOB3owfy8t0OtXDSJPzJVpEAf90Zo8cUwr0jh1qUR3wKLcH/QVnT6w70PGIipvGJxn o2hLMcOVzRg2d4bUfZdcXKSnms42Dc7Vxipqkxm73fP296wVgcKQzhX5E4NgytM3NF9e DYZnyTXdETgoCvXB9hA0rHltO/3JCU8/EwjfA6x6kODVE/pHcFJZE/TyEloVVuZdDh/k nz7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nYfPm3qdzO7zPYHIfPfYxAeBt3kKoEwf6KaTzcFG6A0=; b=T4bGfDpb4TThiIpLgsW5k+j8UlJDeLvEIJWgf4sePjzbU3O9T7S5WbSD499A1kCqbN sc3coFLpesHIqAfIMTrMcCFKxSusgFHcB8+mwuP+wpnPQQDJ9XNh5Fek4jO3SUPSYNei 0NVApz078s5q+i6SFVqnH+biHcSoysgBhDr2yKAKbHTLQct0kv99YcmiEZBebqaMUVcl 0x3HQxQQspdbxtGDFnRXt1k+LVoONQsefHPgICsvh0X3K75J5c+pL5JYDVkKqMYO4kOO 7AvtXk+7K814zy6EXP1JxvE4YsgBdJhrtpLn9hZuImsimAZClpU8fVkVo4G6T82F9BPS J+/A== X-Gm-Message-State: AOAM5329umuBWch+5HsyRHL7oTU9W9WfXkMenKsacBBUZwytihIqPfdj xTpjiCXcDsfrU1gY0k3qWzwNk90d8xcL7w== X-Google-Smtp-Source: ABdhPJztx2oGXbqiGTCjhltfcw6c7QHHH+X2qoWDZ/56kslN3CVAO9zLTRrqq3nTWR4ctnt6yZKhCA== X-Received: by 2002:a37:6141:: with SMTP id v62mr70291525qkb.500.1609771120323; Mon, 04 Jan 2021 06:38:40 -0800 (PST) Received: from mbp.home (dynamic-177-53-82-16.telecominternet.net.br. [177.53.82.16]) by smtp.gmail.com with ESMTPSA id i27sm31781330qkk.15.2021.01.04.06.38.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Jan 2021 06:38:39 -0800 (PST) Sender: Renato Botelho Subject: Re: git: 3d4ce4edd86d - main - Remove -g option support which was removed from bhyve in c4df8cbfde53c376d93f439eac3f45a7b4fc705e To: Poul-Henning Kamp , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202101041316.104DGxNQ087822@gitrepo.freebsd.org> From: Renato Botelho Message-ID: <3cb158d3-72a4-47fa-27d6-8cf317f7acd1@FreeBSD.org> Date: Mon, 4 Jan 2021 11:38:35 -0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <202101041316.104DGxNQ087822@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4D8dXx3jr6z4nhd X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 14:38:41 -0000 On 04/01/21 10:16, Poul-Henning Kamp wrote: > The branch main has been updated by phk: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3d4ce4edd86de8359267792be65d6ca20e1cf619 > > commit 3d4ce4edd86de8359267792be65d6ca20e1cf619 > Author: Poul-Henning Kamp > AuthorDate: 2021-01-04 13:15:50 +0000 > Commit: Poul-Henning Kamp > CommitDate: 2021-01-04 13:15:50 +0000 > > Remove -g option support which was removed from bhyve in > c4df8cbfde53c376d93f439eac3f45a7b4fc705e > --- > share/examples/bhyve/vmrun.sh | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/share/examples/bhyve/vmrun.sh b/share/examples/bhyve/vmrun.sh > index 607597015e62..bfc2aad2cb8c 100755 > --- a/share/examples/bhyve/vmrun.sh > +++ b/share/examples/bhyve/vmrun.sh > @@ -58,7 +58,7 @@ usage() { > "[-d ]" > echo " [-e ] [-f ]" \ > "[-F ]" > - echo " [-g ] [-H ]" > + echo " [-H ]" It seems you left an extra space here ^ -- Renato Botelho From owner-dev-commits-src-all@freebsd.org Mon Jan 4 14:54:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9CAE74D83BB; Mon, 4 Jan 2021 14:54:42 +0000 (UTC) (envelope-from git@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 4D8dvQ42BTz4pSS; Mon, 4 Jan 2021 14:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 78D8A1BC7F; Mon, 4 Jan 2021 14:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104Esgcn019325; Mon, 4 Jan 2021 14:54:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104EsgDd019324; Mon, 4 Jan 2021 14:54:42 GMT (envelope-from git) Date: Mon, 4 Jan 2021 14:54:42 GMT Message-Id: <202101041454.104EsgDd019324@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: 9cfd8046a48e - main - Remove a space I missed in previous commit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9cfd8046a48e0c60692e31e66eaa7f9c32b5da0f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 14:54:42 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=9cfd8046a48e0c60692e31e66eaa7f9c32b5da0f commit 9cfd8046a48e0c60692e31e66eaa7f9c32b5da0f Author: Poul-Henning Kamp AuthorDate: 2021-01-04 14:53:35 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-01-04 14:53:57 +0000 Remove a space I missed in previous commit --- share/examples/bhyve/vmrun.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/examples/bhyve/vmrun.sh b/share/examples/bhyve/vmrun.sh index bfc2aad2cb8c..c3cd05356eea 100755 --- a/share/examples/bhyve/vmrun.sh +++ b/share/examples/bhyve/vmrun.sh @@ -58,7 +58,7 @@ usage() { "[-d ]" echo " [-e ] [-f ]" \ "[-F ]" - echo " [-H ]" + echo " [-H ]" echo " [-I ] [-l ]" echo " [-L ]" echo " [-m ]" \ From owner-dev-commits-src-all@freebsd.org Mon Jan 4 14:55:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0BBDB4D8803; Mon, 4 Jan 2021 14:55:05 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (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 4D8dvr6D8sz4pnS; Mon, 4 Jan 2021 14:55:04 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (v-critter.freebsd.dk [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id C0AFF8A3CA; Mon, 4 Jan 2021 14:54:56 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.16.1/8.16.1) with ESMTPS id 104EsudR080357 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 4 Jan 2021 14:54:56 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.16.1/8.16.1/Submit) id 104EsutU080356; Mon, 4 Jan 2021 14:54:56 GMT (envelope-from phk) To: Renato Botelho cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 3d4ce4edd86d - main - Remove -g option support which was removed from bhyve in c4df8cbfde53c376d93f439eac3f45a7b4fc705e In-reply-to: <3cb158d3-72a4-47fa-27d6-8cf317f7acd1@FreeBSD.org> From: "Poul-Henning Kamp" References: <202101041316.104DGxNQ087822@gitrepo.freebsd.org> <3cb158d3-72a4-47fa-27d6-8cf317f7acd1@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <80354.1609772096.1@critter.freebsd.dk> Date: Mon, 04 Jan 2021 14:54:56 +0000 Message-ID: <80355.1609772096@critter.freebsd.dk> X-Rspamd-Queue-Id: 4D8dvr6D8sz4pnS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 14:55:05 -0000 -------- Renato Botelho writes: > It seems you left an extra space here ^ Sorry, fixed. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-dev-commits-src-all@freebsd.org Mon Jan 4 15:25:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B1E604D8CC7; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@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 4D8fZp3Rryz4rLy; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 650231C34D; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104FPMRc059107; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104FPMVK059106; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git) Date: Mon, 4 Jan 2021 15:25:22 GMT Message-Id: <202101041525.104FPMVK059106@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 4401fa9bf1a3 - main - pkgbase: rename PKGSIGNKEY to PKG_REPO_SIGNING_KEY MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4401fa9bf1a3f2a7f2ca04fae9291218e1ca56bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 15:25:22 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=4401fa9bf1a3f2a7f2ca04fae9291218e1ca56bf commit 4401fa9bf1a3f2a7f2ca04fae9291218e1ca56bf Author: Emmanuel Vadot AuthorDate: 2021-01-04 15:23:10 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 15:24:14 +0000 pkgbase: rename PKGSIGNKEY to PKG_REPO_SIGNING_KEY this way, it'll be automatically picked up by poudriere That's quite handy when building pkgbase! Submitted by: Mina Galić Reviewed By: bapt, bcr (manpages) Differential Revision: https://reviews.freebsd.org/D27690 --- Makefile.inc1 | 4 ++-- share/man/man5/make.conf.5 | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 6ca69da0f0bc..fecdc1bdca71 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1851,7 +1851,7 @@ WSTAGEDIR?= ${OBJTOP}/worldstage KSTAGEDIR?= ${OBJTOP}/kernelstage REPODIR?= ${OBJROOT}repo PKG_FORMAT?= txz -PKGSIGNKEY?= # empty +PKG_REPO_SIGNING_KEY?= # empty PKG_OUTPUT_DIR?= ${PKG_VERSION} .ORDER: stage-packages create-packages @@ -2064,7 +2064,7 @@ sign-packages: _pkgbootstrap .PHONY -m ${WSTAGEDIR}/meta \ -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/${PKG_VERSION} \ ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/${PKG_VERSION} \ - ${PKGSIGNKEY} ; \ + ${PKG_REPO_SIGNING_KEY} ; \ cd ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI); \ ln -s ${PKG_OUTPUT_DIR} latest diff --git a/share/man/man5/make.conf.5 b/share/man/man5/make.conf.5 index 7cb28c865151..3dffdf7b402c 100644 --- a/share/man/man5/make.conf.5 +++ b/share/man/man5/make.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2018 +.Dd December 20, 2020 .Dt MAKE.CONF 5 .Os .Sh NAME @@ -444,6 +444,16 @@ statically linked, this can be bad. If set, every utility that uses .Pa bsd.prog.mk will be linked statically. +.It Va PKG_REPO_SIGNING_KEY +.Pq Vt str +Path to rsa private key passed to +.Xr pkg-repo 8 +to sign packages created when building the +.Ar packages +target, i.e.: pkgbase. +The variable is named the same in +.Xr poudriere 8 +so it will automatically be picked up when building pkgbase with poudriere. .It Va PPP_NO_NAT .Pq Vt bool Build From owner-dev-commits-src-all@freebsd.org Mon Jan 4 15:25:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B7F044D8E54; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@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 4D8fZp4mTlz4r5Z; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 92EBC1BE69; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104FPMhL059158; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104FPMEX059157; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git) Date: Mon, 4 Jan 2021 15:25:22 GMT Message-Id: <202101041525.104FPMEX059157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 066a8c691e67 - main - pkgbase: Install atf and kyua in the tests package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 066a8c691e6751e281e529938c620f183299229a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 15:25:22 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=066a8c691e6751e281e529938c620f183299229a commit 066a8c691e6751e281e529938c620f183299229a Author: Emmanuel Vadot AuthorDate: 2020-12-21 22:36:31 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 15:20:47 +0000 pkgbase: Install atf and kyua in the tests package While here make sure that all tests dirs are taggued correctly. Reviewed by: bapt, emaste Differential Revision: https://reviews.freebsd.org/D27714 --- etc/mtree/BSD.root.dist | 2 +- etc/mtree/BSD.tests.dist | 2 +- etc/mtree/BSD.usr.dist | 14 +++++++------- lib/atf/libatf-c++/Makefile | 1 + lib/atf/libatf-c/Makefile | 1 + libexec/atf/atf-check/Makefile | 1 + libexec/atf/atf-sh/Makefile | 2 ++ share/doc/atf/Makefile | 1 + usr.bin/kyua/Makefile | 6 ++++++ 9 files changed, 21 insertions(+), 9 deletions(-) diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist index 7e5917c049b9..2cfa18dd5662 100644 --- a/etc/mtree/BSD.root.dist +++ b/etc/mtree/BSD.root.dist @@ -56,7 +56,7 @@ .. gss .. - kyua + kyua tags=package=tests .. mail .. diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index cb9632570d79..3d50a1943ce4 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -3,7 +3,7 @@ # Please see the file src/etc/mtree/README before making changes to this file. # -/set type=dir uname=root gname=wheel mode=0755 +/set type=dir uname=root gname=wheel mode=0755 tags=package=tests . bin cat diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index 1f3a4f5c54cc..f643d5ad269f 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -168,7 +168,7 @@ sbin .. share - atf + atf tags=package=tests .. bsdconfig media @@ -219,9 +219,9 @@ doc IPv6 .. - atf + atf tags=package=tests .. - kyua + kyua tags=package=tests .. legal .. @@ -319,7 +319,7 @@ .. .. .. - kyua + kyua tags=package=tests .. libusb20 .. @@ -460,10 +460,10 @@ .. .. .. - kyua - misc + kyua tags=package=tests + misc tags=package=tests .. - store + store tags=package=tests .. .. locale diff --git a/lib/atf/libatf-c++/Makefile b/lib/atf/libatf-c++/Makefile index cacf87520d2d..10450dff2399 100644 --- a/lib/atf/libatf-c++/Makefile +++ b/lib/atf/libatf-c++/Makefile @@ -28,6 +28,7 @@ .include .include +PACKAGE= tests LIB_CXX= atf-c++ PRIVATELIB= true SHLIB_MAJOR= 2 diff --git a/lib/atf/libatf-c/Makefile b/lib/atf/libatf-c/Makefile index 7473cd09b478..78b821b3c64d 100644 --- a/lib/atf/libatf-c/Makefile +++ b/lib/atf/libatf-c/Makefile @@ -44,6 +44,7 @@ ATF_BUILD_CFLAGS:= ${CFLAGS:M-[DILOWf]*} ATF_BUILD_CPPFLAGS:= ${CPPFLAGS:M-[DILOWf]*} ATF_BUILD_CXXFLAGS:= ${CXXFLAGS:M-[DILOWf]*} +PACKAGE= tests LIB= atf-c PRIVATELIB= true SHLIB_MAJOR= 1 diff --git a/libexec/atf/atf-check/Makefile b/libexec/atf/atf-check/Makefile index b6ef6778403a..6711d1744430 100644 --- a/libexec/atf/atf-check/Makefile +++ b/libexec/atf/atf-check/Makefile @@ -31,6 +31,7 @@ ATF= ${SRCTOP}/contrib/atf .PATH: ${ATF}/atf-sh +PACKAGE= tests PROG_CXX= atf-check SRCS= atf-check.cpp MAN= atf-check.1 diff --git a/libexec/atf/atf-sh/Makefile b/libexec/atf/atf-sh/Makefile index d04816f8a591..50a18e2f59dd 100644 --- a/libexec/atf/atf-sh/Makefile +++ b/libexec/atf/atf-sh/Makefile @@ -31,6 +31,7 @@ ATF= ${SRCTOP}/contrib/atf .PATH: ${ATF}/atf-sh +PACKAGE= tests PROG_CXX= atf-sh SRCS= atf-sh.cpp MAN= atf-sh.1 atf-sh.3 @@ -74,6 +75,7 @@ FILESGROUPS= SUBR SUBRDIR= ${SHAREDIR}/atf SUBR= libatf-sh.subr +SUBRTAGS= package=tests HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/share/doc/atf/Makefile b/share/doc/atf/Makefile index 78eb7bc7c607..8eaa15db8edd 100644 --- a/share/doc/atf/Makefile +++ b/share/doc/atf/Makefile @@ -32,5 +32,6 @@ FILESGROUPS= TOP TOPDIR= ${SHAREDIR}/doc/atf TOP= AUTHORS COPYING NEWS README +TOPTAGS= package=tests .include diff --git a/usr.bin/kyua/Makefile b/usr.bin/kyua/Makefile index 2c7ae11c7408..e27c8603f11b 100644 --- a/usr.bin/kyua/Makefile +++ b/usr.bin/kyua/Makefile @@ -6,6 +6,7 @@ .PATH: ${KYUA_SRCDIR} +PACKAGE= tests PROG_CXX= kyua SRCS= main.cpp LIBADD= kyua_cli kyua_drivers kyua_engine kyua_model kyua_store @@ -41,20 +42,25 @@ FILESGROUPS+= EXAMPLES CONFS= kyua.conf-default CONFSDIR= ${KYUA_CONFDIR} CONFSNAME= kyua.conf +CONFSDIRTAGS= package=tests DOCS= AUTHORS CONTRIBUTORS LICENSE DOCSDIR= ${KYUA_DOCDIR} +DOCSTAGS= package=tests EXAMPLES= Kyuafile.top kyua.conf EXAMPLESDIR= ${KYUA_EGDIR} +EXAMPLESTAGS= package=tests .PATH: ${KYUA_SRCDIR}/examples MISC= context.html index.html report.css test_result.html MISCDIR= ${KYUA_MISCDIR} +MISCTAGS= package=tests .PATH: ${KYUA_SRCDIR}/misc STORE= migrate_v1_v2.sql migrate_v2_v3.sql schema_v3.sql STOREDIR= ${KYUA_STOREDIR} +STORETAGS= package=tests .PATH: ${KYUA_SRCDIR}/store CLEANFILES+= ${MAN} From owner-dev-commits-src-all@freebsd.org Mon Jan 4 15:25:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B1E414D8FFD; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@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 4D8fZp3jxkz4r7s; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E4B81C248; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104FPM2G059124; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104FPMXu059123; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git) Date: Mon, 4 Jan 2021 15:25:22 GMT Message-Id: <202101041525.104FPMXu059123@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 53a27d89551e - main - bsd.incs.mk: Add support to override tags for a specific include group MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53a27d89551e2f10ec166ea3beec4a479642434f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 15:25:22 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=53a27d89551e2f10ec166ea3beec4a479642434f commit 53a27d89551e2f10ec166ea3beec4a479642434f Author: Emmanuel Vadot AuthorDate: 2020-12-14 17:53:34 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 15:21:32 +0000 bsd.incs.mk: Add support to override tags for a specific include group With this patch if a Makefile is using the INCSGROUPS mechanisms it can override the default package for specific includes files using GROUPPACKAGE= mynewpackage While here add a few comments after endif/endfor so it's easier to read. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D27611 --- share/mk/bsd.incs.mk | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/share/mk/bsd.incs.mk b/share/mk/bsd.incs.mk index 959f1b4748d1..1492c07ca6be 100644 --- a/share/mk/bsd.incs.mk +++ b/share/mk/bsd.incs.mk @@ -8,13 +8,6 @@ INCSGROUPS?= INCS -.if defined(NO_ROOT) -.if !defined(TAGS) || ! ${TAGS:Mpackage=*} -TAGS+= package=${PACKAGE:Uutilities} -.endif -TAG_ARGS= -T ${TAGS:[*]:S/ /,/g} -.endif - .if !target(buildincludes) .for group in ${INCSGROUPS} buildincludes: ${${group}} @@ -37,6 +30,17 @@ STAGE_SETS+= ${group:C,[/*],_,g} STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${group}DIR} STAGE_SYMLINKS_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP} +.if defined(NO_ROOT) +.if !defined(${group}TAGS) || ! ${${group}TAGS:Mpackage=*} +.if defined(${group}PACKAGE) +${group}TAGS+= package=${${group}PACKAGE:Uutilities},dev +.else +${group}TAGS+= package=${PACKAGE:Uutilities},dev +.endif +.endif +${group}TAG_ARGS= -T ${${group}TAGS:[*]:S/ /,/g} +.endif + _${group}INCS= .for header in ${${group}} .if defined(${group}OWN_${header:T}) || defined(${group}GRP_${header:T}) || \ @@ -67,7 +71,7 @@ _${group}INS_${header:T}: ${header} .else _${group}INCS+= ${header} .endif -.endfor +.endfor # header in ${${group}} .if !empty(_${group}INCS) stage_files.${group}: ${_${group}INCS} stage_includes: stage_files.${group} @@ -75,16 +79,16 @@ stage_includes: stage_files.${group} installincludes: _${group}INS _${group}INS: ${_${group}INCS} .if defined(${group}NAME) - ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ + ${INSTALL} ${${group}TAG_ARGS} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME} .else - ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ + ${INSTALL} ${${group}TAG_ARGS} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ ${.ALLSRC} ${DESTDIR}${${group}DIR}/ .endif -.endif +.endif # !empty(_${group}INCS) .endif # defined(${group}) && !empty(${group}) -.endfor +.endfor # group in ${INCSGROUPS} .if defined(INCSLINKS) && !empty(INCSLINKS) installincludes: From owner-dev-commits-src-all@freebsd.org Mon Jan 4 15:25:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C99634D8E56; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@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 4D8fZp5KQCz4r34; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A470C1BE6A; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104FPMoq059175; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104FPMBK059174; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git) Date: Mon, 4 Jan 2021 15:25:22 GMT Message-Id: <202101041525.104FPMBK059174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: b0995124cd97 - main - pkgbase: Install libxo test files in the tests package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b0995124cd97d215419fc42fa147ae8dff07cc5f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 15:25:23 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b0995124cd97d215419fc42fa147ae8dff07cc5f commit b0995124cd97d215419fc42fa147ae8dff07cc5f Author: Emmanuel Vadot AuthorDate: 2020-12-21 22:35:53 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 15:20:26 +0000 pkgbase: Install libxo test files in the tests package Reviewed by: bapt, emaste Differential Revision: https://reviews.freebsd.org/D27713 --- lib/libxo/tests/encoder/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libxo/tests/encoder/Makefile b/lib/libxo/tests/encoder/Makefile index 6f657781a8e1..a8839e45a9fa 100644 --- a/lib/libxo/tests/encoder/Makefile +++ b/lib/libxo/tests/encoder/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= tests + LIBXOSRC= ${SRCTOP}/contrib/libxo .PATH: ${LIBXOSRC}/encoder/test From owner-dev-commits-src-all@freebsd.org Mon Jan 4 15:25:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2AC8E4D8C61; Mon, 4 Jan 2021 15:25:23 +0000 (UTC) (envelope-from git@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 4D8fZq0k8sz4rGT; Mon, 4 Jan 2021 15:25:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BB4C1C249; Mon, 4 Jan 2021 15:25:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104FPMYO059260; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104FPMAD059259; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git) Date: Mon, 4 Jan 2021 15:25:22 GMT Message-Id: <202101041525.104FPMAD059259@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 2d486ba15f33 - main - pkgbase: Move bectl to the runtime package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d486ba15f3367072d631ee588192ef46687fa4b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 15:25:23 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=2d486ba15f3367072d631ee588192ef46687fa4b commit 2d486ba15f3367072d631ee588192ef46687fa4b Author: Emmanuel Vadot AuthorDate: 2020-12-21 15:00:02 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 15:17:12 +0000 pkgbase: Move bectl to the runtime package runtime contain what is needed to boot in single user and repair a system, bectl could be handy to have in this situation. Differential Revision: https://reviews.freebsd.org/D27708 --- lib/libbe/Makefile | 1 + sbin/bectl/Makefile | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/libbe/Makefile b/lib/libbe/Makefile index 291e2438ee2a..d1fab41578bf 100644 --- a/lib/libbe/Makefile +++ b/lib/libbe/Makefile @@ -4,6 +4,7 @@ SHLIBDIR?= /lib .include +PACKAGE= runtime LIB= be SHLIB_MAJOR= 1 SHLIB_MINOR= 0 diff --git a/sbin/bectl/Makefile b/sbin/bectl/Makefile index 6fa84f48661d..46d43306b9ca 100644 --- a/sbin/bectl/Makefile +++ b/sbin/bectl/Makefile @@ -2,6 +2,7 @@ .include +PACKAGE=runtime PROG= bectl MAN= bectl.8 From owner-dev-commits-src-all@freebsd.org Mon Jan 4 15:25:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1A3954D9100; Mon, 4 Jan 2021 15:25:23 +0000 (UTC) (envelope-from git@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 4D8fZq0FpJz4rJd; Mon, 4 Jan 2021 15:25:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDE7A1BE6B; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104FPMci059243; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104FPMEe059242; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git) Date: Mon, 4 Jan 2021 15:25:22 GMT Message-Id: <202101041525.104FPMEe059242@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 6b68fdbbf7be - main - pkgbase: Put zoneinfo file in their own package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6b68fdbbf7be12abdc5478e8c4b07e96945173f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 15:25:23 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=6b68fdbbf7be12abdc5478e8c4b07e96945173f8 commit 6b68fdbbf7be12abdc5478e8c4b07e96945173f8 Author: Emmanuel Vadot AuthorDate: 2020-12-21 16:54:23 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 15:18:36 +0000 pkgbase: Put zoneinfo file in their own package Those files take some amount of diskspace and one might not want them installed on some situation (mfsdisk, small embedded system etc ...) Reviewed by: bapt, emaste Differential Revision: https://reviews.freebsd.org/D27709 --- share/zoneinfo/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/share/zoneinfo/Makefile b/share/zoneinfo/Makefile index de354f885674..6e4cb51a63e3 100644 --- a/share/zoneinfo/Makefile +++ b/share/zoneinfo/Makefile @@ -32,6 +32,7 @@ .include +PACKAGE= zoneinfo CLEANFILES+= yearistype CLEANDIRS+= builddir CONTRIBDIR= ${SRCTOP}/contrib/tzdata/ From owner-dev-commits-src-all@freebsd.org Mon Jan 4 15:25:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B7D3B4D8EA1; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@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 4D8fZp4Fqcz4rM0; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80BC51C176; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104FPMDJ059141; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104FPMZa059140; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git) Date: Mon, 4 Jan 2021 15:25:22 GMT Message-Id: <202101041525.104FPMZa059140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: e3ff9a1f2ed6 - main - pkgbase: Put the last rc files in the rc package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3ff9a1f2ed640a969062f9114de05198655934f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 15:25:22 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=e3ff9a1f2ed640a969062f9114de05198655934f commit e3ff9a1f2ed640a969062f9114de05198655934f Author: Emmanuel Vadot AuthorDate: 2020-12-21 23:17:17 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 15:21:13 +0000 pkgbase: Put the last rc files in the rc package Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D27718 --- libexec/rc/rc.d/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index 7e0e63dae414..a8277e08932c 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -153,6 +153,7 @@ APMPACKAGE= apm CONFGROUPS+= AUDIT AUDIT+= auditd AUDIT+= auditdistd +AUDITPACKAGE= rc .endif .if ${MK_AUTOFS} != "no" @@ -320,6 +321,7 @@ ZFS+= zfsbe ZFS+= zfsd ZFS+= zpool ZFS+= zvol +ZFSPACKAGE= rc .endif .for fg in ${CONFGROUPS} From owner-dev-commits-src-all@freebsd.org Mon Jan 4 15:25:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DBBB04D8DE4; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@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 4D8fZp5qWrz4rJc; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B82A91C177; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104FPMCp059192; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104FPMve059191; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git) Date: Mon, 4 Jan 2021 15:25:22 GMT Message-Id: <202101041525.104FPMve059191@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 735a585e80b9 - main - mk: Set the DIR tags based on the files one MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 735a585e80b99f5c67e6d1de4454c3d22986f50d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 15:25:23 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=735a585e80b99f5c67e6d1de4454c3d22986f50d commit 735a585e80b99f5c67e6d1de4454c3d22986f50d Author: Emmanuel Vadot AuthorDate: 2020-12-21 22:20:28 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 15:20:04 +0000 mk: Set the DIR tags based on the files one Otherwise we loose the info as we use bsd.dirs.mk for creating directories. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D27712 --- share/mk/bsd.files.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/mk/bsd.files.mk b/share/mk/bsd.files.mk index 9594bdd27f81..a327d142662c 100644 --- a/share/mk/bsd.files.mk +++ b/share/mk/bsd.files.mk @@ -53,10 +53,12 @@ ${group}TAG_ARGS= -T ${${group}TAGS:[*]:S/ /,/g} .if ${${group}DIR:S/^\///} == ${${group}DIR} # ${group}DIR specifies a variable that specifies a path DIRS+= ${${group}DIR} +${group}DIRTAGS= ${group}TAGS _${group}DIR= ${${group}DIR} .else # ${group}DIR specifies a path DIRS+= ${group}DIR +${group}DIRTAGS= ${${group}TAGS} _${group}DIR= ${group}DIR .endif From owner-dev-commits-src-all@freebsd.org Mon Jan 4 15:25:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0AF124D8C60; Mon, 4 Jan 2021 15:25:23 +0000 (UTC) (envelope-from git@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 4D8fZp6rntz4rM1; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC6551C481; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104FPMRR059226; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104FPMTn059225; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git) Date: Mon, 4 Jan 2021 15:25:22 GMT Message-Id: <202101041525.104FPMTn059225@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: c92017ce5b49 - main - pkgbase: Put libalias in the natd package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c92017ce5b491da06ee18825dc4963d4aaa92b64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 15:25:23 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=c92017ce5b491da06ee18825dc4963d4aaa92b64 commit c92017ce5b491da06ee18825dc4963d4aaa92b64 Author: Emmanuel Vadot AuthorDate: 2020-12-21 17:34:36 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 15:19:08 +0000 pkgbase: Put libalias in the natd package natd is the main user of the libalias* modules, put them together. Reviewed by: bapt, emaste Differential Revision: https://reviews.freebsd.org/D27710 --- lib/libalias/libalias/Makefile | 1 + lib/libalias/modules/dummy/Makefile | 5 +++-- lib/libalias/modules/ftp/Makefile | 5 +++-- lib/libalias/modules/irc/Makefile | 5 +++-- lib/libalias/modules/nbt/Makefile | 5 +++-- lib/libalias/modules/pptp/Makefile | 5 +++-- lib/libalias/modules/skinny/Makefile | 5 +++-- lib/libalias/modules/smedia/Makefile | 5 +++-- 8 files changed, 22 insertions(+), 14 deletions(-) diff --git a/lib/libalias/libalias/Makefile b/lib/libalias/libalias/Makefile index 1078e6d46b78..eba0e3098017 100644 --- a/lib/libalias/libalias/Makefile +++ b/lib/libalias/libalias/Makefile @@ -2,6 +2,7 @@ .PATH: ${SRCTOP}/sys/netinet/libalias +PACKAGE= natd CONFS= libalias.conf LIB= alias SHLIBDIR?= /lib diff --git a/lib/libalias/modules/dummy/Makefile b/lib/libalias/modules/dummy/Makefile index 8a2abe594d48..87a7db22b429 100644 --- a/lib/libalias/modules/dummy/Makefile +++ b/lib/libalias/modules/dummy/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ -NAME= dummy -SRCS= alias_dummy.c +PACKAGE= natd +NAME= dummy +SRCS= alias_dummy.c .include diff --git a/lib/libalias/modules/ftp/Makefile b/lib/libalias/modules/ftp/Makefile index ad3f86fc0fe3..a7f5562974d0 100644 --- a/lib/libalias/modules/ftp/Makefile +++ b/lib/libalias/modules/ftp/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ -NAME= ftp -SRCS= alias_ftp.c +PACKAGE= natd +NAME= ftp +SRCS= alias_ftp.c .include diff --git a/lib/libalias/modules/irc/Makefile b/lib/libalias/modules/irc/Makefile index 1d5308d70489..b96813b90c19 100644 --- a/lib/libalias/modules/irc/Makefile +++ b/lib/libalias/modules/irc/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ -NAME= irc -SRCS= alias_irc.c +PACKAGE= natd +NAME= irc +SRCS= alias_irc.c .include diff --git a/lib/libalias/modules/nbt/Makefile b/lib/libalias/modules/nbt/Makefile index a8cfc8c5fdc0..99df1ff8aea9 100644 --- a/lib/libalias/modules/nbt/Makefile +++ b/lib/libalias/modules/nbt/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ -NAME= nbt -SRCS= alias_nbt.c +PACKAGE= natd +NAME= nbt +SRCS= alias_nbt.c .include diff --git a/lib/libalias/modules/pptp/Makefile b/lib/libalias/modules/pptp/Makefile index ffbae7ede829..a0cdc30c164c 100644 --- a/lib/libalias/modules/pptp/Makefile +++ b/lib/libalias/modules/pptp/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ -NAME= pptp -SRCS= alias_pptp.c +PACKAGE= natd +NAME= pptp +SRCS= alias_pptp.c .include diff --git a/lib/libalias/modules/skinny/Makefile b/lib/libalias/modules/skinny/Makefile index 4969ecb0bf6c..5b528b7635e0 100644 --- a/lib/libalias/modules/skinny/Makefile +++ b/lib/libalias/modules/skinny/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ -NAME= skinny -SRCS= alias_skinny.c +PACKAGE= natd +NAME= skinny +SRCS= alias_skinny.c .include diff --git a/lib/libalias/modules/smedia/Makefile b/lib/libalias/modules/smedia/Makefile index 135d22c7460b..11a7a178edb4 100644 --- a/lib/libalias/modules/smedia/Makefile +++ b/lib/libalias/modules/smedia/Makefile @@ -1,6 +1,7 @@ # $FreeBSD$ -NAME= smedia -SRCS= alias_smedia.c +PACKAGE= natd +NAME= smedia +SRCS= alias_smedia.c .include From owner-dev-commits-src-all@freebsd.org Mon Jan 4 15:25:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 02CD34D9083; Mon, 4 Jan 2021 15:25:23 +0000 (UTC) (envelope-from git@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 4D8fZp6c7nz4qxH; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D40DC1C480; Mon, 4 Jan 2021 15:25:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104FPMb1059209; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104FPMP0059208; Mon, 4 Jan 2021 15:25:22 GMT (envelope-from git) Date: Mon, 4 Jan 2021 15:25:22 GMT Message-Id: <202101041525.104FPMP0059208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: a22cde7c029d - main - pkgbase: Put ppp in it's own package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a22cde7c029d00549b70fc2edce3269b5e3a4b0f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 15:25:23 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=a22cde7c029d00549b70fc2edce3269b5e3a4b0f commit a22cde7c029d00549b70fc2edce3269b5e3a4b0f Author: Emmanuel Vadot AuthorDate: 2020-12-21 17:35:12 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 15:19:36 +0000 pkgbase: Put ppp in it's own package ppp uses libalias modules which now belong in the natd package. Avoid bringing a dependancy on natd for the utilities package. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D27711 --- usr.sbin/ppp/Makefile | 1 + usr.sbin/pppctl/Makefile | 1 + 2 files changed, 2 insertions(+) diff --git a/usr.sbin/ppp/Makefile b/usr.sbin/ppp/Makefile index 2e77285abe4c..a7a35d49295e 100644 --- a/usr.sbin/ppp/Makefile +++ b/usr.sbin/ppp/Makefile @@ -2,6 +2,7 @@ .include +PACKAGE= ppp PROG= ppp MAN= ppp.8 SRCS= acf.c arp.c async.c auth.c bundle.c cbcp.c ccp.c chap.c chat.c \ diff --git a/usr.sbin/pppctl/Makefile b/usr.sbin/pppctl/Makefile index dcb793139bed..064f12dd7763 100644 --- a/usr.sbin/pppctl/Makefile +++ b/usr.sbin/pppctl/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= ppp PROG= pppctl MAN= pppctl.8 From owner-dev-commits-src-all@freebsd.org Mon Jan 4 15:36:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ABC8A4D953A; Mon, 4 Jan 2021 15:36:52 +0000 (UTC) (envelope-from git@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 4D8fr44Rzkz4tF0; Mon, 4 Jan 2021 15:36:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B8AA1C59F; Mon, 4 Jan 2021 15:36:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104FaqGQ072380; Mon, 4 Jan 2021 15:36:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104FaqEu072379; Mon, 4 Jan 2021 15:36:52 GMT (envelope-from git) Date: Mon, 4 Jan 2021 15:36:52 GMT Message-Id: <202101041536.104FaqEu072379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: f61a3898bb98 - main - include: Use INCSGROUPS for a few files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f61a3898bb989edef7ca308043224e495ed78f64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 15:36:52 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=f61a3898bb989edef7ca308043224e495ed78f64 commit f61a3898bb989edef7ca308043224e495ed78f64 Author: Emmanuel Vadot AuthorDate: 2020-12-14 17:56:56 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 15:36:43 +0000 include: Use INCSGROUPS for a few files Instead of using install directly use INCSGROUPS for them. All those files are the ones we installed when the directory have more .h files that we don't want to install so they aren't using the LSUBDIR stuff. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D27612 --- include/Makefile | 193 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 128 insertions(+), 65 deletions(-) diff --git a/include/Makefile b/include/Makefile index 108623216b79..1cdd8350bc7d 100644 --- a/include/Makefile +++ b/include/Makefile @@ -67,6 +67,134 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ LSUBSUBDIRS= dev/mpt/mpilib +.PATH: ${SRCTOP}/sys/dev/acpica +ACPICA= acpi_hpet.h \ + acpiio.h +ACPICADIR= ${INCLUDEDIR}/dev/acpica + +.PATH: ${SRCTOP}/sys/dev/agp +AGP= agpreg.h +AGPDIR= ${INCLUDEDIR}/dev/agp + +.PATH: ${SRCTOP}/sys/fs/cd9660 +FS9660= cd9660_mount.h \ + cd9660_node.h \ + cd9660_rrip.h \ + iso.h \ + iso_rrip.h +FS9660DIR= ${INCLUDEDIR}/isofs/cd9660 + +.PATH: ${SRCTOP}/sys/crypto +CRYPTO= rijndael/rijndael.h +CRYPTODIR= ${INCLUDEDIR}/crypto + +.PATH: ${SRCTOP}/sys/dev/evdev +EVDEV= input.h \ + input-event-codes.h \ + uinput.h +EVDEVDIR= ${INCLUDEDIR}/dev/evdev + +.PATH: ${SRCTOP}/sys/dev/hyperv/include ${SRCTOP}/sys/dev/hyperv/utilities +HYPERV= hv_snapshot.h \ + hyperv.h +HYPERVDIR= ${INCLUDEDIR}/dev/hyperv + +.PATH: ${SRCTOP}/sys/opencrypto +OPENCRYPTO= _cryptodev.h \ + cbc_mac.h \ + cryptodev.h \ + deflate.h \ + gfmult.h \ + gmac.h \ + rmd160.h \ + xform.h \ + xform_auth.h \ + xform_comp.h \ + xform_enc.h \ + xform_poly1305.h +OPENCRYPTODIR= ${INCLUDEDIR}/crypto + +.PATH: ${SRCTOP}/sys/dev/pci +PCI= pcireg.h +PCIDIR= ${INCLUDEDIR}/dev/pci + +.PATH: ${SRCTOP}/sys/dev/veriexec +VERIEXEC= veriexec_ioctl.h +VERIEXECDIR= ${INCLUDEDIR}/dev/veriexec + +.PATH: ${SRCTOP}/sys/contrib/ipfilter/netinet +IPFILTER= ip_auth.h \ + ip_compat.h \ + ip_dstlist.h \ + ip_fil.h \ + ip_frag.h \ + ip_htable.h \ + ip_lookup.h \ + ip_nat.h \ + ip_pool.h \ + ip_proxy.h \ + ip_rules.h \ + ip_scan.h \ + ip_state.h \ + ip_sync.h \ + ipf_rb.h \ + ipl.h \ + radix_ipf.h +IPFILTERDIR= ${INCLUDEDIR}/netinet + +.PATH: ${SRCTOP}/sys/netpfil/pf +PF= pf.h \ + pf_altq.h \ + pf_mtag.h +PFPACKAGE= pf +PFDIR= ${INCLUDEDIR}/netpfil/pf + +.PATH: ${SRCTOP}/sys/rpc +RPC= rpcsec_tls.h \ + types.h +RPCDIR= ${INCLUDEDIR}/rpc + +.PATH: ${SRCTOP}/sys/teken +TEKEN= teken.h +TEKENDIR= ${INCLUDEDIR}/teken + +.PATH: ${SRCTOP}/sys/contrib/openzfs/include/sys +NVPAIR= nvpair.h +NVPAIRDIR= ${INCLUDEDIR}/sys + +.PATH: ${SRCTOP}/sys/dev/mlx5 +MLX5= mlx5io.h +MLX5DIR= ${INCLUDEDIR}/dev/mlx5 + +INCSGROUPS= INCS \ + ACPICA \ + AGP \ + CRYPTO \ + EVDEV \ + FS9660 \ + HYPERV \ + OPENCRYPTO \ + PCI \ + RPC \ + TEKEN \ + VERIEXEC + +.if ${MK_IPFILTER} != "no" +INCSGROUPS+= IPFILTER +.endif + +.if ${MK_PF} != "no" +INCSGROUPS+= PF +.endif + +.if ${MK_CDDL} != "no" +INCSGROUPS+= NVPAIR +.endif + +.if ${MK_MLX5TOOL} != "no" +INCSGROUPS+= MLX5 +.endif + .if ${MK_BLUETOOTH} != "no" LSUBSUBDIRS+= netgraph/bluetooth/include .endif @@ -164,52 +292,6 @@ copies: .PHONY .META ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${SDESTDIR}${INCLUDEDIR}/$i .endfor - cd ${SRCTOP}/sys/dev/acpica; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/acpica - cd ${SRCTOP}/sys/dev/agp; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/agp - cd ${SRCTOP}/sys/dev/evdev; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 input.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/evdev; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 input-event-codes.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/evdev; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 uinput.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/evdev - cd ${SRCTOP}/sys/dev/hyperv/include; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hyperv.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv - cd ${SRCTOP}/sys/dev/hyperv/utilities; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hv_snapshot.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv - cd ${SRCTOP}/sys/dev/pci; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/pci - cd ${SRCTOP}/sys/dev/veriexec; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 veriexec_ioctl.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/veriexec - cd ${SRCTOP}/sys/fs/cd9660/; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ - ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660 -.if ${MK_IPFILTER} != "no" - cd ${SRCTOP}/sys/contrib/ipfilter/netinet; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ - ${SDESTDIR}${INCLUDEDIR}/netinet -.endif -.if ${MK_PF} != "no" - cd ${SRCTOP}/sys/netpfil/pf; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ - ${SDESTDIR}${INCLUDEDIR}/netpfil/pf -.endif - cd ${SRCTOP}/sys/crypto; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \ - ${SDESTDIR}${INCLUDEDIR}/crypto - cd ${SRCTOP}/sys/opencrypto; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ - ${SDESTDIR}${INCLUDEDIR}/crypto cd ${SRCTOP}/sys/${MACHINE}/include; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/machine @@ -234,25 +316,6 @@ copies: .PHONY .META .endif .endif .endfor - cd ${SRCTOP}/sys/rpc; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 rpcsec_tls.h \ - ${SDESTDIR}${INCLUDEDIR}/rpc - cd ${SRCTOP}/sys/rpc; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 types.h \ - ${SDESTDIR}${INCLUDEDIR}/rpc - cd ${SRCTOP}/sys/teken; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \ - ${SDESTDIR}${INCLUDEDIR}/teken -.if ${MK_CDDL} != "no" - cd ${SRCTOP}/sys/contrib/openzfs/include/sys; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nvpair.h \ - ${SDESTDIR}${INCLUDEDIR}/sys -.endif -.if ${MK_MLX5TOOL} != "no" - cd ${SRCTOP}/sys/dev/mlx5; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 mlx5io.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 -.endif symlinks: .PHONY .META @${ECHO} "Setting up symlinks to kernel source tree..." From owner-dev-commits-src-all@freebsd.org Mon Jan 4 15:36:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BA2B64D9734; Mon, 4 Jan 2021 15:36:52 +0000 (UTC) (envelope-from git@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 4D8fr44xf3z4t8f; Mon, 4 Jan 2021 15:36:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D3E71C5A0; Mon, 4 Jan 2021 15:36:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104Faqar072397; Mon, 4 Jan 2021 15:36:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104FaqnD072396; Mon, 4 Jan 2021 15:36:52 GMT (envelope-from git) Date: Mon, 4 Jan 2021 15:36:52 GMT Message-Id: <202101041536.104FaqnD072396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: b6cc69322a77 - main - include: Tag the last includes files as part of the -dev package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b6cc69322a77fa778b00db873781be04f26bd2ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 15:36:52 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b6cc69322a77fa778b00db873781be04f26bd2ee commit b6cc69322a77fa778b00db873781be04f26bd2ee Author: Emmanuel Vadot AuthorDate: 2020-12-15 12:50:00 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 15:36:39 +0000 include: Tag the last includes files as part of the -dev package Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D27618 --- include/Makefile | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/include/Makefile b/include/Makefile index e8c5bbf29b1e..108623216b79 100644 --- a/include/Makefile +++ b/include/Makefile @@ -259,23 +259,23 @@ symlinks: .PHONY .META .for i in ${LDIRS} cd ${SRCTOP}/sys/$i; \ for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ done .endfor .for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec} cd ${SRCTOP}/sys/$i; \ for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ done .endfor cd ${SRCTOP}/sys/dev/acpica; \ for h in acpiio.h acpi_hpet.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/acpica/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/acpica/$$h \ ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ done cd ${SRCTOP}/sys/dev/agp; \ for h in agpreg.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/agp/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/$$h \ ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ done cd ${SRCTOP}/sys/dev/evdev; \ @@ -285,17 +285,17 @@ symlinks: .PHONY .META done cd ${SRCTOP}/sys/dev/hyperv/include; \ for h in hyperv.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/include/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/$$h \ ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ done cd ${SRCTOP}/sys/dev/hyperv/utilities; \ for h in hv_snapshot.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/utilities/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/$$h \ ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ done cd ${SRCTOP}/sys/dev/pci; \ for h in pcireg.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/pci/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/$$h \ ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ done cd ${SRCTOP}/sys/dev/veriexec; \ @@ -306,60 +306,60 @@ symlinks: .PHONY .META .for i in ${LSUBSUBDIRS} cd ${SRCTOP}/sys/$i; \ for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ done .endfor .if ${MK_IPFILTER} != "no" cd ${SRCTOP}/sys/contrib/ipfilter/netinet; \ for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/contrib/ipfilter/netinet/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/contrib/ipfilter/netinet/$$h \ ${SDESTDIR}${INCLUDEDIR}/netinet; \ done .endif .if ${MK_PF} != "no" cd ${SRCTOP}/sys/netpfil/pf; \ for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/netpfil/pf/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/netpfil/pf/$$h \ ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; \ done .endif cd ${SRCTOP}/sys/crypto; \ for h in rijndael/rijndael.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/crypto/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/$$h \ ${SDESTDIR}${INCLUDEDIR}/crypto; \ done cd ${SRCTOP}/sys/opencrypto; \ for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/opencrypto/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/opencrypto/$$h \ ${SDESTDIR}${INCLUDEDIR}/crypto; \ done cd ${SRCTOP}/sys/${MACHINE}/include; \ for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${MACHINE}/include/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/${MACHINE}/include/$$h \ ${SDESTDIR}${INCLUDEDIR}/machine; \ done .if exists(${SRCTOP}/sys/${MACHINE}/include/pc) cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${MACHINE}/include/pc/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/${MACHINE}/include/pc/$$h \ ${SDESTDIR}${INCLUDEDIR}/machine/pc; \ done .endif .for _MARCH in ${_MARCHS} .if exists(${SRCTOP}/sys/${_MARCH}/include) - ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ cd ${SRCTOP}/sys/${_MARCH}/include; \ for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${_MARCH}/include/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/${_MARCH}/include/$$h \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ done .if exists(${SRCTOP}/sys/${_MARCH}/include/pc) - ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${_MARCH}/include/pc/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/${_MARCH}/include/pc/$$h \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ done .endif @@ -367,21 +367,21 @@ symlinks: .PHONY .META .endfor cd ${SRCTOP}/sys/fs/cd9660; \ for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/fs/cd9660/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/fs/cd9660/$$h \ ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ done cd ${SRCTOP}/sys/rpc; \ for h in rpcsec_tls.h types.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/rpc/$$h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/rpc/$$h \ ${SDESTDIR}${INCLUDEDIR}/rpc; \ done .if ${MK_CDDL} != "no" - ${INSTALL_SYMLINK} ${TAG_ARGS} \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ ../../../sys/contrib/openenzfs/include/sys/nvpair.h \ ${SDESTDIR}${INCLUDEDIR}/sys .endif .if ${MK_MLX5TOOL} != "no" - ${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/mlx5/mlx5io.h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \ ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 .endif From owner-dev-commits-src-all@freebsd.org Mon Jan 4 16:31:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C031F4DB944; Mon, 4 Jan 2021 16:31:28 +0000 (UTC) (envelope-from git@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 4D8h3458DDz3GDc; Mon, 4 Jan 2021 16:31:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3E6C1CF97; Mon, 4 Jan 2021 16:31:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104GVSPS046351; Mon, 4 Jan 2021 16:31:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104GVS24046350; Mon, 4 Jan 2021 16:31:28 GMT (envelope-from git) Date: Mon, 4 Jan 2021 16:31:28 GMT Message-Id: <202101041631.104GVS24046350@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: e5df46055add - main - arm64: rockchip: rk_clk_mux: Tell the clk framework if we didn't change the clock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5df46055add3bcf074c9ba275ceb4481802ba04 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 16:31:28 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=e5df46055add3bcf074c9ba275ceb4481802ba04 commit e5df46055add3bcf074c9ba275ceb4481802ba04 Author: Emmanuel Vadot AuthorDate: 2021-01-04 16:30:00 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-04 16:30:00 +0000 arm64: rockchip: rk_clk_mux: Tell the clk framework if we didn't change the clock Otherwise the clk framework will not pass the freq change request to the clock parents. Fix d03fd8ede2c4 Reported by: br --- sys/arm64/rockchip/clk/rk_clk_mux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/arm64/rockchip/clk/rk_clk_mux.c b/sys/arm64/rockchip/clk/rk_clk_mux.c index 2280051b5a0c..eb3cdeb99f4b 100644 --- a/sys/arm64/rockchip/clk/rk_clk_mux.c +++ b/sys/arm64/rockchip/clk/rk_clk_mux.c @@ -138,8 +138,10 @@ rk_clk_mux_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout, sc = clknode_get_softc(clk); - if ((sc->mux_flags & RK_CLK_MUX_REPARENT) == 0) + if ((sc->mux_flags & RK_CLK_MUX_REPARENT) == 0) { + *stop = 0; return (0); + } dprintf("Finding best parent for target freq of %ju\n", *fout); p_names = clknode_get_parent_names(clk); From owner-dev-commits-src-all@freebsd.org Mon Jan 4 16:58:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DBCCB4DC70D; Mon, 4 Jan 2021 16:58:05 +0000 (UTC) (envelope-from git@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 4D8hdn5tqTz3J1d; Mon, 4 Jan 2021 16:58:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCC681D74B; Mon, 4 Jan 2021 16:58:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104Gw5Uj075914; Mon, 4 Jan 2021 16:58:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104Gw5eB075913; Mon, 4 Jan 2021 16:58:05 GMT (envelope-from git) Date: Mon, 4 Jan 2021 16:58:05 GMT Message-Id: <202101041658.104Gw5eB075913@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: b2a8d7a9b52d - main - loader: fix powerpc build with gfx_fb MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b2a8d7a9b52d588338ded70cb101899e32c1d352 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 16:58:05 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=b2a8d7a9b52d588338ded70cb101899e32c1d352 commit b2a8d7a9b52d588338ded70cb101899e32c1d352 Author: Toomas Soome AuthorDate: 2021-01-04 16:51:58 +0000 Commit: Toomas Soome CommitDate: 2021-01-04 16:57:58 +0000 loader: fix powerpc build with gfx_fb Need to add stub data and gfx functions to make linking happy. --- stand/powerpc/kboot/Makefile | 5 ++- stand/powerpc/kboot/gfx_fb.c | 78 ++++++++++++++++++++++++++++++++++++++++++++ stand/powerpc/ofw/Makefile | 5 ++- stand/powerpc/ofw/gfx_fb.c | 78 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 164 insertions(+), 2 deletions(-) diff --git a/stand/powerpc/kboot/Makefile b/stand/powerpc/kboot/Makefile index 671db88a14a9..8b632ae3d076 100644 --- a/stand/powerpc/kboot/Makefile +++ b/stand/powerpc/kboot/Makefile @@ -19,7 +19,10 @@ INSTALLFLAGS= -b # Architecture-specific loader code SRCS= conf.c vers.c main.c ppc64_elf_freebsd.c SRCS+= host_syscall.S hostcons.c hostdisk.c kerneltramp.S kbootfdt.c -SRCS+= ucmpdi2.c +SRCS+= ucmpdi2.c gfx_fb.c + +CFLAGS.gfx_fb.c += -I${SRCTOP}/contrib/pnglite +CFLAGS.gfx_fb.c += -I${SRCTOP}/sys/teken .include "${BOOTSRC}/fdt.mk" diff --git a/stand/powerpc/kboot/gfx_fb.c b/stand/powerpc/kboot/gfx_fb.c new file mode 100644 index 000000000000..318e45225e06 --- /dev/null +++ b/stand/powerpc/kboot/gfx_fb.c @@ -0,0 +1,78 @@ +/*- + * Copyright 2021 Toomas Soome + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * powerpc specific gfx stubs. + */ + +#include +#include +#include "bootstrap.h" +#include "gfx_fb.h" + +font_list_t fonts = STAILQ_HEAD_INITIALIZER(fonts); +teken_gfx_t gfx_state = { 0 }; + +void +gfx_fb_setpixel(uint32_t x __unused, uint32_t y __unused) +{ +} + +void +gfx_fb_drawrect(uint32_t x1 __unused, uint32_t y1 __unused, + uint32_t x2 __unused, uint32_t y2 __unused, uint32_t fill __unused) +{ +} + +void +gfx_term_drawrect(uint32_t x1 __unused, uint32_t y1 __unused, + uint32_t x2 __unused, uint32_t y2 __unused) +{ +} + +void +gfx_fb_line(uint32_t x0 __unused, uint32_t y0 __unused, + uint32_t x1 __unused, uint32_t y1 __unused, uint32_t w __unused) +{ +} + +void +gfx_fb_bezier(uint32_t x0 __unused, uint32_t y0 __unused, + uint32_t x1 __unused, uint32_t y1 __unused, uint32_t x2 __unused, + uint32_t y2 __unused, uint32_t w __unused) +{ +} + +int +gfx_fb_putimage(png_t *png __unused, uint32_t ux1 __unused, + uint32_t uy1 __unused, uint32_t ux2 __unused, uint32_t uy2 __unused, + uint32_t flags __unused) +{ + return (1); +} diff --git a/stand/powerpc/ofw/Makefile b/stand/powerpc/ofw/Makefile index b247b8b73e2d..a35a7c7c56bf 100644 --- a/stand/powerpc/ofw/Makefile +++ b/stand/powerpc/ofw/Makefile @@ -18,7 +18,10 @@ INSTALLFLAGS= -b # Architecture-specific loader code SRCS= conf.c vers.c main.c elf_freebsd.c ppc64_elf_freebsd.c start.c -SRCS+= ucmpdi2.c +SRCS+= ucmpdi2.c gfx_fb.c + +CFLAGS.gfx_fb.c += -I${SRCTOP}/contrib/pnglite +CFLAGS.gfx_fb.c += -I${SRCTOP}/sys/teken .include "${BOOTSRC}/fdt.mk" .if ${MK_FDT} == "yes" diff --git a/stand/powerpc/ofw/gfx_fb.c b/stand/powerpc/ofw/gfx_fb.c new file mode 100644 index 000000000000..318e45225e06 --- /dev/null +++ b/stand/powerpc/ofw/gfx_fb.c @@ -0,0 +1,78 @@ +/*- + * Copyright 2021 Toomas Soome + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * powerpc specific gfx stubs. + */ + +#include +#include +#include "bootstrap.h" +#include "gfx_fb.h" + +font_list_t fonts = STAILQ_HEAD_INITIALIZER(fonts); +teken_gfx_t gfx_state = { 0 }; + +void +gfx_fb_setpixel(uint32_t x __unused, uint32_t y __unused) +{ +} + +void +gfx_fb_drawrect(uint32_t x1 __unused, uint32_t y1 __unused, + uint32_t x2 __unused, uint32_t y2 __unused, uint32_t fill __unused) +{ +} + +void +gfx_term_drawrect(uint32_t x1 __unused, uint32_t y1 __unused, + uint32_t x2 __unused, uint32_t y2 __unused) +{ +} + +void +gfx_fb_line(uint32_t x0 __unused, uint32_t y0 __unused, + uint32_t x1 __unused, uint32_t y1 __unused, uint32_t w __unused) +{ +} + +void +gfx_fb_bezier(uint32_t x0 __unused, uint32_t y0 __unused, + uint32_t x1 __unused, uint32_t y1 __unused, uint32_t x2 __unused, + uint32_t y2 __unused, uint32_t w __unused) +{ +} + +int +gfx_fb_putimage(png_t *png __unused, uint32_t ux1 __unused, + uint32_t uy1 __unused, uint32_t ux2 __unused, uint32_t uy2 __unused, + uint32_t flags __unused) +{ + return (1); +} From owner-dev-commits-src-all@freebsd.org Mon Jan 4 16:58:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EEC8B4DC62C; Mon, 4 Jan 2021 16:58:05 +0000 (UTC) (envelope-from git@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 4D8hdn6TkYz3J87; Mon, 4 Jan 2021 16:58:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CDBB81CFED; Mon, 4 Jan 2021 16:58:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104Gw5s5075931; Mon, 4 Jan 2021 16:58:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104Gw5Qp075930; Mon, 4 Jan 2021 16:58:05 GMT (envelope-from git) Date: Mon, 4 Jan 2021 16:58:05 GMT Message-Id: <202101041658.104Gw5Qp075930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: e24d4e72c03b - main - loader: fix mips build with gfx_fb MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e24d4e72c03bd7b089c0189cdb460450177c53fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 16:58:06 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=e24d4e72c03bd7b089c0189cdb460450177c53fc commit e24d4e72c03bd7b089c0189cdb460450177c53fc Author: Toomas Soome AuthorDate: 2021-01-04 16:41:04 +0000 Commit: Toomas Soome CommitDate: 2021-01-04 16:57:50 +0000 loader: fix mips build with gfx_fb Need to add stub data and gfx functions to make linking happy. --- stand/mips/beri/loader/Makefile | 6 +++- stand/mips/beri/loader/gfx_fb.c | 78 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/stand/mips/beri/loader/Makefile b/stand/mips/beri/loader/Makefile index 8e554b4b95b9..fa0d48388ea3 100644 --- a/stand/mips/beri/loader/Makefile +++ b/stand/mips/beri/loader/Makefile @@ -48,7 +48,8 @@ SRCS= start.S \ devicename.c \ exec.c \ vers.c \ - arch.c + arch.c \ + gfx_fb.c # libstand front-ends for shared driver code SRCS+= beri_console.c \ @@ -60,6 +61,9 @@ SRCS+= altera_jtag_uart.c \ cfi.c \ sdcard.c +CFLAGS.gfx_fb.c += -I${SRCTOP}/contrib/pnglite +CFLAGS.gfx_fb.c += -I${SRCTOP}/sys/teken + # Since we don't have a backward compatibility issue, default to this on BERI. CFLAGS+= -DBOOT_PROMPT_123 diff --git a/stand/mips/beri/loader/gfx_fb.c b/stand/mips/beri/loader/gfx_fb.c new file mode 100644 index 000000000000..74ff34cf9bd2 --- /dev/null +++ b/stand/mips/beri/loader/gfx_fb.c @@ -0,0 +1,78 @@ +/*- + * Copyright 2021 Toomas Soome + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * mips beri specific gfx stubs. + */ + +#include +#include +#include "bootstrap.h" +#include "gfx_fb.h" + +font_list_t fonts = STAILQ_HEAD_INITIALIZER(fonts); +teken_gfx_t gfx_state = { 0 }; + +void +gfx_fb_setpixel(uint32_t x __unused, uint32_t y __unused) +{ +} + +void +gfx_fb_drawrect(uint32_t x1 __unused, uint32_t y1 __unused, + uint32_t x2 __unused, uint32_t y2 __unused, uint32_t fill __unused) +{ +} + +void +gfx_term_drawrect(uint32_t x1 __unused, uint32_t y1 __unused, + uint32_t x2 __unused, uint32_t y2 __unused) +{ +} + +void +gfx_fb_line(uint32_t x0 __unused, uint32_t y0 __unused, + uint32_t x1 __unused, uint32_t y1 __unused, uint32_t w __unused) +{ +} + +void +gfx_fb_bezier(uint32_t x0 __unused, uint32_t y0 __unused, + uint32_t x1 __unused, uint32_t y1 __unused, uint32_t x2 __unused, + uint32_t y2 __unused, uint32_t w __unused) +{ +} + +int +gfx_fb_putimage(png_t *png __unused, uint32_t ux1 __unused, + uint32_t uy1 __unused, uint32_t ux2 __unused, uint32_t uy2 __unused, + uint32_t flags __unused) +{ + return (1); +} From owner-dev-commits-src-all@freebsd.org Mon Jan 4 17:23:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0512F4DD8B0; Mon, 4 Jan 2021 17:23:05 +0000 (UTC) (envelope-from git@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 4D8jBc6ms3z3LZq; Mon, 4 Jan 2021 17:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0CC31D666; Mon, 4 Jan 2021 17:23:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104HN4EF014194; Mon, 4 Jan 2021 17:23:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104HN46E014193; Mon, 4 Jan 2021 17:23:04 GMT (envelope-from git) Date: Mon, 4 Jan 2021 17:23:04 GMT Message-Id: <202101041723.104HN46E014193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 12d053032b6b - main - Support overflow count in hwpmc on arm64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 12d053032b6bf51e0563c2720c82a4dba0cc8b82 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 17:23:05 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=12d053032b6bf51e0563c2720c82a4dba0cc8b82 commit 12d053032b6bf51e0563c2720c82a4dba0cc8b82 Author: Andrew Turner AuthorDate: 2020-12-29 12:44:45 +0000 Commit: Andrew Turner CommitDate: 2021-01-04 17:14:41 +0000 Support overflow count in hwpmc on arm64 We increment the overflow count when receiving an overflow interrupt with special care to check if it happens while reading the event counter. Sponsored by: Innovate UK --- sys/dev/hwpmc/hwpmc_arm64.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index 4ae8645abaf6..15ea4f892ed0 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -195,6 +195,8 @@ arm64_read_pmc(int cpu, int ri, pmc_value_t *v) { pmc_value_t tmp; struct pmc *pm; + register_t s; + int reg; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[arm64,%d] illegal CPU value %d", __LINE__, cpu)); @@ -203,7 +205,23 @@ arm64_read_pmc(int cpu, int ri, pmc_value_t *v) pm = arm64_pcpu[cpu]->pc_arm64pmcs[ri].phw_pmc; + /* + * Ensure we don't get interrupted while updating the overflow count. + */ + s = intr_disable(); tmp = arm64_pmcn_read(ri); + reg = (1 << ri); + if ((READ_SPECIALREG(pmovsclr_el0) & reg) != 0) { + /* Clear Overflow Flag */ + WRITE_SPECIALREG(pmovsclr_el0, reg); + if (!PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) + pm->pm_overflowcnt++; + + /* Reread counter in case we raced. */ + tmp = arm64_pmcn_read(ri); + } + tmp += 0x100000000llu * pm->pm_overflowcnt; + intr_restore(s); PMCDBG2(MDP, REA, 2, "arm64-read id=%d -> %jd", ri, tmp); if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) @@ -231,6 +249,7 @@ arm64_write_pmc(int cpu, int ri, pmc_value_t v) PMCDBG3(MDP, WRI, 1, "arm64-write cpu=%d ri=%d v=%jx", cpu, ri, v); + pm->pm_overflowcnt = v >> 32; arm64_pmcn_write(ri, v); return 0; @@ -342,9 +361,6 @@ arm64_intr(struct trapframe *tf) pm = arm64_pcpu[cpu]->pc_arm64pmcs[ri].phw_pmc; if (pm == NULL) continue; - if (!PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) - continue; - /* Check if counter is overflowed */ reg = (1 << ri); if ((READ_SPECIALREG(pmovsclr_el0) & reg) == 0) @@ -355,6 +371,12 @@ arm64_intr(struct trapframe *tf) isb(); retval = 1; /* Found an interrupting PMC. */ + + if (!PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) { + pm->pm_overflowcnt += 1; + continue; + } + if (pm->pm_state != PMC_STATE_RUNNING) continue; From owner-dev-commits-src-all@freebsd.org Mon Jan 4 18:47:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 563594C070D; Mon, 4 Jan 2021 18:47:55 +0000 (UTC) (envelope-from git@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 4D8l4W200zz3jPY; Mon, 4 Jan 2021 18:47:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32C7D1EC22; Mon, 4 Jan 2021 18:47:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104Iltht019197; Mon, 4 Jan 2021 18:47:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104IltI5019196; Mon, 4 Jan 2021 18:47:55 GMT (envelope-from git) Date: Mon, 4 Jan 2021 18:47:55 GMT Message-Id: <202101041847.104IltI5019196@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 25e00a2894ea - stable/12 - Fix daily_backup_gpart_exclude in periodic daily 221.backup-gpart MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 25e00a2894ea4ea2cbe64f25d9f3d99b60d1ea32 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 18:47:55 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=25e00a2894ea4ea2cbe64f25d9f3d99b60d1ea32 commit 25e00a2894ea4ea2cbe64f25d9f3d99b60d1ea32 Author: Ed Maste AuthorDate: 2020-12-27 00:24:18 +0000 Commit: Ed Maste CommitDate: 2021-01-04 18:47:46 +0000 Fix daily_backup_gpart_exclude in periodic daily 221.backup-gpart Since gpart_devs was not quoted (losing embedded newlines), if daily_backup_gpart_exclude matched something, gpart_devs was empty. PR: 251961 Submitted by: Kan Sasaki (cherry picked from commit 93900fc697992f893e2e69dce0c2f67b1f66a774) --- usr.sbin/periodic/etc/daily/221.backup-gpart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/periodic/etc/daily/221.backup-gpart b/usr.sbin/periodic/etc/daily/221.backup-gpart index d71bd8ffe12a..b2bfde820272 100755 --- a/usr.sbin/periodic/etc/daily/221.backup-gpart +++ b/usr.sbin/periodic/etc/daily/221.backup-gpart @@ -54,7 +54,7 @@ case "$daily_backup_gpart_enable" in gpart_devs=$(gpart show | awk '$1 == "=>" { print $4 }') if [ -n "$daily_backup_gpart_exclude" ]; then - gpart_devs=$(echo ${gpart_devs} | grep -E -v "${daily_backup_gpart_exclude}") + gpart_devs=$(echo "${gpart_devs}" | grep -E -v "${daily_backup_gpart_exclude}") fi if [ -z "$gpart_devs" ]; then From owner-dev-commits-src-all@freebsd.org Mon Jan 4 19:26:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3DA4A4C4A4E; Mon, 4 Jan 2021 19:26:14 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8lwh6J4Nz3qR7; Mon, 4 Jan 2021 19:26:12 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1609788369; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y0sHeKVPiQ/fKh+lCzfZwR6mg2xEEOJRrFTVivciiCU=; b=tsni+SZzxTxmhgBJr7d3lHLG0VgJSPWOi99jHhsGGj2hGN48lzHI0GvZkgvSghLP8YIZWT eFrnZdY9QgbOwAou/ftDePxfhaex/jdJJFgQoVJ6rSSYrC17Lgw1UqmMcfsb3Nq1rIBZO6 FkTE2K4jannQQP8KSI8eb3PT8WOqwGA= Received: from amy.home (lfbn-idf2-1-745-114.w86-247.abo.wanadoo.fr [86.247.192.114]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 6a45dde2 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 Jan 2021 19:26:08 +0000 (UTC) Date: Mon, 4 Jan 2021 20:26:08 +0100 From: Emmanuel Vadot To: Konstantin Belousov Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org, greg@unrelenting.technology Subject: Re: git: 44c5db52e258 - main - Add eventfd(3) wrappers to libc. Message-Id: <20210104202608.c7b0645ca0af0d6ff171f375@bidouilliste.com> In-Reply-To: <202012271057.0BRAvdLB013895@gitrepo.freebsd.org> References: <202012271057.0BRAvdLB013895@gitrepo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4D8lwh6J4Nz3qR7 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mx header.b=tsni+SZz; dmarc=pass (policy=none) header.from=bidouilliste.com; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.155.74 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-3.50 / 15.00]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mx]; FREEFALL_USER(0.00)[manu]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+mx]; ARC_NA(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[212.83.155.74:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bidouilliste.com:+]; DMARC_POLICY_ALLOW(-0.50)[bidouilliste.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[212.83.155.74:from]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 19:26:14 -0000 Hello, This break devel/glib20 I don't have much info, just logs from two poudriere build : https://people.freebsd.org/~manu/glib-2.66.4_1,1-7f4e724829.log https://people.freebsd.org/~manu/glib-2.66.4_1,1-9dd48b87e6.log Cheers, On Sun, 27 Dec 2020 10:57:39 GMT Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=44c5db52e258aebed0c5d01047c79bc3d8487966 > > commit 44c5db52e258aebed0c5d01047c79bc3d8487966 > Author: Konstantin Belousov > AuthorDate: 2020-12-23 14:16:35 +0000 > Commit: Konstantin Belousov > CommitDate: 2020-12-27 10:57:26 +0000 > > Add eventfd(3) wrappers to libc. > > eventfd_read/write one-liners are from musl libc. > > Submitted by: greg@unrelenting.technology > Reviewed by: markj (previous version) > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D26668 > --- > lib/libc/gen/Makefile.inc | 1 + > lib/libc/gen/Symbol.map | 3 +++ > lib/libc/gen/eventfd.c | 54 +++++++++++++++++++++++++++++++++++++++++ > lib/libc/include/libc_private.h | 1 + > lib/libc/sys/Makefile.inc | 3 +++ > 5 files changed, 62 insertions(+) > > diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc > index c0d719371fc8..76a21975f1ac 100644 > --- a/lib/libc/gen/Makefile.inc > +++ b/lib/libc/gen/Makefile.inc > @@ -47,6 +47,7 @@ SRCS+= __getosreldate.c \ > err.c \ > errlst.c \ > errno.c \ > + eventfd.c \ > exec.c \ > exect.c \ > fdevname.c \ > diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map > index 2fb8e080de6a..c89eb63caada 100644 > --- a/lib/libc/gen/Symbol.map > +++ b/lib/libc/gen/Symbol.map > @@ -422,6 +422,9 @@ FBSD_1.5 { > }; > > FBSD_1.6 { > + eventfd; > + eventfd_read; > + eventfd_write; > getlogin_r; > memalign; > scandir_b; > diff --git a/lib/libc/gen/eventfd.c b/lib/libc/gen/eventfd.c > new file mode 100644 > index 000000000000..b757f82029a9 > --- /dev/null > +++ b/lib/libc/gen/eventfd.c > @@ -0,0 +1,54 @@ > +/*- > + * SPDX-License-Identifier: MIT > + * > + * Copyright (c) 2005-2020 Rich Felker, et al. > + * Copyright (c) 2020 Greg V > + * > + * Permission is hereby granted, free of charge, to any person obtaining > + * a copy of this software and associated documentation files (the > + * "Software"), to deal in the Software without restriction, including > + * without limitation the rights to use, copy, modify, merge, publish, > + * distribute, sublicense, and/or sell copies of the Software, and to > + * permit persons to whom the Software is furnished to do so, subject to > + * the following conditions: > + * > + * The above copyright notice and this permission notice shall be > + * included in all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. > + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY > + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, > + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE > + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include "namespace.h" > +#include > +#include > +#include > +#include "un-namespace.h" > +#include "libc_private.h" > + > +int eventfd(unsigned int initval, int flags) > +{ > + struct specialfd_eventfd args; > + > + args.initval = initval; > + args.flags = flags; > + return (__sys___specialfd(SPECIALFD_EVENTFD, &args, sizeof(args))); > +} > + > +int eventfd_read(int fd, eventfd_t *value) > +{ > + return (sizeof(*value) == _read(fd, value, sizeof(*value)) ? 0 : -1); > +} > + > +int eventfd_write(int fd, eventfd_t value) > +{ > + return (sizeof(value) == _write(fd, &value, sizeof(value)) ? 0 : -1); > +} > diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h > index 21f5b1762eb4..d26c78c21c07 100644 > --- a/lib/libc/include/libc_private.h > +++ b/lib/libc/include/libc_private.h > @@ -382,6 +382,7 @@ int __sys_sigtimedwait(const __sigset_t *, struct __siginfo *, > const struct timespec *); > int __sys_sigwait(const __sigset_t *, int *); > int __sys_sigwaitinfo(const __sigset_t *, struct __siginfo *); > +int __sys___specialfd(int, const void *, __size_t); > int __sys_statfs(const char *, struct statfs *); > int __sys_swapcontext(struct __ucontext *, > const struct __ucontext *); > diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc > index 38156ccf507d..d43a59719563 100644 > --- a/lib/libc/sys/Makefile.inc > +++ b/lib/libc/sys/Makefile.inc > @@ -178,6 +178,7 @@ MAN+= abort2.2 \ > cpuset_getaffinity.2 \ > cpuset_getdomain.2 \ > dup.2 \ > + eventfd.2 \ > execve.2 \ > _exit.2 \ > extattr_get_file.2 \ > @@ -379,6 +380,8 @@ MLINKS+=cpuset.2 cpuset_getid.2 \ > MLINKS+=cpuset_getaffinity.2 cpuset_setaffinity.2 > MLINKS+=cpuset_getdomain.2 cpuset_setdomain.2 > MLINKS+=dup.2 dup2.2 > +MLINKS+=eventfd.2 eventfd_read.3 \ > + eventfd.2 eventfd_write.3 > MLINKS+=execve.2 fexecve.2 > MLINKS+=extattr_get_file.2 extattr.2 \ > extattr_get_file.2 extattr_delete_fd.2 \ -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Mon Jan 4 19:51:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6DA174C8695; Mon, 4 Jan 2021 19:51:47 +0000 (UTC) (envelope-from greg@unrelenting.technology) Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) (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 4D8mVC2Bv4z3tvK; Mon, 4 Jan 2021 19:51:47 +0000 (UTC) (envelope-from greg@unrelenting.technology) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unrelenting.technology; s=default; t=1609789905; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6LvlpDwfjQnrdL/Ib8MNYYTvFa+N573AxHtDZje12fw=; b=cSoJtpaMWU7KvB8H6DP7TPRtyxnyhyJhpF1tjWJjsTjZwRNGYgZ9hW/Xp/gTLp7NqxNwD5 XhGPzq14208G1SWvzJ9iPpeoYJI1H7nZx0zJcf0qUuV412pUXLVKIizEHbqiTG03y2JOg1 9xzsLPZElXKtvcomkCsdx0lPU5OYffE= From: myfreeweb To: Emmanuel Vadot , Konstantin Belousov CC: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 44c5db52e258 - main - Add eventfd(3) wrappers to libc. In-Reply-To: <20210104202608.c7b0645ca0af0d6ff171f375@bidouilliste.com> References: <202012271057.0BRAvdLB013895@gitrepo.freebsd.org> <20210104202608.c7b0645ca0af0d6ff171f375@bidouilliste.com> Message-ID: <46188CDB-0263-4644-BA0F-603CA24AA209@unrelenting.technology> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: greg@unrelenting.technology Date: Mon, 04 Jan 2021 19:51:45 GMT X-Rspamd-Queue-Id: 4D8mVC2Bv4z3tvK X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 19:51:47 -0000 On January 4, 2021 7:26:08 PM UTC, Emmanuel Vadot wrote: > > Hello, > > This break devel/glib20 > > I don't have much info, just logs from two poudriere build :=20 >https://people=2Efreebsd=2Eorg/~manu/glib-2=2E66=2E4_1,1-7f4e724829=2Elog >https://people=2Efreebsd=2Eorg/~manu/glib-2=2E66=2E4_1,1-9dd48b87e6=2Elog Sounds like you have eventfd in libc only (in the poudriere jail) but not = in the kernel: > !!! Jail is newer than host=2E (Jail: 1300133, Host: 1300131) !!! From owner-dev-commits-src-all@freebsd.org Mon Jan 4 19:55:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 966314C8B24; Mon, 4 Jan 2021 19:55:18 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8mZG0H7yz3v1y; Mon, 4 Jan 2021 19:55:17 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1609790116; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h/34H+304Qmxk5w7Q3AaTqUtiNt1MF7t1yU28tG2pt0=; b=RS60R2NOxPVa2nl8eCmijWFQ4TLNwB0YWzek5McP1bmUw4c6F35fA2LI0FoTMEOXfKa3MQ 0JpCD6XcEiQlNxG5cJB8H4vvd/OVTUjtjbOLbq7HbBHkg+DlnjKFt4zkmxjBT00C0chgc7 0aR6AnbUrlSRfH4refwMjZzliqOscco= Received: from amy.home (lfbn-idf2-1-745-114.w86-247.abo.wanadoo.fr [86.247.192.114]) by mx.blih.net (OpenSMTPD) with ESMTPSA id aa4d292f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 Jan 2021 19:55:16 +0000 (UTC) Date: Mon, 4 Jan 2021 20:55:15 +0100 From: Emmanuel Vadot To: myfreeweb Cc: Konstantin Belousov , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 44c5db52e258 - main - Add eventfd(3) wrappers to libc. Message-Id: <20210104205515.d4bc0672f7497f7445eb346f@bidouilliste.com> In-Reply-To: <46188CDB-0263-4644-BA0F-603CA24AA209@unrelenting.technology> References: <202012271057.0BRAvdLB013895@gitrepo.freebsd.org> <20210104202608.c7b0645ca0af0d6ff171f375@bidouilliste.com> <46188CDB-0263-4644-BA0F-603CA24AA209@unrelenting.technology> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4D8mZG0H7yz3v1y X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 19:55:18 -0000 On Mon, 04 Jan 2021 19:51:45 GMT myfreeweb wrote: > > > On January 4, 2021 7:26:08 PM UTC, Emmanuel Vadot wrote: > > > > Hello, > > > > This break devel/glib20 > > > > I don't have much info, just logs from two poudriere build : > >https://people.freebsd.org/~manu/glib-2.66.4_1,1-7f4e724829.log > >https://people.freebsd.org/~manu/glib-2.66.4_1,1-9dd48b87e6.log > > Sounds like you have eventfd in libc only (in the poudriere jail) but not in the kernel: > > > !!! Jail is newer than host. (Jail: 1300133, Host: 1300131) !!! Yeah I've just realized that I haven't upgraded this host and was about to reply to my mail :) Sorry for the noise. -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Mon Jan 4 19:57:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 656044C87EA; Mon, 4 Jan 2021 19:57:41 +0000 (UTC) (envelope-from git@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 4D8md12QhVz3vLR; Mon, 4 Jan 2021 19:57:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 460991FA6E; Mon, 4 Jan 2021 19:57:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104JvfJ2009274; Mon, 4 Jan 2021 19:57:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104JvftT009273; Mon, 4 Jan 2021 19:57:41 GMT (envelope-from git) Date: Mon, 4 Jan 2021 19:57:41 GMT Message-Id: <202101041957.104JvftT009273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 459511895e48 - main - cap_sysctl: expose structures and variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 459511895e48e8f0a6673bd452812e994d96a960 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 19:57:41 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=459511895e48e8f0a6673bd452812e994d96a960 commit 459511895e48e8f0a6673bd452812e994d96a960 Author: Mariusz Zaborski AuthorDate: 2021-01-04 19:56:07 +0000 Commit: Mariusz Zaborski CommitDate: 2021-01-04 19:56:07 +0000 cap_sysctl: expose structures and variables Expose structures and variables that may be used on systems build without Casper support. --- lib/libcasper/services/cap_sysctl/cap_sysctl.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/libcasper/services/cap_sysctl/cap_sysctl.h b/lib/libcasper/services/cap_sysctl/cap_sysctl.h index df0fb7fd6f45..5a338d672a84 100644 --- a/lib/libcasper/services/cap_sysctl/cap_sysctl.h +++ b/lib/libcasper/services/cap_sysctl/cap_sysctl.h @@ -38,12 +38,16 @@ #include -#ifdef WITH_CASPER #define CAP_SYSCTL_READ 0x01 #define CAP_SYSCTL_WRITE 0x02 #define CAP_SYSCTL_RDWR (CAP_SYSCTL_READ | CAP_SYSCTL_WRITE) #define CAP_SYSCTL_RECURSIVE 0x04 +struct cap_sysctl_limit; +typedef struct cap_sysctl_limit cap_sysctl_limit_t; + +#ifdef WITH_CASPER + __BEGIN_DECLS int cap_sysctl(cap_channel_t *chan, const int *name, u_int namelen, void *oldp, @@ -53,9 +57,6 @@ int cap_sysctlbyname(cap_channel_t *chan, const char *name, void *oldp, int cap_sysctlnametomib(cap_channel_t *chan, const char *name, int *mibp, size_t *sizep); -struct cap_sysctl_limit; -typedef struct cap_sysctl_limit cap_sysctl_limit_t; - cap_sysctl_limit_t *cap_sysctl_limit_init(cap_channel_t *); cap_sysctl_limit_t *cap_sysctl_limit_name(cap_sysctl_limit_t *limit, const char *name, int flags); From owner-dev-commits-src-all@freebsd.org Mon Jan 4 19:57:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 78EE34C87EB; Mon, 4 Jan 2021 19:57:41 +0000 (UTC) (envelope-from git@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 4D8md132cPz3vTf; Mon, 4 Jan 2021 19:57:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5765E1FABC; Mon, 4 Jan 2021 19:57:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104Jvf3Q009291; Mon, 4 Jan 2021 19:57:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104JvfmM009290; Mon, 4 Jan 2021 19:57:41 GMT (envelope-from git) Date: Mon, 4 Jan 2021 19:57:41 GMT Message-Id: <202101041957.104JvfmM009290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 8c121177f063 - main - casper: convert macros to inline functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c121177f063a187534dcd475b136c34474802cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 19:57:41 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=8c121177f063a187534dcd475b136c34474802cd commit 8c121177f063a187534dcd475b136c34474802cd Author: Mariusz Zaborski AuthorDate: 2021-01-04 19:50:58 +0000 Commit: Mariusz Zaborski CommitDate: 2021-01-04 19:55:35 +0000 casper: convert macros to inline functions In libcasper, the first argument to the function is a structure that represents a connection to Casper. On systems without Casper, macros are used to interpose the Casper functions to standard libc ones. This may cause errors/warnings that the variable is not used. With the inline function, there is no such problem. --- lib/libcasper/services/cap_pwd/cap_pwd.h | 109 +++++++++++++++++++++---- lib/libcasper/services/cap_sysctl/cap_sysctl.h | 65 ++++++++++++--- 2 files changed, 145 insertions(+), 29 deletions(-) diff --git a/lib/libcasper/services/cap_pwd/cap_pwd.h b/lib/libcasper/services/cap_pwd/cap_pwd.h index 74b9de098e2d..d8de56c3bea9 100644 --- a/lib/libcasper/services/cap_pwd/cap_pwd.h +++ b/lib/libcasper/services/cap_pwd/cap_pwd.h @@ -66,24 +66,97 @@ int cap_pwd_limit_users(cap_channel_t *chan, const char * const *names, __END_DECLS #else -#define cap_getpwent(chan) getpwent() -#define cap_getpwnam(chan, login) getpwnam(login) -#define cap_getpwuid(chan, uid) getpwuid(uid) - -#define cap_getpwent_r(chan, pwd, buffer, bufsize, result) \ - getpwent_r(pwd, buffer, bufsize, result) -#define cap_getpwnam_r(chan, name, pwd, buffer, bufsize, result) \ - getpwnam_r(name, pwd, buffer, bufsize, result) -#define cap_getpwuid_r(chan, uid, pwd, buffer, bufsize, result) \ - getpwuid_r(uid, pwd, buffer, bufsize, result) - -#define cap_setpassent(chan, stayopen) setpassent(stayopen) -#define cap_setpwent(chan) setpwent() -#define cap_endpwent(chan) endpwent() - -#define cap_pwd_limit_cmds(chan, cmds, ncmds) (0) -#define cap_pwd_limit_fields(chan, fields, nfields) (0) -#define cap_pwd_limit_users(chan, names, nnames, uids, nuids) (0) + +static inline struct passwd * +cap_getpwent(cap_channel_t *chan __unused) +{ + + return (getpwent()); +} + +static inline struct passwd * +cap_getpwnam(cap_channel_t *chan __unused, const char *login) +{ + + return (getpwnam(login)); +} + +static inline struct passwd * +cap_getpwuid(cap_channel_t *chan __unused, uid_t uid) +{ + + return (getpwuid(uid)); +} + +static inline int +cap_getpwent_r(cap_channel_t *chan __unused, struct passwd *pwd, char *buffer, + size_t bufsize, struct passwd **result) +{ + + return (getpwent_r(pwd, buffer, bufsize, result)); +} + +static inline int +cap_getpwnam_r(cap_channel_t *chan __unused, const char *name, + struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result) +{ + + return (getpwnam_r(name, pwd, buffer, bufsize, result)); +} + +static inline int +cap_getpwuid_r(cap_channel_t *chan __unused, uid_t uid, struct passwd *pwd, + char *buffer, size_t bufsize, struct passwd **result) +{ + + return (getpwuid_r(uid, pwd, buffer, bufsize, result)); +} + +static inline int +cap_setpassent(cap_channel_t *chan __unused, int stayopen) +{ + + return (setpassent(stayopen)); +} + +static inline void +cap_setpwent(cap_channel_t *chan __unused) +{ + + return (setpwent()); +} + +static inline void +cap_endpwent(cap_channel_t *chan __unused) +{ + + return (endpwent()); +} + +static inline int +cap_pwd_limit_cmds(cap_channel_t *chan __unused, + const char * const *cmds __unused, size_t ncmds __unused) +{ + + return (0); +} + +static inline int +cap_pwd_limit_fields(cap_channel_t *chan __unused, + const char * const *fields __unused, size_t nfields __unused) +{ + + return (0); +} + +static inline int +cap_pwd_limit_users(cap_channel_t *chan __unused, + const char * const *names __unused, size_t nnames __unused, + uid_t *uids __unused, size_t nuids __unused) +{ + + return (0); +} #endif #endif /* !_CAP_PWD_H_ */ diff --git a/lib/libcasper/services/cap_sysctl/cap_sysctl.h b/lib/libcasper/services/cap_sysctl/cap_sysctl.h index 226d7766a95e..df0fb7fd6f45 100644 --- a/lib/libcasper/services/cap_sysctl/cap_sysctl.h +++ b/lib/libcasper/services/cap_sysctl/cap_sysctl.h @@ -66,17 +66,60 @@ int cap_sysctl_limit(cap_sysctl_limit_t *limit); __END_DECLS #else /* !WITH_CASPER */ -#define cap_sysctl(chan, name, namelen, oldp, oldlenp, newp, newlen) \ - sysctl((name), (namelen), (oldp), (oldlenp), (newp), (newlen)) -#define cap_sysctlbyname(chan, name, oldp, oldlenp, newp, newlen) \ - sysctlbyname((name), (oldp), (oldlenp), (newp), (newlen)) -#define cap_sysctlnametomib(chan, name, mibp, sizep) \ - sysctlnametomib((name), (mibp), (sizep)) - -#define cap_sysctl_limit_init(chan) (NULL) -#define cap_sysctl_limit_name(limit, name, flags) (NULL) -#define cap_sysctl_limit_mib(limit, mibp, miblen, flags) (NULL) -#define cap_sysctl_limit(limit) (0) +static inline int +cap_sysctl(cap_channel_t *chan __unused, const int *name, u_int namelen, + void *oldp, size_t *oldlenp, const void *newp, size_t newlen) +{ + + return (sysctl(name, namelen, oldp, oldlenp, newp, newlen)); +} + +static inline int +cap_sysctlbyname(cap_channel_t *chan __unused, const char *name, + void *oldp, size_t *oldlenp, const void *newp, size_t newlen) +{ + + return (sysctlbyname(name, oldp, oldlenp, newp, newlen)); +} + +static inline int +cap_sysctlnametomib(cap_channel_t *chan __unused, const char *name, int *mibp, + size_t *sizep) +{ + + return (sysctlnametomib(name, mibp, sizep)); +} + +static inline cap_sysctl_limit_t * +cap_sysctl_limit_init(cap_channel_t *limit __unused) +{ + + return (NULL); +} + +static inline cap_sysctl_limit_t * +cap_sysctl_limit_name(cap_sysctl_limit_t *limit __unused, + const char *name __unused, int flags __unused) +{ + + return (NULL); +} + +static inline cap_sysctl_limit_t * +cap_sysctl_limit_mib(cap_sysctl_limit_t *limit __unused, + const int *mibp __unused, u_int miblen __unused, + int flags __unused) +{ + + return (NULL); +} + +static inline int +cap_sysctl_limit(cap_sysctl_limit_t *limit __unused) +{ + + return (0); +} #endif /* WITH_CASPER */ #endif /* !_CAP_SYSCTL_H_ */ From owner-dev-commits-src-all@freebsd.org Mon Jan 4 19:57:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 882394C86CF; Mon, 4 Jan 2021 19:57:41 +0000 (UTC) (envelope-from git@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 4D8md13W2Hz3vNw; Mon, 4 Jan 2021 19:57:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A7B51FABD; Mon, 4 Jan 2021 19:57:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104JvfvV009308; Mon, 4 Jan 2021 19:57:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104JvfGS009307; Mon, 4 Jan 2021 19:57:41 GMT (envelope-from git) Date: Mon, 4 Jan 2021 19:57:41 GMT Message-Id: <202101041957.104JvfGS009307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 381073282961 - main - lib9p: fix building on systems without capser MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 381073282961af9d11d6225fcf9dfdf650915acf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 19:57:41 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=381073282961af9d11d6225fcf9dfdf650915acf commit 381073282961af9d11d6225fcf9dfdf650915acf Author: Mariusz Zaborski AuthorDate: 2021-01-04 19:48:48 +0000 Commit: Mariusz Zaborski CommitDate: 2021-01-04 19:48:48 +0000 lib9p: fix building on systems without capser PR: 252353 --- lib/lib9p/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/lib9p/Makefile b/lib/lib9p/Makefile index c909bdb1f781..c810ccd79e64 100644 --- a/lib/lib9p/Makefile +++ b/lib/lib9p/Makefile @@ -1,10 +1,15 @@ # $FreeBSD$ +.include + .PATH: ${.CURDIR}/../../contrib/lib9p -CFLAGS+= -DWITH_CASPER CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/../../contrib/lib9p +.if ${MK_CASPER} != "no" +CFLAGS+= -DWITH_CASPER +.endif + LIB= 9p PACKAGE= lib${LIB} SHLIB_MAJOR= 1 From owner-dev-commits-src-all@freebsd.org Mon Jan 4 20:12:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5C8B54C93A5; Mon, 4 Jan 2021 20:12: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 4D8mxZ05ccz4QxC; Mon, 4 Jan 2021 20:12: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 104KBqQa067266 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 4 Jan 2021 22:11:55 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 104KBqQa067266 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 104KBqnI067265; Mon, 4 Jan 2021 22:11:52 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 4 Jan 2021 22:11:52 +0200 From: Konstantin Belousov To: Emmanuel Vadot Cc: myfreeweb , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 44c5db52e258 - main - Add eventfd(3) wrappers to libc. Message-ID: References: <202012271057.0BRAvdLB013895@gitrepo.freebsd.org> <20210104202608.c7b0645ca0af0d6ff171f375@bidouilliste.com> <46188CDB-0263-4644-BA0F-603CA24AA209@unrelenting.technology> <20210104205515.d4bc0672f7497f7445eb346f@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210104205515.d4bc0672f7497f7445eb346f@bidouilliste.com> 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: 4D8mxZ05ccz4QxC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 20:12:02 -0000 On Mon, Jan 04, 2021 at 08:55:15PM +0100, Emmanuel Vadot wrote: > On Mon, 04 Jan 2021 19:51:45 GMT > myfreeweb wrote: > > > > > > > On January 4, 2021 7:26:08 PM UTC, Emmanuel Vadot wrote: > > > > > > Hello, > > > > > > This break devel/glib20 > > > > > > I don't have much info, just logs from two poudriere build : > > >https://people.freebsd.org/~manu/glib-2.66.4_1,1-7f4e724829.log > > >https://people.freebsd.org/~manu/glib-2.66.4_1,1-9dd48b87e6.log > > > > Sounds like you have eventfd in libc only (in the poudriere jail) but not in the kernel: > > > > > !!! Jail is newer than host. (Jail: 1300133, Host: 1300131) !!! > > Yeah I've just realized that I haven't upgraded this host and was > about to reply to my mail :) > Sorry for the noise. So does it work, ultimately ? I would be not surprised that we somewhat deviate from the Linux interface. From owner-dev-commits-src-all@freebsd.org Mon Jan 4 20:16:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 107394C974C; Mon, 4 Jan 2021 20:16:09 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8n2J44mGz4RJf; Mon, 4 Jan 2021 20:16:08 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1609791366; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9xLw1mWoMC7e7TYHNSHSQlhOFS/2iwsctjK69qV+1oE=; b=tk+VlDoULnD4eXzOp+MHZFPOI0uZYgJYQMaK+lZpcAkoyyxiOF2U4AvHsUZtymVAzOUs+x gvS7kTHwtNIKJGv4Jo/z9mM2FP7O9CQlpkIkj61Kgl1h9bqobalKWl+4ZsZVT3GoPv0mWm YEiQMD1O9z6SA4TBAbHtNk5E2jp23dI= Received: from amy.home (lfbn-idf2-1-745-114.w86-247.abo.wanadoo.fr [86.247.192.114]) by mx.blih.net (OpenSMTPD) with ESMTPSA id a1571b86 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 Jan 2021 20:16:06 +0000 (UTC) Date: Mon, 4 Jan 2021 21:16:05 +0100 From: Emmanuel Vadot To: Konstantin Belousov Cc: myfreeweb , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 44c5db52e258 - main - Add eventfd(3) wrappers to libc. Message-Id: <20210104211605.95966b493d4f80a472631e56@bidouilliste.com> In-Reply-To: References: <202012271057.0BRAvdLB013895@gitrepo.freebsd.org> <20210104202608.c7b0645ca0af0d6ff171f375@bidouilliste.com> <46188CDB-0263-4644-BA0F-603CA24AA209@unrelenting.technology> <20210104205515.d4bc0672f7497f7445eb346f@bidouilliste.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4D8n2J44mGz4RJf X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 20:16:09 -0000 On Mon, 4 Jan 2021 22:11:52 +0200 Konstantin Belousov wrote: > On Mon, Jan 04, 2021 at 08:55:15PM +0100, Emmanuel Vadot wrote: > > On Mon, 04 Jan 2021 19:51:45 GMT > > myfreeweb wrote: > > > > > > > > > > > On January 4, 2021 7:26:08 PM UTC, Emmanuel Vadot wrote: > > > > > > > > Hello, > > > > > > > > This break devel/glib20 > > > > > > > > I don't have much info, just logs from two poudriere build : > > > >https://people.freebsd.org/~manu/glib-2.66.4_1,1-7f4e724829.log > > > >https://people.freebsd.org/~manu/glib-2.66.4_1,1-9dd48b87e6.log > > > > > > Sounds like you have eventfd in libc only (in the poudriere jail) but not in the kernel: > > > > > > > !!! Jail is newer than host. (Jail: 1300133, Host: 1300131) !!! > > > > Yeah I've just realized that I haven't upgraded this host and was > > about to reply to my mail :) > > Sorry for the noise. > So does it work, ultimately ? I would be not surprised that we somewhat > deviate from the Linux interface. I'm updating the host and will let you know. -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Mon Jan 4 20:49:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 49E394CB218; Mon, 4 Jan 2021 20:49:28 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8nmm0FvFz4TdM; Mon, 4 Jan 2021 20:49:27 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 104KnJP8004913; Mon, 4 Jan 2021 12:49:19 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 104KnJ05004912; Mon, 4 Jan 2021 12:49:19 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202101042049.104KnJ05004912@gndrsh.dnsmgr.net> Subject: Re: git: 2d486ba15f33 - main - pkgbase: Move bectl to the runtime package In-Reply-To: <202101041525.104FPMAD059259@gitrepo.freebsd.org> To: Emmanuel Vadot Date: Mon, 4 Jan 2021 12:49:19 -0800 (PST) CC: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4D8nmm0FvFz4TdM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 20:49:28 -0000 > The branch main has been updated by manu: > > URL: https://cgit.FreeBSD.org/src/commit/?id=2d486ba15f3367072d631ee588192ef46687fa4b > > commit 2d486ba15f3367072d631ee588192ef46687fa4b > Author: Emmanuel Vadot > AuthorDate: 2020-12-21 15:00:02 +0000 > Commit: Emmanuel Vadot > CommitDate: 2021-01-04 15:17:12 +0000 > > pkgbase: Move bectl to the runtime package > > runtime contain what is needed to boot in single user and repair a > system, bectl could be handy to have in this situation. I would think it belongs in the zfs package, as unless you have zfs you do not need bectrl. > > Differential Revision: https://reviews.freebsd.org/D27708 > --- > lib/libbe/Makefile | 1 + > sbin/bectl/Makefile | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/lib/libbe/Makefile b/lib/libbe/Makefile > index 291e2438ee2a..d1fab41578bf 100644 > --- a/lib/libbe/Makefile > +++ b/lib/libbe/Makefile > @@ -4,6 +4,7 @@ SHLIBDIR?= /lib > > .include > > +PACKAGE= runtime > LIB= be > SHLIB_MAJOR= 1 > SHLIB_MINOR= 0 > diff --git a/sbin/bectl/Makefile b/sbin/bectl/Makefile > index 6fa84f48661d..46d43306b9ca 100644 > --- a/sbin/bectl/Makefile > +++ b/sbin/bectl/Makefile > @@ -2,6 +2,7 @@ > > .include > > +PACKAGE=runtime > PROG= bectl > MAN= bectl.8 > > -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-all@freebsd.org Mon Jan 4 20:52:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8D16A4CBCC0; Mon, 4 Jan 2021 20:52:12 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8nqv6WYmz4V93; Mon, 4 Jan 2021 20:52:11 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1609793529; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g9BKqYfH3s4UFmMV6j2p96xY4+93D6TzW1Tmi4qLO2I=; b=AkKm+ZSbVA46vmD8aDSwTg1I+S2Fws5SJZ/TvwkcVAdntY0mCS9h8TdhKk2iBVE3g7+SFG QVD6JXdDR1dowvoVQnemPx4NWgf1CQWh9nnVjvJEVJvhfPSY6I8GPnbLpG1Ugyv1qpUyrP 9aGZTBfqChaTuHBJomLXE0MOWEN2tt4= Received: from amy.home (lfbn-idf2-1-745-114.w86-247.abo.wanadoo.fr [86.247.192.114]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 6f9e729b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 Jan 2021 20:52:09 +0000 (UTC) Date: Mon, 4 Jan 2021 21:52:08 +0100 From: Emmanuel Vadot To: rgrimes@freebsd.org Cc: "Rodney W. Grimes" , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 2d486ba15f33 - main - pkgbase: Move bectl to the runtime package Message-Id: <20210104215208.d02e08a9ef9fdd0387287784@bidouilliste.com> In-Reply-To: <202101042049.104KnJ05004912@gndrsh.dnsmgr.net> References: <202101041525.104FPMAD059259@gitrepo.freebsd.org> <202101042049.104KnJ05004912@gndrsh.dnsmgr.net> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4D8nqv6WYmz4V93 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 20:52:12 -0000 On Mon, 4 Jan 2021 12:49:19 -0800 (PST) "Rodney W. Grimes" wrote: > > The branch main has been updated by manu: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=2d486ba15f3367072d631ee588192ef46687fa4b > > > > commit 2d486ba15f3367072d631ee588192ef46687fa4b > > Author: Emmanuel Vadot > > AuthorDate: 2020-12-21 15:00:02 +0000 > > Commit: Emmanuel Vadot > > CommitDate: 2021-01-04 15:17:12 +0000 > > > > pkgbase: Move bectl to the runtime package > > > > runtime contain what is needed to boot in single user and repair a > > system, bectl could be handy to have in this situation. > > I would think it belongs in the zfs package, > as unless you have zfs you do not need bectrl. There is no zfs package. Having zfs is controlled by WITH/WITHOUT_ZFS and this is not related to pkgbase. > > > > > Differential Revision: https://reviews.freebsd.org/D27708 > > --- > > lib/libbe/Makefile | 1 + > > sbin/bectl/Makefile | 1 + > > 2 files changed, 2 insertions(+) > > > > diff --git a/lib/libbe/Makefile b/lib/libbe/Makefile > > index 291e2438ee2a..d1fab41578bf 100644 > > --- a/lib/libbe/Makefile > > +++ b/lib/libbe/Makefile > > @@ -4,6 +4,7 @@ SHLIBDIR?= /lib > > > > .include > > > > +PACKAGE= runtime > > LIB= be > > SHLIB_MAJOR= 1 > > SHLIB_MINOR= 0 > > diff --git a/sbin/bectl/Makefile b/sbin/bectl/Makefile > > index 6fa84f48661d..46d43306b9ca 100644 > > --- a/sbin/bectl/Makefile > > +++ b/sbin/bectl/Makefile > > @@ -2,6 +2,7 @@ > > > > .include > > > > +PACKAGE=runtime > > PROG= bectl > > MAN= bectl.8 > > > > > > -- > Rod Grimes rgrimes@freebsd.org -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Mon Jan 4 20:59:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F2E394CC9F1 for ; Mon, 4 Jan 2021 20:59:05 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8nzs4NZHz4VSd; Mon, 4 Jan 2021 20:59:05 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 104KwwpL004967; Mon, 4 Jan 2021 12:58:58 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 104Kwwhx004966; Mon, 4 Jan 2021 12:58:58 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202101042058.104Kwwhx004966@gndrsh.dnsmgr.net> Subject: Re: git: 2d486ba15f33 - main - pkgbase: Move bectl to the runtime package In-Reply-To: <20210104215208.d02e08a9ef9fdd0387287784@bidouilliste.com> To: Emmanuel Vadot Date: Mon, 4 Jan 2021 12:58:58 -0800 (PST) CC: rgrimes@freebsd.org, "Rodney W. Grimes" , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4D8nzs4NZHz4VSd X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 20:59:06 -0000 > On Mon, 4 Jan 2021 12:49:19 -0800 (PST) > "Rodney W. Grimes" wrote: > > > > The branch main has been updated by manu: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=2d486ba15f3367072d631ee588192ef46687fa4b > > > > > > commit 2d486ba15f3367072d631ee588192ef46687fa4b > > > Author: Emmanuel Vadot > > > AuthorDate: 2020-12-21 15:00:02 +0000 > > > Commit: Emmanuel Vadot > > > CommitDate: 2021-01-04 15:17:12 +0000 > > > > > > pkgbase: Move bectl to the runtime package > > > > > > runtime contain what is needed to boot in single user and repair a > > > system, bectl could be handy to have in this situation. > > > > I would think it belongs in the zfs package, > > as unless you have zfs you do not need bectrl. > > There is no zfs package. I would consider that an oversight. > Having zfs is controlled by WITH/WITHOUT_ZFS and this is not related > to pkgbase. WITH/WITHOUT are compile time constructs, pkgbase is an install time set of tools, why can there not be a zfs pkg? > > > > > > > > Differential Revision: https://reviews.freebsd.org/D27708 > > > --- > > > lib/libbe/Makefile | 1 + > > > sbin/bectl/Makefile | 1 + > > > 2 files changed, 2 insertions(+) > > > > > > diff --git a/lib/libbe/Makefile b/lib/libbe/Makefile > > > index 291e2438ee2a..d1fab41578bf 100644 > > > --- a/lib/libbe/Makefile > > > +++ b/lib/libbe/Makefile > > > @@ -4,6 +4,7 @@ SHLIBDIR?= /lib > > > > > > .include > > > > > > +PACKAGE= runtime > > > LIB= be > > > SHLIB_MAJOR= 1 > > > SHLIB_MINOR= 0 > > > diff --git a/sbin/bectl/Makefile b/sbin/bectl/Makefile > > > index 6fa84f48661d..46d43306b9ca 100644 > > > --- a/sbin/bectl/Makefile > > > +++ b/sbin/bectl/Makefile > > > @@ -2,6 +2,7 @@ > > > > > > .include > > > > > > +PACKAGE=runtime > > > PROG= bectl > > > MAN= bectl.8 > > > > > > > > > > -- > > Rod Grimes rgrimes@freebsd.org > > > -- > Emmanuel Vadot > -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-all@freebsd.org Mon Jan 4 21:10:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0CA5A4CD01D; Mon, 4 Jan 2021 21:10:02 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8pDT3By7z4W8B; Mon, 4 Jan 2021 21:10:01 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1609794599; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8PiDbFnctuicHieGmr8q7sdwe2gmaSbDX8BEFl5F89Q=; b=lSOoSMMtNjYVOna2qEB3OVY0LsejgBD2infguO+NGRI05nlUh11RfMlYwUzLNd+bKoNTrJ If9TBtyEnI07SqPjnDkl5T99kKeUiOsOULapktm32OSSK7wV0VDv1INJSwy/67ac8C18PJ REmpnQ12dtt/zChvvwQvXBAhxae7Jgk= Received: from amy.home (lfbn-idf2-1-745-114.w86-247.abo.wanadoo.fr [86.247.192.114]) by mx.blih.net (OpenSMTPD) with ESMTPSA id c1a4770c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 Jan 2021 21:09:59 +0000 (UTC) Date: Mon, 4 Jan 2021 22:09:59 +0100 From: Emmanuel Vadot To: rgrimes@freebsd.org Cc: "Rodney W. Grimes" , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 2d486ba15f33 - main - pkgbase: Move bectl to the runtime package Message-Id: <20210104220959.fb00d9ec75b43c3ed580ae37@bidouilliste.com> In-Reply-To: <202101042058.104Kwwhx004966@gndrsh.dnsmgr.net> References: <20210104215208.d02e08a9ef9fdd0387287784@bidouilliste.com> <202101042058.104Kwwhx004966@gndrsh.dnsmgr.net> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4D8pDT3By7z4W8B X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 21:10:02 -0000 On Mon, 4 Jan 2021 12:58:58 -0800 (PST) "Rodney W. Grimes" wrote: > > On Mon, 4 Jan 2021 12:49:19 -0800 (PST) > > "Rodney W. Grimes" wrote: > > > > > > The branch main has been updated by manu: > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=2d486ba15f3367072d631ee588192ef46687fa4b > > > > > > > > commit 2d486ba15f3367072d631ee588192ef46687fa4b > > > > Author: Emmanuel Vadot > > > > AuthorDate: 2020-12-21 15:00:02 +0000 > > > > Commit: Emmanuel Vadot > > > > CommitDate: 2021-01-04 15:17:12 +0000 > > > > > > > > pkgbase: Move bectl to the runtime package > > > > > > > > runtime contain what is needed to boot in single user and repair a > > > > system, bectl could be handy to have in this situation. > > > > > > I would think it belongs in the zfs package, > > > as unless you have zfs you do not need bectrl. > > > > There is no zfs package. > > I would consider that an oversight. I don't. We don't have a ufs package for example. > > Having zfs is controlled by WITH/WITHOUT_ZFS and this is not related > > to pkgbase. > > WITH/WITHOUT are compile time constructs, pkgbase is an install time > set of tools, why can there not be a zfs pkg? pkgbase is just a reflection of what is built. There can be a zfs package nothing prevent us for having one. But as said in the commit runtime is the package that should contain everything needed for booting to single user and repair a system so it contain zfs related tools (and ufs ones). The idea behind runtime is that if you start upgrading and things break just after it you have all the tools to repair an install. > > > > > > > > > > > Differential Revision: https://reviews.freebsd.org/D27708 > > > > --- > > > > lib/libbe/Makefile | 1 + > > > > sbin/bectl/Makefile | 1 + > > > > 2 files changed, 2 insertions(+) > > > > > > > > diff --git a/lib/libbe/Makefile b/lib/libbe/Makefile > > > > index 291e2438ee2a..d1fab41578bf 100644 > > > > --- a/lib/libbe/Makefile > > > > +++ b/lib/libbe/Makefile > > > > @@ -4,6 +4,7 @@ SHLIBDIR?= /lib > > > > > > > > .include > > > > > > > > +PACKAGE= runtime > > > > LIB= be > > > > SHLIB_MAJOR= 1 > > > > SHLIB_MINOR= 0 > > > > diff --git a/sbin/bectl/Makefile b/sbin/bectl/Makefile > > > > index 6fa84f48661d..46d43306b9ca 100644 > > > > --- a/sbin/bectl/Makefile > > > > +++ b/sbin/bectl/Makefile > > > > @@ -2,6 +2,7 @@ > > > > > > > > .include > > > > > > > > +PACKAGE=runtime > > > > PROG= bectl > > > > MAN= bectl.8 > > > > > > > > > > > > > > -- > > > Rod Grimes rgrimes@freebsd.org > > > > > > -- > > Emmanuel Vadot > > > > -- > Rod Grimes rgrimes@freebsd.org -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Mon Jan 4 21:11:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AAA044CD162; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@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 4D8pFx4SNSz4WWn; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C2BB203F9; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104LBH4S010996; Mon, 4 Jan 2021 21:11:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104LBHu4010995; Mon, 4 Jan 2021 21:11:17 GMT (envelope-from git) Date: Mon, 4 Jan 2021 21:11:17 GMT Message-Id: <202101042111.104LBHu4010995@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 6a45b9926f2e - stable/12 - gdb(4) fix x86 signal reporting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6a45b9926f2ecd90b1948ae469652a0a42071e86 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 21:11:17 -0000 The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=6a45b9926f2ecd90b1948ae469652a0a42071e86 commit 6a45b9926f2ecd90b1948ae469652a0a42071e86 Author: Mitchell Horne AuthorDate: 2020-12-23 19:36:17 +0000 Commit: Mitchell Horne CommitDate: 2021-01-04 21:01:09 +0000 gdb(4) fix x86 signal reporting The existing values correspond to x86 exception vector numbers, but the trap numbers used in the kernel do not match these 1-to-1. Prefer the definitions from x86/trap.h, as they are what actually get passed to kdb_trap(). This is of little consequence, as gdb_cpu_signal() only reports the trap reason (signal number) to the gdb client. This is limited to the subset of trap values for which kdb_trap() is reachable. Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. (cherry picked from commit 962c06c5a32deb9357851d5aca060defc79e6e90) --- sys/amd64/amd64/gdb_machdep.c | 27 ++++++++++++--------------- sys/i386/i386/gdb_machdep.c | 27 ++++++++++++--------------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/sys/amd64/amd64/gdb_machdep.c b/sys/amd64/amd64/gdb_machdep.c index 73022bee7674..8b391bb63dcf 100644 --- a/sys/amd64/amd64/gdb_machdep.c +++ b/sys/amd64/amd64/gdb_machdep.c @@ -136,21 +136,18 @@ gdb_cpu_signal(int type, int code) { switch (type & ~T_USER) { - case 0: return (SIGFPE); /* Divide by zero. */ - case 1: return (SIGTRAP); /* Debug exception. */ - case 3: return (SIGTRAP); /* Breakpoint. */ - case 4: return (SIGSEGV); /* into instr. (overflow). */ - case 5: return (SIGURG); /* bound instruction. */ - case 6: return (SIGILL); /* Invalid opcode. */ - case 7: return (SIGFPE); /* Coprocessor not present. */ - case 8: return (SIGEMT); /* Double fault. */ - case 9: return (SIGSEGV); /* Coprocessor segment overrun. */ - case 10: return (SIGTRAP); /* Invalid TSS (also single-step). */ - case 11: return (SIGSEGV); /* Segment not present. */ - case 12: return (SIGSEGV); /* Stack exception. */ - case 13: return (SIGSEGV); /* General protection. */ - case 14: return (SIGSEGV); /* Page fault. */ - case 16: return (SIGEMT); /* Coprocessor error. */ + case T_BPTFLT: return (SIGTRAP); + case T_ARITHTRAP: return (SIGFPE); + case T_PROTFLT: return (SIGSEGV); + case T_TRCTRAP: return (SIGTRAP); + case T_PAGEFLT: return (SIGSEGV); + case T_DIVIDE: return (SIGFPE); + case T_NMI: return (SIGTRAP); + case T_FPOPFLT: return (SIGILL); + case T_TSSFLT: return (SIGSEGV); + case T_SEGNPFLT: return (SIGSEGV); + case T_STKFLT: return (SIGSEGV); + case T_XMMFLT: return (SIGFPE); } return (SIGEMT); } diff --git a/sys/i386/i386/gdb_machdep.c b/sys/i386/i386/gdb_machdep.c index d501b847fda9..fd522309dbb2 100644 --- a/sys/i386/i386/gdb_machdep.c +++ b/sys/i386/i386/gdb_machdep.c @@ -99,21 +99,18 @@ gdb_cpu_signal(int type, int code) { switch (type & ~T_USER) { - case 0: return (SIGFPE); /* Divide by zero. */ - case 1: return (SIGTRAP); /* Debug exception. */ - case 3: return (SIGTRAP); /* Breakpoint. */ - case 4: return (SIGURG); /* into instr. (overflow). */ - case 5: return (SIGURG); /* bound instruction. */ - case 6: return (SIGILL); /* Invalid opcode. */ - case 7: return (SIGFPE); /* Coprocessor not present. */ - case 8: return (SIGEMT); /* Double fault. */ - case 9: return (SIGSEGV); /* Coprocessor segment overrun. */ - case 10: return (SIGTRAP); /* Invalid TSS (also single-step). */ - case 11: return (SIGSEGV); /* Segment not present. */ - case 12: return (SIGSEGV); /* Stack exception. */ - case 13: return (SIGSEGV); /* General protection. */ - case 14: return (SIGSEGV); /* Page fault. */ - case 16: return (SIGEMT); /* Coprocessor error. */ + case T_BPTFLT: return (SIGTRAP); + case T_ARITHTRAP: return (SIGFPE); + case T_PROTFLT: return (SIGSEGV); + case T_TRCTRAP: return (SIGTRAP); + case T_PAGEFLT: return (SIGSEGV); + case T_DIVIDE: return (SIGFPE); + case T_NMI: return (SIGTRAP); + case T_FPOPFLT: return (SIGILL); + case T_TSSFLT: return (SIGSEGV); + case T_SEGNPFLT: return (SIGSEGV); + case T_STKFLT: return (SIGSEGV); + case T_XMMFLT: return (SIGFPE); } return (SIGEMT); } From owner-dev-commits-src-all@freebsd.org Mon Jan 4 21:11:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C84814CD1BF; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@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 4D8pFx5FkJz4WRH; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A71AD20922; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104LBH1i011013; Mon, 4 Jan 2021 21:11:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104LBH6S011012; Mon, 4 Jan 2021 21:11:17 GMT (envelope-from git) Date: Mon, 4 Jan 2021 21:11:17 GMT Message-Id: <202101042111.104LBH6S011012@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 1c002413c3d5 - stable/12 - gdb(4): allow bulk write of registers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1c002413c3d5bc9a4b9f9258d4113e92a55b1ae7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 21:11:17 -0000 The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=1c002413c3d5bc9a4b9f9258d4113e92a55b1ae7 commit 1c002413c3d5bc9a4b9f9258d4113e92a55b1ae7 Author: Mitchell Horne AuthorDate: 2020-12-23 18:37:05 +0000 Commit: Mitchell Horne CommitDate: 2021-01-04 21:00:42 +0000 gdb(4): allow bulk write of registers Add support for the remote 'G' packet. This is not widely used by gdb when 'P' is supported, but is technically required by any remote gdb stub implementation [1]. [1] https://sourceware.org/gdb/current/onlinedocs/gdb/Overview.html Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. (cherry picked from commit 3f3cc995a35a3e9136204a98af0af5808c11047f) --- sys/gdb/gdb_main.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/gdb/gdb_main.c b/sys/gdb/gdb_main.c index 4c16e06daecf..c5a77430ca5f 100644 --- a/sys/gdb/gdb_main.c +++ b/sys/gdb/gdb_main.c @@ -199,9 +199,23 @@ gdb_trap(int type, int code) gdb_tx_end(); break; } - case 'G': /* Write registers. */ - gdb_tx_err(0); + case 'G': { /* Write registers. */ + char *val; + bool success; + size_t r; + for (success = true, r = 0; r < GDB_NREGS; r++) { + val = gdb_rxp; + if (!gdb_rx_mem(val, gdb_cpu_regsz(r))) { + gdb_tx_err(EINVAL); + success = false; + break; + } + gdb_cpu_setreg(r, val); + } + if (success) + gdb_tx_ok(); break; + } case 'H': { /* Set thread. */ intmax_t tid; struct thread *thr; From owner-dev-commits-src-all@freebsd.org Mon Jan 4 21:11:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1C56B4CD044; Mon, 4 Jan 2021 21:11:18 +0000 (UTC) (envelope-from git@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 4D8pFx6g17z4WCx; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D438020830; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104LBHTO011064; Mon, 4 Jan 2021 21:11:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104LBHCI011063; Mon, 4 Jan 2021 21:11:17 GMT (envelope-from git) Date: Mon, 4 Jan 2021 21:11:17 GMT Message-Id: <202101042111.104LBHCI011063@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: cfe79bddf4b0 - stable/12 - amd64: allow gdb(4) to write to most registers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cfe79bddf4b02bd3a9f9d299085ac84e25b0d491 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 21:11:18 -0000 The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=cfe79bddf4b02bd3a9f9d299085ac84e25b0d491 commit cfe79bddf4b02bd3a9f9d299085ac84e25b0d491 Author: Mitchell Horne AuthorDate: 2020-12-18 16:09:24 +0000 Commit: Mitchell Horne CommitDate: 2021-01-04 20:50:43 +0000 amd64: allow gdb(4) to write to most registers Similar to the recent patch to arm's gdb stub in r368414, allow GDB to update the contents of most general purpose registers. Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. (cherry picked from commit 0ef474de88fdb78e3cb7ac9bc0b1b98e5b49b4e4) --- sys/amd64/amd64/gdb_machdep.c | 38 ++++++++++++++++++++++++++++++++++---- sys/amd64/include/gdb_machdep.h | 16 ++++++++++++++++ 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/sys/amd64/amd64/gdb_machdep.c b/sys/amd64/amd64/gdb_machdep.c index f7ca3c07ea36..cf5979b7a1ea 100644 --- a/sys/amd64/amd64/gdb_machdep.c +++ b/sys/amd64/amd64/gdb_machdep.c @@ -92,12 +92,42 @@ gdb_cpu_getreg(int regnum, size_t *regsz) void gdb_cpu_setreg(int regnum, void *val) { + register_t regval = *(register_t *)val; + /* + * Write registers to the trapframe and pcb, if applicable. + * Some scratch registers are not tracked by the pcb. + */ + if (kdb_thread == curthread) { + switch (regnum) { + case GDB_REG_RAX: kdb_frame->tf_rax = regval; break; + case GDB_REG_RBX: kdb_frame->tf_rbx = regval; break; + case GDB_REG_RCX: kdb_frame->tf_rcx = regval; break; + case GDB_REG_RDX: kdb_frame->tf_rdx = regval; break; + case GDB_REG_RSI: kdb_frame->tf_rsi = regval; break; + case GDB_REG_RDI: kdb_frame->tf_rdi = regval; break; + case GDB_REG_RBP: kdb_frame->tf_rbp = regval; break; + case GDB_REG_RSP: kdb_frame->tf_rsp = regval; break; + case GDB_REG_R8: kdb_frame->tf_r8 = regval; break; + case GDB_REG_R9: kdb_frame->tf_r9 = regval; break; + case GDB_REG_R10: kdb_frame->tf_r10 = regval; break; + case GDB_REG_R11: kdb_frame->tf_r11 = regval; break; + case GDB_REG_R12: kdb_frame->tf_r12 = regval; break; + case GDB_REG_R13: kdb_frame->tf_r13 = regval; break; + case GDB_REG_R14: kdb_frame->tf_r14 = regval; break; + case GDB_REG_R15: kdb_frame->tf_r15 = regval; break; + case GDB_REG_PC: kdb_frame->tf_rip = regval; break; + } + } switch (regnum) { - case GDB_REG_PC: - kdb_thrctx->pcb_rip = *(register_t *)val; - if (kdb_thread == curthread) - kdb_frame->tf_rip = *(register_t *)val; + case GDB_REG_RBX: kdb_thrctx->pcb_rbx = regval; break; + case GDB_REG_RBP: kdb_thrctx->pcb_rbp = regval; break; + case GDB_REG_RSP: kdb_thrctx->pcb_rsp = regval; break; + case GDB_REG_R12: kdb_thrctx->pcb_r12 = regval; break; + case GDB_REG_R13: kdb_thrctx->pcb_r13 = regval; break; + case GDB_REG_R14: kdb_thrctx->pcb_r14 = regval; break; + case GDB_REG_R15: kdb_thrctx->pcb_r15 = regval; break; + case GDB_REG_PC: kdb_thrctx->pcb_rip = regval; break; } } diff --git a/sys/amd64/include/gdb_machdep.h b/sys/amd64/include/gdb_machdep.h index 6ad8b01d00ca..add6dc94dfec 100644 --- a/sys/amd64/include/gdb_machdep.h +++ b/sys/amd64/include/gdb_machdep.h @@ -33,6 +33,22 @@ #define GDB_BUFSZ (GDB_NREGS * 16) #define GDB_NREGS 56 +#define GDB_REG_RAX 0 +#define GDB_REG_RBX 1 +#define GDB_REG_RCX 2 +#define GDB_REG_RDX 3 +#define GDB_REG_RSI 4 +#define GDB_REG_RDI 5 +#define GDB_REG_RBP 6 +#define GDB_REG_RSP 7 +#define GDB_REG_R8 8 +#define GDB_REG_R9 9 +#define GDB_REG_R10 10 +#define GDB_REG_R11 11 +#define GDB_REG_R12 12 +#define GDB_REG_R13 13 +#define GDB_REG_R14 14 +#define GDB_REG_R15 15 #define GDB_REG_PC 16 static __inline size_t From owner-dev-commits-src-all@freebsd.org Mon Jan 4 21:11:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D3E1D4CD39C; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@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 4D8pFx5Ws5z4WJD; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF3A620574; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104LBHIK011030; Mon, 4 Jan 2021 21:11:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104LBHDu011029; Mon, 4 Jan 2021 21:11:17 GMT (envelope-from git) Date: Mon, 4 Jan 2021 21:11:17 GMT Message-Id: <202101042111.104LBHDu011029@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 7b7138454fd3 - stable/12 - gdb(4): handle single register read packets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7b7138454fd3b629823728a365ebd34b6bd37212 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 21:11:17 -0000 The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=7b7138454fd3b629823728a365ebd34b6bd37212 commit 7b7138454fd3b629823728a365ebd34b6bd37212 Author: Mitchell Horne AuthorDate: 2020-12-23 18:36:08 +0000 Commit: Mitchell Horne CommitDate: 2021-01-04 21:00:12 +0000 gdb(4): handle single register read packets We support bulk reads of the register set, but not reading specific registers via the 'p' packet. This is useful at least for the 'call' command in gdb. Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. (cherry picked from commit fd29833d9a7d8355ce21743ed8c706b72ba03363) --- sys/gdb/gdb_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/gdb/gdb_main.c b/sys/gdb/gdb_main.c index 206fee4f7566..4c16e06daecf 100644 --- a/sys/gdb/gdb_main.c +++ b/sys/gdb/gdb_main.c @@ -252,6 +252,17 @@ gdb_trap(int type, int code) gdb_tx_ok(); break; } + case 'p': { /* Read register. */ + uintmax_t reg; + if (gdb_rx_varhex(®)) { + gdb_tx_err(EINVAL); + break; + } + gdb_tx_begin(0); + gdb_tx_reg(reg); + gdb_tx_end(); + break; + } case 'P': { /* Write register. */ char *val; uintmax_t reg; From owner-dev-commits-src-all@freebsd.org Mon Jan 4 21:11:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E8F6F4CD404; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@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 4D8pFx64V6z4WCw; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0D8F2082F; Mon, 4 Jan 2021 21:11:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104LBHum011047; Mon, 4 Jan 2021 21:11:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104LBHpW011046; Mon, 4 Jan 2021 21:11:17 GMT (envelope-from git) Date: Mon, 4 Jan 2021 21:11:17 GMT Message-Id: <202101042111.104LBHpW011046@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: aba250f6264f - stable/12 - amd64: use register macros for gdb_cpu_getreg() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: aba250f6264fd606b025bed87675530171a8c9f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 21:11:18 -0000 The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=aba250f6264fd606b025bed87675530171a8c9f8 commit aba250f6264fd606b025bed87675530171a8c9f8 Author: Mitchell Horne AuthorDate: 2020-12-18 16:16:03 +0000 Commit: Mitchell Horne CommitDate: 2021-01-04 20:59:35 +0000 amd64: use register macros for gdb_cpu_getreg() Prefer these newly-added definitions to bare values. Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. (cherry picked from commit 72939459bdfa930348d0b3397db5d947593ad348) --- sys/amd64/amd64/gdb_machdep.c | 44 ++++++++++++++++++++--------------------- sys/amd64/include/gdb_machdep.h | 4 ++++ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/sys/amd64/amd64/gdb_machdep.c b/sys/amd64/amd64/gdb_machdep.c index cf5979b7a1ea..73022bee7674 100644 --- a/sys/amd64/amd64/gdb_machdep.c +++ b/sys/amd64/amd64/gdb_machdep.c @@ -60,31 +60,31 @@ gdb_cpu_getreg(int regnum, size_t *regsz) if (kdb_thread == curthread) { switch (regnum) { - case 0: return (&kdb_frame->tf_rax); - case 2: return (&kdb_frame->tf_rcx); - case 3: return (&kdb_frame->tf_rdx); - case 4: return (&kdb_frame->tf_rsi); - case 5: return (&kdb_frame->tf_rdi); - case 8: return (&kdb_frame->tf_r8); - case 9: return (&kdb_frame->tf_r9); - case 10: return (&kdb_frame->tf_r10); - case 11: return (&kdb_frame->tf_r11); - case 17: return (&kdb_frame->tf_rflags); - case 18: return (&kdb_frame->tf_cs); - case 19: return (&kdb_frame->tf_ss); + case GDB_REG_RAX: return (&kdb_frame->tf_rax); + case GDB_REG_RCX: return (&kdb_frame->tf_rcx); + case GDB_REG_RDX: return (&kdb_frame->tf_rdx); + case GDB_REG_RSI: return (&kdb_frame->tf_rsi); + case GDB_REG_RDI: return (&kdb_frame->tf_rdi); + case GDB_REG_R8: return (&kdb_frame->tf_r8); + case GDB_REG_R9: return (&kdb_frame->tf_r9); + case GDB_REG_R10: return (&kdb_frame->tf_r10); + case GDB_REG_R11: return (&kdb_frame->tf_r11); + case GDB_REG_RFLAGS: return (&kdb_frame->tf_rflags); + case GDB_REG_CS: return (&kdb_frame->tf_cs); + case GDB_REG_SS: return (&kdb_frame->tf_ss); } } switch (regnum) { - case 1: return (&kdb_thrctx->pcb_rbx); - case 6: return (&kdb_thrctx->pcb_rbp); - case 7: return (&kdb_thrctx->pcb_rsp); - case 12: return (&kdb_thrctx->pcb_r12); - case 13: return (&kdb_thrctx->pcb_r13); - case 14: return (&kdb_thrctx->pcb_r14); - case 15: return (&kdb_thrctx->pcb_r15); - case 16: return (&kdb_thrctx->pcb_rip); - case 18: return (&_kcodesel); - case 19: return (&_kdatasel); + case GDB_REG_RBX: return (&kdb_thrctx->pcb_rbx); + case GDB_REG_RBP: return (&kdb_thrctx->pcb_rbp); + case GDB_REG_RSP: return (&kdb_thrctx->pcb_rsp); + case GDB_REG_R12: return (&kdb_thrctx->pcb_r12); + case GDB_REG_R13: return (&kdb_thrctx->pcb_r13); + case GDB_REG_R14: return (&kdb_thrctx->pcb_r14); + case GDB_REG_R15: return (&kdb_thrctx->pcb_r15); + case GDB_REG_PC: return (&kdb_thrctx->pcb_rip); + case GDB_REG_CS: return (&_kcodesel); + case GDB_REG_SS: return (&_kdatasel); } return (NULL); } diff --git a/sys/amd64/include/gdb_machdep.h b/sys/amd64/include/gdb_machdep.h index add6dc94dfec..cd297addb965 100644 --- a/sys/amd64/include/gdb_machdep.h +++ b/sys/amd64/include/gdb_machdep.h @@ -50,6 +50,10 @@ #define GDB_REG_R14 14 #define GDB_REG_R15 15 #define GDB_REG_PC 16 +#define GDB_REG_RFLAGS 17 +#define GDB_REG_CS 18 +#define GDB_REG_SS 19 +_Static_assert(GDB_BUFSZ >= (GDB_NREGS * 16), "buffer fits 'g' regs"); static __inline size_t gdb_cpu_regsz(int regnum) From owner-dev-commits-src-all@freebsd.org Mon Jan 4 21:47:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D40BC4CE536; Mon, 4 Jan 2021 21:47:15 +0000 (UTC) (envelope-from git@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 4D8q3R5f0bz4Z36; Mon, 4 Jan 2021 21:47:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF62C211E2; Mon, 4 Jan 2021 21:47:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104LlFrw051732; Mon, 4 Jan 2021 21:47:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104LlFNg051731; Mon, 4 Jan 2021 21:47:15 GMT (envelope-from git) Date: Mon, 4 Jan 2021 21:47:15 GMT Message-Id: <202101042147.104LlFNg051731@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 9c0ff6a8bbb5 - main - Remove now-unused RT_GATEWAY* definitions. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c0ff6a8bbb5b32db2b8c7afb8bc5212ce717804 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 21:47:15 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=9c0ff6a8bbb5b32db2b8c7afb8bc5212ce717804 commit 9c0ff6a8bbb5b32db2b8c7afb8bc5212ce717804 Author: Alexander V. Chernikov AuthorDate: 2021-01-04 21:45:46 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-01-04 21:45:46 +0000 Remove now-unused RT_GATEWAY* definitions. They were used to simplify nexthop transition, hence not needed anymore. --- sys/net/route/nhop.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/net/route/nhop.h b/sys/net/route/nhop.h index 8b5ac7ada072..ce18cc04e163 100644 --- a/sys/net/route/nhop.h +++ b/sys/net/route/nhop.h @@ -157,9 +157,6 @@ struct nhop_object { #define NH_IS_VALID(_nh) RT_LINK_IS_UP((_nh)->nh_ifp) #define NH_IS_NHGRP(_nh) ((_nh)->nh_flags & NHF_MULTIPATH) -#define RT_GATEWAY(_rt) ((struct sockaddr *)&(_rt)->rt_nhop->gw4_sa) -#define RT_GATEWAY_CONST(_rt) ((const struct sockaddr *)&(_rt)->rt_nhop->gw4_sa) - #define NH_FREE(_nh) do { \ nhop_free(_nh); \ /* guard against invalid refs */ \ From owner-dev-commits-src-all@freebsd.org Mon Jan 4 22:16:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9FF004CE9D2; Mon, 4 Jan 2021 22:16:59 +0000 (UTC) (envelope-from git@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 4D8qjl4B1sz4bMn; Mon, 4 Jan 2021 22:16:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E11F21794; Mon, 4 Jan 2021 22:16:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104MGxI0090661; Mon, 4 Jan 2021 22:16:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104MGxwp090660; Mon, 4 Jan 2021 22:16:59 GMT (envelope-from git) Date: Mon, 4 Jan 2021 22:16:59 GMT Message-Id: <202101042216.104MGxwp090660@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 7beeacb27b27 - main - Honor the vm page's PG_NODUMP flag on arm and i386. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7beeacb27b2792dfdab9c806c00d50b6ac9fc34b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 22:16:59 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=7beeacb27b2792dfdab9c806c00d50b6ac9fc34b commit 7beeacb27b2792dfdab9c806c00d50b6ac9fc34b Author: Alan Cox AuthorDate: 2021-01-04 21:59:05 +0000 Commit: Alan Cox CommitDate: 2021-01-04 22:15:42 +0000 Honor the vm page's PG_NODUMP flag on arm and i386. Reviewed by: kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27949 --- sys/arm/arm/minidump_machdep.c | 3 +++ sys/i386/i386/minidump_machdep_base.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/sys/arm/arm/minidump_machdep.c b/sys/arm/arm/minidump_machdep.c index 92e15bec860b..c5f9cb58302e 100644 --- a/sys/arm/arm/minidump_machdep.c +++ b/sys/arm/arm/minidump_machdep.c @@ -68,8 +68,11 @@ static uint64_t counter, progress; static int is_dumpable(vm_paddr_t pa) { + vm_page_t m; int i; + if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) + return ((m->flags & PG_NODUMP) == 0); for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) return (1); diff --git a/sys/i386/i386/minidump_machdep_base.c b/sys/i386/i386/minidump_machdep_base.c index 9e803c6fd813..e2b4234eba11 100644 --- a/sys/i386/i386/minidump_machdep_base.c +++ b/sys/i386/i386/minidump_machdep_base.c @@ -65,8 +65,11 @@ static uint64_t counter, progress; static int is_dumpable(vm_paddr_t pa) { + vm_page_t m; int i; + if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) + return ((m->flags & PG_NODUMP) == 0); for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) return (1); From owner-dev-commits-src-all@freebsd.org Mon Jan 4 22:26:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D9CFB4CEAE0 for ; Mon, 4 Jan 2021 22:26:01 +0000 (UTC) (envelope-from git@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 4D8qw95sdQz4c3X; Mon, 4 Jan 2021 22:26:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7C4121267; Mon, 4 Jan 2021 22:26:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104MQ1PM003435; Mon, 4 Jan 2021 22:26:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104MQ1WU003434; Mon, 4 Jan 2021 22:26:01 GMT (envelope-from git) Date: Mon, 4 Jan 2021 22:26:01 GMT Message-Id: <202101042226.104MQ1WU003434@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Jung-uk Kim Subject: git: a4634ed7779f - vendor/acpica - Import ACPICA 20201217. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/vendor/acpica X-Git-Reftype: branch X-Git-Commit: a4634ed7779f0905e3bfeb781e58d40a5bdf9bb7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 22:26:01 -0000 The branch vendor/acpica has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=a4634ed7779f0905e3bfeb781e58d40a5bdf9bb7 commit a4634ed7779f0905e3bfeb781e58d40a5bdf9bb7 Author: Jung-uk Kim AuthorDate: 2021-01-04 22:20:55 +0000 Commit: Jung-uk Kim CommitDate: 2021-01-04 22:20:55 +0000 Import ACPICA 20201217. --- changes.txt | 35 ++++++++++++++++++++++++++++++++ source/compiler/aslanalyze.c | 2 +- source/compiler/aslcompiler.l | 4 ++-- source/compiler/aslerror.c | 2 +- source/compiler/aslmethod.c | 1 + source/compiler/aslparseop.c | 4 ++-- source/compiler/aslwalks.c | 2 +- source/compiler/dtfield.c | 2 +- source/compiler/dttemplate.c | 3 ++- source/components/debugger/dbinput.c | 4 ++-- source/components/debugger/dbobject.c | 2 +- source/components/disassembler/dmwalk.c | 8 ++++---- source/components/dispatcher/dscontrol.c | 2 +- source/components/dispatcher/dsdebug.c | 2 +- source/components/dispatcher/dswexec.c | 3 +-- source/components/dispatcher/dswload.c | 2 +- source/components/dispatcher/dswload2.c | 2 +- source/components/executer/exfldio.c | 2 +- source/components/executer/exresop.c | 4 ++-- source/components/executer/exstore.c | 4 ++-- source/components/hardware/hwgpe.c | 2 +- source/components/parser/psloop.c | 3 +-- source/components/parser/psparse.c | 2 +- source/components/utilities/utdelete.c | 2 +- source/components/utilities/utstrsuppt.c | 4 ++-- source/include/acexcep.h | 10 ++++----- source/include/acpixf.h | 2 +- source/include/actypes.h | 5 +++++ source/include/platform/acgcc.h | 15 ++++++++++++++ source/tools/acpibin/abmain.c | 2 +- source/tools/acpihelp/ahaml.c | 4 ++-- source/tools/acpihelp/ahdecode.c | 8 ++++---- 32 files changed, 102 insertions(+), 47 deletions(-) diff --git a/changes.txt b/changes.txt index e7cc572a0cc3..d27547d31b76 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,40 @@ ---------------------------------------- +17 December 2020. Summary of changes for version 20201217: +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Note: The implementation of ACPI 6.4 is underway, and is expected to be +mostly finished next month, when ACPI 6.4 is released. + +From qzed:- fixed-ae-class-macros. Fix exception code class checks. Added +several new macros, such as ACPI_CNTL_EXCEPTION(Status) in order to +enable this. + +AcpiExec/iASL/AcpiHelp: Added a few changes for support of GCC 10.2.0. +These included a few casts, as well as a null pointer check. + +Fix -Wfallthrough: GCC 7.1 gained -Wimplicit-fallthrough to warn on +implicit fallthrough, as well as __attribute__((__fallthrough__)) and +comments to explicitly denote that cases of fallthrough were intentional. +Clang also supports this warning and statement attribute, but not the +comment form. Added a new macro, ACPI_FALLTHROUGH to support this feature +of GCC. With assistance from @nickdesaulniers. + +2) iASL Compiler/Disassembler and ACPICA tools: + +Added improvement to method call analysis by saving the return type and +relaxing certain cases of type checking. + +iASL Table Compiler: Improved info messages. Added a message to the -T +option for when the default template (DSDT) is used. +Also added a note for when multiple SSDTs are created with a DSDT that +the SSDTs are created in the same file as the DSDT. + + +---------------------------------------- 13 November 2020. Summary of changes for version 20201113: diff --git a/source/compiler/aslanalyze.c b/source/compiler/aslanalyze.c index 63feba2b127b..d2c40eababb5 100644 --- a/source/compiler/aslanalyze.c +++ b/source/compiler/aslanalyze.c @@ -470,7 +470,7 @@ AnCheckMethodReturnValue ( "Method returns [%s], %s operator requires [%s]", AslGbl_StringBuffer, OpInfo->Name, AslGbl_StringBuffer2); - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, AslGbl_MsgBuffer); + AslError (ASL_WARNING, ASL_MSG_INVALID_TYPE, ArgOp, AslGbl_MsgBuffer); } } diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index 8e448fb76ead..f77dfc0d7242 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -812,9 +812,9 @@ NamePathTail [.]{NameSeg} "__PATH__" { count (0); return (PARSEOP___PATH__); } "__METHOD__" { count (0); return (PARSEOP___METHOD__); } "__EXPECT__"{ErrorCode} { char *s; - int index = 0; + unsigned int index = 0; count (0); - while (!isdigit (AslCompilertext[index])) + while (!isdigit ((int) AslCompilertext[index])) { index++; } diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index 150983429b3b..51c8c9b2ba89 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -1456,7 +1456,7 @@ AslIsExceptionDisabled ( { return (TRUE); } - /* Fall through */ + ACPI_FALLTHROUGH; case ASL_WARNING: case ASL_REMARK: diff --git a/source/compiler/aslmethod.c b/source/compiler/aslmethod.c index 32b4b123f02e..9f5b753b2d17 100644 --- a/source/compiler/aslmethod.c +++ b/source/compiler/aslmethod.c @@ -288,6 +288,7 @@ MtMethodAnalysisWalkBegin ( NextType = Next->Asl.Child; MethodInfo->ValidReturnTypes = MtProcessTypeOp (NextType); + Op->Asl.AcpiBtype |= MethodInfo->ValidReturnTypes; /* Get the ParameterType node */ diff --git a/source/compiler/aslparseop.c b/source/compiler/aslparseop.c index 51ef9b8c413c..6b17689d2e68 100644 --- a/source/compiler/aslparseop.c +++ b/source/compiler/aslparseop.c @@ -414,7 +414,7 @@ TrCreateValuedLeafOp ( for (i = 0; i < ACPI_NAMESEG_SIZE; i++) { - if (islower (Op->Asl.Value.Name[i])) + if (islower ((int) Op->Asl.Value.Name[i])) { AcpiUtStrupr (&Op->Asl.Value.Name[i]); AslError (ASL_REMARK, ASL_MSG_LOWER_CASE_NAMESEG, Op, Op->Asl.Value.Name); @@ -431,7 +431,7 @@ TrCreateValuedLeafOp ( StringPtr = Op->Asl.Value.Name; for (i = 0; *StringPtr; i++) { - if (islower (*StringPtr)) + if (islower ((int) *StringPtr)) { AcpiUtStrupr (&Op->Asl.Value.Name[i]); AslError (ASL_REMARK, ASL_MSG_LOWER_CASE_NAMEPATH, Op, Op->Asl.Value.Name); diff --git a/source/compiler/aslwalks.c b/source/compiler/aslwalks.c index 215544f6a527..66e702640da2 100644 --- a/source/compiler/aslwalks.c +++ b/source/compiler/aslwalks.c @@ -516,7 +516,7 @@ AnOperandTypecheckWalkEnd ( break; } - /* Fallthrough */ + ACPI_FALLTHROUGH; case ARGI_STORE_TARGET: diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c index f976bba5255a..9a5729cfe95e 100644 --- a/source/compiler/dtfield.c +++ b/source/compiler/dtfield.c @@ -227,7 +227,7 @@ DtCompileOneField ( break; } - /* Fall through. */ + ACPI_FALLTHROUGH; case DT_FIELD_TYPE_BUFFER: diff --git a/source/compiler/dttemplate.c b/source/compiler/dttemplate.c index 5129138fd904..2262c745147d 100644 --- a/source/compiler/dttemplate.c +++ b/source/compiler/dttemplate.c @@ -255,6 +255,7 @@ DtCreateTemplates ( if (AcpiGbl_Optind < 3) { + fprintf (stderr, "Creating default template: [DSDT]\n"); Status = DtCreateOneTemplateFile (ACPI_SIG_DSDT, 0); goto Exit; } @@ -640,7 +641,7 @@ DtCreateOneTemplate ( { fprintf (stderr, "Created ACPI table templates for [%4.4s] " - "and %u [SSDT], written to \"%s\"\n", + "and %u [SSDT] in same file, written to \"%s\"\n", Signature, TableCount, DisasmFilename); } diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index 0cc97310fa10..15e9f351b122 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -642,7 +642,7 @@ AcpiDbGetNextToken ( /* Remove any spaces at the beginning, ignore blank lines */ - while (*String && isspace (*String)) + while (*String && isspace ((int) *String)) { String++; } @@ -754,7 +754,7 @@ AcpiDbGetNextToken ( /* Find end of token */ - while (*String && !isspace (*String)) + while (*String && !isspace ((int) *String)) { String++; } diff --git a/source/components/debugger/dbobject.c b/source/components/debugger/dbobject.c index 01d885d03df7..a5af85d6beab 100644 --- a/source/components/debugger/dbobject.c +++ b/source/components/debugger/dbobject.c @@ -201,7 +201,7 @@ AcpiDbDumpMethodInfo ( /* Ignore control codes, they are not errors */ - if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL) + if (ACPI_CNTL_EXCEPTION (Status)) { return; } diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c index 76ef0aacb66c..2359468f142d 100644 --- a/source/components/disassembler/dmwalk.c +++ b/source/components/disassembler/dmwalk.c @@ -400,7 +400,7 @@ AcpiDmBlockType ( return (BLOCK_NONE); } - /*lint -fallthrough */ + ACPI_FALLTHROUGH; case AML_PACKAGE_OP: case AML_VARIABLE_PACKAGE_OP: @@ -422,7 +422,7 @@ AcpiDmBlockType ( return (BLOCK_NONE); } - /*lint -fallthrough */ + ACPI_FALLTHROUGH; default: @@ -688,7 +688,7 @@ AcpiDmDescendingOp ( return (AE_OK); } - /* Fallthrough */ + ACPI_FALLTHROUGH; default: @@ -772,7 +772,7 @@ AcpiDmDescendingOp ( AcpiDmNamestring (NextOp->Common.Value.Name); AcpiOsPrintf (", "); - /*lint -fallthrough */ + ACPI_FALLTHROUGH; default: diff --git a/source/components/dispatcher/dscontrol.c b/source/components/dispatcher/dscontrol.c index 4ff0b3823a5d..32632c547e22 100644 --- a/source/components/dispatcher/dscontrol.c +++ b/source/components/dispatcher/dscontrol.c @@ -210,7 +210,7 @@ AcpiDsExecBeginControlOp ( } } - /*lint -fallthrough */ + ACPI_FALLTHROUGH; case AML_IF_OP: /* diff --git a/source/components/dispatcher/dsdebug.c b/source/components/dispatcher/dsdebug.c index a7ece9b013bd..68d3fc2fb07a 100644 --- a/source/components/dispatcher/dsdebug.c +++ b/source/components/dispatcher/dsdebug.c @@ -254,7 +254,7 @@ AcpiDsDumpMethodStack ( /* Ignore control codes, they are not errors */ - if ((Status & AE_CODE_MASK) == AE_CODE_CONTROL) + if (ACPI_CNTL_EXCEPTION (Status)) { return_VOID; } diff --git a/source/components/dispatcher/dswexec.c b/source/components/dispatcher/dswexec.c index 3fa7b95bba8e..87e692a0634a 100644 --- a/source/components/dispatcher/dswexec.c +++ b/source/components/dispatcher/dswexec.c @@ -772,8 +772,7 @@ AcpiDsExecEndOp ( break; } - /* Fall through */ - /*lint -fallthrough */ + ACPI_FALLTHROUGH; case AML_INT_EVAL_SUBTREE_OP: diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c index 62a4fdca417b..be2f4a2beef8 100644 --- a/source/components/dispatcher/dswload.c +++ b/source/components/dispatcher/dswload.c @@ -375,7 +375,7 @@ AcpiDsLoad1BeginOp ( break; } - /*lint -fallthrough */ + ACPI_FALLTHROUGH; default: diff --git a/source/components/dispatcher/dswload2.c b/source/components/dispatcher/dswload2.c index 0ab715cd139b..76148af324bd 100644 --- a/source/components/dispatcher/dswload2.c +++ b/source/components/dispatcher/dswload2.c @@ -366,7 +366,7 @@ AcpiDsLoad2BeginOp ( break; } - /*lint -fallthrough */ + ACPI_FALLTHROUGH; default: diff --git a/source/components/executer/exfldio.c b/source/components/executer/exfldio.c index 69f9e1a6c5fe..64be8bf1da9f 100644 --- a/source/components/executer/exfldio.c +++ b/source/components/executer/exfldio.c @@ -616,7 +616,7 @@ AcpiExFieldDatumIo ( * RegionField case and write the datum to the Operation Region */ - /*lint -fallthrough */ + ACPI_FALLTHROUGH; case ACPI_TYPE_LOCAL_REGION_FIELD: /* diff --git a/source/components/executer/exresop.c b/source/components/executer/exresop.c index bf43d5d28d7c..b0d1c7409e60 100644 --- a/source/components/executer/exresop.c +++ b/source/components/executer/exresop.c @@ -358,7 +358,7 @@ AcpiExResolveOperands ( TargetOp = AML_DEBUG_OP; - /*lint -fallthrough */ + ACPI_FALLTHROUGH; case ACPI_REFCLASS_ARG: case ACPI_REFCLASS_LOCAL: @@ -422,7 +422,7 @@ AcpiExResolveOperands ( * Else not a string - fall through to the normal Reference * case below */ - /*lint -fallthrough */ + ACPI_FALLTHROUGH; case ARGI_REFERENCE: /* References: */ case ARGI_INTEGER_REF: diff --git a/source/components/executer/exstore.c b/source/components/executer/exstore.c index b374d6faa1e0..d6b9143bbbf9 100644 --- a/source/components/executer/exstore.c +++ b/source/components/executer/exstore.c @@ -248,7 +248,7 @@ AcpiExStore ( return_ACPI_STATUS (AE_OK); } - /*lint -fallthrough */ + ACPI_FALLTHROUGH; default: @@ -585,7 +585,7 @@ AcpiExStoreObjectToNode ( break; } - /* Fallthrough */ + ACPI_FALLTHROUGH; case ACPI_TYPE_DEVICE: case ACPI_TYPE_EVENT: diff --git a/source/components/hardware/hwgpe.c b/source/components/hardware/hwgpe.c index e8ad8926ce11..c7b7a4696794 100644 --- a/source/components/hardware/hwgpe.c +++ b/source/components/hardware/hwgpe.c @@ -254,7 +254,7 @@ AcpiHwLowSetGpe ( return (AE_BAD_PARAMETER); } - /*lint -fallthrough */ + ACPI_FALLTHROUGH; case ACPI_GPE_ENABLE: diff --git a/source/components/parser/psloop.c b/source/components/parser/psloop.c index 5b4b0d989bdd..6ccac91012b5 100644 --- a/source/components/parser/psloop.c +++ b/source/components/parser/psloop.c @@ -410,8 +410,7 @@ AcpiPsParseLoop ( */ WalkState->Op = NULL; Status = AcpiDsGetPredicateValue (WalkState, ACPI_TO_POINTER (TRUE)); - if (ACPI_FAILURE (Status) && - ((Status & AE_CODE_MASK) != AE_CODE_CONTROL)) + if (ACPI_FAILURE (Status) && !ACPI_CNTL_EXCEPTION (Status)) { if (Status == AE_AML_NO_RETURN_VALUE) { diff --git a/source/components/parser/psparse.c b/source/components/parser/psparse.c index d935ebc2df76..16458bc3e9d5 100644 --- a/source/components/parser/psparse.c +++ b/source/components/parser/psparse.c @@ -533,7 +533,7 @@ AcpiPsNextParseState ( default: Status = CallbackStatus; - if ((CallbackStatus & AE_CODE_MASK) == AE_CODE_CONTROL) + if (ACPI_CNTL_EXCEPTION (CallbackStatus)) { Status = AE_OK; } diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c index aafd52959379..0e0500a0d20b 100644 --- a/source/components/utilities/utdelete.c +++ b/source/components/utilities/utdelete.c @@ -266,7 +266,7 @@ AcpiUtDeleteInternalObj ( (void) AcpiEvDeleteGpeBlock (Object->Device.GpeBlock); } - /*lint -fallthrough */ + ACPI_FALLTHROUGH; case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_THERMAL: diff --git a/source/components/utilities/utstrsuppt.c b/source/components/utilities/utstrsuppt.c index 153b56e85cff..c0ea049558d8 100644 --- a/source/components/utilities/utstrsuppt.c +++ b/source/components/utilities/utstrsuppt.c @@ -274,7 +274,7 @@ AcpiUtConvertDecimalString ( * 1) Runtime: terminate with no error, per the ACPI spec * 2) Compiler: return an error */ - if (!isdigit (*String)) + if (!isdigit ((int) *String)) { #ifdef ACPI_ASL_COMPILER Status = AE_BAD_DECIMAL_CONSTANT; @@ -336,7 +336,7 @@ AcpiUtConvertHexString ( * 1) Runtime: terminate with no error, per the ACPI spec * 2) Compiler: return an error */ - if (!isxdigit (*String)) + if (!isxdigit ((int) *String)) { #ifdef ACPI_ASL_COMPILER Status = AE_BAD_HEX_CONSTANT; diff --git a/source/include/acexcep.h b/source/include/acexcep.h index 11c81398e915..8cbd75498642 100644 --- a/source/include/acexcep.h +++ b/source/include/acexcep.h @@ -204,11 +204,11 @@ typedef struct acpi_exception_info #define AE_OK (ACPI_STATUS) 0x0000 -#define ACPI_ENV_EXCEPTION(Status) (Status & AE_CODE_ENVIRONMENTAL) -#define ACPI_AML_EXCEPTION(Status) (Status & AE_CODE_AML) -#define ACPI_PROG_EXCEPTION(Status) (Status & AE_CODE_PROGRAMMER) -#define ACPI_TABLE_EXCEPTION(Status) (Status & AE_CODE_ACPI_TABLES) -#define ACPI_CNTL_EXCEPTION(Status) (Status & AE_CODE_CONTROL) +#define ACPI_ENV_EXCEPTION(Status) (((Status) & AE_CODE_MASK) == AE_CODE_ENVIRONMENTAL) +#define ACPI_AML_EXCEPTION(Status) (((Status) & AE_CODE_MASK) == AE_CODE_AML) +#define ACPI_PROG_EXCEPTION(Status) (((Status) & AE_CODE_MASK) == AE_CODE_PROGRAMMER) +#define ACPI_TABLE_EXCEPTION(Status) (((Status) & AE_CODE_MASK) == AE_CODE_ACPI_TABLES) +#define ACPI_CNTL_EXCEPTION(Status) (((Status) & AE_CODE_MASK) == AE_CODE_CONTROL) /* diff --git a/source/include/acpixf.h b/source/include/acpixf.h index df45d2dc3ca8..866f22f9d78c 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -154,7 +154,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20201113 +#define ACPI_CA_VERSION 0x20201217 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/actypes.h b/source/include/actypes.h index 48388c2198ed..1f0a189ab4ba 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -1537,5 +1537,10 @@ typedef enum #define ACPI_OPT_END -1 +/* Definitions for explicit fallthrough */ + +#ifndef ACPI_FALLTHROUGH +#define ACPI_FALLTHROUGH do {} while(0) +#endif #endif /* __ACTYPES_H__ */ diff --git a/source/include/platform/acgcc.h b/source/include/platform/acgcc.h index 797fde3386cd..8743332561aa 100644 --- a/source/include/platform/acgcc.h +++ b/source/include/platform/acgcc.h @@ -196,4 +196,19 @@ typedef __builtin_va_list va_list; #define ACPI_USE_NATIVE_MATH64 +/* GCC did not support __has_attribute until 5.1. */ + +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif + +/* + * Explictly mark intentional explicit fallthrough to silence + * -Wimplicit-fallthrough in GCC 7.1+. + */ + +#if __has_attribute(__fallthrough__) +#define ACPI_FALLTHROUGH __attribute__((__fallthrough__)) +#endif + #endif /* __ACGCC_H__ */ diff --git a/source/tools/acpibin/abmain.c b/source/tools/acpibin/abmain.c index 613408143bb9..c928a1af9333 100644 --- a/source/tools/acpibin/abmain.c +++ b/source/tools/acpibin/abmain.c @@ -234,7 +234,7 @@ main ( AbGbl_DisplayAllMiscompares = TRUE; - /* Fallthrough */ + ACPI_FALLTHROUGH; case 'c': /* Compare Files */ diff --git a/source/tools/acpihelp/ahaml.c b/source/tools/acpihelp/ahaml.c index 83cd86bd900a..f3d1428c2498 100644 --- a/source/tools/acpihelp/ahaml.c +++ b/source/tools/acpihelp/ahaml.c @@ -215,9 +215,9 @@ AhFindAmlOpcode ( } } - if (!Found) + if (!Found && Name) { - printf ("%s, no matching AML operators\n", Name); + printf ("%s, no matching AML opcodes\n", Name); } } diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index b72db2a800d2..d573ac06ed68 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -377,7 +377,7 @@ AhDoSpecialNames ( case 'E': if (Name[2] == 'J') { - if (isdigit (Name[3]) || (Name[3] == 'X')) + if (isdigit ((int) Name[3]) || (Name[3] == 'X')) { /* _EJx */ @@ -386,12 +386,12 @@ AhDoSpecialNames ( } } - /* Fallthrough */ + ACPI_FALLTHROUGH; case 'L': case 'Q': case 'W': - if ((isxdigit (Name[2]) && isxdigit (Name[3])) + if ((isxdigit ((int) Name[2]) && isxdigit ((int) Name[3])) || ((Name[2] == 'X') && (Name[3] == 'X'))) { @@ -405,7 +405,7 @@ AhDoSpecialNames ( case 'A': if ((Name[2] == 'C') || (Name[2] == 'L')) { - if (isdigit (Name[3]) || (Name[3] == 'X')) + if (isdigit ((int) Name[3]) || (Name[3] == 'X')) { /* _ACx or _ALx */ From owner-dev-commits-src-all@freebsd.org Mon Jan 4 22:32:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BCDB64CEFFA; Mon, 4 Jan 2021 22:32:47 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D8r3z1xKmz4cM4; Mon, 4 Jan 2021 22:32:46 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1609799564; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zMe6uDu9CtidcJXbhe2wgMnowrve50nTX3nnbpNXIX0=; b=m6Mw/uL8BqB0a5+lLZ3n6oCwqn4OjRMJjKX9u6TqTBtpMoJxKlan+QD8bZGGRMAuYrbT/X 1UUyLgE8hPIDMEwWeiXEFxUzFJ6/gfIK/mRd+yBXp+HhAWK5mA1nJvh9WAKh2knJ2lQWkb oEpGQ4wKGKzYXI2KdhTGym6QqctGwsc= Received: from amy.home (lfbn-idf2-1-745-114.w86-247.abo.wanadoo.fr [86.247.192.114]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 7ae21d3e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 4 Jan 2021 22:32:43 +0000 (UTC) Date: Mon, 4 Jan 2021 23:32:43 +0100 From: Emmanuel Vadot To: Emmanuel Vadot Cc: Konstantin Belousov , myfreeweb , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 44c5db52e258 - main - Add eventfd(3) wrappers to libc. Message-Id: <20210104233243.9038db66c26f10781d59c6c0@bidouilliste.com> In-Reply-To: <20210104211605.95966b493d4f80a472631e56@bidouilliste.com> References: <202012271057.0BRAvdLB013895@gitrepo.freebsd.org> <20210104202608.c7b0645ca0af0d6ff171f375@bidouilliste.com> <46188CDB-0263-4644-BA0F-603CA24AA209@unrelenting.technology> <20210104205515.d4bc0672f7497f7445eb346f@bidouilliste.com> <20210104211605.95966b493d4f80a472631e56@bidouilliste.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4D8r3z1xKmz4cM4 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 22:32:47 -0000 On Mon, 4 Jan 2021 21:16:05 +0100 Emmanuel Vadot wrote: > On Mon, 4 Jan 2021 22:11:52 +0200 > Konstantin Belousov wrote: > > > On Mon, Jan 04, 2021 at 08:55:15PM +0100, Emmanuel Vadot wrote: > > > On Mon, 04 Jan 2021 19:51:45 GMT > > > myfreeweb wrote: > > > > > > > > > > > > > > > On January 4, 2021 7:26:08 PM UTC, Emmanuel Vadot wrote: > > > > > > > > > > Hello, > > > > > > > > > > This break devel/glib20 > > > > > > > > > > I don't have much info, just logs from two poudriere build : > > > > >https://people.freebsd.org/~manu/glib-2.66.4_1,1-7f4e724829.log > > > > >https://people.freebsd.org/~manu/glib-2.66.4_1,1-9dd48b87e6.log > > > > > > > > Sounds like you have eventfd in libc only (in the poudriere jail) but not in the kernel: > > > > > > > > > !!! Jail is newer than host. (Jail: 1300133, Host: 1300131) !!! > > > > > > Yeah I've just realized that I haven't upgraded this host and was > > > about to reply to my mail :) > > > Sorry for the noise. > > So does it work, ultimately ? I would be not surprised that we somewhat > > deviate from the Linux interface. > > I'm updating the host and will let you know. It builds fine at least, will know more tomorow. -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Mon Jan 4 22:38:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 318A24CF3C7 for ; Mon, 4 Jan 2021 22:38:20 +0000 (UTC) (envelope-from git@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 4D8rBM6RDrz4clC; Mon, 4 Jan 2021 22:38:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C011021C82; Mon, 4 Jan 2021 22:38:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104McJC2016641; Mon, 4 Jan 2021 22:38:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104McJSP016640; Mon, 4 Jan 2021 22:38:19 GMT (envelope-from git) Date: Mon, 4 Jan 2021 22:38:19 GMT Message-Id: <202101042238.104McJSP016640@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Jung-uk Kim Subject: git: 635d6df1a66f - Create tag vendor/acpica/20201217 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/tags/vendor/acpica/20201217 X-Git-Reftype: annotated tag X-Git-Commit: 635d6df1a66f2d8a5185eab3e7b74b4cc8324b8d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 22:38:20 -0000 The annotated tag vendor/acpica/20201217 has been created by jkim: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/acpica/20201217 tag vendor/acpica/20201217 Tagger: Jung-uk Kim TaggerDate: 2021-01-04 22:36:17 +0000 Tag ACPICA 20201217. commit a4634ed7779f0905e3bfeb781e58d40a5bdf9bb7 Author: Jung-uk Kim AuthorDate: 2021-01-04 22:20:55 +0000 Commit: Jung-uk Kim CommitDate: 2021-01-04 22:20:55 +0000 Import ACPICA 20201217. From owner-dev-commits-src-all@freebsd.org Mon Jan 4 22:52:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0BB544CF9F6; Mon, 4 Jan 2021 22:52:21 +0000 (UTC) (envelope-from git@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 4D8rVX6zQ0z4dMK; Mon, 4 Jan 2021 22:52:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E24CE22007; Mon, 4 Jan 2021 22:52:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104MqKV4041945; Mon, 4 Jan 2021 22:52:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104MqKTx041944; Mon, 4 Jan 2021 22:52:20 GMT (envelope-from git) Date: Mon, 4 Jan 2021 22:52:20 GMT Message-Id: <202101042252.104MqKTx041944@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 58661b3ba9eb - main - loader: only use vidc_install_font() with vga controller MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 58661b3ba9ebe82f889cbc336afe618ad7f7940a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 22:52:21 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=58661b3ba9ebe82f889cbc336afe618ad7f7940a commit 58661b3ba9ebe82f889cbc336afe618ad7f7940a Author: Toomas Soome AuthorDate: 2021-01-04 22:43:39 +0000 Commit: Toomas Soome CommitDate: 2021-01-04 22:49:18 +0000 loader: only use vidc_install_font() with vga controller If the controller does not support VGA, we should not touch VGA registers. --- stand/i386/libi386/vbe.c | 12 ++++++++++++ stand/i386/libi386/vbe.h | 1 + stand/i386/libi386/vidconsole.c | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/stand/i386/libi386/vbe.c b/stand/i386/libi386/vbe.c index 7681eb633b85..232f13dab077 100644 --- a/stand/i386/libi386/vbe.c +++ b/stand/i386/libi386/vbe.c @@ -226,6 +226,18 @@ vga_set_grc(int reg, int i, int v) vga_set_indexed(reg, VGA_GC_ADDRESS, VGA_GC_DATA, i, v); } +/* + * Return true when this controller is VGA compatible. + */ +bool +vbe_is_vga(void) +{ + if (vbe == NULL) + return (false); + + return ((vbe->Capabilities & VBE_CAP_NONVGA) == 0); +} + /* Actually assuming mode 3. */ void bios_set_text_mode(int mode) diff --git a/stand/i386/libi386/vbe.h b/stand/i386/libi386/vbe.h index ff28b960df9c..79574349baee 100644 --- a/stand/i386/libi386/vbe.h +++ b/stand/i386/libi386/vbe.h @@ -152,6 +152,7 @@ int vga_get_grc(int, int); void vga_set_grc(int, int, int); /* high-level VBE helpers, from vbe.c */ +bool vbe_is_vga(void); void bios_set_text_mode(int); int biosvbe_palette_format(int *); void vbe_init(void); diff --git a/stand/i386/libi386/vidconsole.c b/stand/i386/libi386/vidconsole.c index c0da698d2d96..e373bc638ee4 100644 --- a/stand/i386/libi386/vidconsole.c +++ b/stand/i386/libi386/vidconsole.c @@ -780,6 +780,10 @@ vidc_install_font(void) int bpc, f_offset; teken_attr_t a = { 0 }; + /* We can only program VGA registers. */ + if (!vbe_is_vga()) + return; + if (gfx_state.tg_fb_type != FB_TEXT) return; From owner-dev-commits-src-all@freebsd.org Mon Jan 4 22:52:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 12C224CFABD; Mon, 4 Jan 2021 22:52:21 +0000 (UTC) (envelope-from git@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 4D8rVY04WFz4dX8; Mon, 4 Jan 2021 22:52:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9BFB21E1E; Mon, 4 Jan 2021 22:52:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 104MqKUO041962; Mon, 4 Jan 2021 22:52:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 104MqKfl041961; Mon, 4 Jan 2021 22:52:20 GMT (envelope-from git) Date: Mon, 4 Jan 2021 22:52:20 GMT Message-Id: <202101042252.104MqKfl041961@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 8c1dda11711e - main - loader: vidc_load_palette() does not need arguments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c1dda11711ec0dba5b34291d29a360029e6fdf6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2021 22:52:21 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=8c1dda11711ec0dba5b34291d29a360029e6fdf6 commit 8c1dda11711ec0dba5b34291d29a360029e6fdf6 Author: Toomas Soome AuthorDate: 2021-01-04 21:29:43 +0000 Commit: Toomas Soome CommitDate: 2021-01-04 22:49:08 +0000 loader: vidc_load_palette() does not need arguments Remove left over argument from vidc_load_palette. --- stand/i386/libi386/vidconsole.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stand/i386/libi386/vidconsole.c b/stand/i386/libi386/vidconsole.c index b4829db1ea42..c0da698d2d96 100644 --- a/stand/i386/libi386/vidconsole.c +++ b/stand/i386/libi386/vidconsole.c @@ -620,7 +620,7 @@ env_screen_nounset(struct env_var *ev __unused) } static int -vidc_load_palette(uint32_t *cmap) +vidc_load_palette(void) { int i, roff, goff, boff, rc; @@ -932,7 +932,7 @@ cons_update_mode(bool use_gfx_mode) gfx_state.tg_fb.fb_mask_blue >> boff, boff); if (gfx_state.tg_ctype == CT_INDEXED) - vidc_load_palette(cmap); + vidc_load_palette(); teken_set_winsize(&gfx_state.tg_teken, &gfx_state.tg_tp); a = teken_get_defattr(&gfx_state.tg_teken); From owner-dev-commits-src-all@freebsd.org Tue Jan 5 10:07:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0BDA64DF778; Tue, 5 Jan 2021 10:07:55 +0000 (UTC) (envelope-from git@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 4D97V26vt8z3lr8; Tue, 5 Jan 2021 10:07:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E022E25C9; Tue, 5 Jan 2021 10:07:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105A7skG011917; Tue, 5 Jan 2021 10:07:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105A7sR5011916; Tue, 5 Jan 2021 10:07:54 GMT (envelope-from git) Date: Tue, 5 Jan 2021 10:07:54 GMT Message-Id: <202101051007.105A7sR5011916@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 9fd96b416c45 - main - Add the missing pmcstat log entries MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9fd96b416c4572c83d4958763819bae83928cbce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 10:07:55 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=9fd96b416c4572c83d4958763819bae83928cbce commit 9fd96b416c4572c83d4958763819bae83928cbce Author: Andrew Turner AuthorDate: 2021-01-04 18:16:10 +0000 Commit: Andrew Turner CommitDate: 2021-01-05 10:03:05 +0000 Add the missing pmcstat log entries Sponsored by: Innovate UK --- usr.sbin/pmcstat/pmcstat_log.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/usr.sbin/pmcstat/pmcstat_log.c b/usr.sbin/pmcstat/pmcstat_log.c index 4f58ffb2eb65..71f3b6b9b14e 100644 --- a/usr.sbin/pmcstat/pmcstat_log.c +++ b/usr.sbin/pmcstat/pmcstat_log.c @@ -452,6 +452,12 @@ pmcstat_print_log(void) ev.pl_u.pl_c.pl_pid, ev.pl_u.pl_c.pl_value); break; + case PMCLOG_TYPE_PROC_CREATE: + PMCSTAT_PRINT_ENTRY("create","%d %x \"%s\"", + ev.pl_u.pl_pc.pl_pid, + ev.pl_u.pl_pc.pl_flags, + ev.pl_u.pl_pc.pl_pcomm); + break; case PMCLOG_TYPE_PROCEXEC: PMCSTAT_PRINT_ENTRY("exec","0x%x %d %p \"%s\"", ev.pl_u.pl_x.pl_pmcid, @@ -478,6 +484,17 @@ pmcstat_print_log(void) PMCSTAT_PRINT_ENTRY("exit","%d", ev.pl_u.pl_se.pl_pid); break; + case PMCLOG_TYPE_THR_CREATE: + PMCSTAT_PRINT_ENTRY("thr-create","%d %d %x \"%s\"", + ev.pl_u.pl_tc.pl_tid, + ev.pl_u.pl_tc.pl_pid, + ev.pl_u.pl_tc.pl_flags, + ev.pl_u.pl_tc.pl_tdname); + break; + case PMCLOG_TYPE_THR_EXIT: + PMCSTAT_PRINT_ENTRY("thr-exit","%d", + ev.pl_u.pl_tc.pl_tid); + break; default: fprintf(args.pa_printfile, "unknown event (type %d).\n", ev.pl_type); From owner-dev-commits-src-all@freebsd.org Tue Jan 5 10:07:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 19F884DF67B; Tue, 5 Jan 2021 10:07:55 +0000 (UTC) (envelope-from git@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 4D97V30HmDz3lg8; Tue, 5 Jan 2021 10:07:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0EDD244C; Tue, 5 Jan 2021 10:07:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105A7s1D011934; Tue, 5 Jan 2021 10:07:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105A7saI011933; Tue, 5 Jan 2021 10:07:54 GMT (envelope-from git) Date: Tue, 5 Jan 2021 10:07:54 GMT Message-Id: <202101051007.105A7saI011933@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: a7d8bd8c239e - main - Add missing structs to pmclog_entry MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7d8bd8c239ed743866006636c1e99491023d3c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 10:07:55 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=a7d8bd8c239ed743866006636c1e99491023d3c6 commit a7d8bd8c239ed743866006636c1e99491023d3c6 Author: Andrew Turner AuthorDate: 2021-01-04 17:44:10 +0000 Commit: Andrew Turner CommitDate: 2021-01-05 10:03:05 +0000 Add missing structs to pmclog_entry This is used to size allocations so needs to incude all log structs to ensure its size is correct. Sponsored by: Innovate UK --- sys/sys/pmclog.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/sys/pmclog.h b/sys/sys/pmclog.h index 51a8a20d14a6..0ee9b7e2e853 100644 --- a/sys/sys/pmclog.h +++ b/sys/sys/pmclog.h @@ -267,10 +267,13 @@ union pmclog_entry { /* only used to size scratch areas */ struct pmclog_pmcattach pl_t; struct pmclog_pmcdetach pl_d; struct pmclog_proccsw pl_c; + struct pmclog_proccreate pl_pc; struct pmclog_procexec pl_x; struct pmclog_procexit pl_e; struct pmclog_procfork pl_f; struct pmclog_sysexit pl_se; + struct pmclog_threadcreate pl_tc; + struct pmclog_threadexit pl_te; struct pmclog_userdata pl_u; }; From owner-dev-commits-src-all@freebsd.org Tue Jan 5 13:02:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 34E5A4E4868; Tue, 5 Jan 2021 13:02:04 +0000 (UTC) (envelope-from git@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 4D9CM012dYz4RSn; Tue, 5 Jan 2021 13:02:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1654B4AC5; Tue, 5 Jan 2021 13:02:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105D24YE041219; Tue, 5 Jan 2021 13:02:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105D24lW041218; Tue, 5 Jan 2021 13:02:04 GMT (envelope-from git) Date: Tue, 5 Jan 2021 13:02:04 GMT Message-Id: <202101051302.105D24lW041218@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 821aa63a09402935da0a73abf20ba0441562aa07 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 13:02:04 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba0441562aa07 commit 821aa63a09402935da0a73abf20ba0441562aa07 Author: Baptiste Daroussin AuthorDate: 2021-01-04 16:29:40 +0000 Commit: Baptiste Daroussin CommitDate: 2021-01-05 13:01:32 +0000 ncurses: only keep the version with widechar support Only keep the widechar version of ncurses as libncursesw.so.9 Keep the old name to avoid breaking the ABI compatibility (the non widechar version libncurses.so.9 is not binary compatible with libncursesw.so.9) since all ports and base are already only linking against the widechar version we can simply remove libncurses.so.9 Since the .9 version only lived in the dev branch and never ended in a release, it is simply removed and not added to any binary compat package. Add symlinks to keep build time compatibility for anyone linking against -lncurses --- Makefile.inc1 | 5 +-- Makefile.libcompat | 4 +- ObsoleteFiles.inc | 2 + lib/ncurses/Makefile | 6 +-- lib/ncurses/config.mk | 11 +----- lib/ncurses/form/Makefile | 18 ++++++--- lib/ncurses/formw/Makefile | 5 --- lib/ncurses/formw/Makefile.depend | 17 --------- lib/ncurses/menu/Makefile | 18 ++++++--- lib/ncurses/menuw/Makefile | 5 --- lib/ncurses/menuw/Makefile.depend | 17 --------- lib/ncurses/ncurses/Makefile | 71 +++++++++++++++-------------------- lib/ncurses/ncursesw/Makefile | 7 ---- lib/ncurses/ncursesw/Makefile.depend | 16 -------- lib/ncurses/panel/Makefile | 23 ++++++++---- lib/ncurses/panelw/Makefile | 5 --- lib/ncurses/panelw/Makefile.depend | 17 --------- share/mk/src.libnames.mk | 16 ++------ tools/bsdbox/Makefile.base | 2 +- tools/tools/ath/athratestats/Makefile | 2 +- 20 files changed, 87 insertions(+), 180 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index fecdc1bdca71..a19fde9195cf 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2524,7 +2524,6 @@ _bt_clean= ${CLEANDIR} ${LOCAL_TOOL_DIRS} \ ${_jevents} \ lib/ncurses/ncurses \ - lib/ncurses/ncursesw \ ${_rescue} \ ${_share} \ usr.bin/awk \ @@ -2870,7 +2869,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ lib/libzstd \ ${_lib_casper} \ - lib/ncurses/ncurses lib/ncurses/ncursesw \ + lib/ncurses/ncurses \ lib/libopie lib/libpam/libpam ${_lib_libthr} \ ${_lib_libradius} lib/libsbuf lib/libtacplus \ lib/libgeom \ @@ -2891,7 +2890,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ .if ${MK_DIALOG} != "no" _prebuild_libs+= gnu/lib/libdialog -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncurses__L .endif .if ${MK_GOOGLETEST} != "no" diff --git a/Makefile.libcompat b/Makefile.libcompat index 3f23a33aa19b..85859a960d81 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -45,7 +45,7 @@ _LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib _LC_INCDIRS= \ include \ - lib/ncurses/ncursesw \ + lib/ncurses/ncurses \ ${_LC_LIBDIRS.yes} .if ${MK_FILE} != "no" @@ -94,7 +94,7 @@ build${libcompat}: .PHONY DIRPRFX=${_dir}/ ${_t} .endfor .endfor -.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevents} +.for _dir in lib/ncurses/ncurses lib/ncurses/ncurses ${_libmagic} ${_jevents} .for _t in ${_obj} build-tools ${_+_}cd ${.CURDIR}/${_dir}; \ WORLDTMP=${WORLDTMP} \ diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index e6da2abd5e5c..638b27b530f0 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20210105: remove non widechar version of clang +OLD_LIBS+=lib/libncurses.so.9 # 20210103: new clang import which bumps version from 11.0.0 to 11.0.1. OLD_FILES+=usr/lib/clang/11.0.0/include/cuda_wrappers/algorithm OLD_FILES+=usr/lib/clang/11.0.0/include/cuda_wrappers/complex diff --git a/lib/ncurses/Makefile b/lib/ncurses/Makefile index a5a19deafafd..be8697fbc609 100644 --- a/lib/ncurses/Makefile +++ b/lib/ncurses/Makefile @@ -1,13 +1,11 @@ # $FreeBSD$ -SUBDIR= ncurses form menu panel \ - ncursesw formw menuw panelw +SUBDIR= ncurses form menu panel SUBDIR_PARALLEL= -.for subdir in ${SUBDIR:Nncurses*:N*w} +.for subdir in ${SUBDIR:Nncurses*} SUBDIR_DEPEND_${subdir}= ncurses -SUBDIR_DEPEND_${subdir}w= ncursesw .endfor .include diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk index d15be8601136..f199c5829b65 100644 --- a/lib/ncurses/config.mk +++ b/lib/ncurses/config.mk @@ -4,20 +4,11 @@ NCURSES_DIR= ${SRCTOP}/contrib/ncurses -.if defined(ENABLE_WIDEC) -LIB_SUFFIX= w CFLAGS+= -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC -NCURSES_CFG_H= ${.CURDIR:H}/ncurses/ncurses_cfg.h -.else -LIB_SUFFIX= NCURSES_CFG_H= ${.CURDIR}/ncurses_cfg.h -.endif CFLAGS+= -I. -.if exists(${.OBJDIR:H}/ncurses${LIB_SUFFIX}) -CFLAGS+= -I${.OBJDIR:H}/ncurses${LIB_SUFFIX} -.endif -CFLAGS+= -I${.CURDIR:H}/ncurses${LIB_SUFFIX} +CFLAGS+= -I${.CURDIR:H}/ncurses # for ${NCURSES_CFG_H} CFLAGS+= -I${.CURDIR:H}/ncurses diff --git a/lib/ncurses/form/Makefile b/lib/ncurses/form/Makefile index eab5bbb63c09..a8e636d6ce1b 100644 --- a/lib/ncurses/form/Makefile +++ b/lib/ncurses/form/Makefile @@ -1,10 +1,11 @@ # $FreeBSD$ +.include .include "${.CURDIR:H}/config.mk" SRCDIR= ${NCURSES_DIR}/form -LIB= form${LIB_SUFFIX} +LIB= formw .PATH: ${SRCDIR} SRCS= \ @@ -54,9 +55,8 @@ CLEANFILES= ncurses_def.h CFLAGS+= -I${SRCDIR} CFLAGS+= -I${NCURSES_DIR}/menu -LIBADD+= ncurses${LIB_SUFFIX} +LIBADD+= ncursesw -.if defined(ENABLE_WIDEC) INCS= form.h .PATH: ${NCURSES_DIR}/man @@ -156,8 +156,16 @@ MLINKS= form_cursor.3 pos_form_cursor.3 \ form_win.3 scale_form.3 \ form_win.3 set_form_sub.3 \ form_win.3 set_form_win.3 -.else -MAN= + +# backward compat +.if ${MK_INSTALLLIB} != "no" +SYMLINKS+= libformw.a ${LIBDIR}/libform.a +.endif +.if !defined(NO_PIC) +SYMLINKS+= libformw.so ${LIBDIR}/libform.so +.endif +.if ${MK_PROFILE} != "no" +SYMLINKS+= libformw_p.a ${LIBDIR}/libform_p.a .endif .include diff --git a/lib/ncurses/formw/Makefile b/lib/ncurses/formw/Makefile deleted file mode 100644 index 3ec7637373be..000000000000 --- a/lib/ncurses/formw/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -ENABLE_WIDEC= - -.include "${.CURDIR:H}/form/Makefile" diff --git a/lib/ncurses/formw/Makefile.depend b/lib/ncurses/formw/Makefile.depend deleted file mode 100644 index 3d9451023bec..000000000000 --- a/lib/ncurses/formw/Makefile.depend +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/ncurses/ncursesw \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/lib/ncurses/menu/Makefile b/lib/ncurses/menu/Makefile index 653619638fbc..7844cd4d936c 100644 --- a/lib/ncurses/menu/Makefile +++ b/lib/ncurses/menu/Makefile @@ -1,10 +1,11 @@ # $FreeBSD$ +.include .include "${.CURDIR:H}/config.mk" SRCDIR= ${NCURSES_DIR}/menu -LIB= menu${LIB_SUFFIX} +LIB= menuw .PATH: ${SRCDIR} SRCS= \ @@ -40,9 +41,8 @@ CLEANFILES= ncurses_def.h CFLAGS+= -I${SRCDIR} -LIBADD+= ncurses${LIB_SUFFIX} +LIBADD+= ncursesw -.if defined(ENABLE_WIDEC) INCS= menu.h eti.h .PATH: ${NCURSES_DIR}/man @@ -128,8 +128,16 @@ MLINKS= menu_attributes.3 menu_back.3 \ mitem_value.3 item_value.3 \ mitem_value.3 set_item_value.3 \ mitem_visible.3 item_visible.3 -.else -MAN= + +# backward compat +.if ${MK_INSTALLLIB} != "no" +SYMLINKS+= libmenuw.a ${LIBDIR}/libmenu.a +.endif +.if !defined(NO_PIC) +SYMLINKS+= libmenuw.so ${LIBDIR}/libmenu.so +.endif +.if ${MK_PROFILE} != "no" +SYMLINKS+= libmenuw_p.a ${LIBDIR}/libmenu_p.a .endif .include diff --git a/lib/ncurses/menuw/Makefile b/lib/ncurses/menuw/Makefile deleted file mode 100644 index d6df56332826..000000000000 --- a/lib/ncurses/menuw/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -ENABLE_WIDEC= - -.include "${.CURDIR:H}/menu/Makefile" diff --git a/lib/ncurses/menuw/Makefile.depend b/lib/ncurses/menuw/Makefile.depend deleted file mode 100644 index 3d9451023bec..000000000000 --- a/lib/ncurses/menuw/Makefile.depend +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/ncurses/ncursesw \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile index efa38691115e..6f03d93a9ac6 100644 --- a/lib/ncurses/ncurses/Makefile +++ b/lib/ncurses/ncurses/Makefile @@ -3,16 +3,11 @@ PACKAGE= clibs SHLIBDIR?= /lib -.if !defined(ENABLE_WIDEC) -# Override any MAN= setting below.. -MK_MAN=no -.endif - .include .include "${.CURDIR:H}/config.mk" -LIB= ncurses${LIB_SUFFIX} +LIB= ncursesw SHLIB_MAJOR= 9 NO_LINT= @@ -22,17 +17,10 @@ NCURSES_MINOR!= egrep 'NCURSES_MINOR[ ]*=' ${NCURSES_DIR}/dist.mk | sed -e 's%^ NCURSES_PATCH!= egrep 'NCURSES_PATCH[ ]*=' ${NCURSES_DIR}/dist.mk | sed -e 's%^[^0-9]*%%' # From autoconf (!) -.if defined(ENABLE_WIDEC) NCURSES_CH_T= cchar_t NCURSES_OK_WCHAR_T= 1 NEED_WCHAR_H= 1 NCURSES_EXT_COLORS= 1 -.else -NCURSES_CH_T= chtype -NCURSES_OK_WCHAR_T= -NEED_WCHAR_H= 0 -NCURSES_EXT_COLORS= 0 -.endif NCURSES_EXT_FUNCS= 1 NCURSES_CONST= const NCURSES_INLINE= inline @@ -242,7 +230,6 @@ SRCS+= \ lib_vidattr.c \ tty_update.c -.if defined(ENABLE_WIDEC) .PATH: ${NCURSES_DIR}/ncurses/widechar SRCS+= \ charable.c \ @@ -265,7 +252,6 @@ SRCS+= \ lib_vline_set.c \ lib_wacs.c \ lib_wunctrl.c -.endif .PATH: ${NCURSES_DIR}/ncurses/trace SRCS+= \ @@ -298,42 +284,54 @@ HEADERS= curses.h term.h termcap.h unctrl.h SRCHDRS= ncurses_dll.h CLEANFILES+= ncurses_dll.h -.if defined(ENABLE_WIDEC) INCS= ${HEADERS} ${SRCHDRS} INCSLINKS= curses.h ${INCLUDEDIR}/ncurses.h -.endif .if ${MK_INSTALLLIB} != "no" -SYMLINKS+= libncurses${LIB_SUFFIX}.a ${LIBDIR}/libcurses${LIB_SUFFIX}.a -SYMLINKS+= libncurses${LIB_SUFFIX}.a ${LIBDIR}/libtermcap${LIB_SUFFIX}.a -SYMLINKS+= libncurses${LIB_SUFFIX}.a ${LIBDIR}/libtermlib${LIB_SUFFIX}.a -SYMLINKS+= libncurses${LIB_SUFFIX}.a ${LIBDIR}/libtinfo${LIB_SUFFIX}.a +SYMLINKS+= libncursesw.a ${LIBDIR}/libcursesw.a +SYMLINKS+= libncursesw.a ${LIBDIR}/libtermcapw.a +SYMLINKS+= libncursesw.a ${LIBDIR}/libtermlibw.a +SYMLINKS+= libncursesw.a ${LIBDIR}/libtinfow.a +# backward compat +SYMLINKS+= libncursesw.a ${LIBDIR}/libncurses.a +SYMLINKS+= libncursesw.a ${LIBDIR}/libcurses.a +SYMLINKS+= libncursesw.a ${LIBDIR}/libtermcap.a +SYMLINKS+= libncursesw.a ${LIBDIR}/libtermlib.a +SYMLINKS+= libncursesw.a ${LIBDIR}/libtinfo.a .endif .if !defined(NO_PIC) # no need for major at all, it's an ld-time redirection only -SYMLINKS+= libncurses${LIB_SUFFIX}.so ${LIBDIR}/libcurses${LIB_SUFFIX}.so -SYMLINKS+= libncurses${LIB_SUFFIX}.so ${LIBDIR}/libtermcap${LIB_SUFFIX}.so -SYMLINKS+= libncurses${LIB_SUFFIX}.so ${LIBDIR}/libtermlib${LIB_SUFFIX}.so -SYMLINKS+= libncurses${LIB_SUFFIX}.so ${LIBDIR}/libtinfo${LIB_SUFFIX}.so +SYMLINKS+= libncursesw.so ${LIBDIR}/libcursesw.so +SYMLINKS+= libncursesw.so ${LIBDIR}/libtermcapw.so +SYMLINKS+= libncursesw.so ${LIBDIR}/libtermlibw.so +SYMLINKS+= libncursesw.so ${LIBDIR}/libtinfow.so +# backward compat +SYMLINKS+= libncursesw.so ${LIBDIR}/libncurses.so +SYMLINKS+= libncursesw.so ${LIBDIR}/libcurses.so +SYMLINKS+= libncursesw.so ${LIBDIR}/libtermcap.so +SYMLINKS+= libncursesw.so ${LIBDIR}/libtermlib.so +SYMLINKS+= libncursesw.so ${LIBDIR}/libtinfo.so .endif .if ${MK_PROFILE} != "no" -SYMLINKS+= libncurses${LIB_SUFFIX}_p.a ${LIBDIR}/libcurses${LIB_SUFFIX}_p.a -SYMLINKS+= libncurses${LIB_SUFFIX}_p.a ${LIBDIR}/libtermcap${LIB_SUFFIX}_p.a -SYMLINKS+= libncurses${LIB_SUFFIX}_p.a ${LIBDIR}/libtermlib${LIB_SUFFIX}_p.a -SYMLINKS+= libncurses${LIB_SUFFIX}_p.a ${LIBDIR}/libtinfo${LIB_SUFFIX}_p.a +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libcursesw_p.a +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtermcapw_p.a +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtermlibw_p.a +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtinfow_p.a +# backward compat +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libncurses_p.a +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libcurses_p.a +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtermcap_p.a +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtermlib_p.a +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtinfo_p.a .endif -.if ${.CURDIR:T} == "ncursesw" -.if defined(ENABLE_WIDEC) DOCSDIR= ${SHAREDIR}/doc/ncurses DOCS= ncurses-intro.html hackguide.html -.endif .if ${MK_HTML} != "no" .PATH: ${NCURSES_DIR}/doc/html FILESGROUPS= DOCS .endif -.endif # Generated source .ORDER: names.c codes.c @@ -394,9 +392,7 @@ curses.h: curses.head MKkey_defs.sh Caps Caps-ncurses cat curses.head > $@.new AWK=${AWK} _POSIX2_VERSION=199209 sh ${NCURSES_DIR}/include/MKkey_defs.sh \ ${NCURSES_DIR}/include/Caps ${NCURSES_DIR}/include/Caps-ncurses >> $@.new -.if defined(ENABLE_WIDEC) cat ${NCURSES_DIR}/include/curses.wide >> $@.new -.endif cat ${NCURSES_DIR}/include/curses.tail >> $@.new mv -f $@.new $@ @@ -505,7 +501,6 @@ terminfo.5: MKterminfo.sh terminfo.head Caps CLEANFILES+= terminfo.5 -.if defined(ENABLE_WIDEC) .PATH: ${NCURSES_DIR}/man MAN= \ curs_addch.3 \ @@ -585,7 +580,6 @@ MAN+= \ MAN+= term.5 terminfo.5 scr_dump.5 user_caps.5 MAN+= term.7 -.endif CLEANFILES+= ${MAN:M*.3} @@ -1065,7 +1059,6 @@ MLINKS= ncurses.3 curses.3 \ resizeterm.3 is_term_resized.3 \ resizeterm.3 resize_term.3 -.if defined(ENABLE_WIDEC) MLINKS+=curs_add_wch.3 add_wch.3 \ curs_add_wch.3 echo_wchar.3 \ curs_add_wch.3 mvadd_wch.3 \ @@ -1145,8 +1138,6 @@ MLINKS+=curs_add_wch.3 add_wch.3 \ curs_scanw.3 vw_scanw.3 \ curs_scanw.3 vwscanw.3 \ curs_scanw.3 wscanw.3 -.endif - .include diff --git a/lib/ncurses/ncursesw/Makefile b/lib/ncurses/ncursesw/Makefile deleted file mode 100644 index 5f6040e7119c..000000000000 --- a/lib/ncurses/ncursesw/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD$ - -ENABLE_WIDEC= - -.PATH: ${.CURDIR:H}/ncurses - -.include "${.CURDIR:H}/ncurses/Makefile" diff --git a/lib/ncurses/ncursesw/Makefile.depend b/lib/ncurses/ncursesw/Makefile.depend deleted file mode 100644 index 8d409f5263ac..000000000000 --- a/lib/ncurses/ncursesw/Makefile.depend +++ /dev/null @@ -1,16 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/lib/ncurses/panel/Makefile b/lib/ncurses/panel/Makefile index 1993f5e76ac2..a22df4d89570 100644 --- a/lib/ncurses/panel/Makefile +++ b/lib/ncurses/panel/Makefile @@ -1,10 +1,11 @@ # $FreeBSD$ +.include .include "${.CURDIR:H}/config.mk" SRCDIR= ${NCURSES_DIR}/panel -LIB= panel${LIB_SUFFIX} +LIB= panelw .PATH: ${SRCDIR} SRCS= \ @@ -29,10 +30,7 @@ CLEANFILES= ncurses_def.h CFLAGS+= -I${SRCDIR} -LIBADD+= ncurses${LIB_SUFFIX} - -.if defined(ENABLE_WIDEC) -INCS= panel.h +LIBADD+= ncursesw # generate MAN .PATH: ${NCURSES_DIR}/man @@ -56,10 +54,19 @@ MLINKS= panel.3 bottom_panel.3 \ panel.3 show_panel.3 \ panel.3 top_panel.3 \ panel.3 update_panels.3 -.else -MAN= + +# backward compat +.if ${MK_INSTALLLIB} != "no" +SYMLINKS+= libpanelw.a ${LIBDIR}/libpanel.a +.endif +.if !defined(NO_PIC) +SYMLINKS+= libpanelw.so ${LIBDIR}/libpanel.so .endif - +.if ${MK_PROFILE} != "no" +SYMLINKS+= libpanelw_p.a ${LIBDIR}/libpanel_p.a +.endif + +INCS= panel.h .include # Keep the .SUFFIXES line after the include of bsd.lib.mk diff --git a/lib/ncurses/panelw/Makefile b/lib/ncurses/panelw/Makefile deleted file mode 100644 index 2585738a5e60..000000000000 --- a/lib/ncurses/panelw/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -ENABLE_WIDEC= - -.include "${.CURDIR:H}/panel/Makefile" diff --git a/lib/ncurses/panelw/Makefile.depend b/lib/ncurses/panelw/Makefile.depend deleted file mode 100644 index 3d9451023bec..000000000000 --- a/lib/ncurses/panelw/Makefile.depend +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/ncurses/ncursesw \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index ee94279e0cca..32cd1677bcd4 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -144,7 +144,6 @@ _LIBRARIES= \ memstat \ mp \ mt \ - ncurses \ ncursesw \ netgraph \ netmap \ @@ -182,7 +181,6 @@ _LIBRARIES= \ supcplusplus \ sysdecode \ tacplus \ - termcap \ termcapw \ tpool \ ufs \ @@ -376,7 +374,6 @@ _DP_c+= ssp_nonshared _DP_stats= sbuf pthread _DP_stdthreads= pthread _DP_tacplus= md -_DP_panel= ncurses _DP_panelw= ncursesw _DP_rpcsec_gss= gssapi _DP_smb= kiconv @@ -663,14 +660,10 @@ LIBBSDXMLDIR= ${OBJTOP}/lib/libexpat LIBKVMDIR= ${OBJTOP}/lib/libkvm LIBPTHREADDIR= ${OBJTOP}/lib/libthr LIBMDIR= ${OBJTOP}/lib/msun -LIBFORMDIR= ${OBJTOP}/lib/ncurses/form -LIBFORMLIBWDIR= ${OBJTOP}/lib/ncurses/formw -LIBMENUDIR= ${OBJTOP}/lib/ncurses/menu -LIBMENULIBWDIR= ${OBJTOP}/lib/ncurses/menuw -LIBNCURSESDIR= ${OBJTOP}/lib/ncurses/ncurses -LIBNCURSESWDIR= ${OBJTOP}/lib/ncurses/ncursesw -LIBPANELDIR= ${OBJTOP}/lib/ncurses/panel -LIBPANELWDIR= ${OBJTOP}/lib/ncurses/panelw +LIBFORMWDIR= ${OBJTOP}/lib/ncurses/form +LIBMENUWDIR= ${OBJTOP}/lib/ncurses/menu +LIBNCURSESWDIR= ${OBJTOP}/lib/ncurses/ncurses +LIBPANELWDIR= ${OBJTOP}/lib/ncurses/panel LIBCRYPTODIR= ${OBJTOP}/secure/lib/libcrypto LIBSPLDIR= ${OBJTOP}/cddl/lib/libspl LIBSSHDIR= ${OBJTOP}/secure/lib/libssh @@ -679,7 +672,6 @@ LIBTEKENDIR= ${OBJTOP}/sys/teken/libteken LIBEGACYDIR= ${OBJTOP}/tools/build LIBLNDIR= ${OBJTOP}/usr.bin/lex/lib -LIBTERMCAPDIR= ${LIBNCURSESDIR} LIBTERMCAPWDIR= ${LIBNCURSESWDIR} # Default other library directories to lib/libNAME. diff --git a/tools/bsdbox/Makefile.base b/tools/bsdbox/Makefile.base index aac44480e2ca..f2ffc2e49f70 100644 --- a/tools/bsdbox/Makefile.base +++ b/tools/bsdbox/Makefile.base @@ -14,7 +14,7 @@ CRUNCH_ALIAS_tset= reset CRUNCH_PROGS_usr.bin+= vmstat #CRUNCH_PROGS_user.bin+= systat -CRUNCH_LIBS+= -ldevstat -lncursesw -lncurses -lmemstat -lkvm -lelf +CRUNCH_LIBS+= -ldevstat -lncursesw -lmemstat -lkvm -lelf # CRUNCH_PROGS_usr.bin+= tar CRUNCH_PROGS_usr.bin+= cpio diff --git a/tools/tools/ath/athratestats/Makefile b/tools/tools/ath/athratestats/Makefile index 7a51392a9a7e..ccf04ebd8da0 100644 --- a/tools/tools/ath/athratestats/Makefile +++ b/tools/tools/ath/athratestats/Makefile @@ -7,7 +7,7 @@ PROG= athratestats SRCS= main.c opt_ah.h ah_osdep.h -LIBADD+= ncurses +LIBADD+= ncursesw CLEANFILES+= opt_ah.h ah_osdep.h From owner-dev-commits-src-all@freebsd.org Tue Jan 5 13:56:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 422814E5BD0; Tue, 5 Jan 2021 13:56:47 +0000 (UTC) (envelope-from git@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 4D9DZ71Lb2z4VK5; Tue, 5 Jan 2021 13:56:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CE9F53C2; Tue, 5 Jan 2021 13:56:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105DuljM009463; Tue, 5 Jan 2021 13:56:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105Dul1Z009462; Tue, 5 Jan 2021 13:56:47 GMT (envelope-from git) Date: Tue, 5 Jan 2021 13:56:47 GMT Message-Id: <202101051356.105Dul1Z009462@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 4696baaaa95c - stable/12 - UFS2: Fix DoS due to corrupted extattrfile MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4696baaaa95ce9a75a7b1989474382c85981f805 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 13:56:47 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=4696baaaa95ce9a75a7b1989474382c85981f805 commit 4696baaaa95ce9a75a7b1989474382c85981f805 Author: Conrad Meyer AuthorDate: 2020-10-30 19:00:42 +0000 Commit: Ed Maste CommitDate: 2021-01-05 13:56:23 +0000 UFS2: Fix DoS due to corrupted extattrfile Prior versions of FreeBSD (11.x) may have produced a corrupt extattr file. (Specifically, r312416 accidentally fixed this defect by removing a strcpy.) CURRENT FreeBSD supports disk images from those prior versions of FreeBSD. Validate the internal structure as soon as we read it in from disk, to prevent these extattr files from causing invariants violations and DoS. Attempting to access the extattr portion of these files results in EINTEGRITY. At this time, the only way to repair files damaged in this way is to copy the contents to another file and move it over the original. PR: 244089 Reported by: Andrea Venturoli Reviewed by: kib Discussed with: mckusick (earlier draft) (cherry picked from commit e6790841f749b3cc1ac7d338181d9358aae04d0b) --- sys/ufs/ffs/ffs_vnops.c | 31 ++++++++++++++++++++----------- sys/ufs/ufs/extattr.h | 2 +- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index d50418fefcad..33f0bb7afedd 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1141,9 +1141,8 @@ ffs_findextattr(u_char *ptr, u_int length, int nspace, const char *name, eap = (struct extattr *)ptr; eaend = (struct extattr *)(ptr + length); for (; eap < eaend; eap = EXTATTR_NEXT(eap)) { - /* make sure this entry is complete */ - if (EXTATTR_NEXT(eap) > eaend) - break; + KASSERT(EXTATTR_NEXT(eap) <= eaend, + ("extattr next %p beyond %p", EXTATTR_NEXT(eap), eaend)); if (eap->ea_namespace != nspace || eap->ea_namelength != nlen || memcmp(eap->ea_name, name, nlen) != 0) continue; @@ -1157,8 +1156,9 @@ ffs_findextattr(u_char *ptr, u_int length, int nspace, const char *name, } static int -ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td, int extra) +ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td) { + const struct extattr *eap, *eaend, *eapnext; struct inode *ip; struct ufs2_dinode *dp; struct fs *fs; @@ -1172,10 +1172,10 @@ ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td, int extra) fs = ITOFS(ip); dp = ip->i_din2; easize = dp->di_extsize; - if ((uoff_t)easize + extra > UFS_NXADDR * fs->fs_bsize) + if ((uoff_t)easize > UFS_NXADDR * fs->fs_bsize) return (EFBIG); - eae = malloc(easize + extra, M_TEMP, M_WAITOK); + eae = malloc(easize, M_TEMP, M_WAITOK); liovec.iov_base = eae; liovec.iov_len = easize; @@ -1190,7 +1190,17 @@ ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td, int extra) error = ffs_extread(vp, &luio, IO_EXT | IO_SYNC); if (error) { free(eae, M_TEMP); - return(error); + return (error); + } + /* Validate disk xattrfile contents. */ + for (eap = (void *)eae, eaend = (void *)(eae + easize); eap < eaend; + eap = eapnext) { + eapnext = EXTATTR_NEXT(eap); + /* Bogusly short entry or bogusly long entry. */ + if (eap->ea_length < sizeof(*eap) || eapnext > eaend) { + free(eae, M_TEMP); + return (EINTEGRITY); + } } *p = eae; return (0); @@ -1241,7 +1251,7 @@ ffs_open_ea(struct vnode *vp, struct ucred *cred, struct thread *td) return (0); } dp = ip->i_din2; - error = ffs_rdextattr(&ip->i_ea_area, vp, td, 0); + error = ffs_rdextattr(&ip->i_ea_area, vp, td); if (error) { ffs_unlock_ea(vp); return (error); @@ -1549,9 +1559,8 @@ vop_listextattr { eap = (struct extattr *)ip->i_ea_area; eaend = (struct extattr *)(ip->i_ea_area + ip->i_ea_len); for (; error == 0 && eap < eaend; eap = EXTATTR_NEXT(eap)) { - /* make sure this entry is complete */ - if (EXTATTR_NEXT(eap) > eaend) - break; + KASSERT(EXTATTR_NEXT(eap) <= eaend, + ("extattr next %p beyond %p", EXTATTR_NEXT(eap), eaend)); if (eap->ea_namespace != ap->a_attrnamespace) continue; diff --git a/sys/ufs/ufs/extattr.h b/sys/ufs/ufs/extattr.h index 68b6a424e563..20d3401e68bf 100644 --- a/sys/ufs/ufs/extattr.h +++ b/sys/ufs/ufs/extattr.h @@ -95,7 +95,7 @@ struct extattr { * content referenced by eap. */ #define EXTATTR_NEXT(eap) \ - ((struct extattr *)(((u_char *)(eap)) + (eap)->ea_length)) + ((struct extattr *)(__DECONST(char *, (eap)) + (eap)->ea_length)) #define EXTATTR_CONTENT(eap) \ (void *)(((u_char *)(eap)) + EXTATTR_BASE_LENGTH(eap)) #define EXTATTR_CONTENT_SIZE(eap) \ From owner-dev-commits-src-all@freebsd.org Tue Jan 5 14:40:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 96FE84E6739; Tue, 5 Jan 2021 14:40:47 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (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 4D9FXv1WDGz4XPq; Tue, 5 Jan 2021 14:40:46 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id wnVrkQSle34axwnVskUzZO; Tue, 05 Jan 2021 07:40:45 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5ff47a6d a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=cTAfAr0FFgagRnWDwokA:9 a=P5oi5Kupg7QNYiOD:21 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 07AC91011; Tue, 5 Jan 2021 06:40:42 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 105EefY4071731; Tue, 5 Jan 2021 06:40:41 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101051440.105EefY4071731@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: Baptiste Daroussin cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support In-reply-to: <202101051302.105D24lW041218@gitrepo.freebsd.org> References: <202101051302.105D24lW041218@gitrepo.freebsd.org> Comments: In-reply-to Baptiste Daroussin message dated "Tue, 05 Jan 2021 13:02:04 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 05 Jan 2021 06:40:41 -0800 X-CMAE-Envelope: MS4xfN6fzIBaPIo7Fi7HHtR10XBZxwkhHRFaIFvLAgetawtxRBEI5kziaQRQYTWKkh5uryeWTC9h4eUCiiZVktU9BhsLND2UmVj2gVv0dRL9a82oMm0nJAg5 +IzlhQmK8SkcFk3WdUk484+dmkm6HjDffUAu+LbOYp7lQ4+tVZt0P83Q0HRNjvuswCilE6/UymUH8KAw2B6PzBuvHTb1yMdN73tAKSaoq43a+98a4LmiKmBo N3yeJJ+Yz9zbxHOvx8B8GeTuezwaH9s+GuDgF3iBNoUI3Xylm8lRfEXjG5nPYzxtwxxDu+AVwRjXx12cuCGoN79migZO9n89+ijBgYoB9Ao= X-Rspamd-Queue-Id: 4D9FXv1WDGz4XPq X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 14:40:47 -0000 In message <202101051302.105D24lW041218@gitrepo.freebsd.org>, Baptiste Daroussi n writes: > The branch main has been updated by bapt: > > URL: https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba044 > 1562aa07 > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > Author: Baptiste Daroussin > AuthorDate: 2021-01-04 16:29:40 +0000 > Commit: Baptiste Daroussin > CommitDate: 2021-01-05 13:01:32 +0000 > > ncurses: only keep the version with widechar support > > Only keep the widechar version of ncurses as libncursesw.so.9 > > Keep the old name to avoid breaking the ABI compatibility (the non > widechar version libncurses.so.9 is not binary compatible with > libncursesw.so.9) since all ports and base are already only linking > against the widechar version we can simply remove libncurses.so.9 > > Since the .9 version only lived in the dev branch and never ended in a > release, it is simply removed and not added to any binary compat > package. > > Add symlinks to keep build time compatibility for anyone linking against > -lncurses > --- > Makefile.inc1 | 5 +-- > Makefile.libcompat | 4 +- > ObsoleteFiles.inc | 2 + > lib/ncurses/Makefile | 6 +-- > lib/ncurses/config.mk | 11 +----- > lib/ncurses/form/Makefile | 18 ++++++--- > lib/ncurses/formw/Makefile | 5 --- > lib/ncurses/formw/Makefile.depend | 17 --------- > lib/ncurses/menu/Makefile | 18 ++++++--- > lib/ncurses/menuw/Makefile | 5 --- > lib/ncurses/menuw/Makefile.depend | 17 --------- > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++------------------ > -- > lib/ncurses/ncursesw/Makefile | 7 ---- > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > lib/ncurses/panel/Makefile | 23 ++++++++---- > lib/ncurses/panelw/Makefile | 5 --- > lib/ncurses/panelw/Makefile.depend | 17 --------- > share/mk/src.libnames.mk | 16 ++------ > tools/bsdbox/Makefile.base | 2 +- > tools/tools/ath/athratestats/Makefile | 2 +- > 20 files changed, 87 insertions(+), 180 deletions(-) > > diff --git a/Makefile.inc1 b/Makefile.inc1 > index fecdc1bdca71..a19fde9195cf 100644 > --- a/Makefile.inc1 > +++ b/Makefile.inc1 > @@ -2524,7 +2524,6 @@ _bt_clean= ${CLEANDIR} > ${LOCAL_TOOL_DIRS} \ > ${_jevents} \ > lib/ncurses/ncurses \ > - lib/ncurses/ncursesw \ > ${_rescue} \ > ${_share} \ > usr.bin/awk \ > @@ -2870,7 +2869,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ > lib/libzstd \ > ${_lib_casper} \ > - lib/ncurses/ncurses lib/ncurses/ncursesw \ > + lib/ncurses/ncurses \ > lib/libopie lib/libpam/libpam ${_lib_libthr} \ > ${_lib_libradius} lib/libsbuf lib/libtacplus \ > lib/libgeom \ > @@ -2891,7 +2890,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > .if ${MK_DIALOG} != "no" > _prebuild_libs+= gnu/lib/libdialog > -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L > +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncurses__L > .endif > > .if ${MK_GOOGLETEST} != "no" > diff --git a/Makefile.libcompat b/Makefile.libcompat > index 3f23a33aa19b..85859a960d81 100644 > --- a/Makefile.libcompat > +++ b/Makefile.libcompat > @@ -45,7 +45,7 @@ _LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib > > _LC_INCDIRS= \ > include \ > - lib/ncurses/ncursesw \ > + lib/ncurses/ncurses \ > ${_LC_LIBDIRS.yes} > > .if ${MK_FILE} != "no" > @@ -94,7 +94,7 @@ build${libcompat}: .PHONY > DIRPRFX=${_dir}/ ${_t} > .endfor > .endfor > -.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevent > s} > +.for _dir in lib/ncurses/ncurses lib/ncurses/ncurses ${_libmagic} ${_jevents > } > .for _t in ${_obj} build-tools > ${_+_}cd ${.CURDIR}/${_dir}; \ > WORLDTMP=${WORLDTMP} \ > diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc > index e6da2abd5e5c..638b27b530f0 100644 > --- a/ObsoleteFiles.inc > +++ b/ObsoleteFiles.inc > @@ -36,6 +36,8 @@ > # xargs -n1 | sort | uniq -d; > # done > > +# 20210105: remove non widechar version of clang > +OLD_LIBS+=lib/libncurses.so.9 > # 20210103: new clang import which bumps version from 11.0.0 to 11.0.1. > OLD_FILES+=usr/lib/clang/11.0.0/include/cuda_wrappers/algorithm > OLD_FILES+=usr/lib/clang/11.0.0/include/cuda_wrappers/complex > diff --git a/lib/ncurses/Makefile b/lib/ncurses/Makefile > index a5a19deafafd..be8697fbc609 100644 > --- a/lib/ncurses/Makefile > +++ b/lib/ncurses/Makefile > @@ -1,13 +1,11 @@ > # $FreeBSD$ > > -SUBDIR= ncurses form menu panel \ > - ncursesw formw menuw panelw > +SUBDIR= ncurses form menu panel > > SUBDIR_PARALLEL= > > -.for subdir in ${SUBDIR:Nncurses*:N*w} > +.for subdir in ${SUBDIR:Nncurses*} > SUBDIR_DEPEND_${subdir}= ncurses > -SUBDIR_DEPEND_${subdir}w= ncursesw > .endfor > > .include > diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk > index d15be8601136..f199c5829b65 100644 > --- a/lib/ncurses/config.mk > +++ b/lib/ncurses/config.mk > @@ -4,20 +4,11 @@ > > NCURSES_DIR= ${SRCTOP}/contrib/ncurses > > -.if defined(ENABLE_WIDEC) > -LIB_SUFFIX= w > CFLAGS+= -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC > -NCURSES_CFG_H= ${.CURDIR:H}/ncurses/ncurses_cfg.h > -.else > -LIB_SUFFIX= > NCURSES_CFG_H= ${.CURDIR}/ncurses_cfg.h > -.endif > > CFLAGS+= -I. > -.if exists(${.OBJDIR:H}/ncurses${LIB_SUFFIX}) > -CFLAGS+= -I${.OBJDIR:H}/ncurses${LIB_SUFFIX} > -.endif > -CFLAGS+= -I${.CURDIR:H}/ncurses${LIB_SUFFIX} > +CFLAGS+= -I${.CURDIR:H}/ncurses > > # for ${NCURSES_CFG_H} > CFLAGS+= -I${.CURDIR:H}/ncurses > diff --git a/lib/ncurses/form/Makefile b/lib/ncurses/form/Makefile > index eab5bbb63c09..a8e636d6ce1b 100644 > --- a/lib/ncurses/form/Makefile > +++ b/lib/ncurses/form/Makefile > @@ -1,10 +1,11 @@ > # $FreeBSD$ > > +.include > .include "${.CURDIR:H}/config.mk" > > SRCDIR= ${NCURSES_DIR}/form > > -LIB= form${LIB_SUFFIX} > +LIB= formw > > .PATH: ${SRCDIR} > SRCS= \ > @@ -54,9 +55,8 @@ CLEANFILES= ncurses_def.h > CFLAGS+= -I${SRCDIR} > CFLAGS+= -I${NCURSES_DIR}/menu > > -LIBADD+= ncurses${LIB_SUFFIX} > +LIBADD+= ncursesw > > -.if defined(ENABLE_WIDEC) > INCS= form.h > > .PATH: ${NCURSES_DIR}/man > @@ -156,8 +156,16 @@ MLINKS= form_cursor.3 pos_form_cursor.3 \ > form_win.3 scale_form.3 \ > form_win.3 set_form_sub.3 \ > form_win.3 set_form_win.3 > -.else > -MAN= > + > +# backward compat > +.if ${MK_INSTALLLIB} != "no" > +SYMLINKS+= libformw.a ${LIBDIR}/libform.a > +.endif > +.if !defined(NO_PIC) > +SYMLINKS+= libformw.so ${LIBDIR}/libform.so > +.endif > +.if ${MK_PROFILE} != "no" > +SYMLINKS+= libformw_p.a ${LIBDIR}/libform_p.a > .endif > > .include > diff --git a/lib/ncurses/formw/Makefile b/lib/ncurses/formw/Makefile > deleted file mode 100644 > index 3ec7637373be..000000000000 > --- a/lib/ncurses/formw/Makefile > +++ /dev/null > @@ -1,5 +0,0 @@ > -# $FreeBSD$ > - > -ENABLE_WIDEC= > - > -.include "${.CURDIR:H}/form/Makefile" > diff --git a/lib/ncurses/formw/Makefile.depend b/lib/ncurses/formw/Makefile.d > epend > deleted file mode 100644 > index 3d9451023bec..000000000000 > --- a/lib/ncurses/formw/Makefile.depend > +++ /dev/null > @@ -1,17 +0,0 @@ > -# $FreeBSD$ > -# Autogenerated - do NOT edit! > - > -DIRDEPS = \ > - include \ > - include/xlocale \ > - lib/${CSU_DIR} \ > - lib/libc \ > - lib/libcompiler_rt \ > - lib/ncurses/ncursesw \ > - > - > -.include > - > -.if ${DEP_RELDIR} == ${_DEP_RELDIR} > -# local dependencies - needed for -jN in clean tree > -.endif > diff --git a/lib/ncurses/menu/Makefile b/lib/ncurses/menu/Makefile > index 653619638fbc..7844cd4d936c 100644 > --- a/lib/ncurses/menu/Makefile > +++ b/lib/ncurses/menu/Makefile > @@ -1,10 +1,11 @@ > # $FreeBSD$ > > +.include > .include "${.CURDIR:H}/config.mk" > > SRCDIR= ${NCURSES_DIR}/menu > > -LIB= menu${LIB_SUFFIX} > +LIB= menuw > > .PATH: ${SRCDIR} > SRCS= \ > @@ -40,9 +41,8 @@ CLEANFILES= ncurses_def.h > > CFLAGS+= -I${SRCDIR} > > -LIBADD+= ncurses${LIB_SUFFIX} > +LIBADD+= ncursesw > > -.if defined(ENABLE_WIDEC) > INCS= menu.h eti.h > > .PATH: ${NCURSES_DIR}/man > @@ -128,8 +128,16 @@ MLINKS= menu_attributes.3 menu_back.3 \ > mitem_value.3 item_value.3 \ > mitem_value.3 set_item_value.3 \ > mitem_visible.3 item_visible.3 > -.else > -MAN= > + > +# backward compat > +.if ${MK_INSTALLLIB} != "no" > +SYMLINKS+= libmenuw.a ${LIBDIR}/libmenu.a > +.endif > +.if !defined(NO_PIC) > +SYMLINKS+= libmenuw.so ${LIBDIR}/libmenu.so > +.endif > +.if ${MK_PROFILE} != "no" > +SYMLINKS+= libmenuw_p.a ${LIBDIR}/libmenu_p.a > .endif > > .include > diff --git a/lib/ncurses/menuw/Makefile b/lib/ncurses/menuw/Makefile > deleted file mode 100644 > index d6df56332826..000000000000 > --- a/lib/ncurses/menuw/Makefile > +++ /dev/null > @@ -1,5 +0,0 @@ > -# $FreeBSD$ > - > -ENABLE_WIDEC= > - > -.include "${.CURDIR:H}/menu/Makefile" > diff --git a/lib/ncurses/menuw/Makefile.depend b/lib/ncurses/menuw/Makefile.d > epend > deleted file mode 100644 > index 3d9451023bec..000000000000 > --- a/lib/ncurses/menuw/Makefile.depend > +++ /dev/null > @@ -1,17 +0,0 @@ > -# $FreeBSD$ > -# Autogenerated - do NOT edit! > - > -DIRDEPS = \ > - include \ > - include/xlocale \ > - lib/${CSU_DIR} \ > - lib/libc \ > - lib/libcompiler_rt \ > - lib/ncurses/ncursesw \ > - > - > -.include > - > -.if ${DEP_RELDIR} == ${_DEP_RELDIR} > -# local dependencies - needed for -jN in clean tree > -.endif > diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile > index efa38691115e..6f03d93a9ac6 100644 > --- a/lib/ncurses/ncurses/Makefile > +++ b/lib/ncurses/ncurses/Makefile > @@ -3,16 +3,11 @@ > PACKAGE= clibs > SHLIBDIR?= /lib > > -.if !defined(ENABLE_WIDEC) > -# Override any MAN= setting below.. > -MK_MAN=no > -.endif > - > .include > > .include "${.CURDIR:H}/config.mk" > > -LIB= ncurses${LIB_SUFFIX} > +LIB= ncursesw > SHLIB_MAJOR= 9 > > NO_LINT= > @@ -22,17 +17,10 @@ NCURSES_MINOR!= egrep 'NCURSES_MINOR[ ]*=' ${NCURSES_ > DIR}/dist.mk | sed -e 's%^ > NCURSES_PATCH!= egrep 'NCURSES_PATCH[ ]*=' ${NCURSES_DIR}/dist.mk | s > ed -e 's%^[^0-9]*%%' > > # From autoconf (!) > -.if defined(ENABLE_WIDEC) > NCURSES_CH_T= cchar_t > NCURSES_OK_WCHAR_T= 1 > NEED_WCHAR_H= 1 > NCURSES_EXT_COLORS= 1 > -.else > -NCURSES_CH_T= chtype > -NCURSES_OK_WCHAR_T= > -NEED_WCHAR_H= 0 > -NCURSES_EXT_COLORS= 0 > -.endif > NCURSES_EXT_FUNCS= 1 > NCURSES_CONST= const > NCURSES_INLINE= inline > @@ -242,7 +230,6 @@ SRCS+= \ > lib_vidattr.c \ > tty_update.c > > -.if defined(ENABLE_WIDEC) > .PATH: ${NCURSES_DIR}/ncurses/widechar > SRCS+= \ > charable.c \ > @@ -265,7 +252,6 @@ SRCS+= \ > lib_vline_set.c \ > lib_wacs.c \ > lib_wunctrl.c > -.endif > > .PATH: ${NCURSES_DIR}/ncurses/trace > SRCS+= \ > @@ -298,42 +284,54 @@ HEADERS= curses.h term.h termcap.h unctrl.h > SRCHDRS= ncurses_dll.h > CLEANFILES+= ncurses_dll.h > > -.if defined(ENABLE_WIDEC) > INCS= ${HEADERS} ${SRCHDRS} > INCSLINKS= curses.h ${INCLUDEDIR}/ncurses.h > -.endif > > .if ${MK_INSTALLLIB} != "no" > -SYMLINKS+= libncurses${LIB_SUFFIX}.a ${LIBDIR}/libcurses${LIB_SUFFIX}.a > -SYMLINKS+= libncurses${LIB_SUFFIX}.a ${LIBDIR}/libtermcap${LIB_SUFFIX}.a > -SYMLINKS+= libncurses${LIB_SUFFIX}.a ${LIBDIR}/libtermlib${LIB_SUFFIX}.a > -SYMLINKS+= libncurses${LIB_SUFFIX}.a ${LIBDIR}/libtinfo${LIB_SUFFIX}.a > +SYMLINKS+= libncursesw.a ${LIBDIR}/libcursesw.a > +SYMLINKS+= libncursesw.a ${LIBDIR}/libtermcapw.a > +SYMLINKS+= libncursesw.a ${LIBDIR}/libtermlibw.a > +SYMLINKS+= libncursesw.a ${LIBDIR}/libtinfow.a > +# backward compat > +SYMLINKS+= libncursesw.a ${LIBDIR}/libncurses.a > +SYMLINKS+= libncursesw.a ${LIBDIR}/libcurses.a > +SYMLINKS+= libncursesw.a ${LIBDIR}/libtermcap.a > +SYMLINKS+= libncursesw.a ${LIBDIR}/libtermlib.a > +SYMLINKS+= libncursesw.a ${LIBDIR}/libtinfo.a > .endif > .if !defined(NO_PIC) > # no need for major at all, it's an ld-time redirection only > -SYMLINKS+= libncurses${LIB_SUFFIX}.so ${LIBDIR}/libcurses${LIB_SUFFIX}.so > -SYMLINKS+= libncurses${LIB_SUFFIX}.so ${LIBDIR}/libtermcap${LIB_SUFFIX}.so > -SYMLINKS+= libncurses${LIB_SUFFIX}.so ${LIBDIR}/libtermlib${LIB_SUFFIX}.so > -SYMLINKS+= libncurses${LIB_SUFFIX}.so ${LIBDIR}/libtinfo${LIB_SUFFIX}.so > +SYMLINKS+= libncursesw.so ${LIBDIR}/libcursesw.so > +SYMLINKS+= libncursesw.so ${LIBDIR}/libtermcapw.so > +SYMLINKS+= libncursesw.so ${LIBDIR}/libtermlibw.so > +SYMLINKS+= libncursesw.so ${LIBDIR}/libtinfow.so > +# backward compat > +SYMLINKS+= libncursesw.so ${LIBDIR}/libncurses.so > +SYMLINKS+= libncursesw.so ${LIBDIR}/libcurses.so > +SYMLINKS+= libncursesw.so ${LIBDIR}/libtermcap.so > +SYMLINKS+= libncursesw.so ${LIBDIR}/libtermlib.so > +SYMLINKS+= libncursesw.so ${LIBDIR}/libtinfo.so > .endif > .if ${MK_PROFILE} != "no" > -SYMLINKS+= libncurses${LIB_SUFFIX}_p.a ${LIBDIR}/libcurses${LIB_SUFFIX}_p. > a > -SYMLINKS+= libncurses${LIB_SUFFIX}_p.a ${LIBDIR}/libtermcap${LIB_SUFFIX}_p > .a > -SYMLINKS+= libncurses${LIB_SUFFIX}_p.a ${LIBDIR}/libtermlib${LIB_SUFFIX}_p > .a > -SYMLINKS+= libncurses${LIB_SUFFIX}_p.a ${LIBDIR}/libtinfo${LIB_SUFFIX}_p.a > +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libcursesw_p.a > +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtermcapw_p.a > +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtermlibw_p.a > +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtinfow_p.a > +# backward compat > +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libncurses_p.a > +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libcurses_p.a > +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtermcap_p.a > +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtermlib_p.a > +SYMLINKS+= libncursesw_p.a ${LIBDIR}/libtinfo_p.a > .endif > > -.if ${.CURDIR:T} == "ncursesw" > -.if defined(ENABLE_WIDEC) > DOCSDIR= ${SHAREDIR}/doc/ncurses > DOCS= ncurses-intro.html hackguide.html > -.endif > > .if ${MK_HTML} != "no" > .PATH: ${NCURSES_DIR}/doc/html > FILESGROUPS= DOCS > .endif > -.endif > > # Generated source > .ORDER: names.c codes.c > @@ -394,9 +392,7 @@ curses.h: curses.head MKkey_defs.sh Caps Caps-ncurses > cat curses.head > $@.new > AWK=${AWK} _POSIX2_VERSION=199209 sh ${NCURSES_DIR}/include/MKkey_defs. > sh \ > ${NCURSES_DIR}/include/Caps ${NCURSES_DIR}/include/Caps-ncurses >> > $@.new > -.if defined(ENABLE_WIDEC) > cat ${NCURSES_DIR}/include/curses.wide >> $@.new > -.endif > cat ${NCURSES_DIR}/include/curses.tail >> $@.new > mv -f $@.new $@ > > @@ -505,7 +501,6 @@ terminfo.5: MKterminfo.sh terminfo.head Caps > > CLEANFILES+= terminfo.5 > > -.if defined(ENABLE_WIDEC) > .PATH: ${NCURSES_DIR}/man > MAN= \ > curs_addch.3 \ > @@ -585,7 +580,6 @@ MAN+= \ > > MAN+= term.5 terminfo.5 scr_dump.5 user_caps.5 > MAN+= term.7 > -.endif > > CLEANFILES+= ${MAN:M*.3} > > @@ -1065,7 +1059,6 @@ MLINKS= ncurses.3 curses.3 \ > resizeterm.3 is_term_resized.3 \ > resizeterm.3 resize_term.3 > > -.if defined(ENABLE_WIDEC) > MLINKS+=curs_add_wch.3 add_wch.3 \ > curs_add_wch.3 echo_wchar.3 \ > curs_add_wch.3 mvadd_wch.3 \ > @@ -1145,8 +1138,6 @@ MLINKS+=curs_add_wch.3 add_wch.3 \ > curs_scanw.3 vw_scanw.3 \ > curs_scanw.3 vwscanw.3 \ > curs_scanw.3 wscanw.3 > -.endif > - > > .include > > diff --git a/lib/ncurses/ncursesw/Makefile b/lib/ncurses/ncursesw/Makefile > deleted file mode 100644 > index 5f6040e7119c..000000000000 > --- a/lib/ncurses/ncursesw/Makefile > +++ /dev/null > @@ -1,7 +0,0 @@ > -# $FreeBSD$ > - > -ENABLE_WIDEC= > - > -.PATH: ${.CURDIR:H}/ncurses > - > -.include "${.CURDIR:H}/ncurses/Makefile" > diff --git a/lib/ncurses/ncursesw/Makefile.depend b/lib/ncurses/ncursesw/Make > file.depend > deleted file mode 100644 > index 8d409f5263ac..000000000000 > --- a/lib/ncurses/ncursesw/Makefile.depend > +++ /dev/null > @@ -1,16 +0,0 @@ > -# $FreeBSD$ > -# Autogenerated - do NOT edit! > - > -DIRDEPS = \ > - include \ > - include/xlocale \ > - lib/${CSU_DIR} \ > - lib/libc \ > - lib/libcompiler_rt \ > - > - > -.include > - > -.if ${DEP_RELDIR} == ${_DEP_RELDIR} > -# local dependencies - needed for -jN in clean tree > -.endif > diff --git a/lib/ncurses/panel/Makefile b/lib/ncurses/panel/Makefile > index 1993f5e76ac2..a22df4d89570 100644 > --- a/lib/ncurses/panel/Makefile > +++ b/lib/ncurses/panel/Makefile > @@ -1,10 +1,11 @@ > # $FreeBSD$ > > +.include > .include "${.CURDIR:H}/config.mk" > > SRCDIR= ${NCURSES_DIR}/panel > > -LIB= panel${LIB_SUFFIX} > +LIB= panelw > > .PATH: ${SRCDIR} > SRCS= \ > @@ -29,10 +30,7 @@ CLEANFILES= ncurses_def.h > > CFLAGS+= -I${SRCDIR} > > -LIBADD+= ncurses${LIB_SUFFIX} > - > -.if defined(ENABLE_WIDEC) > -INCS= panel.h > +LIBADD+= ncursesw > > # generate MAN > .PATH: ${NCURSES_DIR}/man > @@ -56,10 +54,19 @@ MLINKS= panel.3 bottom_panel.3 \ > panel.3 show_panel.3 \ > panel.3 top_panel.3 \ > panel.3 update_panels.3 > -.else > -MAN= > + > +# backward compat > +.if ${MK_INSTALLLIB} != "no" > +SYMLINKS+= libpanelw.a ${LIBDIR}/libpanel.a > +.endif > +.if !defined(NO_PIC) > +SYMLINKS+= libpanelw.so ${LIBDIR}/libpanel.so > .endif > - > +.if ${MK_PROFILE} != "no" > +SYMLINKS+= libpanelw_p.a ${LIBDIR}/libpanel_p.a > +.endif > + > +INCS= panel.h > .include > > # Keep the .SUFFIXES line after the include of bsd.lib.mk > diff --git a/lib/ncurses/panelw/Makefile b/lib/ncurses/panelw/Makefile > deleted file mode 100644 > index 2585738a5e60..000000000000 > --- a/lib/ncurses/panelw/Makefile > +++ /dev/null > @@ -1,5 +0,0 @@ > -# $FreeBSD$ > - > -ENABLE_WIDEC= > - > -.include "${.CURDIR:H}/panel/Makefile" > diff --git a/lib/ncurses/panelw/Makefile.depend b/lib/ncurses/panelw/Makefile > .depend > deleted file mode 100644 > index 3d9451023bec..000000000000 > --- a/lib/ncurses/panelw/Makefile.depend > +++ /dev/null > @@ -1,17 +0,0 @@ > -# $FreeBSD$ > -# Autogenerated - do NOT edit! > - > -DIRDEPS = \ > - include \ > - include/xlocale \ > - lib/${CSU_DIR} \ > - lib/libc \ > - lib/libcompiler_rt \ > - lib/ncurses/ncursesw \ > - > - > -.include > - > -.if ${DEP_RELDIR} == ${_DEP_RELDIR} > -# local dependencies - needed for -jN in clean tree > -.endif > diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk > index ee94279e0cca..32cd1677bcd4 100644 > --- a/share/mk/src.libnames.mk > +++ b/share/mk/src.libnames.mk > @@ -144,7 +144,6 @@ _LIBRARIES= \ > memstat \ > mp \ > mt \ > - ncurses \ > ncursesw \ > netgraph \ > netmap \ > @@ -182,7 +181,6 @@ _LIBRARIES= \ > supcplusplus \ > sysdecode \ > tacplus \ > - termcap \ > termcapw \ > tpool \ > ufs \ > @@ -376,7 +374,6 @@ _DP_c+= ssp_nonshared > _DP_stats= sbuf pthread > _DP_stdthreads= pthread > _DP_tacplus= md > -_DP_panel= ncurses > _DP_panelw= ncursesw > _DP_rpcsec_gss= gssapi > _DP_smb= kiconv > @@ -663,14 +660,10 @@ LIBBSDXMLDIR= ${OBJTOP}/lib/libexpat > LIBKVMDIR= ${OBJTOP}/lib/libkvm > LIBPTHREADDIR= ${OBJTOP}/lib/libthr > LIBMDIR= ${OBJTOP}/lib/msun > -LIBFORMDIR= ${OBJTOP}/lib/ncurses/form > -LIBFORMLIBWDIR= ${OBJTOP}/lib/ncurses/formw > -LIBMENUDIR= ${OBJTOP}/lib/ncurses/menu > -LIBMENULIBWDIR= ${OBJTOP}/lib/ncurses/menuw > -LIBNCURSESDIR= ${OBJTOP}/lib/ncurses/ncurses > -LIBNCURSESWDIR= ${OBJTOP}/lib/ncurses/ncursesw > -LIBPANELDIR= ${OBJTOP}/lib/ncurses/panel > -LIBPANELWDIR= ${OBJTOP}/lib/ncurses/panelw > +LIBFORMWDIR= ${OBJTOP}/lib/ncurses/form > +LIBMENUWDIR= ${OBJTOP}/lib/ncurses/menu > +LIBNCURSESWDIR= ${OBJTOP}/lib/ncurses/ncurses > +LIBPANELWDIR= ${OBJTOP}/lib/ncurses/panel > LIBCRYPTODIR= ${OBJTOP}/secure/lib/libcrypto > LIBSPLDIR= ${OBJTOP}/cddl/lib/libspl > LIBSSHDIR= ${OBJTOP}/secure/lib/libssh > @@ -679,7 +672,6 @@ LIBTEKENDIR= ${OBJTOP}/sys/teken/libteken > LIBEGACYDIR= ${OBJTOP}/tools/build > LIBLNDIR= ${OBJTOP}/usr.bin/lex/lib > > -LIBTERMCAPDIR= ${LIBNCURSESDIR} > LIBTERMCAPWDIR= ${LIBNCURSESWDIR} > > # Default other library directories to lib/libNAME. > diff --git a/tools/bsdbox/Makefile.base b/tools/bsdbox/Makefile.base > index aac44480e2ca..f2ffc2e49f70 100644 > --- a/tools/bsdbox/Makefile.base > +++ b/tools/bsdbox/Makefile.base > @@ -14,7 +14,7 @@ CRUNCH_ALIAS_tset= reset > > CRUNCH_PROGS_usr.bin+= vmstat > #CRUNCH_PROGS_user.bin+= systat > -CRUNCH_LIBS+= -ldevstat -lncursesw -lncurses -lmemstat -lkvm > -lelf > +CRUNCH_LIBS+= -ldevstat -lncursesw -lmemstat -lkvm -lelf > > # CRUNCH_PROGS_usr.bin+= tar > CRUNCH_PROGS_usr.bin+= cpio > diff --git a/tools/tools/ath/athratestats/Makefile b/tools/tools/ath/athrates > tats/Makefile > index 7a51392a9a7e..ccf04ebd8da0 100644 > --- a/tools/tools/ath/athratestats/Makefile > +++ b/tools/tools/ath/athratestats/Makefile > @@ -7,7 +7,7 @@ PROG= athratestats > > SRCS= main.c opt_ah.h ah_osdep.h > > -LIBADD+= ncurses > +LIBADD+= ncursesw > > CLEANFILES+= opt_ah.h ah_osdep.h > > This fails to build in compat32. --- lib/libthr__L --- install -U -s -o root -g wheel -m 444 -S libthr.so.3 /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ --- lib/ncurses/ncurses__L --- /opt/src/git-src/contrib/ncurses/ncurses/curses.priv.h:2322:61: error: unknown type name 'mbstate_t'; did you mean '__mbstate_t'? extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *); ^~~~~~~~~ __mbstate_t /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/sys/_types .h:124:3: note: '__mbstate_t' declared here } __mbstate_t; ^ /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:15: error: implicit declaration of function 'wctob' is invalid in C99 [-Werror,-Wimplicit-function-declaration] result = (wctob((wint_t) ch) == (int) ch); ^ /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:15: note: did you mean 'wctomb'? /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/stdlib.h:1 23:6: note: 'wctomb' declared here int wctomb(char *, wchar_t); ^ /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:22: error: use of undeclared identifier 'wint_t' result = (wctob((wint_t) ch) == (int) ch); ^ /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:49:33: error: unknown type name 'wint_t' NCURSES_EXPORT(int) _nc_to_char(wint_t ch) ^ /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:53:14: error: implicit declaration of function 'wctob' is invalid in C99 [-Werror,-Wimplicit-function-declaration] result = wctob(ch); ^ /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:67:16: error: unknown type name 'wint_t' NCURSES_EXPORT(wint_t) _nc_to_widechar(int ch) --- cddl/lib/libspl__L --- install -U -s -o root -g wheel -m 444 -S libspl.so.2 /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ --- lib/ncurses/ncurses__L --- ^ /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:11: error: expected ';' after expression wint_t result; ^ ; --- cddl/lib/libnvpair__L --- install -U -o root -g wheel -m 444 libnvpair.so.2.debug /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug/usr/lib3 2/ --- lib/ncurses/ncurses__L --- /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:5: error: use of undeclared identifier 'wint_t' wint_t result; ^ /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:12: error: use of undeclared identifier 'result' wint_t result; ^ /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:5: error: use of undeclared identifier 'result' result = btowc(ch); ^ /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:14: error: implicit declaration of function 'btowc' is invalid in C99 [-Werror,-Wimplicit-function-declaration] result = btowc(ch); ^ /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:14: note: did you mean 'mbtowc'? /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/stdlib.h:1 09:6: note: 'mbtowc' declared here int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); ^ /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:84:12: error: use of undeclared identifier 'result' return result; ^ 14 errors generated. *** [charable.o] Error code 1 make[4]: stopped in /opt/src/git-src/lib/ncurses/ncurses 1 error make[4]: stopped in /opt/src/git-src/lib/ncurses/ncurses --- cddl/lib/libicp__L --- --- cddl/lib/libicp_rescue__L --- --- lib/libufs__L --- install -U -C -o root -g wheel -m 444 libufs_p.a /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ --- lib/libutil__L --- --- lib/libthr__L --- install -U -o root -g wheel -m 444 libthr.so.3.debug /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug/usr/lib3 2/ --- cddl/lib/libspl__L --- install -U -o root -g wheel -m 444 libspl.so.2.debug /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug/usr/lib3 2/ --- lib/libthr__L --- --- cddl/lib/libnvpair__L --- install -U -l rs -o root -g wheel -m 755 -S libnvpair.so.2 /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/libnvpair.so *** [build32] Error code 2 make[1]: stopped in /opt/src/git-src 1 error make[1]: stopped in /opt/src/git-src exiting RC=2: building amd64 slippy# -- 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-dev-commits-src-all@freebsd.org Tue Jan 5 14:48:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 26AE74E68DB; Tue, 5 Jan 2021 14:48:26 +0000 (UTC) (envelope-from git@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 4D9Fjk0gZwz4XyH; Tue, 5 Jan 2021 14:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A33A5F44; Tue, 5 Jan 2021 14:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105EmPDR074044; Tue, 5 Jan 2021 14:48:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105EmPZY074043; Tue, 5 Jan 2021 14:48:25 GMT (envelope-from git) Date: Tue, 5 Jan 2021 14:48:25 GMT Message-Id: <202101051448.105EmPZY074043@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 225afb6cad98 - main - Improve readability of the options list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 225afb6cad9808af42408875baaa243d6d75d92d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 14:48:26 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=225afb6cad9808af42408875baaa243d6d75d92d commit 225afb6cad9808af42408875baaa243d6d75d92d Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-01-05 14:46:56 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-01-05 14:46:56 +0000 Improve readability of the options list MFC after: 3 days --- usr.bin/script/script.1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1 index 68e0b76ac790..681440e7274a 100644 --- a/usr.bin/script/script.1 +++ b/usr.bin/script/script.1 @@ -28,7 +28,7 @@ .\" @(#)script.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd September 1, 2020 +.Dd January 5, 2021 .Dt SCRIPT 1 .Os .Sh NAME @@ -66,7 +66,7 @@ will run the specified command with an optional argument vector instead of an interactive shell. .Pp The following options are available: -.Bl -tag -width indent +.Bl -tag -width "-F pipe" .It Fl a Append the output to .Ar file From owner-dev-commits-src-all@freebsd.org Tue Jan 5 14:48:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ED5A54E687F; Tue, 5 Jan 2021 14:48:40 +0000 (UTC) (envelope-from bapt@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 4D9Fk06JyJz4Xkx; Tue, 5 Jan 2021 14:48:40 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from ivaldir.etoilebsd.net (etoilebsd.net [178.32.217.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id 8292C37CA7; Tue, 5 Jan 2021 14:48:40 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by ivaldir.etoilebsd.net (Postfix, from userid 1001) id 85F3FEA821; Tue, 5 Jan 2021 15:48:39 +0100 (CET) Date: Tue, 5 Jan 2021 15:48:39 +0100 From: Baptiste Daroussin To: Cy Schubert Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support Message-ID: <20210105144839.73qamvxrnhxpd3nk@ivaldir.net> References: <202101051302.105D24lW041218@gitrepo.freebsd.org> <202101051440.105EefY4071731@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yj2rojvagivjcjon" Content-Disposition: inline In-Reply-To: <202101051440.105EefY4071731@slippy.cwsent.com> X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 14:48:41 -0000 --yj2rojvagivjcjon Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 05, 2021 at 06:40:41AM -0800, Cy Schubert wrote: > In message <202101051302.105D24lW041218@gitrepo.freebsd.org>, Baptiste=20 > Daroussi > n writes: > > The branch main has been updated by bapt: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D821aa63a09402935da0a73ab= f20ba044 > > 1562aa07 > > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > Author: Baptiste Daroussin > > AuthorDate: 2021-01-04 16:29:40 +0000 > > Commit: Baptiste Daroussin > > CommitDate: 2021-01-05 13:01:32 +0000 > > > > ncurses: only keep the version with widechar support > > =20 > > Only keep the widechar version of ncurses as libncursesw.so.9 > > =20 > > Keep the old name to avoid breaking the ABI compatibility (the non > > widechar version libncurses.so.9 is not binary compatible with > > libncursesw.so.9) since all ports and base are already only linking > > against the widechar version we can simply remove libncurses.so.9 > > =20 > > Since the .9 version only lived in the dev branch and never ended i= n a > > release, it is simply removed and not added to any binary compat > > package. > > =20 > > Add symlinks to keep build time compatibility for anyone linking ag= ainst > > -lncurses > > --- > > Makefile.inc1 | 5 +-- > > Makefile.libcompat | 4 +- > > ObsoleteFiles.inc | 2 + > > lib/ncurses/Makefile | 6 +-- > > lib/ncurses/config.mk | 11 +----- > > lib/ncurses/form/Makefile | 18 ++++++--- > > lib/ncurses/formw/Makefile | 5 --- > > lib/ncurses/formw/Makefile.depend | 17 --------- > > lib/ncurses/menu/Makefile | 18 ++++++--- > > lib/ncurses/menuw/Makefile | 5 --- > > lib/ncurses/menuw/Makefile.depend | 17 --------- > > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++------------= ------ > > -- > > lib/ncurses/ncursesw/Makefile | 7 ---- > > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > > lib/ncurses/panel/Makefile | 23 ++++++++---- > > lib/ncurses/panelw/Makefile | 5 --- > > lib/ncurses/panelw/Makefile.depend | 17 --------- > > share/mk/src.libnames.mk | 16 ++------ > > tools/bsdbox/Makefile.base | 2 +- > > tools/tools/ath/athratestats/Makefile | 2 +- > > 20 files changed, 87 insertions(+), 180 deletions(-) > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > index fecdc1bdca71..a19fde9195cf 100644 > > --- a/Makefile.inc1 > > +++ b/Makefile.inc1 > > @@ -2524,7 +2524,6 @@ _bt_clean=3D ${CLEANDIR} > > ${LOCAL_TOOL_DIRS} \ > > ${_jevents} \ > > lib/ncurses/ncurses \ > > - lib/ncurses/ncursesw \ > > ${_rescue} \ > > ${_share} \ > > usr.bin/awk \ > > @@ -2870,7 +2869,7 @@ _prebuild_libs=3D ${_kerberos5_lib_libasn1} \ > > lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ > > lib/libzstd \ > > ${_lib_casper} \ > > - lib/ncurses/ncurses lib/ncurses/ncursesw \ > > + lib/ncurses/ncurses \ > > lib/libopie lib/libpam/libpam ${_lib_libthr} \ > > ${_lib_libradius} lib/libsbuf lib/libtacplus \ > > lib/libgeom \ > > @@ -2891,7 +2890,7 @@ _prebuild_libs=3D ${_kerberos5_lib_libasn1} \ > > =20 > > .if ${MK_DIALOG} !=3D "no" > > _prebuild_libs+=3D gnu/lib/libdialog > > -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L > > +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncurses__L > > .endif > > =20 > > .if ${MK_GOOGLETEST} !=3D "no" > > diff --git a/Makefile.libcompat b/Makefile.libcompat > > index 3f23a33aa19b..85859a960d81 100644 > > --- a/Makefile.libcompat > > +++ b/Makefile.libcompat > > @@ -45,7 +45,7 @@ _LC_LIBDIRS.${MK_KERBEROS:tl}+=3D kerberos5/lib > > =20 > > _LC_INCDIRS=3D \ > > include \ > > - lib/ncurses/ncursesw \ > > + lib/ncurses/ncurses \ > > ${_LC_LIBDIRS.yes} > > =20 > > .if ${MK_FILE} !=3D "no" > > @@ -94,7 +94,7 @@ build${libcompat}: .PHONY > > DIRPRFX=3D${_dir}/ ${_t} > > .endfor > > .endfor > > -.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_= jevent > > s} > > +.for _dir in lib/ncurses/ncurses lib/ncurses/ncurses ${_libmagic} ${_j= events > > } > > .for _t in ${_obj} build-tools > > ${_+_}cd ${.CURDIR}/${_dir}; \ > > WORLDTMP=3D${WORLDTMP} \ > > diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc > > index e6da2abd5e5c..638b27b530f0 100644 > > --- a/ObsoleteFiles.inc > > +++ b/ObsoleteFiles.inc > > @@ -36,6 +36,8 @@ > > # xargs -n1 | sort | uniq -d; > > # done > > =20 > > +# 20210105: remove non widechar version of clang > > +OLD_LIBS+=3Dlib/libncurses.so.9 > > # 20210103: new clang import which bumps version from 11.0.0 to 11.0.1. > > OLD_FILES+=3Dusr/lib/clang/11.0.0/include/cuda_wrappers/algorithm > > OLD_FILES+=3Dusr/lib/clang/11.0.0/include/cuda_wrappers/complex > > diff --git a/lib/ncurses/Makefile b/lib/ncurses/Makefile > > index a5a19deafafd..be8697fbc609 100644 > > --- a/lib/ncurses/Makefile > > +++ b/lib/ncurses/Makefile > > @@ -1,13 +1,11 @@ > > # $FreeBSD$ > > =20 > > -SUBDIR=3D ncurses form menu panel \ > > - ncursesw formw menuw panelw > > +SUBDIR=3D ncurses form menu panel > > =20 > > SUBDIR_PARALLEL=3D > > =20 > > -.for subdir in ${SUBDIR:Nncurses*:N*w} > > +.for subdir in ${SUBDIR:Nncurses*} > > SUBDIR_DEPEND_${subdir}=3D ncurses > > -SUBDIR_DEPEND_${subdir}w=3D ncursesw > > .endfor > > =20 > > .include > > diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk > > index d15be8601136..f199c5829b65 100644 > > --- a/lib/ncurses/config.mk > > +++ b/lib/ncurses/config.mk > > @@ -4,20 +4,11 @@ > > =20 > > NCURSES_DIR=3D ${SRCTOP}/contrib/ncurses > > =20 > > -.if defined(ENABLE_WIDEC) > > -LIB_SUFFIX=3D w > > CFLAGS+=3D -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC > > -NCURSES_CFG_H=3D ${.CURDIR:H}/ncurses/ncurses_cfg.h > > -.else > > -LIB_SUFFIX=3D > > NCURSES_CFG_H=3D ${.CURDIR}/ncurses_cfg.h > > -.endif > > =20 > > CFLAGS+=3D -I. > > -.if exists(${.OBJDIR:H}/ncurses${LIB_SUFFIX}) > > -CFLAGS+=3D -I${.OBJDIR:H}/ncurses${LIB_SUFFIX} > > -.endif > > -CFLAGS+=3D -I${.CURDIR:H}/ncurses${LIB_SUFFIX} > > +CFLAGS+=3D -I${.CURDIR:H}/ncurses > > =20 > > # for ${NCURSES_CFG_H} > > CFLAGS+=3D -I${.CURDIR:H}/ncurses > > diff --git a/lib/ncurses/form/Makefile b/lib/ncurses/form/Makefile > > index eab5bbb63c09..a8e636d6ce1b 100644 > > --- a/lib/ncurses/form/Makefile > > +++ b/lib/ncurses/form/Makefile > > @@ -1,10 +1,11 @@ > > # $FreeBSD$ > > =20 > > +.include > > .include "${.CURDIR:H}/config.mk" > > =20 > > SRCDIR=3D ${NCURSES_DIR}/form > > =20 > > -LIB=3D form${LIB_SUFFIX} > > +LIB=3D formw > > =20 > > .PATH: ${SRCDIR} > > SRCS=3D \ > > @@ -54,9 +55,8 @@ CLEANFILES=3D ncurses_def.h > > CFLAGS+=3D -I${SRCDIR} > > CFLAGS+=3D -I${NCURSES_DIR}/menu > > =20 > > -LIBADD+=3D ncurses${LIB_SUFFIX} > > +LIBADD+=3D ncursesw > > =20 > > -.if defined(ENABLE_WIDEC) > > INCS=3D form.h > > =20 > > .PATH: ${NCURSES_DIR}/man > > @@ -156,8 +156,16 @@ MLINKS=3D form_cursor.3 pos_form_cursor.3 \ > > form_win.3 scale_form.3 \ > > form_win.3 set_form_sub.3 \ > > form_win.3 set_form_win.3 > > -.else > > -MAN=3D > > + > > +# backward compat > > +.if ${MK_INSTALLLIB} !=3D "no" > > +SYMLINKS+=3D libformw.a ${LIBDIR}/libform.a > > +.endif > > +.if !defined(NO_PIC) > > +SYMLINKS+=3D libformw.so ${LIBDIR}/libform.so > > +.endif > > +.if ${MK_PROFILE} !=3D "no" > > +SYMLINKS+=3D libformw_p.a ${LIBDIR}/libform_p.a > > .endif > > =20 > > .include > > diff --git a/lib/ncurses/formw/Makefile b/lib/ncurses/formw/Makefile > > deleted file mode 100644 > > index 3ec7637373be..000000000000 > > --- a/lib/ncurses/formw/Makefile > > +++ /dev/null > > @@ -1,5 +0,0 @@ > > -# $FreeBSD$ > > - > > -ENABLE_WIDEC=3D > > - > > -.include "${.CURDIR:H}/form/Makefile" > > diff --git a/lib/ncurses/formw/Makefile.depend b/lib/ncurses/formw/Make= file.d > > epend > > deleted file mode 100644 > > index 3d9451023bec..000000000000 > > --- a/lib/ncurses/formw/Makefile.depend > > +++ /dev/null > > @@ -1,17 +0,0 @@ > > -# $FreeBSD$ > > -# Autogenerated - do NOT edit! > > - > > -DIRDEPS =3D \ > > - include \ > > - include/xlocale \ > > - lib/${CSU_DIR} \ > > - lib/libc \ > > - lib/libcompiler_rt \ > > - lib/ncurses/ncursesw \ > > - > > - > > -.include > > - > > -.if ${DEP_RELDIR} =3D=3D ${_DEP_RELDIR} > > -# local dependencies - needed for -jN in clean tree > > -.endif > > diff --git a/lib/ncurses/menu/Makefile b/lib/ncurses/menu/Makefile > > index 653619638fbc..7844cd4d936c 100644 > > --- a/lib/ncurses/menu/Makefile > > +++ b/lib/ncurses/menu/Makefile > > @@ -1,10 +1,11 @@ > > # $FreeBSD$ > > =20 > > +.include > > .include "${.CURDIR:H}/config.mk" > > =20 > > SRCDIR=3D ${NCURSES_DIR}/menu > > =20 > > -LIB=3D menu${LIB_SUFFIX} > > +LIB=3D menuw > > =20 > > .PATH: ${SRCDIR} > > SRCS=3D \ > > @@ -40,9 +41,8 @@ CLEANFILES=3D ncurses_def.h > > =20 > > CFLAGS+=3D -I${SRCDIR} > > =20 > > -LIBADD+=3D ncurses${LIB_SUFFIX} > > +LIBADD+=3D ncursesw > > =20 > > -.if defined(ENABLE_WIDEC) > > INCS=3D menu.h eti.h > > =20 > > .PATH: ${NCURSES_DIR}/man > > @@ -128,8 +128,16 @@ MLINKS=3D menu_attributes.3 menu_back.3 \ > > mitem_value.3 item_value.3 \ > > mitem_value.3 set_item_value.3 \ > > mitem_visible.3 item_visible.3 > > -.else > > -MAN=3D > > + > > +# backward compat > > +.if ${MK_INSTALLLIB} !=3D "no" > > +SYMLINKS+=3D libmenuw.a ${LIBDIR}/libmenu.a > > +.endif > > +.if !defined(NO_PIC) > > +SYMLINKS+=3D libmenuw.so ${LIBDIR}/libmenu.so > > +.endif > > +.if ${MK_PROFILE} !=3D "no" > > +SYMLINKS+=3D libmenuw_p.a ${LIBDIR}/libmenu_p.a > > .endif > > =20 > > .include > > diff --git a/lib/ncurses/menuw/Makefile b/lib/ncurses/menuw/Makefile > > deleted file mode 100644 > > index d6df56332826..000000000000 > > --- a/lib/ncurses/menuw/Makefile > > +++ /dev/null > > @@ -1,5 +0,0 @@ > > -# $FreeBSD$ > > - > > -ENABLE_WIDEC=3D > > - > > -.include "${.CURDIR:H}/menu/Makefile" > > diff --git a/lib/ncurses/menuw/Makefile.depend b/lib/ncurses/menuw/Make= file.d > > epend > > deleted file mode 100644 > > index 3d9451023bec..000000000000 > > --- a/lib/ncurses/menuw/Makefile.depend > > +++ /dev/null > > @@ -1,17 +0,0 @@ > > -# $FreeBSD$ > > -# Autogenerated - do NOT edit! > > - > > -DIRDEPS =3D \ > > - include \ > > - include/xlocale \ > > - lib/${CSU_DIR} \ > > - lib/libc \ > > - lib/libcompiler_rt \ > > - lib/ncurses/ncursesw \ > > - > > - > > -.include > > - > > -.if ${DEP_RELDIR} =3D=3D ${_DEP_RELDIR} > > -# local dependencies - needed for -jN in clean tree > > -.endif > > diff --git a/lib/ncurses/ncurses/Makefile b/lib/ncurses/ncurses/Makefile > > index efa38691115e..6f03d93a9ac6 100644 > > --- a/lib/ncurses/ncurses/Makefile > > +++ b/lib/ncurses/ncurses/Makefile > > @@ -3,16 +3,11 @@ > > PACKAGE=3D clibs > > SHLIBDIR?=3D /lib > > =20 > > -.if !defined(ENABLE_WIDEC) > > -# Override any MAN=3D setting below.. > > -MK_MAN=3Dno > > -.endif > > - > > .include > > =20 > > .include "${.CURDIR:H}/config.mk" > > =20 > > -LIB=3D ncurses${LIB_SUFFIX} > > +LIB=3D ncursesw > > SHLIB_MAJOR=3D 9 > > =20 > > NO_LINT=3D > > @@ -22,17 +17,10 @@ NCURSES_MINOR!=3D egrep 'NCURSES_MINOR[ ]*=3D' ${N= CURSES_ > > DIR}/dist.mk | sed -e 's%^ > > NCURSES_PATCH!=3D egrep 'NCURSES_PATCH[ ]*=3D' ${NCURSES_DIR}/dist.mk= | s > > ed -e 's%^[^0-9]*%%' > > =20 > > # From autoconf (!) > > -.if defined(ENABLE_WIDEC) > > NCURSES_CH_T=3D cchar_t > > NCURSES_OK_WCHAR_T=3D 1 > > NEED_WCHAR_H=3D 1 > > NCURSES_EXT_COLORS=3D 1 > > -.else > > -NCURSES_CH_T=3D chtype > > -NCURSES_OK_WCHAR_T=3D > > -NEED_WCHAR_H=3D 0 > > -NCURSES_EXT_COLORS=3D 0 > > -.endif > > NCURSES_EXT_FUNCS=3D 1 > > NCURSES_CONST=3D const > > NCURSES_INLINE=3D inline > > @@ -242,7 +230,6 @@ SRCS+=3D \ > > lib_vidattr.c \ > > tty_update.c > > =20 > > -.if defined(ENABLE_WIDEC) > > .PATH: ${NCURSES_DIR}/ncurses/widechar > > SRCS+=3D \ > > charable.c \ > > @@ -265,7 +252,6 @@ SRCS+=3D \ > > lib_vline_set.c \ > > lib_wacs.c \ > > lib_wunctrl.c > > -.endif > > =20 > > .PATH: ${NCURSES_DIR}/ncurses/trace > > SRCS+=3D \ > > @@ -298,42 +284,54 @@ HEADERS=3D curses.h term.h termcap.h unctrl.h > > SRCHDRS=3D ncurses_dll.h > > CLEANFILES+=3D ncurses_dll.h > > =20 > > -.if defined(ENABLE_WIDEC) > > INCS=3D ${HEADERS} ${SRCHDRS} > > INCSLINKS=3D curses.h ${INCLUDEDIR}/ncurses.h > > -.endif > > =20 > > .if ${MK_INSTALLLIB} !=3D "no" > > -SYMLINKS+=3D libncurses${LIB_SUFFIX}.a ${LIBDIR}/libcurses${LIB_SUFFIX= }.a > > -SYMLINKS+=3D libncurses${LIB_SUFFIX}.a ${LIBDIR}/libtermcap${LIB_SUFFI= X}.a > > -SYMLINKS+=3D libncurses${LIB_SUFFIX}.a ${LIBDIR}/libtermlib${LIB_SUFFI= X}.a > > -SYMLINKS+=3D libncurses${LIB_SUFFIX}.a ${LIBDIR}/libtinfo${LIB_SUFFIX}= =2Ea > > +SYMLINKS+=3D libncursesw.a ${LIBDIR}/libcursesw.a > > +SYMLINKS+=3D libncursesw.a ${LIBDIR}/libtermcapw.a > > +SYMLINKS+=3D libncursesw.a ${LIBDIR}/libtermlibw.a > > +SYMLINKS+=3D libncursesw.a ${LIBDIR}/libtinfow.a > > +# backward compat > > +SYMLINKS+=3D libncursesw.a ${LIBDIR}/libncurses.a > > +SYMLINKS+=3D libncursesw.a ${LIBDIR}/libcurses.a > > +SYMLINKS+=3D libncursesw.a ${LIBDIR}/libtermcap.a > > +SYMLINKS+=3D libncursesw.a ${LIBDIR}/libtermlib.a > > +SYMLINKS+=3D libncursesw.a ${LIBDIR}/libtinfo.a > > .endif > > .if !defined(NO_PIC) > > # no need for major at all, it's an ld-time redirection only > > -SYMLINKS+=3D libncurses${LIB_SUFFIX}.so ${LIBDIR}/libcurses${LIB_SUFFI= X}.so > > -SYMLINKS+=3D libncurses${LIB_SUFFIX}.so ${LIBDIR}/libtermcap${LIB_SUFF= IX}.so > > -SYMLINKS+=3D libncurses${LIB_SUFFIX}.so ${LIBDIR}/libtermlib${LIB_SUFF= IX}.so > > -SYMLINKS+=3D libncurses${LIB_SUFFIX}.so ${LIBDIR}/libtinfo${LIB_SUFFIX= }.so > > +SYMLINKS+=3D libncursesw.so ${LIBDIR}/libcursesw.so > > +SYMLINKS+=3D libncursesw.so ${LIBDIR}/libtermcapw.so > > +SYMLINKS+=3D libncursesw.so ${LIBDIR}/libtermlibw.so > > +SYMLINKS+=3D libncursesw.so ${LIBDIR}/libtinfow.so > > +# backward compat > > +SYMLINKS+=3D libncursesw.so ${LIBDIR}/libncurses.so > > +SYMLINKS+=3D libncursesw.so ${LIBDIR}/libcurses.so > > +SYMLINKS+=3D libncursesw.so ${LIBDIR}/libtermcap.so > > +SYMLINKS+=3D libncursesw.so ${LIBDIR}/libtermlib.so > > +SYMLINKS+=3D libncursesw.so ${LIBDIR}/libtinfo.so > > .endif > > .if ${MK_PROFILE} !=3D "no" > > -SYMLINKS+=3D libncurses${LIB_SUFFIX}_p.a ${LIBDIR}/libcurses${LIB_SUFF= IX}_p. > > a > > -SYMLINKS+=3D libncurses${LIB_SUFFIX}_p.a ${LIBDIR}/libtermcap${LIB_SUF= FIX}_p > > .a > > -SYMLINKS+=3D libncurses${LIB_SUFFIX}_p.a ${LIBDIR}/libtermlib${LIB_SUF= FIX}_p > > .a > > -SYMLINKS+=3D libncurses${LIB_SUFFIX}_p.a ${LIBDIR}/libtinfo${LIB_SUFFI= X}_p.a > > +SYMLINKS+=3D libncursesw_p.a ${LIBDIR}/libcursesw_p.a > > +SYMLINKS+=3D libncursesw_p.a ${LIBDIR}/libtermcapw_p.a > > +SYMLINKS+=3D libncursesw_p.a ${LIBDIR}/libtermlibw_p.a > > +SYMLINKS+=3D libncursesw_p.a ${LIBDIR}/libtinfow_p.a > > +# backward compat > > +SYMLINKS+=3D libncursesw_p.a ${LIBDIR}/libncurses_p.a > > +SYMLINKS+=3D libncursesw_p.a ${LIBDIR}/libcurses_p.a > > +SYMLINKS+=3D libncursesw_p.a ${LIBDIR}/libtermcap_p.a > > +SYMLINKS+=3D libncursesw_p.a ${LIBDIR}/libtermlib_p.a > > +SYMLINKS+=3D libncursesw_p.a ${LIBDIR}/libtinfo_p.a > > .endif > > =20 > > -.if ${.CURDIR:T} =3D=3D "ncursesw" > > -.if defined(ENABLE_WIDEC) > > DOCSDIR=3D ${SHAREDIR}/doc/ncurses > > DOCS=3D ncurses-intro.html hackguide.html > > -.endif > > =20 > > .if ${MK_HTML} !=3D "no" > > .PATH: ${NCURSES_DIR}/doc/html > > FILESGROUPS=3D DOCS > > .endif > > -.endif > > =20 > > # Generated source > > .ORDER: names.c codes.c > > @@ -394,9 +392,7 @@ curses.h: curses.head MKkey_defs.sh Caps Caps-ncurs= es > > cat curses.head > $@.new > > AWK=3D${AWK} _POSIX2_VERSION=3D199209 sh ${NCURSES_DIR}/include/MKkey= _defs. > > sh \ > > ${NCURSES_DIR}/include/Caps ${NCURSES_DIR}/include/Caps-ncurses >= >=20 > > $@.new > > -.if defined(ENABLE_WIDEC) > > cat ${NCURSES_DIR}/include/curses.wide >> $@.new > > -.endif > > cat ${NCURSES_DIR}/include/curses.tail >> $@.new > > mv -f $@.new $@ > > =20 > > @@ -505,7 +501,6 @@ terminfo.5: MKterminfo.sh terminfo.head Caps > > =20 > > CLEANFILES+=3D terminfo.5 > > =20 > > -.if defined(ENABLE_WIDEC) > > .PATH: ${NCURSES_DIR}/man > > MAN=3D \ > > curs_addch.3 \ > > @@ -585,7 +580,6 @@ MAN+=3D \ > > =20 > > MAN+=3D term.5 terminfo.5 scr_dump.5 user_caps.5 > > MAN+=3D term.7 > > -.endif > > =20 > > CLEANFILES+=3D ${MAN:M*.3} > > =20 > > @@ -1065,7 +1059,6 @@ MLINKS=3D ncurses.3 curses.3 \ > > resizeterm.3 is_term_resized.3 \ > > resizeterm.3 resize_term.3 > > =20 > > -.if defined(ENABLE_WIDEC) > > MLINKS+=3Dcurs_add_wch.3 add_wch.3 \ > > curs_add_wch.3 echo_wchar.3 \ > > curs_add_wch.3 mvadd_wch.3 \ > > @@ -1145,8 +1138,6 @@ MLINKS+=3Dcurs_add_wch.3 add_wch.3 \ > > curs_scanw.3 vw_scanw.3 \ > > curs_scanw.3 vwscanw.3 \ > > curs_scanw.3 wscanw.3 > > -.endif > > - > > =20 > > .include > > =20 > > diff --git a/lib/ncurses/ncursesw/Makefile b/lib/ncurses/ncursesw/Makef= ile > > deleted file mode 100644 > > index 5f6040e7119c..000000000000 > > --- a/lib/ncurses/ncursesw/Makefile > > +++ /dev/null > > @@ -1,7 +0,0 @@ > > -# $FreeBSD$ > > - > > -ENABLE_WIDEC=3D > > - > > -.PATH: ${.CURDIR:H}/ncurses > > - > > -.include "${.CURDIR:H}/ncurses/Makefile" > > diff --git a/lib/ncurses/ncursesw/Makefile.depend b/lib/ncurses/ncurses= w/Make > > file.depend > > deleted file mode 100644 > > index 8d409f5263ac..000000000000 > > --- a/lib/ncurses/ncursesw/Makefile.depend > > +++ /dev/null > > @@ -1,16 +0,0 @@ > > -# $FreeBSD$ > > -# Autogenerated - do NOT edit! > > - > > -DIRDEPS =3D \ > > - include \ > > - include/xlocale \ > > - lib/${CSU_DIR} \ > > - lib/libc \ > > - lib/libcompiler_rt \ > > - > > - > > -.include > > - > > -.if ${DEP_RELDIR} =3D=3D ${_DEP_RELDIR} > > -# local dependencies - needed for -jN in clean tree > > -.endif > > diff --git a/lib/ncurses/panel/Makefile b/lib/ncurses/panel/Makefile > > index 1993f5e76ac2..a22df4d89570 100644 > > --- a/lib/ncurses/panel/Makefile > > +++ b/lib/ncurses/panel/Makefile > > @@ -1,10 +1,11 @@ > > # $FreeBSD$ > > =20 > > +.include > > .include "${.CURDIR:H}/config.mk" > > =20 > > SRCDIR=3D ${NCURSES_DIR}/panel > > =20 > > -LIB=3D panel${LIB_SUFFIX} > > +LIB=3D panelw > > =20 > > .PATH: ${SRCDIR} > > SRCS=3D \ > > @@ -29,10 +30,7 @@ CLEANFILES=3D ncurses_def.h > > =20 > > CFLAGS+=3D -I${SRCDIR} > > =20 > > -LIBADD+=3D ncurses${LIB_SUFFIX} > > - > > -.if defined(ENABLE_WIDEC) > > -INCS=3D panel.h > > +LIBADD+=3D ncursesw > > =20 > > # generate MAN > > .PATH: ${NCURSES_DIR}/man > > @@ -56,10 +54,19 @@ MLINKS=3D panel.3 bottom_panel.3 \ > > panel.3 show_panel.3 \ > > panel.3 top_panel.3 \ > > panel.3 update_panels.3 > > -.else > > -MAN=3D > > + > > +# backward compat > > +.if ${MK_INSTALLLIB} !=3D "no" > > +SYMLINKS+=3D libpanelw.a ${LIBDIR}/libpanel.a > > +.endif > > +.if !defined(NO_PIC) > > +SYMLINKS+=3D libpanelw.so ${LIBDIR}/libpanel.so > > .endif > > -=09 > > +.if ${MK_PROFILE} !=3D "no" > > +SYMLINKS+=3D libpanelw_p.a ${LIBDIR}/libpanel_p.a > > +.endif > > + > > +INCS=3D panel.h > > .include > > =20 > > # Keep the .SUFFIXES line after the include of bsd.lib.mk > > diff --git a/lib/ncurses/panelw/Makefile b/lib/ncurses/panelw/Makefile > > deleted file mode 100644 > > index 2585738a5e60..000000000000 > > --- a/lib/ncurses/panelw/Makefile > > +++ /dev/null > > @@ -1,5 +0,0 @@ > > -# $FreeBSD$ > > - > > -ENABLE_WIDEC=3D > > - > > -.include "${.CURDIR:H}/panel/Makefile" > > diff --git a/lib/ncurses/panelw/Makefile.depend b/lib/ncurses/panelw/Ma= kefile > > .depend > > deleted file mode 100644 > > index 3d9451023bec..000000000000 > > --- a/lib/ncurses/panelw/Makefile.depend > > +++ /dev/null > > @@ -1,17 +0,0 @@ > > -# $FreeBSD$ > > -# Autogenerated - do NOT edit! > > - > > -DIRDEPS =3D \ > > - include \ > > - include/xlocale \ > > - lib/${CSU_DIR} \ > > - lib/libc \ > > - lib/libcompiler_rt \ > > - lib/ncurses/ncursesw \ > > - > > - > > -.include > > - > > -.if ${DEP_RELDIR} =3D=3D ${_DEP_RELDIR} > > -# local dependencies - needed for -jN in clean tree > > -.endif > > diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk > > index ee94279e0cca..32cd1677bcd4 100644 > > --- a/share/mk/src.libnames.mk > > +++ b/share/mk/src.libnames.mk > > @@ -144,7 +144,6 @@ _LIBRARIES=3D \ > > memstat \ > > mp \ > > mt \ > > - ncurses \ > > ncursesw \ > > netgraph \ > > netmap \ > > @@ -182,7 +181,6 @@ _LIBRARIES=3D \ > > supcplusplus \ > > sysdecode \ > > tacplus \ > > - termcap \ > > termcapw \ > > tpool \ > > ufs \ > > @@ -376,7 +374,6 @@ _DP_c+=3D ssp_nonshared > > _DP_stats=3D sbuf pthread > > _DP_stdthreads=3D pthread > > _DP_tacplus=3D md > > -_DP_panel=3D ncurses > > _DP_panelw=3D ncursesw > > _DP_rpcsec_gss=3D gssapi > > _DP_smb=3D kiconv > > @@ -663,14 +660,10 @@ LIBBSDXMLDIR=3D ${OBJTOP}/lib/libexpat > > LIBKVMDIR=3D ${OBJTOP}/lib/libkvm > > LIBPTHREADDIR=3D ${OBJTOP}/lib/libthr > > LIBMDIR=3D ${OBJTOP}/lib/msun > > -LIBFORMDIR=3D ${OBJTOP}/lib/ncurses/form > > -LIBFORMLIBWDIR=3D ${OBJTOP}/lib/ncurses/formw > > -LIBMENUDIR=3D ${OBJTOP}/lib/ncurses/menu > > -LIBMENULIBWDIR=3D ${OBJTOP}/lib/ncurses/menuw > > -LIBNCURSESDIR=3D ${OBJTOP}/lib/ncurses/ncurses > > -LIBNCURSESWDIR=3D ${OBJTOP}/lib/ncurses/ncursesw > > -LIBPANELDIR=3D ${OBJTOP}/lib/ncurses/panel > > -LIBPANELWDIR=3D ${OBJTOP}/lib/ncurses/panelw > > +LIBFORMWDIR=3D ${OBJTOP}/lib/ncurses/form > > +LIBMENUWDIR=3D ${OBJTOP}/lib/ncurses/menu > > +LIBNCURSESWDIR=3D ${OBJTOP}/lib/ncurses/ncurses > > +LIBPANELWDIR=3D ${OBJTOP}/lib/ncurses/panel > > LIBCRYPTODIR=3D ${OBJTOP}/secure/lib/libcrypto > > LIBSPLDIR=3D ${OBJTOP}/cddl/lib/libspl > > LIBSSHDIR=3D ${OBJTOP}/secure/lib/libssh > > @@ -679,7 +672,6 @@ LIBTEKENDIR=3D ${OBJTOP}/sys/teken/libteken > > LIBEGACYDIR=3D ${OBJTOP}/tools/build > > LIBLNDIR=3D ${OBJTOP}/usr.bin/lex/lib > > =20 > > -LIBTERMCAPDIR=3D ${LIBNCURSESDIR} > > LIBTERMCAPWDIR=3D ${LIBNCURSESWDIR} > > =20 > > # Default other library directories to lib/libNAME. > > diff --git a/tools/bsdbox/Makefile.base b/tools/bsdbox/Makefile.base > > index aac44480e2ca..f2ffc2e49f70 100644 > > --- a/tools/bsdbox/Makefile.base > > +++ b/tools/bsdbox/Makefile.base > > @@ -14,7 +14,7 @@ CRUNCH_ALIAS_tset=3D reset > > =20 > > CRUNCH_PROGS_usr.bin+=3D vmstat > > #CRUNCH_PROGS_user.bin+=3D systat > > -CRUNCH_LIBS+=3D -ldevstat -lncursesw -lncurses -lmemstat -lkvm=20 > > -lelf > > +CRUNCH_LIBS+=3D -ldevstat -lncursesw -lmemstat -lkvm -lelf > > =20 > > # CRUNCH_PROGS_usr.bin+=3D tar > > CRUNCH_PROGS_usr.bin+=3D cpio > > diff --git a/tools/tools/ath/athratestats/Makefile b/tools/tools/ath/at= hrates > > tats/Makefile > > index 7a51392a9a7e..ccf04ebd8da0 100644 > > --- a/tools/tools/ath/athratestats/Makefile > > +++ b/tools/tools/ath/athratestats/Makefile > > @@ -7,7 +7,7 @@ PROG=3D athratestats > > =20 > > SRCS=3D main.c opt_ah.h ah_osdep.h > > =20 > > -LIBADD+=3D ncurses > > +LIBADD+=3D ncursesw > > =20 > > CLEANFILES+=3D opt_ah.h ah_osdep.h > > =20 > > >=20 > This fails to build in compat32. >=20 > --- lib/libthr__L --- > install -U -s -o root -g wheel -m 444 -S libthr.so.3=20 > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ > --- lib/ncurses/ncurses__L --- > /opt/src/git-src/contrib/ncurses/ncurses/curses.priv.h:2322:61: error:=20 > unknown type name 'mbstate_t'; did you mean '__mbstate_t'? > extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *); > ^~~~~~~~~ > __mbstate_t > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/sys/_ty= pes > .h:124:3: note: '__mbstate_t' declared here > } __mbstate_t; > ^ > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:15: error= :=20 > implicit declaration of function 'wctob' is invalid in C99=20 > [-Werror,-Wimplicit-function-declaration] > result =3D (wctob((wint_t) ch) =3D=3D (int) ch); > ^ > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:15: note:= =20 > did you mean 'wctomb'? > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/stdlib.= h:1 > 23:6: note: 'wctomb' declared here > int wctomb(char *, wchar_t); > ^ > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:22: error= :=20 > use of undeclared identifier 'wint_t' > result =3D (wctob((wint_t) ch) =3D=3D (int) ch); > ^ > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:49:33: error= :=20 > unknown type name 'wint_t' > NCURSES_EXPORT(int) _nc_to_char(wint_t ch) > ^ > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:53:14: error= :=20 > implicit declaration of function 'wctob' is invalid in C99=20 > [-Werror,-Wimplicit-function-declaration] > result =3D wctob(ch); > ^ > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:67:16: error= :=20 > unknown type name 'wint_t' > NCURSES_EXPORT(wint_t) _nc_to_widechar(int ch) > --- cddl/lib/libspl__L --- > install -U -s -o root -g wheel -m 444 -S libspl.so.2=20 > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ > --- lib/ncurses/ncurses__L --- > ^ > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:11: error= :=20 > expected ';' after expression > wint_t result; > ^ > ; > --- cddl/lib/libnvpair__L --- > install -U -o root -g wheel -m 444 libnvpair.so.2.debug=20 > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug/usr/l= ib3 > 2/ > --- lib/ncurses/ncurses__L --- > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:5: error:= =20 > use of undeclared identifier 'wint_t' > wint_t result; > ^ > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:12: error= :=20 > use of undeclared identifier 'result' > wint_t result; > ^ > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:5: error:= =20 > use of undeclared identifier 'result' > result =3D btowc(ch); > ^ > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:14: error= :=20 > implicit declaration of function 'btowc' is invalid in C99=20 > [-Werror,-Wimplicit-function-declaration] > result =3D btowc(ch); > ^ > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:14: note:= =20 > did you mean 'mbtowc'? > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/stdlib.= h:1 > 09:6: note: 'mbtowc' declared here > int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); > ^ > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:84:12: error= :=20 > use of undeclared identifier 'result' > return result; > ^ > 14 errors generated. > *** [charable.o] Error code 1 >=20 > make[4]: stopped in /opt/src/git-src/lib/ncurses/ncurses > 1 error >=20 > make[4]: stopped in /opt/src/git-src/lib/ncurses/ncurses > --- cddl/lib/libicp__L --- > --- cddl/lib/libicp_rescue__L --- > --- lib/libufs__L --- > install -U -C -o root -g wheel -m 444 libufs_p.a=20 > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ > --- lib/libutil__L --- > --- lib/libthr__L --- > install -U -o root -g wheel -m 444 libthr.so.3.debug=20 > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug/usr/l= ib3 > 2/ > --- cddl/lib/libspl__L --- > install -U -o root -g wheel -m 444 libspl.so.2.debug=20 > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug/usr/l= ib3 > 2/ > --- lib/libthr__L --- > --- cddl/lib/libnvpair__L --- > install -U -l rs -o root -g wheel -m 755 -S libnvpair.so.2=20 > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/libnvpair= =2Eso > *** [build32] Error code 2 >=20 > make[1]: stopped in /opt/src/git-src > 1 error >=20 > make[1]: stopped in /opt/src/git-src > exiting RC=3D2: building amd64 > slippy#=20 >=20 >=20 Weird are you building with -DNO_CLEAN ? or clean build ? Best regards, Bapt --yj2rojvagivjcjon Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAl/0fEUACgkQY4mL3PG3 PlqWcBAAtDR2WDa5g94gWIeJMV2O9isv6qVb8uXY/fwO3yxsWpOK+JjHiHseERlk Yia64tUyvh8SGnnip8GZk4jn/z4RQNW61MG62DdtEJBeBxD6zNfMEmpeVQS9XTGq lvAz+YgEx3nGGkWO8bqJlaJWLCy3n0ObsdRqOJcM6+iY66OC4evOmiNNzc4D8edQ 0Z2rZduOgZ2/HpTI2o/gwbCXkEMdhq/xJ/FVbXdJU2XvA+pApvQNmPKnjOCjBuZT XHD6RpioJbyiQtTbWf+O6fJJB9D4ggY2PWzXxOzjqdb77YXel52pdb1f9CFx4Mly 3tEMfrgj8a2dO6pW3FMGALrZAHZsbPa2WJthmFS+yOx8cfRKAAidnAQRBkfQDYML sMNGP5dL+hPfGyGLIqwT84fU70EmdoenaTceiqa/Pm8e+MVmIbZ7gbyn0k+1A3KQ NVergtgbSl8g0vMfI12lSVvobtJeR1AiCGj0elWID5poAYX7fKKOc1mI6lgyJVmS bjWG81MA2YWVWgoQhj+vGbZx5oJBiUHQ3+2/K5LTwf3Y6qCMrVJt52qe1ExP6pv7 ACRBDmu5bsS8e3MYfRpyVnkVQwQzv5UNBjxLVXg99emxyPXPFXY+ch7fRuIVMrXZ nMywpxUOb12vAxXj3wQwdAu7QHA6qp+fIK6TsKkbDZgdQAprAdI= =j5x6 -----END PGP SIGNATURE----- --yj2rojvagivjcjon-- From owner-dev-commits-src-all@freebsd.org Tue Jan 5 15:32:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BBE794E7A53; Tue, 5 Jan 2021 15:32:17 +0000 (UTC) (envelope-from git@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 4D9GhK505Tz4cJR; Tue, 5 Jan 2021 15:32:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E1A4686C; Tue, 5 Jan 2021 15:32:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105FWHlJ038292; Tue, 5 Jan 2021 15:32:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105FWH3Q038291; Tue, 5 Jan 2021 15:32:17 GMT (envelope-from git) Date: Tue, 5 Jan 2021 15:32:17 GMT Message-Id: <202101051532.105FWH3Q038291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: d41149a8e9cb - main - Add some examples to script.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d41149a8e9cbb76ff89322a3363299f1b93823d2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 15:32:17 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d41149a8e9cbb76ff89322a3363299f1b93823d2 commit d41149a8e9cbb76ff89322a3363299f1b93823d2 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-01-05 15:28:32 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-01-05 15:32:27 +0000 Add some examples to script.1 While here: - Split synopsis into two parts. The first explains how to record sessions, while the second one explains how to replay (some of) the recorded sessions. - Fix the -width argument of the environment variables list. MFC after: 1 week --- usr.bin/script/script.1 | 70 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/usr.bin/script/script.1 b/usr.bin/script/script.1 index 681440e7274a..04fa75fc1612 100644 --- a/usr.bin/script/script.1 +++ b/usr.bin/script/script.1 @@ -36,10 +36,14 @@ .Nd make typescript of terminal session .Sh SYNOPSIS .Nm -.Op Fl adefkpqr +.Op Fl aefkqr .Op Fl F Ar pipe .Op Fl t Ar time .Op Ar file Op Ar command ... +.Nm +.Fl p +.Op Fl deq +.Op Ar file .Sh DESCRIPTION The .Nm @@ -143,7 +147,7 @@ The results are meant to emulate a hardcopy terminal, not an addressable one. .Sh ENVIRONMENT The following environment variables are utilized by .Nm : -.Bl -tag -width SHELL +.Bl -tag -width SCRIPT .It Ev SCRIPT The .Ev SCRIPT @@ -169,6 +173,68 @@ is not set, the Bourne shell is assumed. .Pq Most shells set this variable automatically . .El +.Sh EXAMPLES +Record a simple +.Xr csh 1 +session with no additional details like input, output, and timestamping: +.Bd -literal -offset indent +$ SHELL=/bin/csh script +Script started, output file is typescript +% date +Tue Jan 5 15:08:10 UTC 2021 +% exit +exit + +Script done, output file is typescript +.Ed +.Pp +Now, replay the session recorded in the previous example: +.Bd -literal -offset indent +$ cat ./typescript +Script started on Tue Jan 5 15:08:08 2021 +% date +Tue Jan 5 15:08:10 UTC 2021 +% exit +exit + +Script done on Tue Jan 5 15:08:13 2021 +.Ed +.Pp +Record a +.Xr csh 1 +session, but this time with additional details like timestamping: +.Bd -literal -offset indent +$ SHELL=/bin/csh script -r +Script started, output file is typescript +% date +Tue Jan 5 15:17:11 UTC 2021 +% exit +exit + +Script done, output file is typescript +.Ed +.Pp +In order to replay a sessions recorded with the +.Fl r +flag, it is necessary to specify +.Fl p +.Po +.Xr cat 1 +will not work because of all the aditional information stored in the session file +.Pc . +Also, let us use +.Fl d +to print the whole session at once: +.Bd -literal -offset indent +$ script -dp ./typescript +Script started on Tue Jan 5 15:17:09 2021 +% date +Tue Jan 5 15:17:11 UTC 2021 +% exit +exit + +Script done on Tue Jan 5 15:17:14 2021 +.Ed .Sh SEE ALSO .Xr csh 1 .Po From owner-dev-commits-src-all@freebsd.org Tue Jan 5 15:35:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6EBA94E7B56; Tue, 5 Jan 2021 15:35:18 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (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 4D9Glp09jGz4cVr; Tue, 5 Jan 2021 15:35:17 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id woMckQi9J34axwoMekV90X; Tue, 05 Jan 2021 08:35:16 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5ff48734 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=mi56gJdQAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=USicFwjb1tCjo8MGuYEA:9 a=CjuIK1q_8ugA:10 a=m6W23KLcDyq3lIHOBnQi:22 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 03D6E1052; Tue, 5 Jan 2021 07:35:14 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 105FZDAX036599; Tue, 5 Jan 2021 07:35:13 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101051535.105FZDAX036599@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: Baptiste Daroussin cc: Cy Schubert , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support In-reply-to: <20210105144839.73qamvxrnhxpd3nk@ivaldir.net> References: <202101051302.105D24lW041218@gitrepo.freebsd.org> <202101051440.105EefY4071731@slippy.cwsent.com> <20210105144839.73qamvxrnhxpd3nk@ivaldir.net> Comments: In-reply-to Baptiste Daroussin message dated "Tue, 05 Jan 2021 15:48:39 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 05 Jan 2021 07:35:13 -0800 X-CMAE-Envelope: MS4xfHrX37fCGHMX/5YJZDYkEXDvT3pSDmbs353RkZQd03PpJTwy97gQWym9YIui8knLpogccVXj46UHEjNchBcjNVQpyRQ8P3Bod+nK/IUCZg2jdNyJSCXM rKRQc/CL20ZB7Z6vuZi0FeHTkO/p7aosjcSTIFz+iJpV+CptCIKoagwi1m3E9bM9pdjEyq5+ikAUXL0R8QD7QaZowNAsJUpn+AAYaVXD1o4kGFrN4mH2Ksjx ZDvCyyJZxIHaXZk/OoKIMtMhiwHcTSaVbOeTEwYwWmXUxBk53wWzvjHiIIs0LmUex35TRjbS1id9ff2d+8T8wlc8MYftVWSapa8YiToaQqA= X-Rspamd-Queue-Id: 4D9Glp09jGz4cVr X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 15:35:18 -0000 In message <20210105144839.73qamvxrnhxpd3nk@ivaldir.net>, Baptiste Daroussin wr ites: > > --yj2rojvagivjcjon > Content-Type: text/plain; charset=us-ascii > Content-Disposition: inline > Content-Transfer-Encoding: quoted-printable > > On Tue, Jan 05, 2021 at 06:40:41AM -0800, Cy Schubert wrote: > > In message <202101051302.105D24lW041218@gitrepo.freebsd.org>, Baptiste=20 > > Daroussi > > n writes: > > > The branch main has been updated by bapt: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D821aa63a09402935da0a73ab= > f20ba044 > > > 1562aa07 > > > > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > > Author: Baptiste Daroussin > > > AuthorDate: 2021-01-04 16:29:40 +0000 > > > Commit: Baptiste Daroussin > > > CommitDate: 2021-01-05 13:01:32 +0000 > > > > > > ncurses: only keep the version with widechar support > > > =20 > > > Only keep the widechar version of ncurses as libncursesw.so.9 > > > =20 > > > Keep the old name to avoid breaking the ABI compatibility (the non > > > widechar version libncurses.so.9 is not binary compatible with > > > libncursesw.so.9) since all ports and base are already only linking > > > against the widechar version we can simply remove libncurses.so.9 > > > =20 > > > Since the .9 version only lived in the dev branch and never ended i= > n a > > > release, it is simply removed and not added to any binary compat > > > package. > > > =20 > > > Add symlinks to keep build time compatibility for anyone linking ag= > ainst > > > -lncurses [...] > >=20 > > This fails to build in compat32. > >=20 > > --- lib/libthr__L --- > > install -U -s -o root -g wheel -m 444 -S libthr.so.3=20 > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ > > --- lib/ncurses/ncurses__L --- > > /opt/src/git-src/contrib/ncurses/ncurses/curses.priv.h:2322:61: error:=20 > > unknown type name 'mbstate_t'; did you mean '__mbstate_t'? > > extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *); > > ^~~~~~~~~ > > __mbstate_t > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/sys/_ty= > pes > > .h:124:3: note: '__mbstate_t' declared here > > } __mbstate_t; > > ^ > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:15: error= > :=20 > > implicit declaration of function 'wctob' is invalid in C99=20 > > [-Werror,-Wimplicit-function-declaration] > > result =3D (wctob((wint_t) ch) =3D=3D (int) ch); > > ^ > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:15: note:= > =20 > > did you mean 'wctomb'? > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/stdlib.= > h:1 > > 23:6: note: 'wctomb' declared here > > int wctomb(char *, wchar_t); > > ^ > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:22: error= > :=20 > > use of undeclared identifier 'wint_t' > > result =3D (wctob((wint_t) ch) =3D=3D (int) ch); > > ^ > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:49:33: error= > :=20 > > unknown type name 'wint_t' > > NCURSES_EXPORT(int) _nc_to_char(wint_t ch) > > ^ > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:53:14: error= > :=20 > > implicit declaration of function 'wctob' is invalid in C99=20 > > [-Werror,-Wimplicit-function-declaration] > > result =3D wctob(ch); > > ^ > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:67:16: error= > :=20 > > unknown type name 'wint_t' > > NCURSES_EXPORT(wint_t) _nc_to_widechar(int ch) > > --- cddl/lib/libspl__L --- > > install -U -s -o root -g wheel -m 444 -S libspl.so.2=20 > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ > > --- lib/ncurses/ncurses__L --- > > ^ > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:11: error= > :=20 > > expected ';' after expression > > wint_t result; > > ^ > > ; > > --- cddl/lib/libnvpair__L --- > > install -U -o root -g wheel -m 444 libnvpair.so.2.debug=20 > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug/usr/l= > ib3 > > 2/ > > --- lib/ncurses/ncurses__L --- > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:5: error:= > =20 > > use of undeclared identifier 'wint_t' > > wint_t result; > > ^ > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:12: error= > :=20 > > use of undeclared identifier 'result' > > wint_t result; > > ^ > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:5: error:= > =20 > > use of undeclared identifier 'result' > > result =3D btowc(ch); > > ^ > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:14: error= > :=20 > > implicit declaration of function 'btowc' is invalid in C99=20 > > [-Werror,-Wimplicit-function-declaration] > > result =3D btowc(ch); > > ^ > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:14: note:= > =20 > > did you mean 'mbtowc'? > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/stdlib.= > h:1 > > 09:6: note: 'mbtowc' declared here > > int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); > > ^ > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:84:12: error= > :=20 > > use of undeclared identifier 'result' > > return result; > > ^ > > 14 errors generated. > > *** [charable.o] Error code 1 > >=20 > > make[4]: stopped in /opt/src/git-src/lib/ncurses/ncurses > > 1 error > >=20 > > make[4]: stopped in /opt/src/git-src/lib/ncurses/ncurses > > --- cddl/lib/libicp__L --- > > --- cddl/lib/libicp_rescue__L --- > > --- lib/libufs__L --- > > install -U -C -o root -g wheel -m 444 libufs_p.a=20 > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ > > --- lib/libutil__L --- > > --- lib/libthr__L --- > > install -U -o root -g wheel -m 444 libthr.so.3.debug=20 > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug/usr/l= > ib3 > > 2/ > > --- cddl/lib/libspl__L --- > > install -U -o root -g wheel -m 444 libspl.so.2.debug=20 > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug/usr/l= > ib3 > > 2/ > > --- lib/libthr__L --- > > --- cddl/lib/libnvpair__L --- > > install -U -l rs -o root -g wheel -m 755 -S libnvpair.so.2=20 > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/libnvpair= > =2Eso > > *** [build32] Error code 2 > >=20 > > make[1]: stopped in /opt/src/git-src > > 1 error > >=20 > > make[1]: stopped in /opt/src/git-src > > exiting RC=3D2: building amd64 > > slippy#=20 > >=20 > >=20 > > Weird are you building with -DNO_CLEAN ? or clean build ? NO_CLEAN build. Do you think we need circumvention shim or an UPDATING entry? -- 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-dev-commits-src-all@freebsd.org Tue Jan 5 15:39:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A87154C0014; Tue, 5 Jan 2021 15:39:22 +0000 (UTC) (envelope-from git@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 4D9GrV4GMrz4clc; Tue, 5 Jan 2021 15:39:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 855796B81; Tue, 5 Jan 2021 15:39:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105FdMh8039524; Tue, 5 Jan 2021 15:39:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105FdMIW039523; Tue, 5 Jan 2021 15:39:22 GMT (envelope-from git) Date: Tue, 5 Jan 2021 15:39:22 GMT Message-Id: <202101051539.105FdMIW039523@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: bed70f83ac77 - main - ncurses: document the change requires a clean build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bed70f83ac77b4d948fad9f198b6b39a5110c2af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 15:39:22 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=bed70f83ac77b4d948fad9f198b6b39a5110c2af commit bed70f83ac77b4d948fad9f198b6b39a5110c2af Author: Baptiste Daroussin AuthorDate: 2021-01-05 15:38:05 +0000 Commit: Baptiste Daroussin CommitDate: 2021-01-05 15:38:58 +0000 ncurses: document the change requires a clean build Reporter by: cy --- UPDATING | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UPDATING b/UPDATING index d10e21604558..4ec6f29d7e83 100644 --- a/UPDATING +++ b/UPDATING @@ -26,6 +26,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20200105: + ncurses installation has been modified to only keep the widechar + enabled version. Incremental build is broken for that change, so it + requires a clean build. + 20201223: The FreeBSD project has migrated from Subversion to Git. Temporary instructions can be found at From owner-dev-commits-src-all@freebsd.org Tue Jan 5 15:54:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 852B84C054D for ; Tue, 5 Jan 2021 15:54:22 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D9H9p23K7z4dYP; Tue, 5 Jan 2021 15:54:22 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 105FsFYT008162; Tue, 5 Jan 2021 07:54:15 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 105FsFL7008161; Tue, 5 Jan 2021 07:54:15 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202101051554.105FsFL7008161@gndrsh.dnsmgr.net> Subject: Re: git: 2d486ba15f33 - main - pkgbase: Move bectl to the runtime package In-Reply-To: <20210104220959.fb00d9ec75b43c3ed580ae37@bidouilliste.com> To: Emmanuel Vadot Date: Tue, 5 Jan 2021 07:54:15 -0800 (PST) CC: rgrimes@freebsd.org, "Rodney W. Grimes" , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4D9H9p23K7z4dYP X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 15:54:22 -0000 > On Mon, 4 Jan 2021 12:58:58 -0800 (PST) > "Rodney W. Grimes" wrote: > > > > On Mon, 4 Jan 2021 12:49:19 -0800 (PST) > > > "Rodney W. Grimes" wrote: > > > > > > > > The branch main has been updated by manu: > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=2d486ba15f3367072d631ee588192ef46687fa4b > > > > > > > > > > commit 2d486ba15f3367072d631ee588192ef46687fa4b > > > > > Author: Emmanuel Vadot > > > > > AuthorDate: 2020-12-21 15:00:02 +0000 > > > > > Commit: Emmanuel Vadot > > > > > CommitDate: 2021-01-04 15:17:12 +0000 > > > > > > > > > > pkgbase: Move bectl to the runtime package > > > > > > > > > > runtime contain what is needed to boot in single user and repair a > > > > > system, bectl could be handy to have in this situation. > > > > > > > > I would think it belongs in the zfs package, > > > > as unless you have zfs you do not need bectrl. > > > > > > There is no zfs package. > > > > I would consider that an oversight. > > I don't. We don't have a ufs package for example. My understanding of the "big idea" of pkg base is to fine grain feature install/removal, and I would consider support for things like nfs, ufs, zfs to be along those lines of fine grain. > > > > Having zfs is controlled by WITH/WITHOUT_ZFS and this is not related > > > to pkgbase. > > > > WITH/WITHOUT are compile time constructs, pkgbase is an install time > > set of tools, why can there not be a zfs pkg? > > pkgbase is just a reflection of what is built. There can be a zfs > package nothing prevent us for having one. But as said in the commit Great, then why dont we? And to your "ufs" above could that be added as well? > runtime is the package that should contain everything needed for > booting to single user and repair a system so it contain zfs related > tools (and ufs ones). I thought the runtime package was the bits you MUST have to build a running system, and nothing more. Perhaps I have misunderstood. > The idea behind runtime is that if you start upgrading and things > break just after it you have all the tools to repair an install. I would of called that the "systemrepair" package. > > > > > > > > > > > > > > > Differential Revision: https://reviews.freebsd.org/D27708 > > > > > --- > > > > > lib/libbe/Makefile | 1 + > > > > > sbin/bectl/Makefile | 1 + > > > > > 2 files changed, 2 insertions(+) > > > > > > > > > > diff --git a/lib/libbe/Makefile b/lib/libbe/Makefile > > > > > index 291e2438ee2a..d1fab41578bf 100644 > > > > > --- a/lib/libbe/Makefile > > > > > +++ b/lib/libbe/Makefile > > > > > @@ -4,6 +4,7 @@ SHLIBDIR?= /lib > > > > > > > > > > .include > > > > > > > > > > +PACKAGE= runtime > > > > > LIB= be > > > > > SHLIB_MAJOR= 1 > > > > > SHLIB_MINOR= 0 > > > > > diff --git a/sbin/bectl/Makefile b/sbin/bectl/Makefile > > > > > index 6fa84f48661d..46d43306b9ca 100644 > > > > > --- a/sbin/bectl/Makefile > > > > > +++ b/sbin/bectl/Makefile > > > > > @@ -2,6 +2,7 @@ > > > > > > > > > > .include > > > > > > > > > > +PACKAGE=runtime > > > > > PROG= bectl > > > > > MAN= bectl.8 > > > > > > > > > > > > > > > > > > -- > > > > Rod Grimes rgrimes@freebsd.org > > > > > > > > > -- > > > Emmanuel Vadot > > > > > > > -- > > Rod Grimes rgrimes@freebsd.org > > > -- > Emmanuel Vadot > -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-all@freebsd.org Tue Jan 5 15:57:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E91A44C0462; Tue, 5 Jan 2021 15:57:48 +0000 (UTC) (envelope-from git@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 4D9HFm6LT1z4drQ; Tue, 5 Jan 2021 15:57:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CCAF96BAA; Tue, 5 Jan 2021 15:57:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105Fvm8b064875; Tue, 5 Jan 2021 15:57:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105FvmZf064874; Tue, 5 Jan 2021 15:57:48 GMT (envelope-from git) Date: Tue, 5 Jan 2021 15:57:48 GMT Message-Id: <202101051557.105FvmZf064874@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 613a08cfa2e0 - main - rtld: map without PROT_EXEC for relocation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 613a08cfa2e0fb1b99906961c7a676d527e17f05 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 15:57:49 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=613a08cfa2e0fb1b99906961c7a676d527e17f05 commit 613a08cfa2e0fb1b99906961c7a676d527e17f05 Author: Ed Maste AuthorDate: 2021-01-04 18:55:44 +0000 Commit: Ed Maste CommitDate: 2021-01-05 15:57:14 +0000 rtld: map without PROT_EXEC for relocation This makes text segment relocation work under W^X. Submitted by: Greg V (original version) Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27953 --- libexec/rtld-elf/rtld.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 27262ab9dbc5..7b8bfba84d7d 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -2982,7 +2982,8 @@ reloc_textrel_prot(Obj_Entry *obj, bool before) base = obj->relocbase + trunc_page(ph->p_vaddr); sz = round_page(ph->p_vaddr + ph->p_filesz) - trunc_page(ph->p_vaddr); - prot = convert_prot(ph->p_flags) | (before ? PROT_WRITE : 0); + prot = before ? (PROT_READ | PROT_WRITE) : + convert_prot(ph->p_flags); if (mprotect(base, sz, prot) == -1) { _rtld_error("%s: Cannot write-%sable text segment: %s", obj->path, before ? "en" : "dis", From owner-dev-commits-src-all@freebsd.org Tue Jan 5 15:59:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2DE384C0A29 for ; Tue, 5 Jan 2021 15:59:51 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.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 4D9HJ70cyWz4fF9 for ; Tue, 5 Jan 2021 15:59:50 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f43.google.com with SMTP id i9so36663389wrc.4 for ; Tue, 05 Jan 2021 07:59:50 -0800 (PST) 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=JIsxGNiHGMfrOWW4mdS/oDgk6b9q84TzBJoSTgiq3IQ=; b=K7/sQ3r7UxG+rkwWffk6dRJ65IORiO9aXvzxEKPq6qWq1kb7Y6o7aLU43Tnqqq9bIL tt2xMNNURaWEaxr5IdEDn6dcKUqX8v6wBcquklsyZPSa7HQdymYaL1scPQWXzPTe1qRJ WdNsqxJDOgFx3NgQw+phCRBrfrW284djoi/VJ2H5sKHYJEUBMG3lPG+LJBhTQr0OA8QP twaHUvvhVJKgeG9o/kSNkcGZc6fEh6a7bmc4sbkWvD5JndOr7mhSHqHAdr9BcZ9UwK5I fFsPDIjQKs/7Vl78uwdcp9fV8yuEnXVd+J6nLn4sy0KfP1hTsDWCP42iPTX78CPxh1cF SBZw== X-Gm-Message-State: AOAM533oDiI7pPwWp8EJWufxawUKa1zeKFzrkoCftXcOJVF01V8Z9+EX DRZ9+fwjH0cmWILagZy3ttbCTg== X-Google-Smtp-Source: ABdhPJzJMRwyzmb7MmVo9SgeiYLtDeyKSURwoAzOosGAZtOpVTlP6wk7+8VQd/KxF0h33XXmSCTBMw== X-Received: by 2002:adf:eac1:: with SMTP id o1mr268074wrn.256.1609862389721; Tue, 05 Jan 2021 07:59:49 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id b127sm5247053wmc.45.2021.01.05.07.59.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jan 2021 07:59:48 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 2d486ba15f33 - main - pkgbase: Move bectl to the runtime package From: Jessica Clarke In-Reply-To: <202101051554.105FsFL7008161@gndrsh.dnsmgr.net> Date: Tue, 5 Jan 2021 15:59:47 +0000 Cc: Emmanuel Vadot , "Rodney W. Grimes" , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <202101051554.105FsFL7008161@gndrsh.dnsmgr.net> To: rgrimes@freebsd.org X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4D9HJ70cyWz4fF9 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 15:59:51 -0000 > On 5 Jan 2021, at 15:54, Rodney W. Grimes = wrote: >=20 >> On Mon, 4 Jan 2021 12:58:58 -0800 (PST) >> "Rodney W. Grimes" wrote: >>=20 >>>> On Mon, 4 Jan 2021 12:49:19 -0800 (PST) >>>> "Rodney W. Grimes" wrote: >>>>=20 >>>>>> The branch main has been updated by manu: >>>>>>=20 >>>>>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D2d486ba15f3367072d631ee588192ef4= 6687fa4b >>>>>>=20 >>>>>> commit 2d486ba15f3367072d631ee588192ef46687fa4b >>>>>> Author: Emmanuel Vadot >>>>>> AuthorDate: 2020-12-21 15:00:02 +0000 >>>>>> Commit: Emmanuel Vadot >>>>>> CommitDate: 2021-01-04 15:17:12 +0000 >>>>>>=20 >>>>>> pkgbase: Move bectl to the runtime package >>>>>>=20 >>>>>> runtime contain what is needed to boot in single user and = repair a >>>>>> system, bectl could be handy to have in this situation. >>>>>=20 >>>>> I would think it belongs in the zfs package, >>>>> as unless you have zfs you do not need bectrl. >>>>=20 >>>> There is no zfs package. >>>=20 >>> I would consider that an oversight. >>=20 >> I don't. We don't have a ufs package for example. >=20 > My understanding of the "big idea" of pkg base is to fine > grain feature install/removal, and I would consider support > for things like nfs, ufs, zfs to be along those lines > of fine grain. We could do that. I don't know enough to take a view on whether that's a good idea or not. But I do think it's more important to get something working and rolled-out than spend another 5 years iterating on it to try and achieve perfection. Things that make pkgbase unusable for currently-supported use cases should obviously be fixed, but adding finer-grained packages can come later (or now if you provide tested patches!). Jess From owner-dev-commits-src-all@freebsd.org Tue Jan 5 16:04:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A127A4C0DCD for ; Tue, 5 Jan 2021 16:04:13 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 4D9HP943Ntz4frf for ; Tue, 5 Jan 2021 16:04:13 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f41.google.com with SMTP id 3so31314wmg.4 for ; Tue, 05 Jan 2021 08:04:13 -0800 (PST) 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=8O3TGL9vXsyW9H7HV6oeppwUCbE3UAEK1EBBGOzAm3s=; b=aD9Xiynlc1yMsUBHby6r1cQJkCjGdyc2wYQMKai49/vxX7D8PJxrJerTW63XA/C6yC QnPNh5tPiWpsOVZG7w6WKoHOvHO1EBJ7zsJICbULhZkW/nFNcRDT/NOZtFlVWfAOzWwp 4W3/2SqatIthTu0LQZZDmD2ff16lBvivZ0rNsO4j1hFsiz6ELDjCU1s+FFCrC4zXZxvU WHsZZg8Unl6UgugZdueBxPx9uRYAMOzkerSArPs7viON0Te6iejcUypM/Gsmx6xITJE0 O0TohzZvTMFQenMszP8GZv7ZsG73gqbazR1yavZCmSsKzf658PVCtflWwItmpIFBgmUY lD/A== X-Gm-Message-State: AOAM533lUMUoTwbwkEp/L9yz8zDFpUAIFRWI/OCceIQvykfRiyDnSFpG MwyyDkD1A2F/YhR3Z98La+jhKQ== X-Google-Smtp-Source: ABdhPJw7hFP0YOrgG1aFiFHY7p2LXWPa77z12K1sJUgwtoixl/vFJ8p5ru67pWjSZ5ljB6Gyyx81pQ== X-Received: by 2002:a1c:b7d4:: with SMTP id h203mr4148827wmf.59.1609862652213; Tue, 05 Jan 2021 08:04:12 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id o8sm306043wrm.17.2021.01.05.08.04.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jan 2021 08:04:11 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 613a08cfa2e0 - main - rtld: map without PROT_EXEC for relocation From: Jessica Clarke In-Reply-To: <202101051557.105FvmZf064874@gitrepo.freebsd.org> Date: Tue, 5 Jan 2021 16:04:11 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: 7bit Message-Id: References: <202101051557.105FvmZf064874@gitrepo.freebsd.org> To: Ed Maste X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4D9HP943Ntz4frf X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 16:04:13 -0000 On 5 Jan 2021, at 15:57, Ed Maste wrote: > diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c > index 27262ab9dbc5..7b8bfba84d7d 100644 > --- a/libexec/rtld-elf/rtld.c > +++ b/libexec/rtld-elf/rtld.c > @@ -2982,7 +2982,8 @@ reloc_textrel_prot(Obj_Entry *obj, bool before) > base = obj->relocbase + trunc_page(ph->p_vaddr); > sz = round_page(ph->p_vaddr + ph->p_filesz) - > trunc_page(ph->p_vaddr); > - prot = convert_prot(ph->p_flags) | (before ? PROT_WRITE : 0); > + prot = before ? (PROT_READ | PROT_WRITE) : > + convert_prot(ph->p_flags); > if (mprotect(base, sz, prot) == -1) { > _rtld_error("%s: Cannot write-%sable text segment: %s", > obj->path, before ? "en" : "dis", This error message could perhaps be improved now that both W and X are varying? As it stands it reads like the code used to function. Jess From owner-dev-commits-src-all@freebsd.org Tue Jan 5 16:07:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 743F84C1547 for ; Tue, 5 Jan 2021 16:07:17 +0000 (UTC) (envelope-from njm@njm.me.uk) Received: from smtp001-out.apm-internet.net (smtp001-out.apm-internet.net [85.119.248.222]) (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 4D9HSj12Hgz4gMJ for ; Tue, 5 Jan 2021 16:07:16 +0000 (UTC) (envelope-from njm@njm.me.uk) Received: (qmail 5532 invoked from network); 5 Jan 2021 16:07:14 -0000 X-APM-Out-ID: 16098628340553 X-APM-Authkey: 18389/1(18389/1) 4 Received: from unknown (HELO meld.njm.me.uk) (86.158.98.186) by smtp001.apm-internet.net with SMTP; 5 Jan 2021 16:07:14 -0000 Received: from triton.njm.me.uk (triton.njm.me.uk [192.168.144.133]) by meld.njm.me.uk (8.16.1/8.16.1) with ESMTPS id 105G7Dr5008332 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Jan 2021 16:07:13 GMT (envelope-from njm@njm.me.uk) Received: from localhost (localhost [127.0.0.1]) by triton.njm.me.uk (8.16.1/8.16.1) with ESMTP id 105G7CHD016423; Tue, 5 Jan 2021 16:07:13 GMT (envelope-from njm@njm.me.uk) Date: Tue, 05 Jan 2021 16:07:12 +0000 From: "N.J. Mann" To: Baptiste Daroussin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: bed70f83ac77 - main - ncurses: document the change requires a clean build Message-ID: <58BDD9D4C7DD65ED1D049389@triton.njm.me.uk> In-Reply-To: <202101051539.105FdMIW039523@gitrepo.freebsd.org> References: <202101051539.105FdMIW039523@gitrepo.freebsd.org> X-Mailer: Mulberry/4.0.8 (Linux/x86) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Rspamd-Queue-Id: 4D9HSj12Hgz4gMJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 16:07:17 -0000 Hi, On Tuesday, January 05, 2021 15:39:22 +0000 Baptiste Daroussin wrote: [...] > +20200105: Should that be 20210105 Cheers, Nick. -- From owner-dev-commits-src-all@freebsd.org Tue Jan 5 16:18:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2C4F14C1932; Tue, 5 Jan 2021 16:18:02 +0000 (UTC) (envelope-from git@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 4D9Hj60m3gz4gk2; Tue, 5 Jan 2021 16:18:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CDD070D7; Tue, 5 Jan 2021 16:18:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105GI1j1091222; Tue, 5 Jan 2021 16:18:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105GI17k091221; Tue, 5 Jan 2021 16:18:01 GMT (envelope-from git) Date: Tue, 5 Jan 2021 16:18:01 GMT Message-Id: <202101051618.105GI17k091221@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 009c1100e59b - main - UPDATING: we are now in 2021, bye 2020 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 009c1100e59bb18ced21e4f8a23b98b725a2c36d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 16:18:02 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=009c1100e59bb18ced21e4f8a23b98b725a2c36d commit 009c1100e59bb18ced21e4f8a23b98b725a2c36d Author: Baptiste Daroussin AuthorDate: 2021-01-05 16:16:46 +0000 Commit: Baptiste Daroussin CommitDate: 2021-01-05 16:17:51 +0000 UPDATING: we are now in 2021, bye 2020 Reported by: N.J. Mann --- UPDATING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 4ec6f29d7e83..c2163a4342e4 100644 --- a/UPDATING +++ b/UPDATING @@ -26,7 +26,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) -20200105: +20210105: ncurses installation has been modified to only keep the widechar enabled version. Incremental build is broken for that change, so it requires a clean build. From owner-dev-commits-src-all@freebsd.org Tue Jan 5 16:18:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 082374C16F4; Tue, 5 Jan 2021 16:18:17 +0000 (UTC) (envelope-from bapt@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 4D9HjN6c2dz4gw6; Tue, 5 Jan 2021 16:18:16 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from ivaldir.etoilebsd.net (etoilebsd.net [178.32.217.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id BC143826; Tue, 5 Jan 2021 16:18:16 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by ivaldir.etoilebsd.net (Postfix, from userid 1001) id A8790EA8EB; Tue, 5 Jan 2021 17:17:44 +0100 (CET) Date: Tue, 5 Jan 2021 17:17:44 +0100 From: Baptiste Daroussin To: "N.J. Mann" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: bed70f83ac77 - main - ncurses: document the change requires a clean build Message-ID: <20210105161744.l73uubxqfkycp7zg@ivaldir.net> References: <202101051539.105FdMIW039523@gitrepo.freebsd.org> <58BDD9D4C7DD65ED1D049389@triton.njm.me.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ijnmcn56pbrswiod" Content-Disposition: inline In-Reply-To: <58BDD9D4C7DD65ED1D049389@triton.njm.me.uk> X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 16:18:17 -0000 --ijnmcn56pbrswiod Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 05, 2021 at 04:07:12PM +0000, N.J. Mann wrote: > Hi, >=20 > On Tuesday, January 05, 2021 15:39:22 +0000 Baptiste Daroussin wrote: > [...] > > +20200105: >=20 > Should that be 20210105 >=20 >=20 > Cheers, > Nick. > --=20 >=20 Thank you! Fixed, best regards, Bapt --ijnmcn56pbrswiod Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAl/0kSUACgkQY4mL3PG3 Plos6BAArLSfycJB4H88zkT3x8EDDxyWTcgJTG6kbOyOgiM6NIhytbdQoR17SuKx QOQZG4z9ocZqDjqHIiPNfJgs+oNthRQ9wU5WGyG9dqLZYbxhlXJLBh+7/oAUJyJA e7rcJHDtm83TxZvuKZUm3poA7lBuK4kHx1bYtdw0XbT3kpFN+Ok2tTmMYoZbNwAf gRfeAkETvaZxUe6DUU9DUka787/yOGrIJGafgs6REzsrznvkdIVTgihVO+D84L7Q 12v6OnvqVEP4FkuLRKuC+3Hwly7P7XsKtcX+epVDIEIiWQ5sF/FMG8x74mWCDTi0 34P4eFxgMoIjJrqfe3/k7DYeCWHWY/fNX8bDS8NR85Idcyql8z40unvMZdTgx7qo RGhbxi4jV4CjbbLOtwhdlnbuxFuk0IYkjvKw3XyAQDiqcCnMfzNo1/y2s/7ayRQD 1Ffe942ZKmWCukv8EVgPbTd+LbAR3pUBub7CwvIVGBCt1OlfhYV6D6lDqmo53zsW nYcGU6bH45c7Pko2dXGiRJ8uy7WLodaCJaPuR5QGfUSNB9xRaL6A4s+QZCF3nNed 2sSRgawM141kqWrwPwwSvViQEuGKtzgDoVW8Fl8TDrY/6cOagemYvMaAgFB783eq +/t9Ss3bGNYugzyECUwx4BO/2AgpqkXZvKA9VCgWpoZ9WNs24ig= =7tYx -----END PGP SIGNATURE----- --ijnmcn56pbrswiod-- From owner-dev-commits-src-all@freebsd.org Tue Jan 5 16:22:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A60554C1ADB; Tue, 5 Jan 2021 16:22:34 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D9HpL0zPYz4hMM; Tue, 5 Jan 2021 16:22:33 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1609863745; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5snnol3RTLLij0OIeoN1RJziz4tJ28j/P5fwDL01n40=; b=qwcndofzr9MjdHpn1dsN2/AFYX3cmcbPAPGofJMNJnsLh0XFNSKAhqO+GDc56yzh/C44V/ 2huyjl+ZFLu+z1Ha4ZglTFfC7NbDMKADoZ+qGDZtEltwkEP5izqGEGubikXKEaQsaMbeW8 +00RDORowZ/YVJhqrFEEijB/60LMGwA= Received: from skull.home.blih.net (lfbn-idf2-1-745-114.w86-247.abo.wanadoo.fr [86.247.192.114]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 586b2b34 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 5 Jan 2021 16:22:25 +0000 (UTC) Date: Tue, 5 Jan 2021 17:22:22 +0100 From: Emmanuel Vadot To: rgrimes@freebsd.org Cc: "Rodney W. Grimes" , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 2d486ba15f33 - main - pkgbase: Move bectl to the runtime package Message-Id: <20210105172222.f967fd57a637287a1a3d778a@bidouilliste.com> In-Reply-To: <202101051554.105FsFL7008161@gndrsh.dnsmgr.net> References: <20210104220959.fb00d9ec75b43c3ed580ae37@bidouilliste.com> <202101051554.105FsFL7008161@gndrsh.dnsmgr.net> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4D9HpL0zPYz4hMM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 16:22:34 -0000 On Tue, 5 Jan 2021 07:54:15 -0800 (PST) "Rodney W. Grimes" wrote: > > On Mon, 4 Jan 2021 12:58:58 -0800 (PST) > > "Rodney W. Grimes" wrote: > > > > > > On Mon, 4 Jan 2021 12:49:19 -0800 (PST) > > > > "Rodney W. Grimes" wrote: > > > > > > > > > > The branch main has been updated by manu: > > > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=2d486ba15f3367072d631ee588192ef46687fa4b > > > > > > > > > > > > commit 2d486ba15f3367072d631ee588192ef46687fa4b > > > > > > Author: Emmanuel Vadot > > > > > > AuthorDate: 2020-12-21 15:00:02 +0000 > > > > > > Commit: Emmanuel Vadot > > > > > > CommitDate: 2021-01-04 15:17:12 +0000 > > > > > > > > > > > > pkgbase: Move bectl to the runtime package > > > > > > > > > > > > runtime contain what is needed to boot in single user and repair a > > > > > > system, bectl could be handy to have in this situation. > > > > > > > > > > I would think it belongs in the zfs package, > > > > > as unless you have zfs you do not need bectrl. > > > > > > > > There is no zfs package. > > > > > > I would consider that an oversight. > > > > I don't. We don't have a ufs package for example. > > My understanding of the "big idea" of pkg base is to fine > grain feature install/removal, and I would consider support > for things like nfs, ufs, zfs to be along those lines > of fine grain. There is some limit to the fine grain. We started like that and we had 900+ packages, a lot of people didn't liked that. We're now at 293 packages (68 if you don't count the -dbg, -dev, -lib32 which won't be installed on most user machines). We still split part of the system into packages and I think that putting all the nfs tools might be a good idea (the same is true for a lot of binaries/libs present in the utilities package and a bit for some in the runtime one). > > > > > > Having zfs is controlled by WITH/WITHOUT_ZFS and this is not related > > > > to pkgbase. > > > > > > WITH/WITHOUT are compile time constructs, pkgbase is an install time > > > set of tools, why can there not be a zfs pkg? > > > > pkgbase is just a reflection of what is built. There can be a zfs > > package nothing prevent us for having one. But as said in the commit > > Great, then why dont we? And to your "ufs" above could that be > added as well? I don't think that having those binaries in their own package adds some advantages, even worse I think it's bad from a user point of view. There is honestly more important work to do for pkgbase than arguing about which packages should contain which files. I suggest you try pkgbase and see what you don't like about the organization and send a mail to pkgbase@f.o after. Cheers, > > runtime is the package that should contain everything needed for > > booting to single user and repair a system so it contain zfs related > > tools (and ufs ones). > > I thought the runtime package was the bits you MUST have to > build a running system, and nothing more. Perhaps I have > misunderstood. > > > > The idea behind runtime is that if you start upgrading and things > > break just after it you have all the tools to repair an install. > > I would of called that the "systemrepair" package. > > > > > > > > > > > > > > > > > > > > Differential Revision: https://reviews.freebsd.org/D27708 > > > > > > --- > > > > > > lib/libbe/Makefile | 1 + > > > > > > sbin/bectl/Makefile | 1 + > > > > > > 2 files changed, 2 insertions(+) > > > > > > > > > > > > diff --git a/lib/libbe/Makefile b/lib/libbe/Makefile > > > > > > index 291e2438ee2a..d1fab41578bf 100644 > > > > > > --- a/lib/libbe/Makefile > > > > > > +++ b/lib/libbe/Makefile > > > > > > @@ -4,6 +4,7 @@ SHLIBDIR?= /lib > > > > > > > > > > > > .include > > > > > > > > > > > > +PACKAGE= runtime > > > > > > LIB= be > > > > > > SHLIB_MAJOR= 1 > > > > > > SHLIB_MINOR= 0 > > > > > > diff --git a/sbin/bectl/Makefile b/sbin/bectl/Makefile > > > > > > index 6fa84f48661d..46d43306b9ca 100644 > > > > > > --- a/sbin/bectl/Makefile > > > > > > +++ b/sbin/bectl/Makefile > > > > > > @@ -2,6 +2,7 @@ > > > > > > > > > > > > .include > > > > > > > > > > > > +PACKAGE=runtime > > > > > > PROG= bectl > > > > > > MAN= bectl.8 > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Rod Grimes rgrimes@freebsd.org > > > > > > > > > > > > -- > > > > Emmanuel Vadot > > > > > > > > > > -- > > > Rod Grimes rgrimes@freebsd.org > > > > > > -- > > Emmanuel Vadot > > > > -- > Rod Grimes rgrimes@freebsd.org -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Tue Jan 5 16:27:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 83F234C1F04; Tue, 5 Jan 2021 16:27:05 +0000 (UTC) (envelope-from git@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 4D9HvY3LC6z4hfb; Tue, 5 Jan 2021 16:27:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61BE87265; Tue, 5 Jan 2021 16:27:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105GR558004089; Tue, 5 Jan 2021 16:27:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105GR5ge004088; Tue, 5 Jan 2021 16:27:05 GMT (envelope-from git) Date: Tue, 5 Jan 2021 16:27:05 GMT Message-Id: <202101051627.105GR5ge004088@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: bdc4ea7c2966 - stable/12 - Fix typo in ap_initator_portal. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bdc4ea7c296643868a0d0d339e7555f1e96182fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 16:27:05 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=bdc4ea7c296643868a0d0d339e7555f1e96182fd commit bdc4ea7c296643868a0d0d339e7555f1e96182fd Author: Alexander Motin AuthorDate: 2020-12-29 18:32:05 +0000 Commit: Alexander Motin CommitDate: 2021-01-05 16:25:35 +0000 Fix typo in ap_initator_portal. (cherry picked from commit a3434cdc6b01f23a6a2184923c4367c098ae084d) --- usr.sbin/ctld/ctld.c | 6 +++--- usr.sbin/ctld/ctld.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 25501a80c2e1..beada1e4a9ca 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -362,7 +362,7 @@ auth_portal_new(struct auth_group *ag, const char *portal) if (ap == NULL) log_err(1, "calloc"); ap->ap_auth_group = ag; - ap->ap_initator_portal = checked_strdup(portal); + ap->ap_initiator_portal = checked_strdup(portal); mask = str = checked_strdup(portal); net = strsep(&mask, "/"); if (net[0] == '[') @@ -414,7 +414,7 @@ auth_portal_delete(struct auth_portal *ap) { TAILQ_REMOVE(&ap->ap_auth_group->ag_portals, ap, ap_next); - free(ap->ap_initator_portal); + free(ap->ap_initiator_portal); free(ap); } @@ -1676,7 +1676,7 @@ conf_print(struct conf *conf) auth_name->an_initator_name); TAILQ_FOREACH(auth_portal, &ag->ag_portals, ap_next) fprintf(stderr, "\t initiator-portal %s\n", - auth_portal->ap_initator_portal); + auth_portal->ap_initiator_portal); fprintf(stderr, "}\n"); } TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) { diff --git a/usr.sbin/ctld/ctld.h b/usr.sbin/ctld/ctld.h index 317fd0c33040..ee0b5ad05570 100644 --- a/usr.sbin/ctld/ctld.h +++ b/usr.sbin/ctld/ctld.h @@ -70,7 +70,7 @@ struct auth_name { struct auth_portal { TAILQ_ENTRY(auth_portal) ap_next; struct auth_group *ap_auth_group; - char *ap_initator_portal; + char *ap_initiator_portal; struct sockaddr_storage ap_sa; int ap_mask; }; From owner-dev-commits-src-all@freebsd.org Tue Jan 5 16:27:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6D7FE4C1E98; Tue, 5 Jan 2021 16:27:05 +0000 (UTC) (envelope-from git@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 4D9HvY2kHhz4hWC; Tue, 5 Jan 2021 16:27:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50CA17264; Tue, 5 Jan 2021 16:27:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105GR5bL004072; Tue, 5 Jan 2021 16:27:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105GR5Lk004071; Tue, 5 Jan 2021 16:27:05 GMT (envelope-from git) Date: Tue, 5 Jan 2021 16:27:05 GMT Message-Id: <202101051627.105GR5Lk004071@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 537b3be9c55c - stable/12 - Fix typo in an_initator_name. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 537b3be9c55c0970a252403b8696a614bc57aae0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 16:27:05 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=537b3be9c55c0970a252403b8696a614bc57aae0 commit 537b3be9c55c0970a252403b8696a614bc57aae0 Author: Alexander Motin AuthorDate: 2020-12-29 18:41:56 +0000 Commit: Alexander Motin CommitDate: 2021-01-05 16:26:03 +0000 Fix typo in an_initator_name. (cherry picked from commit bdbc2a6fc2d8c524d2059e3124f81be08f025a65) --- usr.sbin/ctld/ctld.c | 8 ++++---- usr.sbin/ctld/ctld.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index beada1e4a9ca..654f2f050c1e 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -304,7 +304,7 @@ auth_name_new(struct auth_group *ag, const char *name) if (an == NULL) log_err(1, "calloc"); an->an_auth_group = ag; - an->an_initator_name = checked_strdup(name); + an->an_initiator_name = checked_strdup(name); TAILQ_INSERT_TAIL(&ag->ag_names, an, an_next); return (an); } @@ -314,7 +314,7 @@ auth_name_delete(struct auth_name *an) { TAILQ_REMOVE(&an->an_auth_group->ag_names, an, an_next); - free(an->an_initator_name); + free(an->an_initiator_name); free(an); } @@ -332,7 +332,7 @@ auth_name_find(const struct auth_group *ag, const char *name) const struct auth_name *auth_name; TAILQ_FOREACH(auth_name, &ag->ag_names, an_next) { - if (strcmp(auth_name->an_initator_name, name) == 0) + if (strcmp(auth_name->an_initiator_name, name) == 0) return (auth_name); } @@ -1673,7 +1673,7 @@ conf_print(struct conf *conf) auth->a_mutual_user, auth->a_mutual_secret); TAILQ_FOREACH(auth_name, &ag->ag_names, an_next) fprintf(stderr, "\t initiator-name %s\n", - auth_name->an_initator_name); + auth_name->an_initiator_name); TAILQ_FOREACH(auth_portal, &ag->ag_portals, ap_next) fprintf(stderr, "\t initiator-portal %s\n", auth_portal->ap_initiator_portal); diff --git a/usr.sbin/ctld/ctld.h b/usr.sbin/ctld/ctld.h index ee0b5ad05570..f72c8a30f1d6 100644 --- a/usr.sbin/ctld/ctld.h +++ b/usr.sbin/ctld/ctld.h @@ -64,7 +64,7 @@ struct auth { struct auth_name { TAILQ_ENTRY(auth_name) an_next; struct auth_group *an_auth_group; - char *an_initator_name; + char *an_initiator_name; }; struct auth_portal { From owner-dev-commits-src-all@freebsd.org Tue Jan 5 17:32:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 41FC74C3D97; Tue, 5 Jan 2021 17:32:08 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (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 4D9KLZ6r3Kz4mx6; Tue, 5 Jan 2021 17:32:06 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id wqBekNV3PbYg3wqBgkf0L3; Tue, 05 Jan 2021 10:32:04 -0700 X-Authority-Analysis: v=2.4 cv=Q4RsX66a c=1 sm=1 tr=0 ts=5ff4a294 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=VxmjJ2MpAAAA:8 a=mi56gJdQAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=AqOjdld8g1Cx8oSGCzkA:9 a=CjuIK1q_8ugA:10 a=KgIMZu_mwF8A:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=m6W23KLcDyq3lIHOBnQi:22 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 14ED11201; Tue, 5 Jan 2021 09:32:01 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 105HW1r9003463; Tue, 5 Jan 2021 09:32:01 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101051732.105HW1r9003463@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: Baptiste Daroussin cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support In-reply-to: <202101051535.105FZDAX036599@slippy.cwsent.com> References: <202101051302.105D24lW041218@gitrepo.freebsd.org> <202101051440.105EefY4071731@slippy.cwsent.com> <20210105144839.73qamvxrnhxpd3nk@ivaldir.net> <202101051535.105FZDAX036599@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Tue, 05 Jan 2021 07:35:13 -0800." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 05 Jan 2021 09:32:01 -0800 X-CMAE-Envelope: MS4xfDxCR1q1tpNfQeaDWL+33ku9uJmZXV0/SGP+hx2pdEZ1ROXJrqm5L6bUrVIENefjmogSes3jgaDct78GHqxtR0W/Z3+3ZGbEi2d9m8hnw1AwHhKC2/eK KwO+TYcI7Obw0C3mQgtv//s5UCZgv5G2WMe+6wsGwn48eD1TmTxsTVZW72Hf5hE479xMkBPP5hUZF8FgQQ3wjpsd+YwpUNqVGs3tjLSa7ZK6HcewiKYhdkDZ DgSSlobce+waFjpS6lee3KU1MzTsR9LS3yVk270hPGFhd3eEl9o5BnVU9Xh+eA5Y9ztheWkRmnJEE+yOuS9CwzLG/fuWOYAvjILHkdUyqHA= X-Rspamd-Queue-Id: 4D9KLZ6r3Kz4mx6 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.137) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-1.70 / 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)[]; RWL_MAILSPIKE_GOOD(0.00)[64.59.136.137:from]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RECEIVED_SPAMHAUS_PBL(0.00)[70.67.229.168:received]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[64.59.136.137:from]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; AUTH_NA(1.00)[]; SPAMHAUS_ZRD(0.00)[64.59.136.137:from:127.0.2.255]; RCVD_IN_DNSWL_LOW(-0.10)[64.59.136.137:from]; RCVD_TLS_LAST(0.00)[]; R_SPF_NA(0.00)[no SPF record]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 17:32:08 -0000 In message <202101051535.105FZDAX036599@slippy.cwsent.com>, Cy Schubert writes: > In message <20210105144839.73qamvxrnhxpd3nk@ivaldir.net>, Baptiste > Daroussin wr > ites: > > > > --yj2rojvagivjcjon > > Content-Type: text/plain; charset=us-ascii > > Content-Disposition: inline > > Content-Transfer-Encoding: quoted-printable > > > > On Tue, Jan 05, 2021 at 06:40:41AM -0800, Cy Schubert wrote: > > > In message <202101051302.105D24lW041218@gitrepo.freebsd.org>, Baptiste=20 > > > Daroussi > > > n writes: > > > > The branch main has been updated by bapt: > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D821aa63a09402935da0a73ab > = > > f20ba044 > > > > 1562aa07 > > > > > > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > > > Author: Baptiste Daroussin > > > > AuthorDate: 2021-01-04 16:29:40 +0000 > > > > Commit: Baptiste Daroussin > > > > CommitDate: 2021-01-05 13:01:32 +0000 > > > > > > > > ncurses: only keep the version with widechar support > > > > =20 > > > > Only keep the widechar version of ncurses as libncursesw.so.9 > > > > =20 > > > > Keep the old name to avoid breaking the ABI compatibility (the non > > > > widechar version libncurses.so.9 is not binary compatible with > > > > libncursesw.so.9) since all ports and base are already only linking > > > > against the widechar version we can simply remove libncurses.so.9 > > > > =20 > > > > Since the .9 version only lived in the dev branch and never ended i > = > > n a > > > > release, it is simply removed and not added to any binary compat > > > > package. > > > > =20 > > > > Add symlinks to keep build time compatibility for anyone linking ag > = > > ainst > > > > -lncurses > [...] > > >=20 > > > This fails to build in compat32. > > >=20 > > > --- lib/libthr__L --- > > > install -U -s -o root -g wheel -m 444 -S libthr.so.3=20 > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ > > > --- lib/ncurses/ncurses__L --- > > > /opt/src/git-src/contrib/ncurses/ncurses/curses.priv.h:2322:61: error:=20 > > > unknown type name 'mbstate_t'; did you mean '__mbstate_t'? > > > extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *); > > > ^~~~~~~~~ > > > __mbstate_t > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/sys/_ty > = > > pes > > > .h:124:3: note: '__mbstate_t' declared here > > > } __mbstate_t; > > > ^ > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:15: error > = > > :=20 > > > implicit declaration of function 'wctob' is invalid in C99=20 > > > [-Werror,-Wimplicit-function-declaration] > > > result =3D (wctob((wint_t) ch) =3D=3D (int) ch); > > > ^ > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:15: note: > = > > =20 > > > did you mean 'wctomb'? > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/stdlib. > = > > h:1 > > > 23:6: note: 'wctomb' declared here > > > int wctomb(char *, wchar_t); > > > ^ > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:22: error > = > > :=20 > > > use of undeclared identifier 'wint_t' > > > result =3D (wctob((wint_t) ch) =3D=3D (int) ch); > > > ^ > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:49:33: error > = > > :=20 > > > unknown type name 'wint_t' > > > NCURSES_EXPORT(int) _nc_to_char(wint_t ch) > > > ^ > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:53:14: error > = > > :=20 > > > implicit declaration of function 'wctob' is invalid in C99=20 > > > [-Werror,-Wimplicit-function-declaration] > > > result =3D wctob(ch); > > > ^ > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:67:16: error > = > > :=20 > > > unknown type name 'wint_t' > > > NCURSES_EXPORT(wint_t) _nc_to_widechar(int ch) > > > --- cddl/lib/libspl__L --- > > > install -U -s -o root -g wheel -m 444 -S libspl.so.2=20 > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ > > > --- lib/ncurses/ncurses__L --- > > > ^ > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:11: error > = > > :=20 > > > expected ';' after expression > > > wint_t result; > > > ^ > > > ; > > > --- cddl/lib/libnvpair__L --- > > > install -U -o root -g wheel -m 444 libnvpair.so.2.debug=20 > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug/usr/l > = > > ib3 > > > 2/ > > > --- lib/ncurses/ncurses__L --- > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:5: error: > = > > =20 > > > use of undeclared identifier 'wint_t' > > > wint_t result; > > > ^ > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:12: error > = > > :=20 > > > use of undeclared identifier 'result' > > > wint_t result; > > > ^ > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:5: error: > = > > =20 > > > use of undeclared identifier 'result' > > > result =3D btowc(ch); > > > ^ > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:14: error > = > > :=20 > > > implicit declaration of function 'btowc' is invalid in C99=20 > > > [-Werror,-Wimplicit-function-declaration] > > > result =3D btowc(ch); > > > ^ > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:14: note: > = > > =20 > > > did you mean 'mbtowc'? > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/stdlib. > = > > h:1 > > > 09:6: note: 'mbtowc' declared here > > > int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); > > > ^ > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:84:12: error > = > > :=20 > > > use of undeclared identifier 'result' > > > return result; > > > ^ > > > 14 errors generated. > > > *** [charable.o] Error code 1 > > >=20 > > > make[4]: stopped in /opt/src/git-src/lib/ncurses/ncurses > > > 1 error > > >=20 > > > make[4]: stopped in /opt/src/git-src/lib/ncurses/ncurses > > > --- cddl/lib/libicp__L --- > > > --- cddl/lib/libicp_rescue__L --- > > > --- lib/libufs__L --- > > > install -U -C -o root -g wheel -m 444 libufs_p.a=20 > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ > > > --- lib/libutil__L --- > > > --- lib/libthr__L --- > > > install -U -o root -g wheel -m 444 libthr.so.3.debug=20 > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug/usr/l > = > > ib3 > > > 2/ > > > --- cddl/lib/libspl__L --- > > > install -U -o root -g wheel -m 444 libspl.so.2.debug=20 > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug/usr/l > = > > ib3 > > > 2/ > > > --- lib/libthr__L --- > > > --- cddl/lib/libnvpair__L --- > > > install -U -l rs -o root -g wheel -m 755 -S libnvpair.so.2=20 > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/libnvpair > = > > =2Eso > > > *** [build32] Error code 2 > > >=20 > > > make[1]: stopped in /opt/src/git-src > > > 1 error > > >=20 > > > make[1]: stopped in /opt/src/git-src > > > exiting RC=3D2: building amd64 > > > slippy#=20 > > >=20 > > >=20 > > > > Weird are you building with -DNO_CLEAN ? or clean build ? > > NO_CLEAN build. Do you think we need circumvention shim or an UPDATING > entry? I'm seeing the following poudriere failure post installing this into a poudriere jail. cd xxd; CC="cc" CFLAGS="-DLIBICONV_PLUG -I/usr/local/include -O2 -pipe -Wno-misleading-indentation -Wno-tautological-overlap-compare -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1" LDFLAGS="-L. -fstack-protector-strong -rdynamic -Wl,-R/usr/local/lib/perl5/5.32/mach/COR E -fstack-protector-strong -L/usr/local/lib -Wl,--as-needed" /usr/bin/make -f Makefile cc -DLIBICONV_PLUG -I/usr/local/include -O2 -pipe -Wno-misleading-indentatio n -Wno-tautological-overlap-compare -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Wno-misleading-indentation -Wno-tautological-overlap-co mpare -L. -fstack-protector-strong -rdynamic -Wl,-R/usr/local/lib/perl5/5 .32/mach/CORE -fstack-protector-strong -L/usr/local/lib -Wl,--as-needed -DUNIX -o xxd xxd.c OLD_PO_FILE_INPUT=yes msgfmt -v -o af.mo af.po ld-elf.so.1: Shared object "libncurses.so.9" not found, required by "libtextstyle.so.0" *** Error code 1 Stop. make[3]: stopped in /wrkdirs/usr/ports/editors/vim/work/vim-8.2.2263/src/po *** Error code 1 Stop. make[2]: stopped in /wrkdirs/usr/ports/editors/vim/work/vim-8.2.2263/src *** Error code 1 Stop. make[1]: stopped in /wrkdirs/usr/ports/editors/vim/work/vim-8.2.2263 *** Error code 1 Stop. make: stopped in /usr/ports/editors/vim =>> Cleaning up wrkdir ===> Cleaning for vim-8.2.2263 build of editors/vim | vim-8.2.2263 ended at Tue Jan 5 09:10:33 PST 2021 build time: 00:05:46 !!! build failure encountered !!! devel/libtextstyle looks like it needs a rebuild. We probably need __FreeBSD_version bump to force a poudriere rebuild too. -- 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-dev-commits-src-all@freebsd.org Tue Jan 5 17:49:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 37DA14C4306; Tue, 5 Jan 2021 17:49:50 +0000 (UTC) (envelope-from bapt@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 4D9Kl20NJqz4nlr; Tue, 5 Jan 2021 17:49:50 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from ivaldir.etoilebsd.net (etoilebsd.net [178.32.217.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id C7DDD774; Tue, 5 Jan 2021 17:49:49 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by ivaldir.etoilebsd.net (Postfix, from userid 1001) id 2E1D0EA9AA; Tue, 5 Jan 2021 18:49:46 +0100 (CET) Date: Tue, 5 Jan 2021 18:49:46 +0100 From: Baptiste Daroussin To: Cy Schubert Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support Message-ID: <20210105174946.cipkku7f2bhqaq4r@ivaldir.net> References: <202101051302.105D24lW041218@gitrepo.freebsd.org> <202101051440.105EefY4071731@slippy.cwsent.com> <20210105144839.73qamvxrnhxpd3nk@ivaldir.net> <202101051535.105FZDAX036599@slippy.cwsent.com> <202101051732.105HW1r9003463@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yds57fw44r56gk43" Content-Disposition: inline In-Reply-To: <202101051732.105HW1r9003463@slippy.cwsent.com> X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 17:49:50 -0000 --yds57fw44r56gk43 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 05, 2021 at 09:32:01AM -0800, Cy Schubert wrote: > In message <202101051535.105FZDAX036599@slippy.cwsent.com>, Cy Schubert= =20 > writes: > > In message <20210105144839.73qamvxrnhxpd3nk@ivaldir.net>, Baptiste=20 > > Daroussin wr > > ites: > > >=20 > > > --yj2rojvagivjcjon > > > Content-Type: text/plain; charset=3Dus-ascii > > > Content-Disposition: inline > > > Content-Transfer-Encoding: quoted-printable > > > > > > On Tue, Jan 05, 2021 at 06:40:41AM -0800, Cy Schubert wrote: > > > > In message <202101051302.105D24lW041218@gitrepo.freebsd.org>, Bapti= ste=3D20 > > > > Daroussi > > > > n writes: > > > > > The branch main has been updated by bapt: > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D3D821aa63a09402935= da0a73ab > > =3D > > > f20ba044 > > > > > 1562aa07 > > > > > > > > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > > > > Author: Baptiste Daroussin > > > > > AuthorDate: 2021-01-04 16:29:40 +0000 > > > > > Commit: Baptiste Daroussin > > > > > CommitDate: 2021-01-05 13:01:32 +0000 > > > > > > > > > > ncurses: only keep the version with widechar support > > > > > =3D20 > > > > > Only keep the widechar version of ncurses as libncursesw.so.9 > > > > > =3D20 > > > > > Keep the old name to avoid breaking the ABI compatibility (th= e non > > > > > widechar version libncurses.so.9 is not binary compatible with > > > > > libncursesw.so.9) since all ports and base are already only l= inking > > > > > against the widechar version we can simply remove libncurses.= so.9 > > > > > =3D20 > > > > > Since the .9 version only lived in the dev branch and never e= nded i > > =3D > > > n a > > > > > release, it is simply removed and not added to any binary com= pat > > > > > package. > > > > > =3D20 > > > > > Add symlinks to keep build time compatibility for anyone link= ing ag > > =3D > > > ainst > > > > > -lncurses > > [...] > > > >=3D20 > > > > This fails to build in compat32. > > > >=3D20 > > > > --- lib/libthr__L --- > > > > install -U -s -o root -g wheel -m 444 -S libthr.so.3=3D20 > > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ > > > > --- lib/ncurses/ncurses__L --- > > > > /opt/src/git-src/contrib/ncurses/ncurses/curses.priv.h:2322:61: err= or:=3D20 > > > > unknown type name 'mbstate_t'; did you mean '__mbstate_t'? > > > > extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate= _t *); > > > > ^~~~~~~= ~~ > > > > __mbsta= te_t > > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/s= ys/_ty > > =3D > > > pes > > > > .h:124:3: note: '__mbstate_t' declared here > > > > } __mbstate_t; > > > > ^ > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:15:= error > > =3D > > > :=3D20 > > > > implicit declaration of function 'wctob' is invalid in C99=3D20 > > > > [-Werror,-Wimplicit-function-declaration] > > > > result =3D3D (wctob((wint_t) ch) =3D3D=3D3D (int) ch); > > > > ^ > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:15:= note: > > =3D > > > =3D20 > > > > did you mean 'wctomb'? > > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/s= tdlib. > > =3D > > > h:1 > > > > 23:6: note: 'wctomb' declared here > > > > int wctomb(char *, wchar_t); > > > > ^ > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:42:22:= error > > =3D > > > :=3D20 > > > > use of undeclared identifier 'wint_t' > > > > result =3D3D (wctob((wint_t) ch) =3D3D=3D3D (int) ch); > > > > ^ > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:49:33:= error > > =3D > > > :=3D20 > > > > unknown type name 'wint_t' > > > > NCURSES_EXPORT(int) _nc_to_char(wint_t ch) > > > > ^ > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:53:14:= error > > =3D > > > :=3D20 > > > > implicit declaration of function 'wctob' is invalid in C99=3D20 > > > > [-Werror,-Wimplicit-function-declaration] > > > > result =3D3D wctob(ch); > > > > ^ > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:67:16:= error > > =3D > > > :=3D20 > > > > unknown type name 'wint_t' > > > > NCURSES_EXPORT(wint_t) _nc_to_widechar(int ch) > > > > --- cddl/lib/libspl__L --- > > > > install -U -s -o root -g wheel -m 444 -S libspl.so.2=3D20 > > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ > > > > --- lib/ncurses/ncurses__L --- > > > > ^ > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:11:= error > > =3D > > > :=3D20 > > > > expected ';' after expression > > > > wint_t result; > > > > ^ > > > > ; > > > > --- cddl/lib/libnvpair__L --- > > > > install -U -o root -g wheel -m 444 libnvpair.so.2.debug=3D20 > > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug= /usr/l > > =3D > > > ib3 > > > > 2/ > > > > --- lib/ncurses/ncurses__L --- > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:5: = error: > > =3D > > > =3D20 > > > > use of undeclared identifier 'wint_t' > > > > wint_t result; > > > > ^ > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:69:12:= error > > =3D > > > :=3D20 > > > > use of undeclared identifier 'result' > > > > wint_t result; > > > > ^ > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:5: = error: > > =3D > > > =3D20 > > > > use of undeclared identifier 'result' > > > > result =3D3D btowc(ch); > > > > ^ > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:14:= error > > =3D > > > :=3D20 > > > > implicit declaration of function 'btowc' is invalid in C99=3D20 > > > > [-Werror,-Wimplicit-function-declaration] > > > > result =3D3D btowc(ch); > > > > ^ > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:71:14:= note: > > =3D > > > =3D20 > > > > did you mean 'mbtowc'? > > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/include/s= tdlib. > > =3D > > > h:1 > > > > 09:6: note: 'mbtowc' declared here > > > > int mbtowc(wchar_t * __restrict, const char * __restrict, size= _t); > > > > ^ > > > > /opt/src/git-src/contrib/ncurses/ncurses/widechar/charable.c:84:12:= error > > =3D > > > :=3D20 > > > > use of undeclared identifier 'result' > > > > return result; > > > > ^ > > > > 14 errors generated. > > > > *** [charable.o] Error code 1 > > > >=3D20 > > > > make[4]: stopped in /opt/src/git-src/lib/ncurses/ncurses > > > > 1 error > > > >=3D20 > > > > make[4]: stopped in /opt/src/git-src/lib/ncurses/ncurses > > > > --- cddl/lib/libicp__L --- > > > > --- cddl/lib/libicp_rescue__L --- > > > > --- lib/libufs__L --- > > > > install -U -C -o root -g wheel -m 444 libufs_p.a=3D20 > > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/ > > > > --- lib/libutil__L --- > > > > --- lib/libthr__L --- > > > > install -U -o root -g wheel -m 444 libthr.so.3.debug=3D20 > > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug= /usr/l > > =3D > > > ib3 > > > > 2/ > > > > --- cddl/lib/libspl__L --- > > > > install -U -o root -g wheel -m 444 libspl.so.2.debug=3D20 > > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib/debug= /usr/l > > =3D > > > ib3 > > > > 2/ > > > > --- lib/libthr__L --- > > > > --- cddl/lib/libnvpair__L --- > > > > install -U -l rs -o root -g wheel -m 755 -S libnvpair.so.2=3D20 > > > > /export/obj/opt/src/git-src/amd64.amd64/obj-lib32/tmp/usr/lib32/lib= nvpair > > =3D > > > =3D2Eso > > > > *** [build32] Error code 2 > > > >=3D20 > > > > make[1]: stopped in /opt/src/git-src > > > > 1 error > > > >=3D20 > > > > make[1]: stopped in /opt/src/git-src > > > > exiting RC=3D3D2: building amd64 > > > > slippy#=3D20 > > > >=3D20 > > > >=3D20 > > > > > > Weird are you building with -DNO_CLEAN ? or clean build ? > > > > NO_CLEAN build. Do you think we need circumvention shim or an UPDATING= =20 > > entry? >=20 > I'm seeing the following poudriere failure post installing this into a=20 > poudriere jail. >=20 > cd xxd; CC=3D"cc" CFLAGS=3D"-DLIBICONV_PLUG -I/usr/local/include -O2 -pip= e=20 > -Wno-misleading-indentation -Wno-tautological-overlap-compare =20 > -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing =20 > -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3D1" LDFLAGS=3D"-L. =20 > -fstack-protector-strong -rdynamic -Wl,-R/usr/local/lib/perl5/5.32/mach/= COR > E -fstack-protector-strong -L/usr/local/lib -Wl,--as-needed" =20 > /usr/bin/make -f Makefile > cc -DLIBICONV_PLUG -I/usr/local/include -O2 -pipe -Wno-misleading-indenta= tio > n -Wno-tautological-overlap-compare -DLIBICONV_PLUG=20 > -fstack-protector-strong -fno-strict-aliasing -U_FORTIFY_SOURCE=20 > -D_FORTIFY_SOURCE=3D1 -Wno-misleading-indentation -Wno-tautological-overl= ap-co > mpare -L. -fstack-protector-strong -rdynamic -Wl,-R/usr/local/lib/perl= 5/5 > .32/mach/CORE -fstack-protector-strong -L/usr/local/lib -Wl,--as-neede= d=20 > -DUNIX -o xxd xxd.c > OLD_PO_FILE_INPUT=3Dyes msgfmt -v -o af.mo af.po > ld-elf.so.1: Shared object "libncurses.so.9" not found, required by=20 > "libtextstyle.so.0" > *** Error code 1 >=20 > Stop. > make[3]: stopped in /wrkdirs/usr/ports/editors/vim/work/vim-8.2.2263/src/= po > *** Error code 1 >=20 > Stop. > make[2]: stopped in /wrkdirs/usr/ports/editors/vim/work/vim-8.2.2263/src > *** Error code 1 >=20 > Stop. > make[1]: stopped in /wrkdirs/usr/ports/editors/vim/work/vim-8.2.2263 > *** Error code 1 >=20 > Stop. > make: stopped in /usr/ports/editors/vim > =3D>> Cleaning up wrkdir > =3D=3D=3D> Cleaning for vim-8.2.2263 > build of editors/vim | vim-8.2.2263 ended at Tue Jan 5 09:10:33 PST 2021 > build time: 00:05:46 > !!! build failure encountered !!! >=20 > devel/libtextstyle looks like it needs a rebuild. We probably need=20 > __FreeBSD_version bump to force a poudriere rebuild too. >=20 Fixed Best regards, Bapt --yds57fw44r56gk43 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAl/0prcACgkQY4mL3PG3 PlqcFg/+IPfhQ2ziFf88zSUgD199GQpqRF1f0HgjlI4CuIWP78XYL4NzVN6T8rEK 47a20Lw/dj+nyEZHQkOGVtjbb6rwCZuwC55Y09Y9+NPpMUUNKLU7g7KW8h8q8Mkr Vt5K7LixjFEh38hJpS0pqztn0EqEB0nCsJsJhLTbCk99YPA3RNw3R1fEPVBNTEpl dLx0QIwbPHx1Zz8MomOTr6IvPhABmv3XKCbzeO7HieTRll8os8RejCirW1+DI5pr /3kzpQAIEKZbnB7kIw3wywTjAcoqNWfctj02IzQP9hHZXhvmdDR0po9kiWUN+SaH V4TkpRhnTEgx+Mpn/TldKMfdDvgfVwF3+uBdzuGJgPRNDH4JLXP/ntv3qHWJGGoi 3fK73kQG6PAzAGAZcqCwT4/oMyQuIicMLGqIo/JAdX+pn+wnLUZ6CAYKw94Syid0 1873A+aBJMrr2NQPNJ9WrLhMf6+OknOVhDZqR137o5Jdhj/WxAqiJjFaDbxTxDrV p4bHazJ6/xcJ6GUB2iMOFlC8Z+Tj9MDzP3sPt2hqY9v+GaalLYVs6TZvlj7IsLro 9Yf/lqYjxywjgTBXjTsIY1bSn1EmB3eESMobeFKq6FZ1DDv+Qcf6aksK+lrWZWN6 QdWIUhTCwcs0v/Y4TTTUflgxhX+O4k0eUx3XPX0Nt+puJ2LR+u8= =7C/1 -----END PGP SIGNATURE----- --yds57fw44r56gk43-- From owner-dev-commits-src-all@freebsd.org Tue Jan 5 19:44:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D6D784C80A3; Tue, 5 Jan 2021 19:44:36 +0000 (UTC) (envelope-from git@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 4D9NHS5mkNz3D66; Tue, 5 Jan 2021 19:44:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B89AB12092; Tue, 5 Jan 2021 19:44:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105JiaFR062187; Tue, 5 Jan 2021 19:44:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105JiaE6062186; Tue, 5 Jan 2021 19:44:36 GMT (envelope-from git) Date: Tue, 5 Jan 2021 19:44:36 GMT Message-Id: <202101051944.105JiaE6062186@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: df592782db90 - stable/12 - Perform kernel linker ifunc test only for builds MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: df592782db906594c7f7ee0bdb9ed502401cd532 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 19:44:36 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=df592782db906594c7f7ee0bdb9ed502401cd532 commit df592782db906594c7f7ee0bdb9ed502401cd532 Author: Ed Maste AuthorDate: 2020-12-27 00:34:24 +0000 Commit: Ed Maste CommitDate: 2021-01-05 19:44:31 +0000 Perform kernel linker ifunc test only for builds dvl reported that "make installkernel" failed with "amd64/arm64/i386 kernel requires linker ifunc support." This test should apply to builds only; the linker is not used at install time. I think the same (ifunc-supporting) linker used to build the kernel should be detected at install time in usual cases (and so not trigger this error). However, there is no reason to disallow the install, if for some reason the expected linker isn't the one tested at install time. PR: 251580 Reported by: dvl Sponsored by: The FreeBSD Foundation (cherry picked from commit 581ade97d561e136dbb7cf7a413128c343a23199) --- sys/conf/kern.pre.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 65646da42faa..7f0099344d18 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -131,7 +131,8 @@ LDFLAGS+= --build-id=sha1 .if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ ${MACHINE_CPUARCH} == "i386") && \ - defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == "" + defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mifunc} == "" && \ + !make(install) .error amd64/arm64/i386 kernel requires linker ifunc support .endif .if ${MACHINE_CPUARCH} == "amd64" From owner-dev-commits-src-all@freebsd.org Tue Jan 5 19:52:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9FD964C859A; Tue, 5 Jan 2021 19:52:16 +0000 (UTC) (envelope-from git@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 4D9NSJ48FSz3DYF; Tue, 5 Jan 2021 19:52:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8161E11BE7; Tue, 5 Jan 2021 19:52:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105JqGic072252; Tue, 5 Jan 2021 19:52:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105JqGD5072251; Tue, 5 Jan 2021 19:52:16 GMT (envelope-from git) Date: Tue, 5 Jan 2021 19:52:16 GMT Message-Id: <202101051952.105JqGD5072251@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: cb00fc7c4d92 - main - arm64: genet: Add bcm2711-genet-v5 compatible MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb00fc7c4d92a4a2fc240470a8ea67d5aa04b20c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 19:52:16 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=cb00fc7c4d92a4a2fc240470a8ea67d5aa04b20c commit cb00fc7c4d92a4a2fc240470a8ea67d5aa04b20c Author: Emmanuel Vadot AuthorDate: 2021-01-05 19:50:43 +0000 Commit: Emmanuel Vadot CommitDate: 2021-01-05 19:50:43 +0000 arm64: genet: Add bcm2711-genet-v5 compatible Later dtb from the RPI Foundation removed the brcm,genet-v5 compatible for some unknown reason, add brcm,bcm2711-genet-v5 to the list of compatible device for if_genet --- sys/arm64/broadcom/genet/if_genet.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index 9c8b322dee87..5f2dfcc40395 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -111,6 +111,7 @@ static struct ofw_compat_data compat_data[] = { { "brcm,genet-v3", 3 }, { "brcm,genet-v4", 4 }, { "brcm,genet-v5", 5 }, + { "brcm,bcm2711-genet-v5", 5 }, { NULL, 0 } }; From owner-dev-commits-src-all@freebsd.org Tue Jan 5 19:58:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1A4B64C8810; Tue, 5 Jan 2021 19:58:23 +0000 (UTC) (envelope-from git@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 4D9NbM0GY3z3F62; Tue, 5 Jan 2021 19:58:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F051711B67; Tue, 5 Jan 2021 19:58:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105JwMC5075587; Tue, 5 Jan 2021 19:58:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105JwMDN075586; Tue, 5 Jan 2021 19:58:22 GMT (envelope-from git) Date: Tue, 5 Jan 2021 19:58:22 GMT Message-Id: <202101051958.105JwMDN075586@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 4d86ab429ee9 - main - Fix devinfo typo. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d86ab429ee9b4b22654b52380512f7b8cee4478 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 19:58:23 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4d86ab429ee9b4b22654b52380512f7b8cee4478 commit 4d86ab429ee9b4b22654b52380512f7b8cee4478 Author: Alexander Motin AuthorDate: 2021-01-05 19:56:23 +0000 Commit: Alexander Motin CommitDate: 2021-01-05 19:56:23 +0000 Fix devinfo typo. Submitted by: Nick Wolff MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27981 --- usr.sbin/devinfo/devinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/devinfo/devinfo.c b/usr.sbin/devinfo/devinfo.c index be18c57dc5e7..ee5ac0a1f7eb 100644 --- a/usr.sbin/devinfo/devinfo.c +++ b/usr.sbin/devinfo/devinfo.c @@ -235,7 +235,7 @@ usage(void) fprintf(stderr, "%s\n%s\n%s\n", "usage: devinfo [-rv]", " devinfo -u", - " devifno -p dev [-v]"); + " devinfo -p dev [-v]"); exit(1); } From owner-dev-commits-src-all@freebsd.org Tue Jan 5 20:07:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F32ED4C86D2; Tue, 5 Jan 2021 20:07:38 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (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 4D9Np21HkBz3FY0; Tue, 5 Jan 2021 20:07:37 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f181.google.com with SMTP id q5so853138ilc.10; Tue, 05 Jan 2021 12:07:37 -0800 (PST) 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=1Kgm4sP+u/Wvk0G2Nd0P6F1wh9A9GcmLTJUrxGxd/IU=; b=SUviTPFMZop77oFrrsUOiNtAAtgx+CYnfu7Lrbd5QrnbqYel4PjfZYRH8ubZd0awv/ kB0Ke4QIrTT9LA2BjjbhrPNawpp8gUE6lceASOW+L0MSifi65yEQcevx+1uBUc8e6xqT h012GnNArU5kMyGxiX3R4xlB2F7dmnw06JvWpr5acJUz3rjYLXS72erS6bCtIlvayFNN ZH1SVIntFu24g5V/kQMzCds17JE3PA2F7jXJ11pJqOusu8aDgrK394o6xRvEcvQGrPFb 2cKqQFolQk7FztDh3El7j/JOFmJppQP/XAfVyMX8yAeWT+uKitX5mthjZRmdaXP83Fz3 11Pg== X-Gm-Message-State: AOAM532jWaPVrbmyYVbTNP7H1t3JVa7DsH+WV2ku55l8QApFj4fBWEKp u2nymyo/ivUkaHBY7B8Uv5ulnXScdOdQtF+/G1a/AhdJmN8nLw== X-Google-Smtp-Source: ABdhPJyPpWcnDyZbnDK23I716DU1f8hi8J42LEOo7UEJ3mmdMmFoL+ZGSwneoJrYXZs+tFUP1TYAJSyYE4pnfKvmXic= X-Received: by 2002:a92:60b:: with SMTP id x11mr243733ilg.11.1609877257068; Tue, 05 Jan 2021 12:07:37 -0800 (PST) MIME-Version: 1.0 References: <202101051302.105D24lW041218@gitrepo.freebsd.org> <202101051440.105EefY4071731@slippy.cwsent.com> <20210105144839.73qamvxrnhxpd3nk@ivaldir.net> <202101051535.105FZDAX036599@slippy.cwsent.com> In-Reply-To: <202101051535.105FZDAX036599@slippy.cwsent.com> From: Ed Maste Date: Tue, 5 Jan 2021 15:07:25 -0500 Message-ID: Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support To: Cy Schubert Cc: Baptiste Daroussin , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4D9Np21HkBz3FY0 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.181 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-2.57 / 15.00]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEFALL_USER(0.00)[carpeddiem]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; ARC_NA(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[209.85.166.181:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.166.181:from]; NEURAL_HAM_SHORT(-0.57)[-0.566]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.181:from]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.181:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 20:07:39 -0000 On Tue, 5 Jan 2021 at 10:35, Cy Schubert wrote: > > NO_CLEAN build. Do you think we need circumvention shim or an UPDATING > entry? We should add a hack in tools/build/depend-cleanup.sh From owner-dev-commits-src-all@freebsd.org Tue Jan 5 21:55:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A8A914CC10B; Tue, 5 Jan 2021 21:55:31 +0000 (UTC) (envelope-from git@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 4D9RBW4QK2z3NGv; Tue, 5 Jan 2021 21:55:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A7D1139CC; Tue, 5 Jan 2021 21:55:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105LtVhU029654; Tue, 5 Jan 2021 21:55:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105LtVwV029653; Tue, 5 Jan 2021 21:55:31 GMT (envelope-from git) Date: Tue, 5 Jan 2021 21:55:31 GMT Message-Id: <202101052155.105LtVwV029653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Libby Subject: git: f1007ba88d47 - stable/12 - ixl: quiet -Wunused-function MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f1007ba88d47d5e4911c7cede74d0b8c44fe8248 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 21:55:31 -0000 The branch stable/12 has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=f1007ba88d47d5e4911c7cede74d0b8c44fe8248 commit f1007ba88d47d5e4911c7cede74d0b8c44fe8248 Author: Ryan Libby AuthorDate: 2021-01-05 20:51:40 +0000 Commit: Ryan Libby CommitDate: 2021-01-05 20:51:40 +0000 ixl: quiet -Wunused-function Direct commit to stable/12. svn r363876 / git 2bba796c66ede62803ed5da3d83e7efb70c5e9bc MFC'd head svn r361992 / git b4a7ce0690aedd9763b3b47ee7fcdb421f0434c7. These two prototypes were brought back, but the definitions were not. The definitions had been introduced earlier for unrelated work, in svn r353503 / git ba76aa63573f4aeb8fbea6dc85548660cc6d083b, which has not been MFC'd. Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27817 --- sys/dev/ixl/ixl_pf_main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index c272e27fb4a2..6990ef80a184 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -47,8 +47,6 @@ static u8 ixl_convert_sysctl_aq_link_speed(u8, bool); static void ixl_sbuf_print_bytes(struct sbuf *, u8 *, int, int, bool); static const char * ixl_link_speed_string(enum i40e_aq_link_speed); -static u_int ixl_add_maddr(void *, struct sockaddr_dl *, u_int); -static u_int ixl_match_maddr(void *, struct sockaddr_dl *, u_int); static char * ixl_switch_element_string(struct sbuf *, u8, u16); static enum ixl_fw_mode ixl_get_fw_mode(struct ixl_pf *); From owner-dev-commits-src-all@freebsd.org Tue Jan 5 22:37:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EDC9A4CF0D1; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@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 4D9S7Q6KvZz3hfM; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7EC7140C3; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105Mbs8j081492; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105MbsvF081491; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git) Date: Tue, 5 Jan 2021 22:37:54 GMT Message-Id: <202101052237.105MbsvF081491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 320c11165b6b - main - pf: Split pfi_kif into a user and kernel space structure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 320c11165b6b1113b34f9e156cbf85b5ed0aa5eb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 22:37:55 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=320c11165b6b1113b34f9e156cbf85b5ed0aa5eb commit 320c11165b6b1113b34f9e156cbf85b5ed0aa5eb Author: Kristof Provost AuthorDate: 2020-12-12 14:14:56 +0000 Commit: Kristof Provost CommitDate: 2021-01-05 22:35:37 +0000 pf: Split pfi_kif into a user and kernel space structure No functional change. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27761 --- sys/net/pfvar.h | 74 ++++++++++++++--------- sys/netpfil/pf/if_pflog.c | 2 +- sys/netpfil/pf/if_pfsync.c | 6 +- sys/netpfil/pf/pf.c | 62 +++++++++---------- sys/netpfil/pf/pf.h | 23 +++++++ sys/netpfil/pf/pf_if.c | 146 ++++++++++++++++++++++++++------------------- sys/netpfil/pf/pf_ioctl.c | 112 ++++++++++++++++++++-------------- sys/netpfil/pf/pf_lb.c | 12 ++-- sys/netpfil/pf/pf_norm.c | 12 ++-- 9 files changed, 264 insertions(+), 185 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index e1fc60d6f1a7..d72d06490040 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -66,7 +66,7 @@ struct pfi_dynaddr { struct pf_addr pfid_addr6; struct pf_addr pfid_mask6; struct pfr_ktable *pfid_kt; - struct pfi_kif *pfid_kif; + struct pfi_kkif *pfid_kif; int pfid_net; /* mask or 128 */ int pfid_acnt4; /* address count IPv4 */ int pfid_acnt6; /* address count IPv6 */ @@ -294,6 +294,25 @@ extern struct sx pf_end_lock; #ifdef _KERNEL +struct pf_kpooladdr { + struct pf_addr_wrap addr; + TAILQ_ENTRY(pf_kpooladdr) entries; + char ifname[IFNAMSIZ]; + struct pfi_kkif *kif; +}; + +TAILQ_HEAD(pf_kpalist, pf_kpooladdr); + +struct pf_kpool { + struct pf_kpalist list; + struct pf_kpooladdr *cur; + struct pf_poolhashkey key; + struct pf_addr counter; + int tblidx; + u_int16_t proxy_port[2]; + u_int8_t opts; +}; + union pf_krule_ptr { struct pf_krule *ptr; u_int32_t nr; @@ -313,13 +332,13 @@ struct pf_krule { char overload_tblname[PF_TABLE_NAME_SIZE]; TAILQ_ENTRY(pf_krule) entries; - struct pf_pool rpool; + struct pf_kpool rpool; counter_u64_t evaluations; counter_u64_t packets[2]; counter_u64_t bytes[2]; - struct pfi_kif *kif; + struct pfi_kkif *kif; struct pf_kanchor *anchor; struct pfr_ktable *overload_tbl; @@ -398,7 +417,7 @@ struct pf_ksrc_node { struct pf_addr addr; struct pf_addr raddr; union pf_krule_ptr rule; - struct pfi_kif *kif; + struct pfi_kkif *kif; counter_u64_t bytes[2]; counter_u64_t packets[2]; u_int32_t states; @@ -500,8 +519,8 @@ struct pf_state { union pf_krule_ptr nat_rule; struct pf_addr rt_addr; struct pf_state_key *key[2]; /* addresses stack and wire */ - struct pfi_kif *kif; - struct pfi_kif *rt_kif; + struct pfi_kkif *kif; + struct pfi_kkif *rt_kif; struct pf_ksrc_node *src_node; struct pf_ksrc_node *nat_src_node; counter_u64_t packets[2]; @@ -606,7 +625,7 @@ void pfsync_state_export(struct pfsync_state *, /* pflog */ struct pf_kruleset; struct pf_pdesc; -typedef int pflog_packet_t(struct pfi_kif *, struct mbuf *, sa_family_t, +typedef int pflog_packet_t(struct pfi_kkif *, struct mbuf *, sa_family_t, u_int8_t, u_int8_t, struct pf_krule *, struct pf_krule *, struct pf_kruleset *, struct pf_pdesc *, int); extern pflog_packet_t *pflog_packet_ptr; @@ -851,16 +870,12 @@ struct pfr_ktable { #define pfrkt_tzero pfrkt_kts.pfrkts_tzero #endif -/* keep synced with pfi_kif, used in RB_FIND */ -struct pfi_kif_cmp { - char pfik_name[IFNAMSIZ]; -}; - -struct pfi_kif { +#ifdef _KERNEL +struct pfi_kkif { char pfik_name[IFNAMSIZ]; union { - RB_ENTRY(pfi_kif) _pfik_tree; - LIST_ENTRY(pfi_kif) _pfik_list; + RB_ENTRY(pfi_kkif) _pfik_tree; + LIST_ENTRY(pfi_kkif) _pfik_list; } _pfik_glue; #define pfik_tree _pfik_glue._pfik_tree #define pfik_list _pfik_glue._pfik_list @@ -873,6 +888,7 @@ struct pfi_kif { u_int pfik_rulerefs; TAILQ_HEAD(, pfi_dynaddr) pfik_dynaddrs; }; +#endif #define PFI_IFLAG_REFS 0x0001 /* has state references */ #define PFI_IFLAG_SKIP 0x0100 /* skip filtering on interface */ @@ -1379,7 +1395,7 @@ VNET_DECLARE(uint64_t, pf_stateid[MAXCPU]); TAILQ_HEAD(pf_altqqueue, pf_altq); VNET_DECLARE(struct pf_altqqueue, pf_altqs[4]); #define V_pf_altqs VNET(pf_altqs) -VNET_DECLARE(struct pf_palist, pf_pabuf); +VNET_DECLARE(struct pf_kpalist, pf_pabuf); #define V_pf_pabuf VNET(pf_pabuf) VNET_DECLARE(u_int32_t, ticket_altqs_active); @@ -1428,7 +1444,7 @@ extern void pf_purge_expired_src_nodes(void); extern int pf_unlink_state(struct pf_state *, u_int); #define PF_ENTER_LOCKED 0x00000001 #define PF_RETURN_LOCKED 0x00000002 -extern int pf_state_insert(struct pfi_kif *, +extern int pf_state_insert(struct pfi_kkif *, struct pf_state_key *, struct pf_state_key *, struct pf_state *); @@ -1476,13 +1492,13 @@ void pf_free_rule(struct pf_krule *); #ifdef INET int pf_test(int, int, struct ifnet *, struct mbuf **, struct inpcb *); -int pf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *, +int pf_normalize_ip(struct mbuf **, int, struct pfi_kkif *, u_short *, struct pf_pdesc *); #endif /* INET */ #ifdef INET6 int pf_test6(int, int, struct ifnet *, struct mbuf **, struct inpcb *); -int pf_normalize_ip6(struct mbuf **, int, struct pfi_kif *, u_short *, +int pf_normalize_ip6(struct mbuf **, int, struct pfi_kkif *, u_short *, struct pf_pdesc *); void pf_poolmask(struct pf_addr *, struct pf_addr*, struct pf_addr *, struct pf_addr *, u_int8_t); @@ -1510,7 +1526,7 @@ int pf_match_port(u_int8_t, u_int16_t, u_int16_t, u_int16_t); void pf_normalize_init(void); void pf_normalize_cleanup(void); -int pf_normalize_tcp(int, struct pfi_kif *, struct mbuf *, int, int, void *, +int pf_normalize_tcp(int, struct pfi_kkif *, struct mbuf *, int, int, void *, struct pf_pdesc *); void pf_normalize_tcp_cleanup(struct pf_state *); int pf_normalize_tcp_init(struct mbuf *, int, struct pf_pdesc *, @@ -1522,7 +1538,7 @@ u_int32_t pf_state_expires(const struct pf_state *); void pf_purge_expired_fragments(void); void pf_purge_fragments(uint32_t); -int pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *, +int pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *, int); int pf_socket_lookup(int, struct pf_pdesc *, struct mbuf *); struct pf_state_key *pf_alloc_state_key(int); @@ -1565,19 +1581,19 @@ int pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *, int *, u_int32_t, int); MALLOC_DECLARE(PFI_MTYPE); -VNET_DECLARE(struct pfi_kif *, pfi_all); +VNET_DECLARE(struct pfi_kkif *, pfi_all); #define V_pfi_all VNET(pfi_all) void pfi_initialize(void); void pfi_initialize_vnet(void); void pfi_cleanup(void); void pfi_cleanup_vnet(void); -void pfi_kif_ref(struct pfi_kif *); -void pfi_kif_unref(struct pfi_kif *); -struct pfi_kif *pfi_kif_find(const char *); -struct pfi_kif *pfi_kif_attach(struct pfi_kif *, const char *); -int pfi_kif_match(struct pfi_kif *, struct pfi_kif *); -void pfi_kif_purge(void); +void pfi_kkif_ref(struct pfi_kkif *); +void pfi_kkif_unref(struct pfi_kkif *); +struct pfi_kkif *pfi_kkif_find(const char *); +struct pfi_kkif *pfi_kkif_attach(struct pfi_kkif *, const char *); +int pfi_kkif_match(struct pfi_kkif *, struct pfi_kkif *); +void pfi_kkif_purge(void); int pfi_match_addr(struct pfi_dynaddr *, struct pf_addr *, sa_family_t); int pfi_dynaddr_setup(struct pf_addr_wrap *, sa_family_t); @@ -1651,7 +1667,7 @@ int pf_map_addr(u_int8_t, struct pf_krule *, struct pf_addr *, struct pf_addr *, struct pf_addr *, struct pf_ksrc_node **); struct pf_krule *pf_get_translation(struct pf_pdesc *, struct mbuf *, - int, int, struct pfi_kif *, struct pf_ksrc_node **, + int, int, struct pfi_kkif *, struct pf_ksrc_node **, struct pf_state_key **, struct pf_state_key **, struct pf_addr *, struct pf_addr *, uint16_t, uint16_t, struct pf_kanchor_stackframe *); diff --git a/sys/netpfil/pf/if_pflog.c b/sys/netpfil/pf/if_pflog.c index 030f75c2507e..9eb168b9a74f 100644 --- a/sys/netpfil/pf/if_pflog.c +++ b/sys/netpfil/pf/if_pflog.c @@ -201,7 +201,7 @@ pflogioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } static int -pflog_packet(struct pfi_kif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir, +pflog_packet(struct pfi_kkif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir, u_int8_t reason, struct pf_krule *rm, struct pf_krule *am, struct pf_kruleset *ruleset, struct pf_pdesc *pd, int lookupsafe) { diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 83ca4b969636..1cdb365c98df 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -464,7 +464,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) struct pf_state *st = NULL; struct pf_state_key *skw = NULL, *sks = NULL; struct pf_krule *r = NULL; - struct pfi_kif *kif; + struct pfi_kkif *kif; int error; PF_RULES_RASSERT(); @@ -476,7 +476,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) return (EINVAL); } - if ((kif = pfi_kif_find(sp->ifname)) == NULL) { + if ((kif = pfi_kkif_find(sp->ifname)) == NULL) { if (V_pf_status.debug >= PF_DEBUG_MISC) printf("%s: unknown interface: %s\n", __func__, sp->ifname); @@ -764,7 +764,7 @@ pfsync_in_clr(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) creatorid = clr[i].creatorid; if (clr[i].ifname[0] != '\0' && - pfi_kif_find(clr[i].ifname) == NULL) + pfi_kkif_find(clr[i].ifname) == NULL) continue; for (int i = 0; i <= pf_hashmask; i++) { diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 8ace1c5fe281..6f4ccb99ad1f 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -118,7 +118,7 @@ __FBSDID("$FreeBSD$"); /* state tables */ VNET_DEFINE(struct pf_altqqueue, pf_altqs[4]); -VNET_DEFINE(struct pf_palist, pf_pabuf); +VNET_DEFINE(struct pf_kpalist, pf_pabuf); VNET_DEFINE(struct pf_altqqueue *, pf_altqs_active); VNET_DEFINE(struct pf_altqqueue *, pf_altq_ifs_active); VNET_DEFINE(struct pf_altqqueue *, pf_altqs_inactive); @@ -244,38 +244,38 @@ static void pf_state_key_detach(struct pf_state *, int); static int pf_state_key_ctor(void *, int, void *, int); static u_int32_t pf_tcp_iss(struct pf_pdesc *); static int pf_test_rule(struct pf_krule **, struct pf_state **, - int, struct pfi_kif *, struct mbuf *, int, + int, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **, struct inpcb *); static int pf_create_state(struct pf_krule *, struct pf_krule *, struct pf_krule *, struct pf_pdesc *, struct pf_ksrc_node *, struct pf_state_key *, struct pf_state_key *, struct mbuf *, int, - u_int16_t, u_int16_t, int *, struct pfi_kif *, + u_int16_t, u_int16_t, int *, struct pfi_kkif *, struct pf_state **, int, u_int16_t, u_int16_t, int); static int pf_test_fragment(struct pf_krule **, int, - struct pfi_kif *, struct mbuf *, void *, + struct pfi_kkif *, struct mbuf *, void *, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **); static int pf_tcp_track_full(struct pf_state_peer *, struct pf_state_peer *, struct pf_state **, - struct pfi_kif *, struct mbuf *, int, + struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, u_short *, int *); static int pf_tcp_track_sloppy(struct pf_state_peer *, struct pf_state_peer *, struct pf_state **, struct pf_pdesc *, u_short *); static int pf_test_state_tcp(struct pf_state **, int, - struct pfi_kif *, struct mbuf *, int, + struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *, u_short *); static int pf_test_state_udp(struct pf_state **, int, - struct pfi_kif *, struct mbuf *, int, + struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *); static int pf_test_state_icmp(struct pf_state **, int, - struct pfi_kif *, struct mbuf *, int, + struct pfi_kkif *, struct mbuf *, int, void *, struct pf_pdesc *, u_short *); static int pf_test_state_other(struct pf_state **, int, - struct pfi_kif *, struct mbuf *, struct pf_pdesc *); + struct pfi_kkif *, struct mbuf *, struct pf_pdesc *); static u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); static u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, @@ -290,7 +290,7 @@ static int pf_addr_wrap_neq(struct pf_addr_wrap *, struct pf_addr_wrap *); static void pf_patch_8(struct mbuf *, u_int16_t *, u_int8_t *, u_int8_t, bool, u_int8_t); -static struct pf_state *pf_find_state(struct pfi_kif *, +static struct pf_state *pf_find_state(struct pfi_kkif *, struct pf_state_key_cmp *, u_int); static int pf_src_connlimit(struct pf_state **); static void pf_overload_task(void *v, int pending); @@ -1255,7 +1255,7 @@ pf_state_key_clone(struct pf_state_key *orig) } int -pf_state_insert(struct pfi_kif *kif, struct pf_state_key *skw, +pf_state_insert(struct pfi_kkif *kif, struct pf_state_key *skw, struct pf_state_key *sks, struct pf_state *s) { struct pf_idhash *ih; @@ -1341,7 +1341,7 @@ pf_find_state_byid(uint64_t id, uint32_t creatorid) * Returns with ID hash slot locked on success. */ static struct pf_state * -pf_find_state(struct pfi_kif *kif, struct pf_state_key_cmp *key, u_int dir) +pf_find_state(struct pfi_kkif *kif, struct pf_state_key_cmp *key, u_int dir) { struct pf_keyhash *kh; struct pf_state_key *sk; @@ -1538,7 +1538,7 @@ pf_purge_thread(void *unused __unused) pf_purge_expired_fragments(); pf_purge_expired_src_nodes(); pf_purge_unlinked_rules(); - pfi_kif_purge(); + pfi_kkif_purge(); } CURVNET_RESTORE(); } @@ -1561,7 +1561,7 @@ pf_unload_vnet_purge(void) * raise them, and then second run frees. */ pf_purge_unlinked_rules(); - pfi_kif_purge(); + pfi_kkif_purge(); /* * Now purge everything. @@ -1575,7 +1575,7 @@ pf_unload_vnet_purge(void) * thus should be successfully freed. */ pf_purge_unlinked_rules(); - pfi_kif_purge(); + pfi_kkif_purge(); } u_int32_t @@ -2602,7 +2602,7 @@ pf_send_tcp(struct mbuf *replyto, const struct pf_krule *r, sa_family_t af, static void pf_return(struct pf_krule *r, struct pf_krule *nr, struct pf_pdesc *pd, struct pf_state_key *sk, int off, struct mbuf *m, struct tcphdr *th, - struct pfi_kif *kif, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen, + struct pfi_kkif *kif, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen, u_short *reason) { struct pf_addr * const saddr = pd->src; @@ -3325,7 +3325,7 @@ pf_tcp_iss(struct pf_pdesc *pd) static int pf_test_rule(struct pf_krule **rm, struct pf_state **sm, int direction, - struct pfi_kif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, + struct pfi_kkif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, struct pf_krule **am, struct pf_kruleset **rsm, struct inpcb *inp) { struct pf_krule *nr = NULL; @@ -3538,7 +3538,7 @@ pf_test_rule(struct pf_krule **rm, struct pf_state **sm, int direction, while (r != NULL) { counter_u64_add(r->evaluations, 1); - if (pfi_kif_match(r->kif, kif) == r->ifnot) + if (pfi_kkif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != direction) r = r->skip[PF_SKIP_DIR].ptr; @@ -3701,7 +3701,7 @@ static int pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, struct pf_pdesc *pd, struct pf_ksrc_node *nsn, struct pf_state_key *nk, struct pf_state_key *sk, struct mbuf *m, int off, u_int16_t sport, - u_int16_t dport, int *rewrite, struct pfi_kif *kif, struct pf_state **sm, + u_int16_t dport, int *rewrite, struct pfi_kkif *kif, struct pf_state **sm, int tag, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen) { struct pf_state *s = NULL; @@ -3960,7 +3960,7 @@ csfailed: } static int -pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kif *kif, +pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, struct mbuf *m, void *h, struct pf_pdesc *pd, struct pf_krule **am, struct pf_kruleset **rsm) { @@ -3978,7 +3978,7 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kif *kif, r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_FILTER].active.ptr); while (r != NULL) { counter_u64_add(r->evaluations, 1); - if (pfi_kif_match(r->kif, kif) == r->ifnot) + if (pfi_kkif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != direction) r = r->skip[PF_SKIP_DIR].ptr; @@ -4056,7 +4056,7 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kif *kif, static int pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_state **state, struct pfi_kif *kif, struct mbuf *m, int off, + struct pf_state **state, struct pfi_kkif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, u_short *reason, int *copyback) { struct tcphdr *th = pd->hdr.tcp; @@ -4453,7 +4453,7 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, } static int -pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif, +pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd, u_short *reason) { @@ -4621,7 +4621,7 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif, } static int -pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kif *kif, +pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd) { struct pf_state_peer *src, *dst; @@ -4688,7 +4688,7 @@ pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kif *kif, } static int -pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif, +pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kkif *kif, struct mbuf *m, int off, void *h, struct pf_pdesc *pd, u_short *reason) { struct pf_addr *saddr = pd->src, *daddr = pd->dst; @@ -5292,7 +5292,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif, } static int -pf_test_state_other(struct pf_state **state, int direction, struct pfi_kif *kif, +pf_test_state_other(struct pf_state **state, int direction, struct pfi_kkif *kif, struct mbuf *m, struct pf_pdesc *pd) { struct pf_state_peer *src, *dst; @@ -5424,7 +5424,7 @@ pf_pull_hdr(struct mbuf *m, int off, void *p, int len, } int -pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, +pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *kif, int rtableid) { struct ifnet *ifp; @@ -5888,7 +5888,7 @@ pf_check_proto_cksum(struct mbuf *m, int off, int len, u_int8_t p, sa_family_t a int pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) { - struct pfi_kif *kif; + struct pfi_kkif *kif; u_short action, reason = 0, log = 0; struct mbuf *m = *m0; struct ip *h = NULL; @@ -5908,7 +5908,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * memset(&pd, 0, sizeof(pd)); - kif = (struct pfi_kif *)ifp->if_pf_kif; + kif = (struct pfi_kkif *)ifp->if_pf_kif; if (kif == NULL) { DPFPRINTF(PF_DEBUG_URGENT, @@ -6280,7 +6280,7 @@ done: int pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb *inp) { - struct pfi_kif *kif; + struct pfi_kkif *kif; u_short action, reason = 0, log = 0; struct mbuf *m = *m0, *n = NULL; struct m_tag *mtag; @@ -6303,7 +6303,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb if (pd.pf_mtag && pd.pf_mtag->flags & PF_TAG_GENERATED) return (PF_PASS); - kif = (struct pfi_kif *)ifp->if_pf_kif; + kif = (struct pfi_kkif *)ifp->if_pf_kif; if (kif == NULL) { DPFPRINTF(PF_DEBUG_URGENT, ("pf_test6: kif == NULL, if_xname %s\n", ifp->if_xname)); diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 4e73d815aece..511c60f5abd1 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -189,6 +189,29 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, struct pf_rule; +/* keep synced with pfi_kif, used in RB_FIND */ +struct pfi_kif_cmp { + char pfik_name[IFNAMSIZ]; +}; + +struct pfi_kif { + char pfik_name[IFNAMSIZ]; + union { + RB_ENTRY(pfi_kif) _pfik_tree; + LIST_ENTRY(pfi_kif) _pfik_list; + } _pfik_glue; +#define pfik_tree _pfik_glue._pfik_tree +#define pfik_list _pfik_glue._pfik_list + u_int64_t pfik_packets[2][2][2]; + u_int64_t pfik_bytes[2][2][2]; + u_int32_t pfik_tzero; + u_int pfik_flags; + struct ifnet *pfik_ifp; + struct ifg_group *pfik_group; + u_int pfik_rulerefs; + TAILQ_HEAD(, pfi_dynaddr) pfik_dynaddrs; +}; + struct pf_status { uint64_t counters[PFRES_MAX]; uint64_t lcounters[LCNT_MAX]; diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index f8862a9416b5..aa10f0cc9a54 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include -VNET_DEFINE(struct pfi_kif *, pfi_all); +VNET_DEFINE(struct pfi_kkif *, pfi_all); VNET_DEFINE_STATIC(long, pfi_update); #define V_pfi_update VNET(pfi_update) #define PFI_BUFFER_MAX 0x10000 @@ -76,17 +76,17 @@ eventhandler_tag pfi_change_group_cookie; eventhandler_tag pfi_detach_group_cookie; eventhandler_tag pfi_ifaddr_event_cookie; -static void pfi_attach_ifnet(struct ifnet *, struct pfi_kif *); -static void pfi_attach_ifgroup(struct ifg_group *, struct pfi_kif *); +static void pfi_attach_ifnet(struct ifnet *, struct pfi_kkif *); +static void pfi_attach_ifgroup(struct ifg_group *, struct pfi_kkif *); -static void pfi_kif_update(struct pfi_kif *); +static void pfi_kkif_update(struct pfi_kkif *); static void pfi_dynaddr_update(struct pfi_dynaddr *dyn); -static void pfi_table_update(struct pfr_ktable *, struct pfi_kif *, int, +static void pfi_table_update(struct pfr_ktable *, struct pfi_kkif *, int, int); static void pfi_instance_add(struct ifnet *, int, int); static void pfi_address_add(struct sockaddr *, int, int); -static int pfi_if_compare(struct pfi_kif *, struct pfi_kif *); -static int pfi_skip_if(const char *, struct pfi_kif *); +static int pfi_kkif_compare(struct pfi_kkif *, struct pfi_kkif *); +static int pfi_skip_if(const char *, struct pfi_kkif *); static int pfi_unmask(void *); static void pfi_attach_ifnet_event(void * __unused, struct ifnet *); static void pfi_detach_ifnet_event(void * __unused, struct ifnet *); @@ -95,16 +95,16 @@ static void pfi_change_group_event(void * __unused, char *); static void pfi_detach_group_event(void * __unused, struct ifg_group *); static void pfi_ifaddr_event(void * __unused, struct ifnet *); -RB_HEAD(pfi_ifhead, pfi_kif); -static RB_PROTOTYPE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); -static RB_GENERATE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); +RB_HEAD(pfi_ifhead, pfi_kkif); +static RB_PROTOTYPE(pfi_ifhead, pfi_kkif, pfik_tree, pfi_kkif_compare); +static RB_GENERATE(pfi_ifhead, pfi_kkif, pfik_tree, pfi_kkif_compare); VNET_DEFINE_STATIC(struct pfi_ifhead, pfi_ifs); #define V_pfi_ifs VNET(pfi_ifs) #define PFI_BUFFER_MAX 0x10000 MALLOC_DEFINE(PFI_MTYPE, "pf_ifnet", "pf(4) interface database"); -LIST_HEAD(pfi_list, pfi_kif); +LIST_HEAD(pfi_list, pfi_kkif); VNET_DEFINE_STATIC(struct pfi_list, pfi_unlinked_kifs); #define V_pfi_unlinked_kifs VNET(pfi_unlinked_kifs) static struct mtx pfi_unlnkdkifs_mtx; @@ -116,7 +116,7 @@ pfi_initialize_vnet(void) { struct pfi_list kifs = LIST_HEAD_INITIALIZER(); struct epoch_tracker et; - struct pfi_kif *kif; + struct pfi_kkif *kif; struct ifg_group *ifg; struct ifnet *ifp; int nkifs; @@ -141,7 +141,7 @@ pfi_initialize_vnet(void) PF_RULES_WLOCK(); kif = LIST_FIRST(&kifs); LIST_REMOVE(kif, pfik_list); - V_pfi_all = pfi_kif_attach(kif, IFG_ALL); + V_pfi_all = pfi_kkif_attach(kif, IFG_ALL); CK_STAILQ_FOREACH(ifg, &V_ifg_head, ifg_next) { kif = LIST_FIRST(&kifs); LIST_REMOVE(kif, pfik_list); @@ -180,7 +180,7 @@ pfi_initialize(void) void pfi_cleanup_vnet(void) { - struct pfi_kif *kif; + struct pfi_kkif *kif; PF_RULES_WASSERT(); @@ -218,8 +218,8 @@ pfi_cleanup(void) EVENTHANDLER_DEREGISTER(ifaddr_event, pfi_ifaddr_event_cookie); } -struct pfi_kif * -pfi_kif_find(const char *kif_name) +struct pfi_kkif * +pfi_kkif_find(const char *kif_name) { struct pfi_kif_cmp s; @@ -228,18 +228,18 @@ pfi_kif_find(const char *kif_name) bzero(&s, sizeof(s)); strlcpy(s.pfik_name, kif_name, sizeof(s.pfik_name)); - return (RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kif *)&s)); + return (RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kkif *)&s)); } -struct pfi_kif * -pfi_kif_attach(struct pfi_kif *kif, const char *kif_name) +struct pfi_kkif * +pfi_kkif_attach(struct pfi_kkif *kif, const char *kif_name) { - struct pfi_kif *kif1; + struct pfi_kkif *kif1; PF_RULES_WASSERT(); KASSERT(kif != NULL, ("%s: null kif", __func__)); - kif1 = pfi_kif_find(kif_name); + kif1 = pfi_kkif_find(kif_name); if (kif1 != NULL) { free(kif, PFI_MTYPE); return (kif1); @@ -263,7 +263,7 @@ pfi_kif_attach(struct pfi_kif *kif, const char *kif_name) } void -pfi_kif_ref(struct pfi_kif *kif) +pfi_kkif_ref(struct pfi_kkif *kif) { PF_RULES_WASSERT(); @@ -271,7 +271,7 @@ pfi_kif_ref(struct pfi_kif *kif) } void -pfi_kif_unref(struct pfi_kif *kif) +pfi_kkif_unref(struct pfi_kkif *kif) { PF_RULES_WASSERT(); @@ -298,9 +298,9 @@ pfi_kif_unref(struct pfi_kif *kif) } void -pfi_kif_purge(void) +pfi_kkif_purge(void) { - struct pfi_kif *kif, *kif1; + struct pfi_kkif *kif, *kif1; /* * Do naive mark-and-sweep garbage collecting of old kifs. @@ -318,7 +318,7 @@ pfi_kif_purge(void) } int -pfi_kif_match(struct pfi_kif *rule_kif, struct pfi_kif *packet_kif) +pfi_kkif_match(struct pfi_kkif *rule_kif, struct pfi_kkif *packet_kif) { struct ifg_list *p; @@ -337,27 +337,27 @@ pfi_kif_match(struct pfi_kif *rule_kif, struct pfi_kif *packet_kif) } static void -pfi_attach_ifnet(struct ifnet *ifp, struct pfi_kif *kif) +pfi_attach_ifnet(struct ifnet *ifp, struct pfi_kkif *kif) { PF_RULES_WASSERT(); V_pfi_update++; - kif = pfi_kif_attach(kif, ifp->if_xname); + kif = pfi_kkif_attach(kif, ifp->if_xname); if_ref(ifp); kif->pfik_ifp = ifp; ifp->if_pf_kif = kif; - pfi_kif_update(kif); + pfi_kkif_update(kif); } static void -pfi_attach_ifgroup(struct ifg_group *ifg, struct pfi_kif *kif) +pfi_attach_ifgroup(struct ifg_group *ifg, struct pfi_kkif *kif) { PF_RULES_WASSERT(); V_pfi_update++; - kif = pfi_kif_attach(kif, ifg->ifg_group); + kif = pfi_kkif_attach(kif, ifg->ifg_group); kif->pfik_group = ifg; ifg->ifg_pf_kif = kif; } @@ -404,7 +404,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) struct pfi_dynaddr *dyn; char tblname[PF_TABLE_NAME_SIZE]; struct pf_kruleset *ruleset = NULL; - struct pfi_kif *kif; + struct pfi_kkif *kif; int rv = 0; PF_RULES_WASSERT(); @@ -421,10 +421,10 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) } if (!strcmp(aw->v.ifname, "self")) - dyn->pfid_kif = pfi_kif_attach(kif, IFG_ALL); + dyn->pfid_kif = pfi_kkif_attach(kif, IFG_ALL); else - dyn->pfid_kif = pfi_kif_attach(kif, aw->v.ifname); - pfi_kif_ref(dyn->pfid_kif); + dyn->pfid_kif = pfi_kkif_attach(kif, aw->v.ifname); + pfi_kkif_ref(dyn->pfid_kif); dyn->pfid_net = pfi_unmask(&aw->v.a.mask); if (af == AF_INET && dyn->pfid_net == 32) @@ -458,7 +458,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) TAILQ_INSERT_TAIL(&dyn->pfid_kif->pfik_dynaddrs, dyn, entry); aw->p.dyn = dyn; NET_EPOCH_ENTER(et); - pfi_kif_update(dyn->pfid_kif); + pfi_kkif_update(dyn->pfid_kif); NET_EPOCH_EXIT(et); return (0); @@ -469,19 +469,19 @@ _bad: if (ruleset != NULL) pf_remove_if_empty_kruleset(ruleset); if (dyn->pfid_kif != NULL) - pfi_kif_unref(dyn->pfid_kif); + pfi_kkif_unref(dyn->pfid_kif); free(dyn, PFI_MTYPE); return (rv); } static void -pfi_kif_update(struct pfi_kif *kif) +pfi_kkif_update(struct pfi_kkif *kif) { struct ifg_list *ifgl; struct ifg_member *ifgm; struct pfi_dynaddr *p; - struct pfi_kif *tmpkif; + struct pfi_kkif *tmpkif; NET_EPOCH_ASSERT(); PF_RULES_WASSERT(); @@ -494,7 +494,7 @@ pfi_kif_update(struct pfi_kif *kif) if (kif->pfik_group != NULL) { CK_STAILQ_FOREACH(ifgm, &kif->pfik_group->ifg_members, ifgm_next) { - tmpkif = (struct pfi_kif *)ifgm->ifgm_ifp->if_pf_kif; + tmpkif = (struct pfi_kkif *)ifgm->ifgm_ifp->if_pf_kif; if (tmpkif == NULL) continue; @@ -505,7 +505,7 @@ pfi_kif_update(struct pfi_kif *kif) /* again for all groups kif is member of */ if (kif->pfik_ifp != NULL) { CK_STAILQ_FOREACH(ifgl, &kif->pfik_ifp->if_groups, ifgl_next) - pfi_kif_update((struct pfi_kif *) + pfi_kkif_update((struct pfi_kkif *) ifgl->ifgl_group->ifg_pf_kif); } } @@ -513,7 +513,7 @@ pfi_kif_update(struct pfi_kif *kif) static void pfi_dynaddr_update(struct pfi_dynaddr *dyn) { - struct pfi_kif *kif; + struct pfi_kkif *kif; struct pfr_ktable *kt; PF_RULES_WASSERT(); @@ -532,7 +532,7 @@ pfi_dynaddr_update(struct pfi_dynaddr *dyn) } static void -pfi_table_update(struct pfr_ktable *kt, struct pfi_kif *kif, int net, int flags) +pfi_table_update(struct pfr_ktable *kt, struct pfi_kkif *kif, int net, int flags) { int e, size2 = 0; struct ifg_member *ifgm; @@ -677,7 +677,7 @@ pfi_dynaddr_remove(struct pfi_dynaddr *dyn) KASSERT(dyn->pfid_kt != NULL, ("%s: null pfid_kt", __func__)); TAILQ_REMOVE(&dyn->pfid_kif->pfik_dynaddrs, dyn, entry); - pfi_kif_unref(dyn->pfid_kif); + pfi_kkif_unref(dyn->pfid_kif); pfr_detach_table(dyn->pfid_kt); free(dyn, PFI_MTYPE); } @@ -695,7 +695,7 @@ pfi_dynaddr_copyout(struct pf_addr_wrap *aw) } static int -pfi_if_compare(struct pfi_kif *p, struct pfi_kif *q) +pfi_kkif_compare(struct pfi_kkif *p, struct pfi_kkif *q) { return (strncmp(p->pfik_name, q->pfik_name, IFNAMSIZ)); } @@ -703,14 +703,14 @@ pfi_if_compare(struct pfi_kif *p, struct pfi_kif *q) void pfi_update_status(const char *name, struct pf_status *pfs) { - struct pfi_kif *p; + struct pfi_kkif *p; struct pfi_kif_cmp key; struct ifg_member p_member, *ifgm; CK_STAILQ_HEAD(, ifg_member) ifg_members; int i, j, k; strlcpy(key.pfik_name, name, sizeof(key.pfik_name)); - p = RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kif *)&key); + p = RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kkif *)&key); if (p == NULL) return; @@ -731,7 +731,7 @@ pfi_update_status(const char *name, struct pf_status *pfs) CK_STAILQ_FOREACH(ifgm, &ifg_members, ifgm_next) { if (ifgm->ifgm_ifp == NULL || ifgm->ifgm_ifp->if_pf_kif == NULL) continue; - p = (struct pfi_kif *)ifgm->ifgm_ifp->if_pf_kif; + p = (struct pfi_kkif *)ifgm->ifgm_ifp->if_pf_kif; /* just clear statistics */ if (pfs == NULL) { @@ -751,11 +751,31 @@ pfi_update_status(const char *name, struct pf_status *pfs) } } +static void +pf_kkif_to_kif(const struct pfi_kkif *kkif, struct pfi_kif *kif) +{ + + bzero(kif, sizeof(*kif)); + strlcpy(kif->pfik_name, kkif->pfik_name, sizeof(kif->pfik_name)); + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 2; k++) { + kif->pfik_packets[i][j][k] = + kkif->pfik_packets[i][j][k]; + kif->pfik_bytes[i][j][k] = + kkif->pfik_bytes[i][j][k]; + } + } + } + kif->pfik_tzero = kkif->pfik_tzero; + kif->pfik_rulerefs = kkif->pfik_rulerefs; +} + void pfi_get_ifaces(const char *name, struct pfi_kif *buf, int *size) { struct epoch_tracker et; - struct pfi_kif *p, *nextp; + struct pfi_kkif *p, *nextp; int n = 0; NET_EPOCH_ENTER(et); @@ -767,7 +787,7 @@ pfi_get_ifaces(const char *name, struct pfi_kif *buf, int *size) break; if (!p->pfik_tzero) p->pfik_tzero = time_second; - bcopy(p, buf++, sizeof(*buf)); + pf_kkif_to_kif(p, buf++); nextp = RB_NEXT(pfi_ifhead, &V_pfi_ifs, p); } *size = n; @@ -775,7 +795,7 @@ pfi_get_ifaces(const char *name, struct pfi_kif *buf, int *size) } static int -pfi_skip_if(const char *filter, struct pfi_kif *p) +pfi_skip_if(const char *filter, struct pfi_kkif *p) { struct ifg_list *i; int n; @@ -803,7 +823,7 @@ int pfi_set_flags(const char *name, int flags) { struct epoch_tracker et; - struct pfi_kif *p, *kif; + struct pfi_kkif *p, *kif; kif = malloc(sizeof(*kif), PFI_MTYPE, M_NOWAIT); if (kif == NULL) @@ -811,7 +831,7 @@ pfi_set_flags(const char *name, int flags) NET_EPOCH_ENTER(et); - kif = pfi_kif_attach(kif, name); + kif = pfi_kkif_attach(kif, name); RB_FOREACH(p, pfi_ifhead, &V_pfi_ifs) { if (pfi_skip_if(name, p)) @@ -826,7 +846,7 @@ int pfi_clear_flags(const char *name, int flags) { struct epoch_tracker et; - struct pfi_kif *p, *tmp; + struct pfi_kkif *p, *tmp; NET_EPOCH_ENTER(et); RB_FOREACH_SAFE(p, pfi_ifhead, &V_pfi_ifs, tmp) { @@ -869,7 +889,7 @@ static void pfi_attach_ifnet_event(void *arg __unused, struct ifnet *ifp) { struct epoch_tracker et; - struct pfi_kif *kif; + struct pfi_kkif *kif; if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ @@ -890,7 +910,7 @@ static void pfi_detach_ifnet_event(void *arg __unused, struct ifnet *ifp) { struct epoch_tracker et; - struct pfi_kif *kif = (struct pfi_kif *)ifp->if_pf_kif; + struct pfi_kkif *kif = (struct pfi_kkif *)ifp->if_pf_kif; *** 496 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Jan 5 22:37:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CB9A64CEEFF; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@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 4D9S7Q4pwZz3hbx; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9829414271; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105MbsL9081441; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105MbsPa081440; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git) Date: Tue, 5 Jan 2021 22:37:54 GMT Message-Id: <202101052237.105MbsPa081440@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fda7daf06301beef1bdad39891232a12c6925b22 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 22:37:54 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fda7daf06301beef1bdad39891232a12c6925b22 commit fda7daf06301beef1bdad39891232a12c6925b22 Author: Kristof Provost AuthorDate: 2020-12-24 15:02:04 +0000 Commit: Kristof Provost CommitDate: 2021-01-05 22:35:37 +0000 pfctl: Stop sharing pf_ruleset.c with the kernel Now that we've split up the datastructures used by the kernel and userspace there's essentually no more overlap between the pf_ruleset.c code used by userspace and kernelspace. Copy the userspace bits to the pfctl directory and stop using the kernel file. Reviewed by: philip MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27764 --- sbin/pfctl/Makefile | 3 - sbin/pfctl/pf_ruleset.c | 343 ++++++++++++++++++++++++++++++++++++++++++++ sys/netpfil/pf/pf_ruleset.c | 286 +----------------------------------- 3 files changed, 349 insertions(+), 283 deletions(-) diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile index 8ca3b5d86285..14dc83eb97b0 100644 --- a/sbin/pfctl/Makefile +++ b/sbin/pfctl/Makefile @@ -2,9 +2,6 @@ .include -# pf_ruleset.c is shared between kernel and pfctl -.PATH: ${SRCTOP}/sys/netpfil/pf - PACKAGE=pf CONFS= pf.os PROG= pfctl diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c new file mode 100644 index 000000000000..7c337d7a2da7 --- /dev/null +++ b/sbin/pfctl/pf_ruleset.c @@ -0,0 +1,343 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2001 Daniel Hartmeier + * Copyright (c) 2002,2003 Henning Brauer + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - 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 COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDERS 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. + * + * Effort sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F30602-01-2-0537. + * + * $OpenBSD: pf_ruleset.c,v 1.2 2008/12/18 15:31:37 dhill Exp $ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#ifdef INET6 +#include +#endif /* INET6 */ + +#include +#include +#include +#include +#include +#define rs_malloc(x) calloc(1, x) +#define rs_free(x) free(x) + +#ifdef PFDEBUG +#include +#define DPFPRINTF(format, x...) fprintf(stderr, format , ##x) +#else +#define DPFPRINTF(format, x...) ((void)0) +#endif /* PFDEBUG */ + +struct pf_anchor_global pf_anchors; +struct pf_anchor pf_main_anchor; +#undef V_pf_anchors +#define V_pf_anchors pf_anchors +#undef pf_main_ruleset +#define pf_main_ruleset pf_main_anchor.ruleset + +static __inline int pf_anchor_compare(struct pf_anchor *, + struct pf_anchor *); +static struct pf_anchor *pf_find_anchor(const char *); + +RB_GENERATE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); +RB_GENERATE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); + +static __inline int +pf_anchor_compare(struct pf_anchor *a, struct pf_anchor *b) +{ + int c = strcmp(a->path, b->path); + + return (c ? (c < 0 ? -1 : 1) : 0); +} + +int +pf_get_ruleset_number(u_int8_t action) +{ + switch (action) { + case PF_SCRUB: + case PF_NOSCRUB: + return (PF_RULESET_SCRUB); + break; + case PF_PASS: + case PF_DROP: + return (PF_RULESET_FILTER); + break; + case PF_NAT: + case PF_NONAT: + return (PF_RULESET_NAT); + break; + case PF_BINAT: + case PF_NOBINAT: + return (PF_RULESET_BINAT); + break; + case PF_RDR: + case PF_NORDR: + return (PF_RULESET_RDR); + break; + default: + return (PF_RULESET_MAX); + break; + } +} + +void +pf_init_ruleset(struct pf_ruleset *ruleset) +{ + int i; + + memset(ruleset, 0, sizeof(struct pf_ruleset)); + for (i = 0; i < PF_RULESET_MAX; i++) { + TAILQ_INIT(&ruleset->rules[i].queues[0]); + TAILQ_INIT(&ruleset->rules[i].queues[1]); + ruleset->rules[i].active.ptr = &ruleset->rules[i].queues[0]; + ruleset->rules[i].inactive.ptr = &ruleset->rules[i].queues[1]; + } +} + +static struct pf_anchor * +pf_find_anchor(const char *path) +{ + struct pf_anchor *key, *found; + + key = (struct pf_anchor *)rs_malloc(sizeof(*key)); + if (key == NULL) + return (NULL); + strlcpy(key->path, path, sizeof(key->path)); + found = RB_FIND(pf_anchor_global, &V_pf_anchors, key); + rs_free(key); + return (found); +} + +struct pf_ruleset * +pf_find_ruleset(const char *path) +{ + struct pf_anchor *anchor; + + while (*path == '/') + path++; + if (!*path) + return (&pf_main_ruleset); + anchor = pf_find_anchor(path); + if (anchor == NULL) + return (NULL); + else + return (&anchor->ruleset); +} + +struct pf_ruleset * +pf_find_or_create_ruleset(const char *path) +{ + char *p, *q, *r; + struct pf_ruleset *ruleset; + struct pf_anchor *anchor = NULL, *dup, *parent = NULL; + + if (path[0] == 0) + return (&pf_main_ruleset); + while (*path == '/') + path++; + ruleset = pf_find_ruleset(path); + if (ruleset != NULL) + return (ruleset); + p = (char *)rs_malloc(MAXPATHLEN); + if (p == NULL) + return (NULL); + strlcpy(p, path, MAXPATHLEN); + while (parent == NULL && (q = strrchr(p, '/')) != NULL) { + *q = 0; + if ((ruleset = pf_find_ruleset(p)) != NULL) { + parent = ruleset->anchor; + break; + } + } + if (q == NULL) + q = p; + else + q++; + strlcpy(p, path, MAXPATHLEN); + if (!*q) { + rs_free(p); + return (NULL); + } + while ((r = strchr(q, '/')) != NULL || *q) { + if (r != NULL) + *r = 0; + if (!*q || strlen(q) >= PF_ANCHOR_NAME_SIZE || + (parent != NULL && strlen(parent->path) >= + MAXPATHLEN - PF_ANCHOR_NAME_SIZE - 1)) { + rs_free(p); + return (NULL); + } + anchor = (struct pf_anchor *)rs_malloc(sizeof(*anchor)); + if (anchor == NULL) { + rs_free(p); + return (NULL); + } + RB_INIT(&anchor->children); + strlcpy(anchor->name, q, sizeof(anchor->name)); + if (parent != NULL) { + strlcpy(anchor->path, parent->path, + sizeof(anchor->path)); + strlcat(anchor->path, "/", sizeof(anchor->path)); + } + strlcat(anchor->path, anchor->name, sizeof(anchor->path)); + if ((dup = RB_INSERT(pf_anchor_global, &V_pf_anchors, anchor)) != + NULL) { + printf("pf_find_or_create_ruleset: RB_INSERT1 " + "'%s' '%s' collides with '%s' '%s'\n", + anchor->path, anchor->name, dup->path, dup->name); + rs_free(anchor); + rs_free(p); + return (NULL); + } + if (parent != NULL) { + anchor->parent = parent; + if ((dup = RB_INSERT(pf_anchor_node, &parent->children, + anchor)) != NULL) { + printf("pf_find_or_create_ruleset: " + "RB_INSERT2 '%s' '%s' collides with " + "'%s' '%s'\n", anchor->path, anchor->name, + dup->path, dup->name); + RB_REMOVE(pf_anchor_global, &V_pf_anchors, + anchor); + rs_free(anchor); + rs_free(p); + return (NULL); + } + } + pf_init_ruleset(&anchor->ruleset); + anchor->ruleset.anchor = anchor; + parent = anchor; + if (r != NULL) + q = r + 1; + else + *q = 0; + } + rs_free(p); + return (&anchor->ruleset); +} + +void +pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) +{ + struct pf_anchor *parent; + int i; + + while (ruleset != NULL) { + if (ruleset == &pf_main_ruleset || ruleset->anchor == NULL || + !RB_EMPTY(&ruleset->anchor->children) || + ruleset->anchor->refcnt > 0 || ruleset->tables > 0 || + ruleset->topen) + return; + for (i = 0; i < PF_RULESET_MAX; ++i) + if (!TAILQ_EMPTY(ruleset->rules[i].active.ptr) || + !TAILQ_EMPTY(ruleset->rules[i].inactive.ptr) || + ruleset->rules[i].inactive.open) + return; + RB_REMOVE(pf_anchor_global, &V_pf_anchors, ruleset->anchor); + if ((parent = ruleset->anchor->parent) != NULL) + RB_REMOVE(pf_anchor_node, &parent->children, + ruleset->anchor); + rs_free(ruleset->anchor); + if (parent == NULL) + return; + ruleset = &parent->ruleset; + } +} +int +pf_anchor_setup(struct pf_rule *r, const struct pf_ruleset *s, + const char *name) +{ + char *p, *path; + struct pf_ruleset *ruleset; + + r->anchor = NULL; + r->anchor_relative = 0; + r->anchor_wildcard = 0; + if (!name[0]) + return (0); + path = (char *)rs_malloc(MAXPATHLEN); + if (path == NULL) + return (1); + if (name[0] == '/') + strlcpy(path, name + 1, MAXPATHLEN); + else { + /* relative path */ + r->anchor_relative = 1; + if (s->anchor == NULL || !s->anchor->path[0]) + path[0] = 0; + else + strlcpy(path, s->anchor->path, MAXPATHLEN); + while (name[0] == '.' && name[1] == '.' && name[2] == '/') { + if (!path[0]) { + printf("pf_anchor_setup: .. beyond root\n"); + rs_free(path); + return (1); + } + if ((p = strrchr(path, '/')) != NULL) + *p = 0; + else + path[0] = 0; + r->anchor_relative++; + name += 3; + } + if (path[0]) + strlcat(path, "/", MAXPATHLEN); + strlcat(path, name, MAXPATHLEN); + } + if ((p = strrchr(path, '/')) != NULL && !strcmp(p, "/*")) { + r->anchor_wildcard = 1; + *p = 0; + } + ruleset = pf_find_or_create_ruleset(path); + rs_free(path); + if (ruleset == NULL || ruleset->anchor == NULL) { + printf("pf_anchor_setup: ruleset\n"); + return (1); + } + r->anchor = ruleset->anchor; + r->anchor->refcnt++; + return (0); +} diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index b2604795811a..31a4ed879937 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -41,10 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef _KERNEL -# include -# include -#endif /* _KERNEL */ +#include +#include #include #include @@ -60,71 +58,26 @@ __FBSDID("$FreeBSD$"); #include #endif /* INET6 */ -#ifdef _KERNEL +#ifndef _KERNEL +#error "Kernel only file. Please use sbin/pfctl/pf_ruleset.c instead." +#endif + #define DPFPRINTF(format, x...) \ if (V_pf_status.debug >= PF_DEBUG_NOISY) \ printf(format , ##x) #define rs_malloc(x) malloc(x, M_TEMP, M_NOWAIT|M_ZERO) #define rs_free(x) free(x, M_TEMP) -#else -/* Userland equivalents so we can lend code to pfctl et al. */ - -#include -#include -#include -#include -#include -#define rs_malloc(x) calloc(1, x) -#define rs_free(x) free(x) - -#ifdef PFDEBUG -#include -#define DPFPRINTF(format, x...) fprintf(stderr, format , ##x) -#else -#define DPFPRINTF(format, x...) ((void)0) -#endif /* PFDEBUG */ -#endif /* _KERNEL */ - -#ifdef _KERNEL VNET_DEFINE(struct pf_kanchor_global, pf_anchors); VNET_DEFINE(struct pf_kanchor, pf_main_anchor); -#else /* ! _KERNEL */ -struct pf_anchor_global pf_anchors; -struct pf_anchor pf_main_anchor; -#undef V_pf_anchors -#define V_pf_anchors pf_anchors -#undef pf_main_ruleset -#define pf_main_ruleset pf_main_anchor.ruleset -#endif /* _KERNEL */ - -#ifdef _KERNEL static __inline int pf_kanchor_compare(struct pf_kanchor *, struct pf_kanchor *); static struct pf_kanchor *pf_find_kanchor(const char *); RB_GENERATE(pf_kanchor_global, pf_kanchor, entry_global, pf_kanchor_compare); RB_GENERATE(pf_kanchor_node, pf_kanchor, entry_node, pf_kanchor_compare); -#else -static __inline int pf_anchor_compare(struct pf_anchor *, - struct pf_anchor *); -static struct pf_anchor *pf_find_anchor(const char *); -RB_GENERATE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); -RB_GENERATE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); -#endif - - -#ifndef _KERNEL -static __inline int -pf_anchor_compare(struct pf_anchor *a, struct pf_anchor *b) -{ - int c = strcmp(a->path, b->path); - - return (c ? (c < 0 ? -1 : 1) : 0); -} -#else static __inline int pf_kanchor_compare(struct pf_kanchor *a, struct pf_kanchor *b) { @@ -132,7 +85,6 @@ pf_kanchor_compare(struct pf_kanchor *a, struct pf_kanchor *b) return (c ? (c < 0 ? -1 : 1) : 0); } -#endif int pf_get_ruleset_number(u_int8_t action) @@ -164,35 +116,6 @@ pf_get_ruleset_number(u_int8_t action) } } -#ifndef _KERNEL -void -pf_init_ruleset(struct pf_ruleset *ruleset) -{ - int i; - - memset(ruleset, 0, sizeof(struct pf_ruleset)); - for (i = 0; i < PF_RULESET_MAX; i++) { - TAILQ_INIT(&ruleset->rules[i].queues[0]); - TAILQ_INIT(&ruleset->rules[i].queues[1]); - ruleset->rules[i].active.ptr = &ruleset->rules[i].queues[0]; - ruleset->rules[i].inactive.ptr = &ruleset->rules[i].queues[1]; - } -} - -static struct pf_anchor * -pf_find_anchor(const char *path) -{ - struct pf_anchor *key, *found; - - key = (struct pf_anchor *)rs_malloc(sizeof(*key)); - if (key == NULL) - return (NULL); - strlcpy(key->path, path, sizeof(key->path)); - found = RB_FIND(pf_anchor_global, &V_pf_anchors, key); - rs_free(key); - return (found); -} -#else static struct pf_kanchor * pf_find_kanchor(const char *path) { @@ -220,10 +143,7 @@ pf_init_kruleset(struct pf_kruleset *ruleset) ruleset->rules[i].inactive.ptr = &ruleset->rules[i].queues[1]; } } -#endif - -#ifdef _KERNEL struct pf_kruleset * pf_find_kruleset(const char *path) { @@ -476,197 +396,3 @@ pf_kanchor_remove(struct pf_krule *r) pf_remove_if_empty_kruleset(&r->anchor->ruleset); r->anchor = NULL; } - -#else - -struct pf_ruleset * -pf_find_ruleset(const char *path) -{ - struct pf_anchor *anchor; - - while (*path == '/') - path++; - if (!*path) - return (&pf_main_ruleset); - anchor = pf_find_anchor(path); - if (anchor == NULL) - return (NULL); - else - return (&anchor->ruleset); -} - -struct pf_ruleset * -pf_find_or_create_ruleset(const char *path) -{ - char *p, *q, *r; - struct pf_ruleset *ruleset; - struct pf_anchor *anchor = NULL, *dup, *parent = NULL; - - if (path[0] == 0) - return (&pf_main_ruleset); - while (*path == '/') - path++; - ruleset = pf_find_ruleset(path); - if (ruleset != NULL) - return (ruleset); - p = (char *)rs_malloc(MAXPATHLEN); - if (p == NULL) - return (NULL); - strlcpy(p, path, MAXPATHLEN); - while (parent == NULL && (q = strrchr(p, '/')) != NULL) { - *q = 0; - if ((ruleset = pf_find_ruleset(p)) != NULL) { - parent = ruleset->anchor; - break; - } - } - if (q == NULL) - q = p; - else - q++; - strlcpy(p, path, MAXPATHLEN); - if (!*q) { - rs_free(p); - return (NULL); - } - while ((r = strchr(q, '/')) != NULL || *q) { - if (r != NULL) - *r = 0; - if (!*q || strlen(q) >= PF_ANCHOR_NAME_SIZE || - (parent != NULL && strlen(parent->path) >= - MAXPATHLEN - PF_ANCHOR_NAME_SIZE - 1)) { - rs_free(p); - return (NULL); - } - anchor = (struct pf_anchor *)rs_malloc(sizeof(*anchor)); - if (anchor == NULL) { - rs_free(p); - return (NULL); - } - RB_INIT(&anchor->children); - strlcpy(anchor->name, q, sizeof(anchor->name)); - if (parent != NULL) { - strlcpy(anchor->path, parent->path, - sizeof(anchor->path)); - strlcat(anchor->path, "/", sizeof(anchor->path)); - } - strlcat(anchor->path, anchor->name, sizeof(anchor->path)); - if ((dup = RB_INSERT(pf_anchor_global, &V_pf_anchors, anchor)) != - NULL) { - printf("pf_find_or_create_ruleset: RB_INSERT1 " - "'%s' '%s' collides with '%s' '%s'\n", - anchor->path, anchor->name, dup->path, dup->name); - rs_free(anchor); - rs_free(p); - return (NULL); - } - if (parent != NULL) { - anchor->parent = parent; - if ((dup = RB_INSERT(pf_anchor_node, &parent->children, - anchor)) != NULL) { - printf("pf_find_or_create_ruleset: " - "RB_INSERT2 '%s' '%s' collides with " - "'%s' '%s'\n", anchor->path, anchor->name, - dup->path, dup->name); - RB_REMOVE(pf_anchor_global, &V_pf_anchors, - anchor); - rs_free(anchor); - rs_free(p); - return (NULL); - } - } - pf_init_ruleset(&anchor->ruleset); - anchor->ruleset.anchor = anchor; - parent = anchor; - if (r != NULL) - q = r + 1; - else - *q = 0; - } - rs_free(p); - return (&anchor->ruleset); -} - -void -pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) -{ - struct pf_anchor *parent; - int i; - - while (ruleset != NULL) { - if (ruleset == &pf_main_ruleset || ruleset->anchor == NULL || - !RB_EMPTY(&ruleset->anchor->children) || - ruleset->anchor->refcnt > 0 || ruleset->tables > 0 || - ruleset->topen) - return; - for (i = 0; i < PF_RULESET_MAX; ++i) - if (!TAILQ_EMPTY(ruleset->rules[i].active.ptr) || - !TAILQ_EMPTY(ruleset->rules[i].inactive.ptr) || - ruleset->rules[i].inactive.open) - return; - RB_REMOVE(pf_anchor_global, &V_pf_anchors, ruleset->anchor); - if ((parent = ruleset->anchor->parent) != NULL) - RB_REMOVE(pf_anchor_node, &parent->children, - ruleset->anchor); - rs_free(ruleset->anchor); - if (parent == NULL) - return; - ruleset = &parent->ruleset; - } -} -int -pf_anchor_setup(struct pf_rule *r, const struct pf_ruleset *s, - const char *name) -{ - char *p, *path; - struct pf_ruleset *ruleset; - - r->anchor = NULL; - r->anchor_relative = 0; - r->anchor_wildcard = 0; - if (!name[0]) - return (0); - path = (char *)rs_malloc(MAXPATHLEN); - if (path == NULL) - return (1); - if (name[0] == '/') - strlcpy(path, name + 1, MAXPATHLEN); - else { - /* relative path */ - r->anchor_relative = 1; - if (s->anchor == NULL || !s->anchor->path[0]) - path[0] = 0; - else - strlcpy(path, s->anchor->path, MAXPATHLEN); - while (name[0] == '.' && name[1] == '.' && name[2] == '/') { - if (!path[0]) { - printf("pf_anchor_setup: .. beyond root\n"); - rs_free(path); - return (1); - } - if ((p = strrchr(path, '/')) != NULL) - *p = 0; - else - path[0] = 0; - r->anchor_relative++; - name += 3; - } - if (path[0]) - strlcat(path, "/", MAXPATHLEN); - strlcat(path, name, MAXPATHLEN); - } - if ((p = strrchr(path, '/')) != NULL && !strcmp(p, "/*")) { - r->anchor_wildcard = 1; - *p = 0; - } - ruleset = pf_find_or_create_ruleset(path); - rs_free(path); - if (ruleset == NULL || ruleset->anchor == NULL) { - printf("pf_anchor_setup: ruleset\n"); - return (1); - } - r->anchor = ruleset->anchor; - r->anchor->refcnt++; - return (0); -} -#endif From owner-dev-commits-src-all@freebsd.org Tue Jan 5 22:37:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CC0914CF44C; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@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 4D9S7Q5Kw0z3hJ9; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA38813C72; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105Mbs5k081458; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105MbsPb081457; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git) Date: Tue, 5 Jan 2021 22:37:54 GMT Message-Id: <202101052237.105MbsPb081457@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 5a3b9507d784 - main - pf: Convert pfi_kkif to use counter_u64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a3b9507d784aaa6a7ce35432b2111a7eec12cba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 22:37:54 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5a3b9507d784aaa6a7ce35432b2111a7eec12cba commit 5a3b9507d784aaa6a7ce35432b2111a7eec12cba Author: Kristof Provost AuthorDate: 2020-12-13 16:20:02 +0000 Commit: Kristof Provost CommitDate: 2021-01-05 22:35:37 +0000 pf: Convert pfi_kkif to use counter_u64 Improve caching behaviour by using counter_u64 rather than variables shared between cores. The result of converting all counters to counter(9) (i.e. this full patch series) is a significant improvement in throughput. As tested by olivier@, on Intel Xeon E5-2697Av4 (16Cores, 32 threads) hardware with Mellanox ConnectX-4 MCX416A-CCAT (100GBase-SR4) nics we see: x FreeBSD 20201223: inet packets-per-second + FreeBSD 20201223 with pf patches: inet packets-per-second +--------------------------------------------------------------------------+ | + | | xx + | |xxx +++| ||A| | | |A|| +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 5 9216962 9526356 9343902 9371057.6 116720.36 + 5 19427190 19698400 19502922 19546509 109084.92 Difference at 95.0% confidence 1.01755e+07 +/- 164756 108.584% +/- 2.9359% (Student's t, pooled s = 112967) Reviewed by: philip MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27763 --- sys/net/pfvar.h | 5 +++-- sys/netpfil/pf/pf.c | 12 ++++++---- sys/netpfil/pf/pf_if.c | 61 ++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 63 insertions(+), 15 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 65328941ff01..c7df8ffd82c5 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -879,8 +879,8 @@ struct pfi_kkif { } _pfik_glue; #define pfik_tree _pfik_glue._pfik_tree #define pfik_list _pfik_glue._pfik_list - u_int64_t pfik_packets[2][2][2]; - u_int64_t pfik_bytes[2][2][2]; + counter_u64_t pfik_packets[2][2][2]; + counter_u64_t pfik_bytes[2][2][2]; u_int32_t pfik_tzero; u_int pfik_flags; struct ifnet *pfik_ifp; @@ -1678,6 +1678,7 @@ struct pf_state_key *pf_state_key_clone(struct pf_state_key *); struct pfi_kkif *pf_kkif_create(int); void pf_kkif_free(struct pfi_kkif *); +void pf_kkif_zero(struct pfi_kkif *); #endif /* _KERNEL */ #endif /* _NET_PFVAR_H_ */ diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 6f4ccb99ad1f..4cccb0101650 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6196,8 +6196,10 @@ done: (s == NULL)); } - kif->pfik_bytes[0][dir == PF_OUT][action != PF_PASS] += pd.tot_len; - kif->pfik_packets[0][dir == PF_OUT][action != PF_PASS]++; + counter_u64_add(kif->pfik_bytes[0][dir == PF_OUT][action != PF_PASS], + pd.tot_len); + counter_u64_add(kif->pfik_packets[0][dir == PF_OUT][action != PF_PASS], + 1); if (action == PF_PASS || r->action == PF_DROP) { dirndx = (dir == PF_OUT); @@ -6598,8 +6600,10 @@ done: &pd, (s == NULL)); } - kif->pfik_bytes[1][dir == PF_OUT][action != PF_PASS] += pd.tot_len; - kif->pfik_packets[1][dir == PF_OUT][action != PF_PASS]++; + counter_u64_add(kif->pfik_bytes[1][dir == PF_OUT][action != PF_PASS], + pd.tot_len); + counter_u64_add(kif->pfik_packets[1][dir == PF_OUT][action != PF_PASS], + 1); if (action == PF_PASS || r->action == PF_DROP) { dirndx = (dir == PF_OUT); diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 5c389d7a45c5..850a6dc1ca05 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -223,7 +223,26 @@ pf_kkif_create(int flags) { struct pfi_kkif *kif; - kif = malloc(sizeof(*kif), PFI_MTYPE, flags); + kif = malloc(sizeof(*kif), PFI_MTYPE, flags | M_ZERO); + if (! kif) + return (kif); + + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 2; k++) { + kif->pfik_packets[i][j][k] = + counter_u64_alloc(flags); + kif->pfik_bytes[i][j][k] = + counter_u64_alloc(flags); + + if (! kif->pfik_packets[i][j][k] || + ! kif->pfik_bytes[i][j][k]) { + pf_kkif_free(kif); + return (NULL); + } + } + } + } return (kif); } @@ -234,9 +253,35 @@ pf_kkif_free(struct pfi_kkif *kif) if (! kif) return; + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 2; k++) { + if (kif->pfik_packets[i][j][k]) + counter_u64_free(kif->pfik_packets[i][j][k]); + if (kif->pfik_bytes[i][j][k]) + counter_u64_free(kif->pfik_bytes[i][j][k]); + } + } + } + free(kif, PFI_MTYPE); } +void +pf_kkif_zero(struct pfi_kkif *kif) +{ + + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 2; k++) { + counter_u64_zero(kif->pfik_packets[i][j][k]); + counter_u64_zero(kif->pfik_bytes[i][j][k]); + } + } + } + kif->pfik_tzero = time_second; +} + struct pfi_kkif * pfi_kkif_find(const char *kif_name) { @@ -264,7 +309,7 @@ pfi_kkif_attach(struct pfi_kkif *kif, const char *kif_name) return (kif1); } - bzero(kif, sizeof(*kif)); + pf_kkif_zero(kif); strlcpy(kif->pfik_name, kif_name, sizeof(kif->pfik_name)); /* * It seems that the value of time_second is in unintialzied state @@ -754,18 +799,16 @@ pfi_update_status(const char *name, struct pf_status *pfs) /* just clear statistics */ if (pfs == NULL) { - bzero(p->pfik_packets, sizeof(p->pfik_packets)); - bzero(p->pfik_bytes, sizeof(p->pfik_bytes)); - p->pfik_tzero = time_second; + pf_kkif_zero(p); continue; } for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) { pfs->pcounters[i][j][k] += - p->pfik_packets[i][j][k]; + counter_u64_fetch(p->pfik_packets[i][j][k]); pfs->bcounters[i][j] += - p->pfik_bytes[i][j][k]; + counter_u64_fetch(p->pfik_bytes[i][j][k]); } } } @@ -780,9 +823,9 @@ pf_kkif_to_kif(const struct pfi_kkif *kkif, struct pfi_kif *kif) for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { kif->pfik_packets[i][j][k] = - kkif->pfik_packets[i][j][k]; + counter_u64_fetch(kkif->pfik_packets[i][j][k]); kif->pfik_bytes[i][j][k] = - kkif->pfik_bytes[i][j][k]; + counter_u64_fetch(kkif->pfik_bytes[i][j][k]); } } } From owner-dev-commits-src-all@freebsd.org Tue Jan 5 22:37:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 06BB24CF481; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@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 4D9S7Q6njnz3hWq; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBBD413FF8; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105MbsWM081509; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105MbsjD081508; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git) Date: Tue, 5 Jan 2021 22:37:54 GMT Message-Id: <202101052237.105MbsjD081508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c3adacdad4d7 - main - pf: Change pf_krule counters to use counter_u64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c3adacdad4d72b045058cd932351b94579cdd543 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 22:37:55 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c3adacdad4d72b045058cd932351b94579cdd543 commit c3adacdad4d72b045058cd932351b94579cdd543 Author: Kristof Provost AuthorDate: 2020-12-05 20:41:42 +0000 Commit: Kristof Provost CommitDate: 2021-01-05 22:35:37 +0000 pf: Change pf_krule counters to use counter_u64 This improves the cache behaviour of pf and results in improved throughput. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27760 --- sys/net/pfvar.h | 6 ++--- sys/netpfil/pf/pf.c | 32 ++++++++++++---------- sys/netpfil/pf/pf_ioctl.c | 69 +++++++++++++++++++++++++++++++++++++---------- sys/netpfil/pf/pf_lb.c | 2 +- sys/netpfil/pf/pf_norm.c | 18 ++++++------- 5 files changed, 86 insertions(+), 41 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index c0828fa420f9..e1fc60d6f1a7 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -315,9 +315,9 @@ struct pf_krule { TAILQ_ENTRY(pf_krule) entries; struct pf_pool rpool; - u_int64_t evaluations; - u_int64_t packets[2]; - u_int64_t bytes[2]; + counter_u64_t evaluations; + counter_u64_t packets[2]; + counter_u64_t bytes[2]; struct pfi_kif *kif; struct pf_kanchor *anchor; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 469e6b0bc32f..8ace1c5fe281 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -3537,7 +3537,7 @@ pf_test_rule(struct pf_krule **rm, struct pf_state **sm, int direction, } while (r != NULL) { - r->evaluations++; + counter_u64_add(r->evaluations, 1); if (pfi_kif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != direction) @@ -3977,7 +3977,7 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kif *kif, r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_FILTER].active.ptr); while (r != NULL) { - r->evaluations++; + counter_u64_add(r->evaluations, 1); if (pfi_kif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != direction) @@ -6201,16 +6201,18 @@ done: if (action == PF_PASS || r->action == PF_DROP) { dirndx = (dir == PF_OUT); - r->packets[dirndx]++; - r->bytes[dirndx] += pd.tot_len; + counter_u64_add(r->packets[dirndx], 1); + counter_u64_add(r->bytes[dirndx], pd.tot_len); if (a != NULL) { - a->packets[dirndx]++; - a->bytes[dirndx] += pd.tot_len; + counter_u64_add(a->packets[dirndx], 1); + counter_u64_add(a->bytes[dirndx], pd.tot_len); } if (s != NULL) { if (s->nat_rule.ptr != NULL) { - s->nat_rule.ptr->packets[dirndx]++; - s->nat_rule.ptr->bytes[dirndx] += pd.tot_len; + counter_u64_add(s->nat_rule.ptr->packets[dirndx], + 1); + counter_u64_add(s->nat_rule.ptr->bytes[dirndx], + pd.tot_len); } if (s->src_node != NULL) { counter_u64_add(s->src_node->packets[dirndx], @@ -6601,16 +6603,18 @@ done: if (action == PF_PASS || r->action == PF_DROP) { dirndx = (dir == PF_OUT); - r->packets[dirndx]++; - r->bytes[dirndx] += pd.tot_len; + counter_u64_add(r->packets[dirndx], 1); + counter_u64_add(r->bytes[dirndx], pd.tot_len); if (a != NULL) { - a->packets[dirndx]++; - a->bytes[dirndx] += pd.tot_len; + counter_u64_add(a->packets[dirndx], 1); + counter_u64_add(a->bytes[dirndx], pd.tot_len); } if (s != NULL) { if (s->nat_rule.ptr != NULL) { - s->nat_rule.ptr->packets[dirndx]++; - s->nat_rule.ptr->bytes[dirndx] += pd.tot_len; + counter_u64_add(s->nat_rule.ptr->packets[dirndx], + 1); + counter_u64_add(s->nat_rule.ptr->bytes[dirndx], + pd.tot_len); } if (s->src_node != NULL) { counter_u64_add(s->src_node->packets[dirndx], diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 4b5ad44ab01d..cdd058c7b8c5 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -283,6 +283,11 @@ pfattach_vnet(void) V_pf_default_rule.nr = -1; V_pf_default_rule.rtableid = -1; + V_pf_default_rule.evaluations = counter_u64_alloc(M_WAITOK); + for (int i = 0; i < 2; i++) { + V_pf_default_rule.packets[i] = counter_u64_alloc(M_WAITOK); + V_pf_default_rule.bytes[i] = counter_u64_alloc(M_WAITOK); + } V_pf_default_rule.states_cur = counter_u64_alloc(M_WAITOK); V_pf_default_rule.states_tot = counter_u64_alloc(M_WAITOK); V_pf_default_rule.src_nodes = counter_u64_alloc(M_WAITOK); @@ -461,6 +466,11 @@ pf_free_rule(struct pf_krule *rule) pfi_kif_unref(rule->kif); pf_kanchor_remove(rule); pf_empty_pool(&rule->rpool.list); + counter_u64_free(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_free(rule->packets[i]); + counter_u64_free(rule->bytes[i]); + } counter_u64_free(rule->states_cur); counter_u64_free(rule->states_tot); counter_u64_free(rule->src_nodes); @@ -1453,10 +1463,10 @@ pf_krule_to_rule(const struct pf_krule *krule, struct pf_rule *rule) bcopy(&krule->rpool, &rule->rpool, sizeof(krule->rpool)); - rule->evaluations = krule->evaluations; + rule->evaluations = counter_u64_fetch(krule->evaluations); for (int i = 0; i < 2; i++) { - rule->packets[i] = krule->packets[i]; - rule->bytes[i] = krule->bytes[i]; + rule->packets[i] = counter_u64_fetch(krule->packets[i]); + rule->bytes[i] = counter_u64_fetch(krule->bytes[i]); } /* kif, anchor, overload_tbl are not copied over. */ @@ -1808,6 +1818,11 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td if (rule->ifname[0]) kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + rule->evaluations = counter_u64_alloc(M_WAITOK); + for (int i = 0; i < 2; i++) { + rule->packets[i] = counter_u64_alloc(M_WAITOK); + rule->bytes[i] = counter_u64_alloc(M_WAITOK); + } rule->states_cur = counter_u64_alloc(M_WAITOK); rule->states_tot = counter_u64_alloc(M_WAITOK); rule->src_nodes = counter_u64_alloc(M_WAITOK); @@ -1920,8 +1935,11 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td } rule->rpool.cur = TAILQ_FIRST(&rule->rpool.list); - rule->evaluations = rule->packets[0] = rule->packets[1] = - rule->bytes[0] = rule->bytes[1] = 0; + counter_u64_zero(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_zero(rule->packets[i]); + counter_u64_zero(rule->bytes[i]); + } TAILQ_INSERT_TAIL(ruleset->rules[rs_num].inactive.ptr, rule, entries); ruleset->rules[rs_num].inactive.rcount++; @@ -1931,6 +1949,11 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td #undef ERROUT DIOCADDRULE_error: PF_RULES_WUNLOCK(); + counter_u64_free(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_free(rule->packets[i]); + counter_u64_free(rule->bytes[i]); + } counter_u64_free(rule->states_cur); counter_u64_free(rule->states_tot); counter_u64_free(rule->src_nodes); @@ -2016,9 +2039,11 @@ DIOCADDRULE_error: pf_addr_copyout(&pr->rule.dst.addr); if (pr->action == PF_GET_CLR_CNTR) { - rule->evaluations = 0; - rule->packets[0] = rule->packets[1] = 0; - rule->bytes[0] = rule->bytes[1] = 0; + counter_u64_zero(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_zero(rule->packets[i]); + counter_u64_zero(rule->bytes[i]); + } counter_u64_zero(rule->states_tot); } PF_RULES_WUNLOCK(); @@ -2062,6 +2087,13 @@ DIOCADDRULE_error: if (newrule->ifname[0]) kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + newrule->evaluations = counter_u64_alloc(M_WAITOK); + for (int i = 0; i < 2; i++) { + newrule->packets[i] = + counter_u64_alloc(M_WAITOK); + newrule->bytes[i] = + counter_u64_alloc(M_WAITOK); + } newrule->states_cur = counter_u64_alloc(M_WAITOK); newrule->states_tot = counter_u64_alloc(M_WAITOK); newrule->src_nodes = counter_u64_alloc(M_WAITOK); @@ -2174,9 +2206,6 @@ DIOCADDRULE_error: } newrule->rpool.cur = TAILQ_FIRST(&newrule->rpool.list); - newrule->evaluations = 0; - newrule->packets[0] = newrule->packets[1] = 0; - newrule->bytes[0] = newrule->bytes[1] = 0; } pf_empty_pool(&V_pf_pabuf); @@ -2236,6 +2265,11 @@ DIOCADDRULE_error: DIOCCHANGERULE_error: PF_RULES_WUNLOCK(); if (newrule != NULL) { + counter_u64_free(newrule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_free(newrule->packets[i]); + counter_u64_free(newrule->bytes[i]); + } counter_u64_free(newrule->states_cur); counter_u64_free(newrule->states_tot); counter_u64_free(newrule->src_nodes); @@ -2621,9 +2655,11 @@ DIOCGETSTATES_full: PF_RULES_WLOCK(); TAILQ_FOREACH(rule, ruleset->rules[PF_RULESET_FILTER].active.ptr, entries) { - rule->evaluations = 0; - rule->packets[0] = rule->packets[1] = 0; - rule->bytes[0] = rule->bytes[1] = 0; + counter_u64_zero(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_zero(rule->packets[i]); + counter_u64_zero(rule->bytes[i]); + } } PF_RULES_WUNLOCK(); break; @@ -4650,6 +4686,11 @@ pf_unload_vnet(void) uma_zdestroy(V_pf_tag_z); /* Free counters last as we updated them during shutdown. */ + counter_u64_free(V_pf_default_rule.evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_free(V_pf_default_rule.packets[i]); + counter_u64_free(V_pf_default_rule.bytes[i]); + } counter_u64_free(V_pf_default_rule.states_cur); counter_u64_free(V_pf_default_rule.states_tot); counter_u64_free(V_pf_default_rule.src_nodes); diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index 964f576114fc..341c084f9876 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -149,7 +149,7 @@ pf_match_translation(struct pf_pdesc *pd, struct mbuf *m, int off, dst = &r->dst; } - r->evaluations++; + counter_u64_add(r->evaluations, 1); if (pfi_kif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != direction) diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index 656ce7c5f997..bda66295a4ff 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -1012,7 +1012,7 @@ pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short *reason, r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_SCRUB].active.ptr); while (r != NULL) { - r->evaluations++; + counter_u64_add(r->evaluations, 1); if (pfi_kif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != dir) @@ -1039,8 +1039,8 @@ pf_normalize_ip(struct mbuf **m0, int dir, struct pfi_kif *kif, u_short *reason, if (r == NULL || r->action == PF_NOSCRUB) return (PF_PASS); else { - r->packets[dir == PF_OUT]++; - r->bytes[dir == PF_OUT] += pd->tot_len; + counter_u64_add(r->packets[dir == PF_OUT], 1); + counter_u64_add(r->bytes[dir == PF_OUT], pd->tot_len); } /* Check for illegal packets */ @@ -1155,7 +1155,7 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif, r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_SCRUB].active.ptr); while (r != NULL) { - r->evaluations++; + counter_u64_add(r->evaluations, 1); if (pfi_kif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != dir) @@ -1181,8 +1181,8 @@ pf_normalize_ip6(struct mbuf **m0, int dir, struct pfi_kif *kif, if (r == NULL || r->action == PF_NOSCRUB) return (PF_PASS); else { - r->packets[dir == PF_OUT]++; - r->bytes[dir == PF_OUT] += pd->tot_len; + counter_u64_add(r->packets[dir == PF_OUT], 1); + counter_u64_add(r->bytes[dir == PF_OUT], pd->tot_len); } /* Check for illegal packets */ @@ -1309,7 +1309,7 @@ pf_normalize_tcp(int dir, struct pfi_kif *kif, struct mbuf *m, int ipoff, r = TAILQ_FIRST(pf_main_ruleset.rules[PF_RULESET_SCRUB].active.ptr); while (r != NULL) { - r->evaluations++; + counter_u64_add(r->evaluations, 1); if (pfi_kif_match(r->kif, kif) == r->ifnot) r = r->skip[PF_SKIP_IFP].ptr; else if (r->direction && r->direction != dir) @@ -1343,8 +1343,8 @@ pf_normalize_tcp(int dir, struct pfi_kif *kif, struct mbuf *m, int ipoff, if (rm == NULL || rm->action == PF_NOSCRUB) return (PF_PASS); else { - r->packets[dir == PF_OUT]++; - r->bytes[dir == PF_OUT] += pd->tot_len; + counter_u64_add(r->packets[dir == PF_OUT], 1); + counter_u64_add(r->bytes[dir == PF_OUT], pd->tot_len); } if (rm->rule_flag & PFRULE_REASSEMBLE_TCP) From owner-dev-commits-src-all@freebsd.org Tue Jan 5 22:37:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2E7714CF0D4; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@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 4D9S7R0dsRz3hJB; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0748E140C4; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105Mbtas081544; Tue, 5 Jan 2021 22:37:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105MbsJW081542; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git) Date: Tue, 5 Jan 2021 22:37:54 GMT Message-Id: <202101052237.105MbsJW081542@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: e86bddea9fe6 - main - pf: Split pf_rule into kernel and user space versions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e86bddea9fe62d5093a1942cf21950b3c5ca62e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 22:37:55 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e86bddea9fe62d5093a1942cf21950b3c5ca62e5 commit e86bddea9fe62d5093a1942cf21950b3c5ca62e5 Author: Kristof Provost AuthorDate: 2020-12-05 13:32:54 +0000 Commit: Kristof Provost CommitDate: 2021-01-05 22:35:36 +0000 pf: Split pf_rule into kernel and user space versions No functional change intended. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27758 --- sys/net/pfvar.h | 234 +++++++++++++++++++++--------- sys/netpfil/pf/if_pflog.c | 4 +- sys/netpfil/pf/if_pfsync.c | 2 +- sys/netpfil/pf/pf.c | 124 ++++++++-------- sys/netpfil/pf/pf.h | 48 +++++++ sys/netpfil/pf/pf_if.c | 6 +- sys/netpfil/pf/pf_ioctl.c | 337 ++++++++++++++++++++++++++++++++++---------- sys/netpfil/pf/pf_lb.c | 24 ++-- sys/netpfil/pf/pf_norm.c | 10 +- sys/netpfil/pf/pf_ruleset.c | 303 +++++++++++++++++++++++++++++++++++---- sys/netpfil/pf/pf_table.c | 36 ++--- 11 files changed, 857 insertions(+), 271 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index b726abf894fe..846c6b9015e7 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -293,11 +293,115 @@ extern struct sx pf_end_lock; #define PF_ALGNMNT(off) (((off) % 2) == 0) #ifdef _KERNEL + +union pf_krule_ptr { + struct pf_krule *ptr; + u_int32_t nr; +}; + +struct pf_krule { + struct pf_rule_addr src; + struct pf_rule_addr dst; + union pf_krule_ptr skip[PF_SKIP_COUNT]; + char label[PF_RULE_LABEL_SIZE]; + char ifname[IFNAMSIZ]; + char qname[PF_QNAME_SIZE]; + char pqname[PF_QNAME_SIZE]; + char tagname[PF_TAG_NAME_SIZE]; + char match_tagname[PF_TAG_NAME_SIZE]; + + char overload_tblname[PF_TABLE_NAME_SIZE]; + + TAILQ_ENTRY(pf_krule) entries; + struct pf_pool rpool; + + u_int64_t evaluations; + u_int64_t packets[2]; + u_int64_t bytes[2]; + + struct pfi_kif *kif; + struct pf_kanchor *anchor; + struct pfr_ktable *overload_tbl; + + pf_osfp_t os_fingerprint; + + int rtableid; + u_int32_t timeout[PFTM_MAX]; + u_int32_t max_states; + u_int32_t max_src_nodes; + u_int32_t max_src_states; + u_int32_t max_src_conn; + struct { + u_int32_t limit; + u_int32_t seconds; + } max_src_conn_rate; + u_int32_t qid; + u_int32_t pqid; + u_int32_t rt_listid; + u_int32_t nr; + u_int32_t prob; + uid_t cuid; + pid_t cpid; + + counter_u64_t states_cur; + counter_u64_t states_tot; + counter_u64_t src_nodes; + + u_int16_t return_icmp; + u_int16_t return_icmp6; + u_int16_t max_mss; + u_int16_t tag; + u_int16_t match_tag; + u_int16_t scrub_flags; + + struct pf_rule_uid uid; + struct pf_rule_gid gid; + + u_int32_t rule_flag; + u_int8_t action; + u_int8_t direction; + u_int8_t log; + u_int8_t logif; + u_int8_t quick; + u_int8_t ifnot; + u_int8_t match_tag_not; + u_int8_t natpass; + + u_int8_t keep_state; + sa_family_t af; + u_int8_t proto; + u_int8_t type; + u_int8_t code; + u_int8_t flags; + u_int8_t flagset; + u_int8_t min_ttl; + u_int8_t allow_opts; + u_int8_t rt; + u_int8_t return_ttl; + u_int8_t tos; + u_int8_t set_tos; + u_int8_t anchor_relative; + u_int8_t anchor_wildcard; + + u_int8_t flush; + u_int8_t prio; + u_int8_t set_prio[2]; + + struct { + struct pf_addr addr; + u_int16_t port; + } divert; + + uint64_t u_states_cur; + uint64_t u_states_tot; + uint64_t u_src_nodes; +}; + struct pf_ksrc_node { LIST_ENTRY(pf_ksrc_node) entry; struct pf_addr addr; struct pf_addr raddr; - union pf_rule_ptr rule; + union pf_krule_ptr rule; struct pfi_kif *kif; counter_u64_t bytes[2]; counter_u64_t packets[2]; @@ -374,6 +478,15 @@ struct pf_state_cmp { u_int8_t pad[3]; }; +#define PFSTATE_ALLOWOPTS 0x01 +#define PFSTATE_SLOPPY 0x02 +/* was PFSTATE_PFLOW 0x04 */ +#define PFSTATE_NOSYNC 0x08 +#define PFSTATE_ACK 0x10 +#define PFSTATE_SETPRIO 0x0200 +#define PFSTATE_SETMASK (PFSTATE_SETPRIO) + +#ifdef _KERNEL struct pf_state { u_int64_t id; u_int32_t creatorid; @@ -386,9 +499,9 @@ struct pf_state { LIST_ENTRY(pf_state) entry; struct pf_state_peer src; struct pf_state_peer dst; - union pf_rule_ptr rule; - union pf_rule_ptr anchor; - union pf_rule_ptr nat_rule; + union pf_krule_ptr rule; + union pf_krule_ptr anchor; + union pf_krule_ptr nat_rule; struct pf_addr rt_addr; struct pf_state_key *key[2]; /* addresses stack and wire */ struct pfi_kif *kif; @@ -403,13 +516,6 @@ struct pf_state { u_int16_t tag; u_int8_t log; u_int8_t state_flags; -#define PFSTATE_ALLOWOPTS 0x01 -#define PFSTATE_SLOPPY 0x02 -/* was PFSTATE_PFLOW 0x04 */ -#define PFSTATE_NOSYNC 0x08 -#define PFSTATE_ACK 0x10 -#define PFSTATE_SETPRIO 0x0200 -#define PFSTATE_SETMASK (PFSTATE_SETPRIO) u_int8_t timeout; u_int8_t sync_state; /* PFSYNC_S_x */ @@ -417,6 +523,7 @@ struct pf_state { u_int8_t sync_updates; u_int8_t _tail[3]; }; +#endif /* * Unified state structures for pulling states out of the kernel @@ -501,11 +608,11 @@ void pfsync_state_export(struct pfsync_state *, struct pf_state *); /* pflog */ -struct pf_ruleset; +struct pf_kruleset; struct pf_pdesc; typedef int pflog_packet_t(struct pfi_kif *, struct mbuf *, sa_family_t, - u_int8_t, u_int8_t, struct pf_rule *, struct pf_rule *, - struct pf_ruleset *, struct pf_pdesc *, int); + u_int8_t, u_int8_t, struct pf_krule *, struct pf_krule *, + struct pf_kruleset *, struct pf_pdesc *, int); extern pflog_packet_t *pflog_packet_ptr; #endif /* _KERNEL */ @@ -563,42 +670,42 @@ extern pflog_packet_t *pflog_packet_ptr; d += ntohl(s[1]); \ } while (0) -TAILQ_HEAD(pf_rulequeue, pf_rule); +TAILQ_HEAD(pf_krulequeue, pf_krule); -struct pf_anchor; +struct pf_kanchor; -struct pf_ruleset { +struct pf_kruleset { struct { - struct pf_rulequeue queues[2]; + struct pf_krulequeue queues[2]; struct { - struct pf_rulequeue *ptr; - struct pf_rule **ptr_array; + struct pf_krulequeue *ptr; + struct pf_krule **ptr_array; u_int32_t rcount; u_int32_t ticket; int open; } active, inactive; } rules[PF_RULESET_MAX]; - struct pf_anchor *anchor; + struct pf_kanchor *anchor; u_int32_t tticket; int tables; int topen; }; -RB_HEAD(pf_anchor_global, pf_anchor); -RB_HEAD(pf_anchor_node, pf_anchor); -struct pf_anchor { - RB_ENTRY(pf_anchor) entry_global; - RB_ENTRY(pf_anchor) entry_node; - struct pf_anchor *parent; - struct pf_anchor_node children; +RB_HEAD(pf_kanchor_global, pf_kanchor); +RB_HEAD(pf_kanchor_node, pf_kanchor); +struct pf_kanchor { + RB_ENTRY(pf_kanchor) entry_global; + RB_ENTRY(pf_kanchor) entry_node; + struct pf_kanchor *parent; + struct pf_kanchor_node children; char name[PF_ANCHOR_NAME_SIZE]; char path[MAXPATHLEN]; - struct pf_ruleset ruleset; + struct pf_kruleset ruleset; int refcnt; /* anchor rules */ int match; /* XXX: used for pfctl black magic */ }; -RB_PROTOTYPE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); -RB_PROTOTYPE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); +RB_PROTOTYPE(pf_kanchor_global, pf_kanchor, entry_global, pf_anchor_compare); +RB_PROTOTYPE(pf_kanchor_node, pf_kanchor, entry_node, pf_kanchor_compare); #define PF_RESERVED_ANCHOR "_pf" @@ -625,7 +732,7 @@ RB_PROTOTYPE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); PFR_TFLAG_REFDANCHOR | \ PFR_TFLAG_COUNTERS) -struct pf_anchor_stackframe; +struct pf_kanchor_stackframe; struct pfr_table { char pfrt_anchor[MAXPATHLEN]; @@ -707,6 +814,7 @@ struct pfr_kcounters { ((kc)->pfrkc_counters + \ (dir) * PFR_OP_ADDR_MAX * PFR_TYPE_MAX + (op) * PFR_TYPE_MAX + (t)) +#ifdef _KERNEL SLIST_HEAD(pfr_kentryworkq, pfr_kentry); struct pfr_kentry { struct radix_node pfrke_node[2]; @@ -729,7 +837,7 @@ struct pfr_ktable { struct radix_node_head *pfrkt_ip6; struct pfr_ktable *pfrkt_shadow; struct pfr_ktable *pfrkt_root; - struct pf_ruleset *pfrkt_rs; + struct pf_kruleset *pfrkt_rs; long pfrkt_larg; int pfrkt_nflags; }; @@ -745,6 +853,7 @@ struct pfr_ktable { #define pfrkt_match pfrkt_kts.pfrkts_match #define pfrkt_nomatch pfrkt_kts.pfrkts_nomatch #define pfrkt_tzero pfrkt_kts.pfrkts_tzero +#endif /* keep synced with pfi_kif, used in RB_FIND */ struct pfi_kif_cmp { @@ -789,7 +898,7 @@ struct pf_pdesc { void *any; } hdr; - struct pf_rule *nat_rule; /* nat/rdr rule applied to packet */ + struct pf_krule *nat_rule; /* nat/rdr rule applied to packet */ struct pf_addr *src; /* src address */ struct pf_addr *dst; /* dst address */ u_int16_t *sport; @@ -1294,7 +1403,7 @@ VNET_DECLARE(struct pf_altqqueue *, pf_altqs_inactive); VNET_DECLARE(struct pf_altqqueue *, pf_altq_ifs_inactive); #define V_pf_altq_ifs_inactive VNET(pf_altq_ifs_inactive) -VNET_DECLARE(struct pf_rulequeue, pf_unlinked_rules); +VNET_DECLARE(struct pf_krulequeue, pf_unlinked_rules); #define V_pf_unlinked_rules VNET(pf_unlinked_rules) void pf_initialize(void); @@ -1304,7 +1413,7 @@ void pf_cleanup(void); struct pf_mtag *pf_get_mtag(struct mbuf *); -extern void pf_calc_skip_steps(struct pf_rulequeue *); +extern void pf_calc_skip_steps(struct pf_krulequeue *); #ifdef ALTQ extern void pf_altq_ifnet_event(struct ifnet *, int); #endif @@ -1351,7 +1460,7 @@ extern struct pf_state *pf_find_state_byid(uint64_t, uint32_t); extern struct pf_state *pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, - struct pf_rule *, sa_family_t, int); + struct pf_krule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_ksrc_node *); extern u_int pf_free_src_nodes(struct pf_ksrc_node_list *); extern void pf_print_state(struct pf_state *); @@ -1363,11 +1472,11 @@ extern u_int16_t pf_proto_cksum_fixup(struct mbuf *, u_int16_t, VNET_DECLARE(struct ifnet *, sync_ifp); #define V_sync_ifp VNET(sync_ifp); -VNET_DECLARE(struct pf_rule, pf_default_rule); +VNET_DECLARE(struct pf_krule, pf_default_rule); #define V_pf_default_rule VNET(pf_default_rule) extern void pf_addrcpy(struct pf_addr *, struct pf_addr *, u_int8_t); -void pf_free_rule(struct pf_rule *); +void pf_free_rule(struct pf_krule *); #ifdef INET int pf_test(int, int, struct ifnet *, struct mbuf **, struct inpcb *); @@ -1429,7 +1538,7 @@ void pfr_update_stats(struct pfr_ktable *, struct pf_addr *, sa_family_t, int pfr_pool_get(struct pfr_ktable *, int *, struct pf_addr *, sa_family_t); void pfr_dynaddr_update(struct pfr_ktable *, struct pfi_dynaddr *); struct pfr_ktable * - pfr_attach_table(struct pf_ruleset *, char *); + pfr_attach_table(struct pf_kruleset *, char *); void pfr_detach_table(struct pfr_ktable *); int pfr_clr_tables(struct pfr_table *, int *, int); int pfr_add_tables(struct pfr_table *, int, int *, int); @@ -1483,7 +1592,7 @@ void pfi_get_ifaces(const char *, struct pfi_kif *, int *); int pfi_set_flags(const char *, int); int pfi_clear_flags(const char *, int); -int pf_match_tag(struct mbuf *, struct pf_rule *, int *, int); +int pf_match_tag(struct mbuf *, struct pf_krule *, int *, int); int pf_tag_packet(struct mbuf *, struct pf_pdesc *, int); int pf_addr_cmp(struct pf_addr *, struct pf_addr *, sa_family_t); @@ -1502,25 +1611,24 @@ VNET_DECLARE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); #endif /* _KERNEL */ #ifdef _KERNEL -VNET_DECLARE(struct pf_anchor_global, pf_anchors); +VNET_DECLARE(struct pf_kanchor_global, pf_anchors); #define V_pf_anchors VNET(pf_anchors) -VNET_DECLARE(struct pf_anchor, pf_main_anchor); +VNET_DECLARE(struct pf_kanchor, pf_main_anchor); #define V_pf_main_anchor VNET(pf_main_anchor) #define pf_main_ruleset V_pf_main_anchor.ruleset -#endif -/* these ruleset functions can be linked into userland programs (pfctl) */ int pf_get_ruleset_number(u_int8_t); -void pf_init_ruleset(struct pf_ruleset *); -int pf_anchor_setup(struct pf_rule *, - const struct pf_ruleset *, const char *); -int pf_anchor_copyout(const struct pf_ruleset *, - const struct pf_rule *, struct pfioc_rule *); -void pf_anchor_remove(struct pf_rule *); -void pf_remove_if_empty_ruleset(struct pf_ruleset *); -struct pf_ruleset *pf_find_ruleset(const char *); -struct pf_ruleset *pf_find_or_create_ruleset(const char *); +void pf_init_kruleset(struct pf_kruleset *); +int pf_kanchor_setup(struct pf_krule *, + const struct pf_kruleset *, const char *); +int pf_kanchor_copyout(const struct pf_kruleset *, + const struct pf_krule *, struct pfioc_rule *); +void pf_kanchor_remove(struct pf_krule *); +void pf_remove_if_empty_kruleset(struct pf_kruleset *); +struct pf_kruleset *pf_find_kruleset(const char *); +struct pf_kruleset *pf_find_or_create_kruleset(const char *); void pf_rs_initialize(void); +#endif /* The fingerprint functions can be linked into userland programs (tcpdump) */ int pf_osfp_add(struct pf_osfp_ioctl *); @@ -1536,21 +1644,21 @@ int pf_osfp_match(struct pf_osfp_enlist *, pf_osfp_t); #ifdef _KERNEL void pf_print_host(struct pf_addr *, u_int16_t, u_int8_t); -void pf_step_into_anchor(struct pf_anchor_stackframe *, int *, - struct pf_ruleset **, int, struct pf_rule **, - struct pf_rule **, int *); -int pf_step_out_of_anchor(struct pf_anchor_stackframe *, int *, - struct pf_ruleset **, int, struct pf_rule **, - struct pf_rule **, int *); +void pf_step_into_anchor(struct pf_kanchor_stackframe *, int *, + struct pf_kruleset **, int, struct pf_krule **, + struct pf_krule **, int *); +int pf_step_out_of_anchor(struct pf_kanchor_stackframe *, int *, + struct pf_kruleset **, int, struct pf_krule **, + struct pf_krule **, int *); -int pf_map_addr(u_int8_t, struct pf_rule *, +int pf_map_addr(u_int8_t, struct pf_krule *, struct pf_addr *, struct pf_addr *, struct pf_addr *, struct pf_ksrc_node **); -struct pf_rule *pf_get_translation(struct pf_pdesc *, struct mbuf *, +struct pf_krule *pf_get_translation(struct pf_pdesc *, struct mbuf *, int, int, struct pfi_kif *, struct pf_ksrc_node **, struct pf_state_key **, struct pf_state_key **, struct pf_addr *, struct pf_addr *, - uint16_t, uint16_t, struct pf_anchor_stackframe *); + uint16_t, uint16_t, struct pf_kanchor_stackframe *); struct pf_state_key *pf_state_key_setup(struct pf_pdesc *, struct pf_addr *, struct pf_addr *, u_int16_t, u_int16_t); diff --git a/sys/netpfil/pf/if_pflog.c b/sys/netpfil/pf/if_pflog.c index 87e674f46942..030f75c2507e 100644 --- a/sys/netpfil/pf/if_pflog.c +++ b/sys/netpfil/pf/if_pflog.c @@ -202,8 +202,8 @@ pflogioctl(struct ifnet *ifp, u_long cmd, caddr_t data) static int pflog_packet(struct pfi_kif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir, - u_int8_t reason, struct pf_rule *rm, struct pf_rule *am, - struct pf_ruleset *ruleset, struct pf_pdesc *pd, int lookupsafe) + u_int8_t reason, struct pf_krule *rm, struct pf_krule *am, + struct pf_kruleset *ruleset, struct pf_pdesc *pd, int lookupsafe) { struct ifnet *ifn; struct pfloghdr hdr; diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 2f696698e3eb..83ca4b969636 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -463,7 +463,7 @@ pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) struct pfsync_state_key *kw, *ks; struct pf_state *st = NULL; struct pf_state_key *skw = NULL, *sks = NULL; - struct pf_rule *r = NULL; + struct pf_krule *r = NULL; struct pfi_kif *kif; int error; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 6f393bd62698..469e6b0bc32f 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -181,7 +181,7 @@ struct pf_overload_entry { struct pf_addr addr; sa_family_t af; uint8_t dir; - struct pf_rule *rule; + struct pf_krule *rule; }; SLIST_HEAD(pf_overload_head, pf_overload_entry); @@ -196,7 +196,7 @@ MTX_SYSINIT(pf_overloadqueue_mtx, &pf_overloadqueue_mtx, #define PF_OVERLOADQ_LOCK() mtx_lock(&pf_overloadqueue_mtx) #define PF_OVERLOADQ_UNLOCK() mtx_unlock(&pf_overloadqueue_mtx) -VNET_DEFINE(struct pf_rulequeue, pf_unlinked_rules); +VNET_DEFINE(struct pf_krulequeue, pf_unlinked_rules); struct mtx pf_unlnkdrules_mtx; MTX_SYSINIT(pf_unlnkdrules_mtx, &pf_unlnkdrules_mtx, "pf unlinked rules", MTX_DEF); @@ -230,34 +230,34 @@ static void pf_change_icmp(struct pf_addr *, u_int16_t *, u_int16_t *, u_int16_t *, u_int16_t *, u_int16_t *, u_int8_t, sa_family_t); static void pf_send_tcp(struct mbuf *, - const struct pf_rule *, sa_family_t, + const struct pf_krule *, sa_family_t, const struct pf_addr *, const struct pf_addr *, u_int16_t, u_int16_t, u_int32_t, u_int32_t, u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, u_int16_t, struct ifnet *); static void pf_send_icmp(struct mbuf *, u_int8_t, u_int8_t, - sa_family_t, struct pf_rule *); + sa_family_t, struct pf_krule *); static void pf_detach_state(struct pf_state *); static int pf_state_key_attach(struct pf_state_key *, struct pf_state_key *, struct pf_state *); static void pf_state_key_detach(struct pf_state *, int); static int pf_state_key_ctor(void *, int, void *, int); static u_int32_t pf_tcp_iss(struct pf_pdesc *); -static int pf_test_rule(struct pf_rule **, struct pf_state **, +static int pf_test_rule(struct pf_krule **, struct pf_state **, int, struct pfi_kif *, struct mbuf *, int, - struct pf_pdesc *, struct pf_rule **, - struct pf_ruleset **, struct inpcb *); -static int pf_create_state(struct pf_rule *, struct pf_rule *, - struct pf_rule *, struct pf_pdesc *, + struct pf_pdesc *, struct pf_krule **, + struct pf_kruleset **, struct inpcb *); +static int pf_create_state(struct pf_krule *, struct pf_krule *, + struct pf_krule *, struct pf_pdesc *, struct pf_ksrc_node *, struct pf_state_key *, struct pf_state_key *, struct mbuf *, int, u_int16_t, u_int16_t, int *, struct pfi_kif *, struct pf_state **, int, u_int16_t, u_int16_t, int); -static int pf_test_fragment(struct pf_rule **, int, +static int pf_test_fragment(struct pf_krule **, int, struct pfi_kif *, struct mbuf *, void *, - struct pf_pdesc *, struct pf_rule **, - struct pf_ruleset **); + struct pf_pdesc *, struct pf_krule **, + struct pf_kruleset **); static int pf_tcp_track_full(struct pf_state_peer *, struct pf_state_peer *, struct pf_state **, struct pfi_kif *, struct mbuf *, int, @@ -295,20 +295,20 @@ static struct pf_state *pf_find_state(struct pfi_kif *, static int pf_src_connlimit(struct pf_state **); static void pf_overload_task(void *v, int pending); static int pf_insert_src_node(struct pf_ksrc_node **, - struct pf_rule *, struct pf_addr *, sa_family_t); + struct pf_krule *, struct pf_addr *, sa_family_t); static u_int pf_purge_expired_states(u_int, int); static void pf_purge_unlinked_rules(void); static int pf_mtag_uminit(void *, int, int); static void pf_mtag_free(struct m_tag *); #ifdef INET -static void pf_route(struct mbuf **, struct pf_rule *, int, +static void pf_route(struct mbuf **, struct pf_krule *, int, struct ifnet *, struct pf_state *, struct pf_pdesc *, struct inpcb *); #endif /* INET */ #ifdef INET6 static void pf_change_a6(struct pf_addr *, u_int16_t *, struct pf_addr *, u_int8_t); -static void pf_route6(struct mbuf **, struct pf_rule *, int, +static void pf_route6(struct mbuf **, struct pf_krule *, int, struct ifnet *, struct pf_state *, struct pf_pdesc *, struct inpcb *); #endif /* INET6 */ @@ -678,7 +678,7 @@ pf_overload_task(void *v, int pending) * allocate and insert a new one. */ struct pf_ksrc_node * -pf_find_src_node(struct pf_addr *src, struct pf_rule *rule, sa_family_t af, +pf_find_src_node(struct pf_addr *src, struct pf_krule *rule, sa_family_t af, int returnlocked) { struct pf_srchash *sh; @@ -716,7 +716,7 @@ pf_free_src_node(struct pf_ksrc_node *sn) } static int -pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_rule *rule, +pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_krule *rule, struct pf_addr *src, sa_family_t af) { @@ -1806,8 +1806,8 @@ relock: static void pf_purge_unlinked_rules() { - struct pf_rulequeue tmpq; - struct pf_rule *r, *r1; + struct pf_krulequeue tmpq; + struct pf_krule *r, *r1; /* * If we have overloading task pending, then we'd @@ -2032,9 +2032,9 @@ pf_print_flags(u_int8_t f) } while (0) void -pf_calc_skip_steps(struct pf_rulequeue *rules) +pf_calc_skip_steps(struct pf_krulequeue *rules) { - struct pf_rule *cur, *prev, *head[PF_SKIP_COUNT]; + struct pf_krule *cur, *prev, *head[PF_SKIP_COUNT]; int i; cur = TAILQ_FIRST(rules); @@ -2440,7 +2440,7 @@ pf_modulate_sack(struct mbuf *m, int off, struct pf_pdesc *pd, } static void -pf_send_tcp(struct mbuf *replyto, const struct pf_rule *r, sa_family_t af, +pf_send_tcp(struct mbuf *replyto, const struct pf_krule *r, sa_family_t af, const struct pf_addr *saddr, const struct pf_addr *daddr, u_int16_t sport, u_int16_t dport, u_int32_t seq, u_int32_t ack, u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag, @@ -2600,7 +2600,7 @@ pf_send_tcp(struct mbuf *replyto, const struct pf_rule *r, sa_family_t af, } static void -pf_return(struct pf_rule *r, struct pf_rule *nr, struct pf_pdesc *pd, +pf_return(struct pf_krule *r, struct pf_krule *nr, struct pf_pdesc *pd, struct pf_state_key *sk, int off, struct mbuf *m, struct tcphdr *th, struct pfi_kif *kif, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen, u_short *reason) @@ -2714,7 +2714,7 @@ pf_match_ieee8021q_pcp(u_int8_t prio, struct mbuf *m) static void pf_send_icmp(struct mbuf *m, u_int8_t type, u_int8_t code, sa_family_t af, - struct pf_rule *r) + struct pf_krule *r) { struct pf_send_entry *pfse; struct mbuf *m0; @@ -2902,7 +2902,7 @@ pf_match_gid(u_int8_t op, gid_t a1, gid_t a2, gid_t g) } int -pf_match_tag(struct mbuf *m, struct pf_rule *r, int *tag, int mtag) +pf_match_tag(struct mbuf *m, struct pf_krule *r, int *tag, int mtag) { if (*tag == -1) *tag = mtag; @@ -2926,10 +2926,10 @@ pf_tag_packet(struct mbuf *m, struct pf_pdesc *pd, int tag) } #define PF_ANCHOR_STACKSIZE 32 -struct pf_anchor_stackframe { - struct pf_ruleset *rs; - struct pf_rule *r; /* XXX: + match bit */ - struct pf_anchor *child; +struct pf_kanchor_stackframe { + struct pf_kruleset *rs; + struct pf_krule *r; /* XXX: + match bit */ + struct pf_kanchor *child; }; /* @@ -2939,18 +2939,18 @@ struct pf_anchor_stackframe { #define PF_ANCHORSTACK_MASK (PF_ANCHORSTACK_MATCH) #define PF_ANCHOR_MATCH(f) ((uintptr_t)(f)->r & PF_ANCHORSTACK_MATCH) -#define PF_ANCHOR_RULE(f) (struct pf_rule *) \ +#define PF_ANCHOR_RULE(f) (struct pf_krule *) \ ((uintptr_t)(f)->r & ~PF_ANCHORSTACK_MASK) #define PF_ANCHOR_SET_MATCH(f) do { (f)->r = (void *) \ ((uintptr_t)(f)->r | PF_ANCHORSTACK_MATCH); \ } while (0) void -pf_step_into_anchor(struct pf_anchor_stackframe *stack, int *depth, - struct pf_ruleset **rs, int n, struct pf_rule **r, struct pf_rule **a, +pf_step_into_anchor(struct pf_kanchor_stackframe *stack, int *depth, + struct pf_kruleset **rs, int n, struct pf_krule **r, struct pf_krule **a, int *match) { - struct pf_anchor_stackframe *f; + struct pf_kanchor_stackframe *f; PF_RULES_RASSERT(); @@ -2967,9 +2967,9 @@ pf_step_into_anchor(struct pf_anchor_stackframe *stack, int *depth, f->rs = *rs; f->r = *r; if ((*r)->anchor_wildcard) { - struct pf_anchor_node *parent = &(*r)->anchor->children; + struct pf_kanchor_node *parent = &(*r)->anchor->children; - if ((f->child = RB_MIN(pf_anchor_node, parent)) == NULL) { + if ((f->child = RB_MIN(pf_kanchor_node, parent)) == NULL) { *r = NULL; return; } @@ -2982,12 +2982,12 @@ pf_step_into_anchor(struct pf_anchor_stackframe *stack, int *depth, } int -pf_step_out_of_anchor(struct pf_anchor_stackframe *stack, int *depth, - struct pf_ruleset **rs, int n, struct pf_rule **r, struct pf_rule **a, +pf_step_out_of_anchor(struct pf_kanchor_stackframe *stack, int *depth, + struct pf_kruleset **rs, int n, struct pf_krule **r, struct pf_krule **a, int *match) { - struct pf_anchor_stackframe *f; - struct pf_rule *fr; + struct pf_kanchor_stackframe *f; + struct pf_krule *fr; int quick = 0; PF_RULES_RASSERT(); @@ -2998,7 +2998,7 @@ pf_step_out_of_anchor(struct pf_anchor_stackframe *stack, int *depth, f = stack + *depth - 1; fr = PF_ANCHOR_RULE(f); if (f->child != NULL) { - struct pf_anchor_node *parent; + struct pf_kanchor_node *parent; /* * This block traverses through @@ -3014,7 +3014,7 @@ pf_step_out_of_anchor(struct pf_anchor_stackframe *stack, int *depth, PF_ANCHOR_SET_MATCH(f); *match = 0; } - f->child = RB_NEXT(pf_anchor_node, parent, f->child); + f->child = RB_NEXT(pf_kanchor_node, parent, f->child); if (f->child != NULL) { *rs = &f->child->ruleset; *r = TAILQ_FIRST((*rs)->rules[n].active.ptr); @@ -3324,16 +3324,16 @@ pf_tcp_iss(struct pf_pdesc *pd) } static int -pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction, +pf_test_rule(struct pf_krule **rm, struct pf_state **sm, int direction, struct pfi_kif *kif, struct mbuf *m, int off, struct pf_pdesc *pd, - struct pf_rule **am, struct pf_ruleset **rsm, struct inpcb *inp) + struct pf_krule **am, struct pf_kruleset **rsm, struct inpcb *inp) { - struct pf_rule *nr = NULL; + struct pf_krule *nr = NULL; struct pf_addr * const saddr = pd->src; struct pf_addr * const daddr = pd->dst; sa_family_t af = pd->af; - struct pf_rule *r, *a = NULL; - struct pf_ruleset *ruleset = NULL; + struct pf_krule *r, *a = NULL; + struct pf_kruleset *ruleset = NULL; struct pf_ksrc_node *nsn = NULL; struct tcphdr *th = pd->hdr.tcp; struct pf_state_key *sk = NULL, *nk = NULL; @@ -3346,7 +3346,7 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction, u_int16_t sport = 0, dport = 0; u_int16_t bproto_sum = 0, bip_sum = 0; u_int8_t icmptype = 0, icmpcode = 0; - struct pf_anchor_stackframe anchor_stack[PF_ANCHOR_STACKSIZE]; + struct pf_kanchor_stackframe anchor_stack[PF_ANCHOR_STACKSIZE]; PF_RULES_RASSERT(); @@ -3698,7 +3698,7 @@ cleanup: } static int -pf_create_state(struct pf_rule *r, struct pf_rule *nr, struct pf_rule *a, +pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, struct pf_pdesc *pd, struct pf_ksrc_node *nsn, struct pf_state_key *nk, struct pf_state_key *sk, struct mbuf *m, int off, u_int16_t sport, u_int16_t dport, int *rewrite, struct pfi_kif *kif, struct pf_state **sm, @@ -3960,18 +3960,18 @@ csfailed: } static int -pf_test_fragment(struct pf_rule **rm, int direction, struct pfi_kif *kif, - struct mbuf *m, void *h, struct pf_pdesc *pd, struct pf_rule **am, - struct pf_ruleset **rsm) +pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kif *kif, + struct mbuf *m, void *h, struct pf_pdesc *pd, struct pf_krule **am, + struct pf_kruleset **rsm) { - struct pf_rule *r, *a = NULL; - struct pf_ruleset *ruleset = NULL; + struct pf_krule *r, *a = NULL; + struct pf_kruleset *ruleset = NULL; sa_family_t af = pd->af; u_short reason; int tag = -1; int asd = 0; int match = 0; - struct pf_anchor_stackframe anchor_stack[PF_ANCHOR_STACKSIZE]; + struct pf_kanchor_stackframe anchor_stack[PF_ANCHOR_STACKSIZE]; PF_RULES_RASSERT(); @@ -5463,7 +5463,7 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, #ifdef INET static void -pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, +pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0, *m1; @@ -5626,7 +5626,7 @@ bad: #ifdef INET6 static void -pf_route6(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, +pf_route6(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, struct pf_state *s, struct pf_pdesc *pd, struct inpcb *inp) { struct mbuf *m0; @@ -5893,9 +5893,9 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * struct mbuf *m = *m0; struct ip *h = NULL; struct m_tag *ipfwtag; - struct pf_rule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; + struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; struct pf_state *s = NULL; - struct pf_ruleset *ruleset = NULL; + struct pf_kruleset *ruleset = NULL; struct pf_pdesc pd; int off, dirndx, pqid = 0; @@ -6185,7 +6185,7 @@ done: } if (log) { - struct pf_rule *lr; + struct pf_krule *lr; if (s != NULL && s->nat_rule.ptr != NULL && s->nat_rule.ptr->log & PF_LOG_ALL) @@ -6283,9 +6283,9 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb struct mbuf *m = *m0, *n = NULL; struct m_tag *mtag; struct ip6_hdr *h = NULL; - struct pf_rule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; + struct pf_krule *a = NULL, *r = &V_pf_default_rule, *tr, *nr; struct pf_state *s = NULL; - struct pf_ruleset *ruleset = NULL; + struct pf_kruleset *ruleset = NULL; struct pf_pdesc pd; int off, terminal = 0, dirndx, rh_cnt = 0, pqid = 0; @@ -6585,7 +6585,7 @@ done: printf("pf: divert(9) is not supported for IPv6\n"); if (log) { - struct pf_rule *lr; + struct pf_krule *lr; if (s != NULL && s->nat_rule.ptr != NULL && s->nat_rule.ptr->log & PF_LOG_ALL) diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index aa6409bcbaa9..4e73d815aece 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -35,6 +35,8 @@ #ifndef _NET_PF_H_ #define _NET_PF_H_ +#include + #define PF_TCPS_PROXY_SRC ((TCP_NSTATES)+0) #define PF_TCPS_PROXY_DST ((TCP_NSTATES)+1) @@ -569,4 +571,50 @@ struct pf_src_node { #define PFSNODE_HIWAT 10000 /* default source node table size */ +TAILQ_HEAD(pf_rulequeue, pf_rule); + +struct pf_anchor; + +struct pf_ruleset { + struct { + struct pf_rulequeue queues[2]; + struct { + struct pf_rulequeue *ptr; + struct pf_rule **ptr_array; + u_int32_t rcount; + u_int32_t ticket; + int open; + } active, inactive; + } rules[PF_RULESET_MAX]; + struct pf_anchor *anchor; + u_int32_t tticket; + int tables; + int topen; +}; + +RB_HEAD(pf_anchor_global, pf_anchor); +RB_HEAD(pf_anchor_node, pf_anchor); +struct pf_anchor { + RB_ENTRY(pf_anchor) entry_global; + RB_ENTRY(pf_anchor) entry_node; + struct pf_anchor *parent; + struct pf_anchor_node children; + char name[PF_ANCHOR_NAME_SIZE]; + char path[MAXPATHLEN]; + struct pf_ruleset ruleset; + int refcnt; /* anchor rules */ + int match; /* XXX: used for pfctl black magic */ +}; +RB_PROTOTYPE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); +RB_PROTOTYPE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); + +/* these ruleset functions can be linked into userland programs (pfctl) */ +int pf_get_ruleset_number(u_int8_t); +void pf_init_ruleset(struct pf_ruleset *); +int pf_anchor_setup(struct pf_rule *, + const struct pf_ruleset *, const char *); +void pf_remove_if_empty_ruleset(struct pf_ruleset *); +struct pf_ruleset *pf_find_ruleset(const char *); +struct pf_ruleset *pf_find_or_create_ruleset(const char *); + #endif /* _NET_PF_H_ */ diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 24179f9f3e63..f8862a9416b5 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -403,7 +403,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) struct epoch_tracker et; struct pfi_dynaddr *dyn; char tblname[PF_TABLE_NAME_SIZE]; - struct pf_ruleset *ruleset = NULL; + struct pf_kruleset *ruleset = NULL; struct pfi_kif *kif; int rv = 0; @@ -441,7 +441,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) if (dyn->pfid_net != 128) snprintf(tblname + strlen(tblname), sizeof(tblname) - strlen(tblname), "/%d", dyn->pfid_net); - if ((ruleset = pf_find_or_create_ruleset(PF_RESERVED_ANCHOR)) == NULL) { + if ((ruleset = pf_find_or_create_kruleset(PF_RESERVED_ANCHOR)) == NULL) { rv = ENOMEM; goto _bad; } @@ -467,7 +467,7 @@ _bad: if (dyn->pfid_kt != NULL) pfr_detach_table(dyn->pfid_kt); if (ruleset != NULL) - pf_remove_if_empty_ruleset(ruleset); + pf_remove_if_empty_kruleset(ruleset); if (dyn->pfid_kif != NULL) pfi_kif_unref(dyn->pfid_kif); free(dyn, PFI_MTYPE); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index bb7034f27daf..4b5ad44ab01d 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -109,11 +109,11 @@ static void pf_qid_unref(u_int32_t); #endif /* ALTQ */ static int pf_begin_rules(u_int32_t *, int, const char *); static int pf_rollback_rules(u_int32_t, int, char *); -static int pf_setup_pfsync_matching(struct pf_ruleset *); -static void pf_hash_rule(MD5_CTX *, struct pf_rule *); +static int pf_setup_pfsync_matching(struct pf_kruleset *); +static void pf_hash_rule(MD5_CTX *, struct pf_krule *); static void pf_hash_rule_addr(MD5_CTX *, struct pf_rule_addr *); static int pf_commit_rules(u_int32_t, int, char *); -static int pf_addr_setup(struct pf_ruleset *, +static int pf_addr_setup(struct pf_kruleset *, struct pf_addr_wrap *, sa_family_t); static void pf_addr_copyout(struct pf_addr_wrap *); static void pf_src_node_copy(const struct pf_ksrc_node *, @@ -125,7 +125,7 @@ static int pf_import_kaltq(struct pfioc_altq_v1 *, struct pf_altq *, size_t); #endif /* ALTQ */ -VNET_DEFINE(struct pf_rule, pf_default_rule); +VNET_DEFINE(struct pf_krule, pf_default_rule); #ifdef ALTQ VNET_DEFINE_STATIC(int, pf_altq_running); @@ -271,7 +271,7 @@ pfattach_vnet(void) V_pf_limits[PF_LIMIT_SRC_NODES].limit = PFSNODE_HIWAT; RB_INIT(&V_pf_anchors); - pf_init_ruleset(&pf_main_ruleset); + pf_init_kruleset(&pf_main_ruleset); /* default rule should never be garbage collected */ V_pf_default_rule.entries.tqe_prev = &V_pf_default_rule.entries.tqe_next; *** 1385 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Jan 5 22:37:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3D82C4CF501; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@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 4D9S7R0tpjz3hhH; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 111B1140C5; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105Mbt6o081562; Tue, 5 Jan 2021 22:37:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105Mbt7S081560; Tue, 5 Jan 2021 22:37:55 GMT (envelope-from git) Date: Tue, 5 Jan 2021 22:37:55 GMT Message-Id: <202101052237.105Mbt7S081560@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: dc865dae89c3 - main - pf: Migrate pf_rule and related structs to pf.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc865dae89c34291467e0ba569a8c78fc7a5d360 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 22:37:55 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dc865dae89c34291467e0ba569a8c78fc7a5d360 commit dc865dae89c34291467e0ba569a8c78fc7a5d360 Author: Kristof Provost AuthorDate: 2020-12-03 16:17:39 +0000 Commit: Kristof Provost CommitDate: 2021-01-05 22:35:36 +0000 pf: Migrate pf_rule and related structs to pf.h As part of the split between user and kernel mode structures we're moving all user space usable definitions into pf.h. No functional change intended. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27757 --- sys/net/pfvar.h | 316 --------------------------------------------------- sys/netpfil/pf/pf.h | 317 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 317 insertions(+), 316 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 0b6299268b5e..b726abf894fe 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -54,31 +54,6 @@ #include #include -#define PFI_AFLAG_NETWORK 0x01 -#define PFI_AFLAG_BROADCAST 0x02 -#define PFI_AFLAG_PEER 0x04 -#define PFI_AFLAG_MODEMASK 0x07 -#define PFI_AFLAG_NOALIAS 0x08 - -struct pf_addr_wrap { - union { - struct { - struct pf_addr addr; - struct pf_addr mask; - } a; - char ifname[IFNAMSIZ]; - char tblname[PF_TABLE_NAME_SIZE]; - } v; - union { - struct pfi_dynaddr *dyn; - struct pfr_ktable *tbl; - int dyncnt; - int tblcnt; - } p; - u_int8_t type; /* PF_ADDR_* */ - u_int8_t iflags; /* PFI_AFLAG_* */ -}; - #ifdef _KERNEL SYSCTL_DECL(_net_pf); @@ -317,297 +292,6 @@ extern struct sx pf_end_lock; #define PF_ALGNMNT(off) (((off) % 2) == 0) -struct pf_rule_uid { - uid_t uid[2]; - u_int8_t op; -}; - -struct pf_rule_gid { - uid_t gid[2]; - u_int8_t op; -}; - -struct pf_rule_addr { - struct pf_addr_wrap addr; - u_int16_t port[2]; - u_int8_t neg; - u_int8_t port_op; -}; - -struct pf_pooladdr { - struct pf_addr_wrap addr; - TAILQ_ENTRY(pf_pooladdr) entries; - char ifname[IFNAMSIZ]; - struct pfi_kif *kif; -}; - -TAILQ_HEAD(pf_palist, pf_pooladdr); - -struct pf_poolhashkey { - union { - u_int8_t key8[16]; - u_int16_t key16[8]; - u_int32_t key32[4]; - } pfk; /* 128-bit hash key */ -#define key8 pfk.key8 -#define key16 pfk.key16 -#define key32 pfk.key32 -}; - -struct pf_pool { - struct pf_palist list; - struct pf_pooladdr *cur; - struct pf_poolhashkey key; - struct pf_addr counter; - int tblidx; - u_int16_t proxy_port[2]; - u_int8_t opts; -}; - -/* A packed Operating System description for fingerprinting */ -typedef u_int32_t pf_osfp_t; -#define PF_OSFP_ANY ((pf_osfp_t)0) -#define PF_OSFP_UNKNOWN ((pf_osfp_t)-1) -#define PF_OSFP_NOMATCH ((pf_osfp_t)-2) - -struct pf_osfp_entry { - SLIST_ENTRY(pf_osfp_entry) fp_entry; - pf_osfp_t fp_os; - int fp_enflags; -#define PF_OSFP_EXPANDED 0x001 /* expanded entry */ -#define PF_OSFP_GENERIC 0x002 /* generic signature */ -#define PF_OSFP_NODETAIL 0x004 /* no p0f details */ -#define PF_OSFP_LEN 32 - char fp_class_nm[PF_OSFP_LEN]; - char fp_version_nm[PF_OSFP_LEN]; - char fp_subtype_nm[PF_OSFP_LEN]; -}; -#define PF_OSFP_ENTRY_EQ(a, b) \ - ((a)->fp_os == (b)->fp_os && \ - memcmp((a)->fp_class_nm, (b)->fp_class_nm, PF_OSFP_LEN) == 0 && \ - memcmp((a)->fp_version_nm, (b)->fp_version_nm, PF_OSFP_LEN) == 0 && \ - memcmp((a)->fp_subtype_nm, (b)->fp_subtype_nm, PF_OSFP_LEN) == 0) - -/* handle pf_osfp_t packing */ -#define _FP_RESERVED_BIT 1 /* For the special negative #defines */ -#define _FP_UNUSED_BITS 1 -#define _FP_CLASS_BITS 10 /* OS Class (Windows, Linux) */ -#define _FP_VERSION_BITS 10 /* OS version (95, 98, NT, 2.4.54, 3.2) */ -#define _FP_SUBTYPE_BITS 10 /* patch level (NT SP4, SP3, ECN patch) */ -#define PF_OSFP_UNPACK(osfp, class, version, subtype) do { \ - (class) = ((osfp) >> (_FP_VERSION_BITS+_FP_SUBTYPE_BITS)) & \ - ((1 << _FP_CLASS_BITS) - 1); \ - (version) = ((osfp) >> _FP_SUBTYPE_BITS) & \ - ((1 << _FP_VERSION_BITS) - 1);\ - (subtype) = (osfp) & ((1 << _FP_SUBTYPE_BITS) - 1); \ -} while(0) -#define PF_OSFP_PACK(osfp, class, version, subtype) do { \ - (osfp) = ((class) & ((1 << _FP_CLASS_BITS) - 1)) << (_FP_VERSION_BITS \ - + _FP_SUBTYPE_BITS); \ - (osfp) |= ((version) & ((1 << _FP_VERSION_BITS) - 1)) << \ - _FP_SUBTYPE_BITS; \ - (osfp) |= (subtype) & ((1 << _FP_SUBTYPE_BITS) - 1); \ -} while(0) - -/* the fingerprint of an OSes TCP SYN packet */ -typedef u_int64_t pf_tcpopts_t; -struct pf_os_fingerprint { - SLIST_HEAD(pf_osfp_enlist, pf_osfp_entry) fp_oses; /* list of matches */ - pf_tcpopts_t fp_tcpopts; /* packed TCP options */ - u_int16_t fp_wsize; /* TCP window size */ - u_int16_t fp_psize; /* ip->ip_len */ - u_int16_t fp_mss; /* TCP MSS */ - u_int16_t fp_flags; -#define PF_OSFP_WSIZE_MOD 0x0001 /* Window modulus */ -#define PF_OSFP_WSIZE_DC 0x0002 /* Window don't care */ -#define PF_OSFP_WSIZE_MSS 0x0004 /* Window multiple of MSS */ -#define PF_OSFP_WSIZE_MTU 0x0008 /* Window multiple of MTU */ -#define PF_OSFP_PSIZE_MOD 0x0010 /* packet size modulus */ -#define PF_OSFP_PSIZE_DC 0x0020 /* packet size don't care */ -#define PF_OSFP_WSCALE 0x0040 /* TCP window scaling */ -#define PF_OSFP_WSCALE_MOD 0x0080 /* TCP window scale modulus */ -#define PF_OSFP_WSCALE_DC 0x0100 /* TCP window scale dont-care */ -#define PF_OSFP_MSS 0x0200 /* TCP MSS */ -#define PF_OSFP_MSS_MOD 0x0400 /* TCP MSS modulus */ -#define PF_OSFP_MSS_DC 0x0800 /* TCP MSS dont-care */ -#define PF_OSFP_DF 0x1000 /* IPv4 don't fragment bit */ -#define PF_OSFP_TS0 0x2000 /* Zero timestamp */ -#define PF_OSFP_INET6 0x4000 /* IPv6 */ - u_int8_t fp_optcnt; /* TCP option count */ - u_int8_t fp_wscale; /* TCP window scaling */ - u_int8_t fp_ttl; /* IPv4 TTL */ -#define PF_OSFP_MAXTTL_OFFSET 40 -/* TCP options packing */ -#define PF_OSFP_TCPOPT_NOP 0x0 /* TCP NOP option */ -#define PF_OSFP_TCPOPT_WSCALE 0x1 /* TCP window scaling option */ -#define PF_OSFP_TCPOPT_MSS 0x2 /* TCP max segment size opt */ -#define PF_OSFP_TCPOPT_SACK 0x3 /* TCP SACK OK option */ -#define PF_OSFP_TCPOPT_TS 0x4 /* TCP timestamp option */ -#define PF_OSFP_TCPOPT_BITS 3 /* bits used by each option */ -#define PF_OSFP_MAX_OPTS \ - (sizeof(((struct pf_os_fingerprint *)0)->fp_tcpopts) * 8) \ - / PF_OSFP_TCPOPT_BITS - - SLIST_ENTRY(pf_os_fingerprint) fp_next; -}; - -struct pf_osfp_ioctl { - struct pf_osfp_entry fp_os; - pf_tcpopts_t fp_tcpopts; /* packed TCP options */ - u_int16_t fp_wsize; /* TCP window size */ - u_int16_t fp_psize; /* ip->ip_len */ - u_int16_t fp_mss; /* TCP MSS */ - u_int16_t fp_flags; - u_int8_t fp_optcnt; /* TCP option count */ - u_int8_t fp_wscale; /* TCP window scaling */ - u_int8_t fp_ttl; /* IPv4 TTL */ - - int fp_getnum; /* DIOCOSFPGET number */ -}; - -#define PF_ANCHOR_NAME_SIZE 64 - -struct pf_rule { - struct pf_rule_addr src; - struct pf_rule_addr dst; -#define PF_SKIP_IFP 0 -#define PF_SKIP_DIR 1 -#define PF_SKIP_AF 2 -#define PF_SKIP_PROTO 3 -#define PF_SKIP_SRC_ADDR 4 -#define PF_SKIP_SRC_PORT 5 -#define PF_SKIP_DST_ADDR 6 -#define PF_SKIP_DST_PORT 7 -#define PF_SKIP_COUNT 8 - union pf_rule_ptr skip[PF_SKIP_COUNT]; -#define PF_RULE_LABEL_SIZE 64 - char label[PF_RULE_LABEL_SIZE]; - char ifname[IFNAMSIZ]; - char qname[PF_QNAME_SIZE]; - char pqname[PF_QNAME_SIZE]; -#define PF_TAG_NAME_SIZE 64 - char tagname[PF_TAG_NAME_SIZE]; - char match_tagname[PF_TAG_NAME_SIZE]; - - char overload_tblname[PF_TABLE_NAME_SIZE]; - - TAILQ_ENTRY(pf_rule) entries; - struct pf_pool rpool; - - u_int64_t evaluations; - u_int64_t packets[2]; - u_int64_t bytes[2]; - - struct pfi_kif *kif; - struct pf_anchor *anchor; - struct pfr_ktable *overload_tbl; - - pf_osfp_t os_fingerprint; - - int rtableid; - u_int32_t timeout[PFTM_MAX]; - u_int32_t max_states; - u_int32_t max_src_nodes; - u_int32_t max_src_states; - u_int32_t max_src_conn; - struct { - u_int32_t limit; - u_int32_t seconds; - } max_src_conn_rate; - u_int32_t qid; - u_int32_t pqid; - u_int32_t rt_listid; - u_int32_t nr; - u_int32_t prob; - uid_t cuid; - pid_t cpid; - - counter_u64_t states_cur; - counter_u64_t states_tot; - counter_u64_t src_nodes; - - u_int16_t return_icmp; - u_int16_t return_icmp6; - u_int16_t max_mss; - u_int16_t tag; - u_int16_t match_tag; - u_int16_t scrub_flags; - - struct pf_rule_uid uid; - struct pf_rule_gid gid; - - u_int32_t rule_flag; - u_int8_t action; - u_int8_t direction; - u_int8_t log; - u_int8_t logif; - u_int8_t quick; - u_int8_t ifnot; - u_int8_t match_tag_not; - u_int8_t natpass; - -#define PF_STATE_NORMAL 0x1 -#define PF_STATE_MODULATE 0x2 -#define PF_STATE_SYNPROXY 0x3 - u_int8_t keep_state; - sa_family_t af; - u_int8_t proto; - u_int8_t type; - u_int8_t code; - u_int8_t flags; - u_int8_t flagset; - u_int8_t min_ttl; - u_int8_t allow_opts; - u_int8_t rt; - u_int8_t return_ttl; - u_int8_t tos; - u_int8_t set_tos; - u_int8_t anchor_relative; - u_int8_t anchor_wildcard; - -#define PF_FLUSH 0x01 -#define PF_FLUSH_GLOBAL 0x02 - u_int8_t flush; -#define PF_PRIO_ZERO 0xff /* match "prio 0" packets */ -#define PF_PRIO_MAX 7 - u_int8_t prio; - u_int8_t set_prio[2]; - - struct { - struct pf_addr addr; - u_int16_t port; - } divert; - - uint64_t u_states_cur; - uint64_t u_states_tot; - uint64_t u_src_nodes; -}; - -/* rule flags */ -#define PFRULE_DROP 0x0000 -#define PFRULE_RETURNRST 0x0001 -#define PFRULE_FRAGMENT 0x0002 -#define PFRULE_RETURNICMP 0x0004 -#define PFRULE_RETURN 0x0008 -#define PFRULE_NOSYNC 0x0010 -#define PFRULE_SRCTRACK 0x0020 /* track source states */ -#define PFRULE_RULESRCTRACK 0x0040 /* per rule */ -#define PFRULE_REFS 0x0080 /* rule has references */ - -/* scrub flags */ -#define PFRULE_NODF 0x0100 -#define PFRULE_RANDOMID 0x0800 -#define PFRULE_REASSEMBLE_TCP 0x1000 -#define PFRULE_SET_TOS 0x2000 - -/* rule flags again */ -#define PFRULE_IFBOUND 0x00010000 /* if-bound */ -#define PFRULE_STATESLOPPY 0x00020000 /* sloppy state tracking */ - -#define PFSTATE_HIWAT 100000 /* default state table size */ -#define PFSTATE_ADAPT_START 60000 /* default adaptive timeout start */ -#define PFSTATE_ADAPT_END 120000 /* default adaptive timeout end */ - #ifdef _KERNEL struct pf_ksrc_node { LIST_ENTRY(pf_ksrc_node) entry; diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 7add0877224e..aa6409bcbaa9 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -219,11 +219,328 @@ struct pf_addr { #define addr32 pfa.addr32 }; +#define PFI_AFLAG_NETWORK 0x01 +#define PFI_AFLAG_BROADCAST 0x02 +#define PFI_AFLAG_PEER 0x04 +#define PFI_AFLAG_MODEMASK 0x07 +#define PFI_AFLAG_NOALIAS 0x08 + +struct pf_addr_wrap { + union { + struct { + struct pf_addr addr; + struct pf_addr mask; + } a; + char ifname[IFNAMSIZ]; + char tblname[PF_TABLE_NAME_SIZE]; + } v; + union { + struct pfi_dynaddr *dyn; + struct pfr_ktable *tbl; + int dyncnt; + int tblcnt; + } p; + u_int8_t type; /* PF_ADDR_* */ + u_int8_t iflags; /* PFI_AFLAG_* */ +}; + union pf_rule_ptr { struct pf_rule *ptr; u_int32_t nr; }; +struct pf_rule_uid { + uid_t uid[2]; + u_int8_t op; +}; + +struct pf_rule_gid { + uid_t gid[2]; + u_int8_t op; +}; + +struct pf_rule_addr { + struct pf_addr_wrap addr; + u_int16_t port[2]; + u_int8_t neg; + u_int8_t port_op; +}; + +struct pf_pooladdr { + struct pf_addr_wrap addr; + TAILQ_ENTRY(pf_pooladdr) entries; + char ifname[IFNAMSIZ]; + struct pfi_kif *kif; +}; + +TAILQ_HEAD(pf_palist, pf_pooladdr); + +struct pf_poolhashkey { + union { + u_int8_t key8[16]; + u_int16_t key16[8]; + u_int32_t key32[4]; + } pfk; /* 128-bit hash key */ +#define key8 pfk.key8 +#define key16 pfk.key16 +#define key32 pfk.key32 +}; + +struct pf_pool { + struct pf_palist list; + struct pf_pooladdr *cur; + struct pf_poolhashkey key; + struct pf_addr counter; + int tblidx; + u_int16_t proxy_port[2]; + u_int8_t opts; +}; + +/* A packed Operating System description for fingerprinting */ +typedef u_int32_t pf_osfp_t; +#define PF_OSFP_ANY ((pf_osfp_t)0) +#define PF_OSFP_UNKNOWN ((pf_osfp_t)-1) +#define PF_OSFP_NOMATCH ((pf_osfp_t)-2) + +struct pf_osfp_entry { + SLIST_ENTRY(pf_osfp_entry) fp_entry; + pf_osfp_t fp_os; + int fp_enflags; +#define PF_OSFP_EXPANDED 0x001 /* expanded entry */ +#define PF_OSFP_GENERIC 0x002 /* generic signature */ +#define PF_OSFP_NODETAIL 0x004 /* no p0f details */ +#define PF_OSFP_LEN 32 + char fp_class_nm[PF_OSFP_LEN]; + char fp_version_nm[PF_OSFP_LEN]; + char fp_subtype_nm[PF_OSFP_LEN]; +}; +#define PF_OSFP_ENTRY_EQ(a, b) \ + ((a)->fp_os == (b)->fp_os && \ + memcmp((a)->fp_class_nm, (b)->fp_class_nm, PF_OSFP_LEN) == 0 && \ + memcmp((a)->fp_version_nm, (b)->fp_version_nm, PF_OSFP_LEN) == 0 && \ + memcmp((a)->fp_subtype_nm, (b)->fp_subtype_nm, PF_OSFP_LEN) == 0) + +/* handle pf_osfp_t packing */ +#define _FP_RESERVED_BIT 1 /* For the special negative #defines */ +#define _FP_UNUSED_BITS 1 +#define _FP_CLASS_BITS 10 /* OS Class (Windows, Linux) */ +#define _FP_VERSION_BITS 10 /* OS version (95, 98, NT, 2.4.54, 3.2) */ +#define _FP_SUBTYPE_BITS 10 /* patch level (NT SP4, SP3, ECN patch) */ +#define PF_OSFP_UNPACK(osfp, class, version, subtype) do { \ + (class) = ((osfp) >> (_FP_VERSION_BITS+_FP_SUBTYPE_BITS)) & \ + ((1 << _FP_CLASS_BITS) - 1); \ + (version) = ((osfp) >> _FP_SUBTYPE_BITS) & \ + ((1 << _FP_VERSION_BITS) - 1);\ + (subtype) = (osfp) & ((1 << _FP_SUBTYPE_BITS) - 1); \ +} while(0) +#define PF_OSFP_PACK(osfp, class, version, subtype) do { \ + (osfp) = ((class) & ((1 << _FP_CLASS_BITS) - 1)) << (_FP_VERSION_BITS \ + + _FP_SUBTYPE_BITS); \ + (osfp) |= ((version) & ((1 << _FP_VERSION_BITS) - 1)) << \ + _FP_SUBTYPE_BITS; \ + (osfp) |= (subtype) & ((1 << _FP_SUBTYPE_BITS) - 1); \ +} while(0) + +/* the fingerprint of an OSes TCP SYN packet */ +typedef u_int64_t pf_tcpopts_t; +struct pf_os_fingerprint { + SLIST_HEAD(pf_osfp_enlist, pf_osfp_entry) fp_oses; /* list of matches */ + pf_tcpopts_t fp_tcpopts; /* packed TCP options */ + u_int16_t fp_wsize; /* TCP window size */ + u_int16_t fp_psize; /* ip->ip_len */ + u_int16_t fp_mss; /* TCP MSS */ + u_int16_t fp_flags; +#define PF_OSFP_WSIZE_MOD 0x0001 /* Window modulus */ +#define PF_OSFP_WSIZE_DC 0x0002 /* Window don't care */ +#define PF_OSFP_WSIZE_MSS 0x0004 /* Window multiple of MSS */ +#define PF_OSFP_WSIZE_MTU 0x0008 /* Window multiple of MTU */ +#define PF_OSFP_PSIZE_MOD 0x0010 /* packet size modulus */ +#define PF_OSFP_PSIZE_DC 0x0020 /* packet size don't care */ +#define PF_OSFP_WSCALE 0x0040 /* TCP window scaling */ +#define PF_OSFP_WSCALE_MOD 0x0080 /* TCP window scale modulus */ +#define PF_OSFP_WSCALE_DC 0x0100 /* TCP window scale dont-care */ +#define PF_OSFP_MSS 0x0200 /* TCP MSS */ +#define PF_OSFP_MSS_MOD 0x0400 /* TCP MSS modulus */ +#define PF_OSFP_MSS_DC 0x0800 /* TCP MSS dont-care */ +#define PF_OSFP_DF 0x1000 /* IPv4 don't fragment bit */ +#define PF_OSFP_TS0 0x2000 /* Zero timestamp */ +#define PF_OSFP_INET6 0x4000 /* IPv6 */ + u_int8_t fp_optcnt; /* TCP option count */ + u_int8_t fp_wscale; /* TCP window scaling */ + u_int8_t fp_ttl; /* IPv4 TTL */ +#define PF_OSFP_MAXTTL_OFFSET 40 +/* TCP options packing */ +#define PF_OSFP_TCPOPT_NOP 0x0 /* TCP NOP option */ +#define PF_OSFP_TCPOPT_WSCALE 0x1 /* TCP window scaling option */ +#define PF_OSFP_TCPOPT_MSS 0x2 /* TCP max segment size opt */ +#define PF_OSFP_TCPOPT_SACK 0x3 /* TCP SACK OK option */ +#define PF_OSFP_TCPOPT_TS 0x4 /* TCP timestamp option */ +#define PF_OSFP_TCPOPT_BITS 3 /* bits used by each option */ +#define PF_OSFP_MAX_OPTS \ + (sizeof(((struct pf_os_fingerprint *)0)->fp_tcpopts) * 8) \ + / PF_OSFP_TCPOPT_BITS + + SLIST_ENTRY(pf_os_fingerprint) fp_next; +}; + +struct pf_osfp_ioctl { + struct pf_osfp_entry fp_os; + pf_tcpopts_t fp_tcpopts; /* packed TCP options */ + u_int16_t fp_wsize; /* TCP window size */ + u_int16_t fp_psize; /* ip->ip_len */ + u_int16_t fp_mss; /* TCP MSS */ + u_int16_t fp_flags; + u_int8_t fp_optcnt; /* TCP option count */ + u_int8_t fp_wscale; /* TCP window scaling */ + u_int8_t fp_ttl; /* IPv4 TTL */ + + int fp_getnum; /* DIOCOSFPGET number */ +}; + +#define PF_ANCHOR_NAME_SIZE 64 + +struct pf_rule { + struct pf_rule_addr src; + struct pf_rule_addr dst; +#define PF_SKIP_IFP 0 +#define PF_SKIP_DIR 1 +#define PF_SKIP_AF 2 +#define PF_SKIP_PROTO 3 +#define PF_SKIP_SRC_ADDR 4 +#define PF_SKIP_SRC_PORT 5 +#define PF_SKIP_DST_ADDR 6 +#define PF_SKIP_DST_PORT 7 +#define PF_SKIP_COUNT 8 + union pf_rule_ptr skip[PF_SKIP_COUNT]; +#define PF_RULE_LABEL_SIZE 64 + char label[PF_RULE_LABEL_SIZE]; + char ifname[IFNAMSIZ]; + char qname[PF_QNAME_SIZE]; + char pqname[PF_QNAME_SIZE]; +#define PF_TAG_NAME_SIZE 64 + char tagname[PF_TAG_NAME_SIZE]; + char match_tagname[PF_TAG_NAME_SIZE]; + + char overload_tblname[PF_TABLE_NAME_SIZE]; + + TAILQ_ENTRY(pf_rule) entries; + struct pf_pool rpool; + + u_int64_t evaluations; + u_int64_t packets[2]; + u_int64_t bytes[2]; + + struct pfi_kif *kif; + struct pf_anchor *anchor; + struct pfr_ktable *overload_tbl; + + pf_osfp_t os_fingerprint; + + int rtableid; + u_int32_t timeout[PFTM_MAX]; + u_int32_t max_states; + u_int32_t max_src_nodes; + u_int32_t max_src_states; + u_int32_t max_src_conn; + struct { + u_int32_t limit; + u_int32_t seconds; + } max_src_conn_rate; + u_int32_t qid; + u_int32_t pqid; + u_int32_t rt_listid; + u_int32_t nr; + u_int32_t prob; + uid_t cuid; + pid_t cpid; + + counter_u64_t states_cur; + counter_u64_t states_tot; + counter_u64_t src_nodes; + + u_int16_t return_icmp; + u_int16_t return_icmp6; + u_int16_t max_mss; + u_int16_t tag; + u_int16_t match_tag; + u_int16_t scrub_flags; + + struct pf_rule_uid uid; + struct pf_rule_gid gid; + + u_int32_t rule_flag; + u_int8_t action; + u_int8_t direction; + u_int8_t log; + u_int8_t logif; + u_int8_t quick; + u_int8_t ifnot; + u_int8_t match_tag_not; + u_int8_t natpass; + +#define PF_STATE_NORMAL 0x1 +#define PF_STATE_MODULATE 0x2 +#define PF_STATE_SYNPROXY 0x3 + u_int8_t keep_state; + sa_family_t af; + u_int8_t proto; + u_int8_t type; + u_int8_t code; + u_int8_t flags; + u_int8_t flagset; + u_int8_t min_ttl; + u_int8_t allow_opts; + u_int8_t rt; + u_int8_t return_ttl; + u_int8_t tos; + u_int8_t set_tos; + u_int8_t anchor_relative; + u_int8_t anchor_wildcard; + +#define PF_FLUSH 0x01 +#define PF_FLUSH_GLOBAL 0x02 + u_int8_t flush; +#define PF_PRIO_ZERO 0xff /* match "prio 0" packets */ +#define PF_PRIO_MAX 7 + u_int8_t prio; + u_int8_t set_prio[2]; + + struct { + struct pf_addr addr; + u_int16_t port; + } divert; + + uint64_t u_states_cur; + uint64_t u_states_tot; + uint64_t u_src_nodes; +}; + +/* rule flags */ +#define PFRULE_DROP 0x0000 +#define PFRULE_RETURNRST 0x0001 +#define PFRULE_FRAGMENT 0x0002 +#define PFRULE_RETURNICMP 0x0004 +#define PFRULE_RETURN 0x0008 +#define PFRULE_NOSYNC 0x0010 +#define PFRULE_SRCTRACK 0x0020 /* track source states */ +#define PFRULE_RULESRCTRACK 0x0040 /* per rule */ +#define PFRULE_REFS 0x0080 /* rule has references */ + +/* scrub flags */ +#define PFRULE_NODF 0x0100 +#define PFRULE_RANDOMID 0x0800 +#define PFRULE_REASSEMBLE_TCP 0x1000 +#define PFRULE_SET_TOS 0x2000 + +/* rule flags again */ +#define PFRULE_IFBOUND 0x00010000 /* if-bound */ +#define PFRULE_STATESLOPPY 0x00020000 /* sloppy state tracking */ + +#define PFSTATE_HIWAT 100000 /* default state table size */ +#define PFSTATE_ADAPT_START 60000 /* default adaptive timeout start */ +#define PFSTATE_ADAPT_END 120000 /* default adaptive timeout end */ + + struct pf_threshold { u_int32_t limit; #define PF_THRESHOLD_MULT 1000 From owner-dev-commits-src-all@freebsd.org Tue Jan 5 22:37:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EDEDF4CF0D2; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@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 4D9S7Q6J1hz3hby; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB81A13DEE; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105MbsZo081475; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105MbsgU081474; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git) Date: Tue, 5 Jan 2021 22:37:54 GMT Message-Id: <202101052237.105MbsgU081474@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 26c841e2a402 - main - pf: Allocate and free pfi_kkif in separate functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 26c841e2a402ed43896313d1b3f00facaa9d839f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 22:37:55 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=26c841e2a402ed43896313d1b3f00facaa9d839f commit 26c841e2a402ed43896313d1b3f00facaa9d839f Author: Kristof Provost AuthorDate: 2020-12-13 10:36:54 +0000 Commit: Kristof Provost CommitDate: 2021-01-05 22:35:37 +0000 pf: Allocate and free pfi_kkif in separate functions Factor out allocating and freeing pfi_kkif structures. This will be useful when we change the counters to be counter_u64, so we don't have to deal with that complexity in the multiple locations where we allocate pfi_kkif structures. No functional change. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27762 --- sys/net/pfvar.h | 3 +++ sys/netpfil/pf/pf_if.c | 41 ++++++++++++++++++++++++++++++----------- sys/netpfil/pf/pf_ioctl.c | 16 ++++++++-------- 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index d72d06490040..65328941ff01 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1675,6 +1675,9 @@ struct pf_krule *pf_get_translation(struct pf_pdesc *, struct mbuf *, struct pf_state_key *pf_state_key_setup(struct pf_pdesc *, struct pf_addr *, struct pf_addr *, u_int16_t, u_int16_t); struct pf_state_key *pf_state_key_clone(struct pf_state_key *); + +struct pfi_kkif *pf_kkif_create(int); +void pf_kkif_free(struct pfi_kkif *); #endif /* _KERNEL */ #endif /* _NET_PFVAR_H_ */ diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index aa10f0cc9a54..5c389d7a45c5 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -133,7 +133,7 @@ pfi_initialize_vnet(void) nkifs++; for (int n = 0; n < nkifs; n++) { - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); LIST_INSERT_HEAD(&kifs, kif, pfik_list); } @@ -193,13 +193,13 @@ pfi_cleanup_vnet(void) if_rele(kif->pfik_ifp); kif->pfik_ifp->if_pf_kif = NULL; } - free(kif, PFI_MTYPE); + pf_kkif_free(kif); } mtx_lock(&pfi_unlnkdkifs_mtx); while ((kif = LIST_FIRST(&V_pfi_unlinked_kifs))) { LIST_REMOVE(kif, pfik_list); - free(kif, PFI_MTYPE); + pf_kkif_free(kif); } mtx_unlock(&pfi_unlnkdkifs_mtx); @@ -218,6 +218,25 @@ pfi_cleanup(void) EVENTHANDLER_DEREGISTER(ifaddr_event, pfi_ifaddr_event_cookie); } +struct pfi_kkif* +pf_kkif_create(int flags) +{ + struct pfi_kkif *kif; + + kif = malloc(sizeof(*kif), PFI_MTYPE, flags); + + return (kif); +} + +void +pf_kkif_free(struct pfi_kkif *kif) +{ + if (! kif) + return; + + free(kif, PFI_MTYPE); +} + struct pfi_kkif * pfi_kkif_find(const char *kif_name) { @@ -241,7 +260,7 @@ pfi_kkif_attach(struct pfi_kkif *kif, const char *kif_name) kif1 = pfi_kkif_find(kif_name); if (kif1 != NULL) { - free(kif, PFI_MTYPE); + pf_kkif_free(kif); return (kif1); } @@ -310,7 +329,7 @@ pfi_kkif_purge(void) LIST_FOREACH_SAFE(kif, &V_pfi_unlinked_kifs, pfik_list, kif1) { if (!(kif->pfik_flags & PFI_IFLAG_REFS)) { LIST_REMOVE(kif, pfik_list); - free(kif, PFI_MTYPE); + pf_kkif_free(kif); } else kif->pfik_flags &= ~PFI_IFLAG_REFS; } @@ -415,7 +434,7 @@ pfi_dynaddr_setup(struct pf_addr_wrap *aw, sa_family_t af) if ((dyn = malloc(sizeof(*dyn), PFI_MTYPE, M_NOWAIT | M_ZERO)) == NULL) return (ENOMEM); - if ((kif = malloc(sizeof(*kif), PFI_MTYPE, M_NOWAIT)) == NULL) { + if ((kif = pf_kkif_create(M_NOWAIT)) == NULL) { free(dyn, PFI_MTYPE); return (ENOMEM); } @@ -825,7 +844,7 @@ pfi_set_flags(const char *name, int flags) struct epoch_tracker et; struct pfi_kkif *p, *kif; - kif = malloc(sizeof(*kif), PFI_MTYPE, M_NOWAIT); + kif = pf_kkif_create(M_NOWAIT); if (kif == NULL) return (ENOMEM); @@ -858,7 +877,7 @@ pfi_clear_flags(const char *name, int flags) p->pfik_flags == 0 && p->pfik_rulerefs == 0) { /* Delete this kif. */ RB_REMOVE(pfi_ifhead, &V_pfi_ifs, p); - free(p, PFI_MTYPE); + pf_kkif_free(p); } } NET_EPOCH_EXIT(et); @@ -895,7 +914,7 @@ pfi_attach_ifnet_event(void *arg __unused, struct ifnet *ifp) /* Avoid teardown race in the least expensive way. */ return; } - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_NOWAIT); NET_EPOCH_ENTER(et); PF_RULES_WLOCK(); pfi_attach_ifnet(ifp, kif); @@ -950,7 +969,7 @@ pfi_attach_group_event(void *arg __unused, struct ifg_group *ifg) /* Avoid teardown race in the least expensive way. */ return; } - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); NET_EPOCH_ENTER(et); PF_RULES_WLOCK(); pfi_attach_ifgroup(ifg, kif); @@ -969,7 +988,7 @@ pfi_change_group_event(void *arg __unused, char *gname) return; } - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); NET_EPOCH_ENTER(et); PF_RULES_WLOCK(); V_pfi_update++; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 9ba9e4315baa..b6e2ec98ddce 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1837,7 +1837,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td pf_rule_to_krule(&pr->rule, rule); if (rule->ifname[0]) - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); rule->evaluations = counter_u64_alloc(M_WAITOK); for (int i = 0; i < 2; i++) { rule->packets[i] = counter_u64_alloc(M_WAITOK); @@ -1979,7 +1979,7 @@ DIOCADDRULE_error: counter_u64_free(rule->src_nodes); free(rule, M_PFRULE); if (kif) - free(kif, PFI_MTYPE); + pf_kkif_free(kif); break; } @@ -2106,7 +2106,7 @@ DIOCADDRULE_error: pf_rule_to_krule(&pcr->rule, newrule); if (newrule->ifname[0]) - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); newrule->evaluations = counter_u64_alloc(M_WAITOK); for (int i = 0; i < 2; i++) { newrule->packets[i] = @@ -2296,7 +2296,7 @@ DIOCCHANGERULE_error: free(newrule, M_PFRULE); } if (kif != NULL) - free(kif, PFI_MTYPE); + pf_kkif_free(kif); break; } @@ -2932,12 +2932,12 @@ DIOCGETSTATES_full: pa = malloc(sizeof(*pa), M_PFRULE, M_WAITOK); pf_pooladdr_to_kpooladdr(&pp->addr, pa); if (pa->ifname[0]) - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); PF_RULES_WLOCK(); if (pp->ticket != V_ticket_pabuf) { PF_RULES_WUNLOCK(); if (pa->ifname[0]) - free(kif, PFI_MTYPE); + pf_kkif_free(kif); free(pa, M_PFRULE); error = EBUSY; break; @@ -3049,7 +3049,7 @@ DIOCGETSTATES_full: newpa = malloc(sizeof(*newpa), M_PFRULE, M_WAITOK); bcopy(&pca->addr, newpa, sizeof(struct pf_pooladdr)); if (newpa->ifname[0]) - kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); + kif = pf_kkif_create(M_WAITOK); newpa->kif = NULL; } #define ERROUT(x) { error = (x); goto DIOCCHANGEADDR_error; } @@ -3140,7 +3140,7 @@ DIOCCHANGEADDR_error: } PF_RULES_WUNLOCK(); if (kif != NULL) - free(kif, PFI_MTYPE); + pf_kkif_free(kif); break; } From owner-dev-commits-src-all@freebsd.org Tue Jan 5 22:37:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1B0B94CF450; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@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 4D9S7R0Ch5z3hP8; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECA591413B; Tue, 5 Jan 2021 22:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105Mbssp081526; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105Mbs9t081525; Tue, 5 Jan 2021 22:37:54 GMT (envelope-from git) Date: Tue, 5 Jan 2021 22:37:54 GMT Message-Id: <202101052237.105Mbs9t081525@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c7bdafe2f1b7 - main - pf: Remove unused fields from pf_krule MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c7bdafe2f1b703fdf72489019edc3d6b9e5483da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 22:37:55 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c7bdafe2f1b703fdf72489019edc3d6b9e5483da commit c7bdafe2f1b703fdf72489019edc3d6b9e5483da Author: Kristof Provost AuthorDate: 2020-12-05 13:38:12 +0000 Commit: Kristof Provost CommitDate: 2021-01-05 22:35:36 +0000 pf: Remove unused fields from pf_krule The u_* counters are used only to communicate with userspace, as userspace cannot use counter_u64. As pf_krule is not passed to userspace these fields are now obsolete. MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27759 --- sys/net/pfvar.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 846c6b9015e7..c0828fa420f9 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -391,10 +391,6 @@ struct pf_krule { struct pf_addr addr; u_int16_t port; } divert; - - uint64_t u_states_cur; - uint64_t u_states_tot; - uint64_t u_src_nodes; }; struct pf_ksrc_node { From owner-dev-commits-src-all@freebsd.org Tue Jan 5 22:37:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6E9284CF502; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@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 4D9S7R1bVHz3hhL; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2400113DEF; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105MbtCh081579; Tue, 5 Jan 2021 22:37:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105MbtVd081578; Tue, 5 Jan 2021 22:37:55 GMT (envelope-from git) Date: Tue, 5 Jan 2021 22:37:55 GMT Message-Id: <202101052237.105MbtVd081578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: fbbf270eef27 - main - pf: Use counter_u64 in pf_src_node MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fbbf270eef271806a0a106e45356d91f5b5e1f55 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 22:37:55 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fbbf270eef271806a0a106e45356d91f5b5e1f55 commit fbbf270eef271806a0a106e45356d91f5b5e1f55 Author: Kristof Provost AuthorDate: 2020-11-13 19:31:51 +0000 Commit: Kristof Provost CommitDate: 2021-01-05 22:35:36 +0000 pf: Use counter_u64 in pf_src_node Reviewd by: philip MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27756 --- sys/net/pfvar.h | 4 ++-- sys/netpfil/pf/pf.c | 50 ++++++++++++++++++++++++++++++++++++++--------- sys/netpfil/pf/pf_ioctl.c | 7 +++++-- 3 files changed, 48 insertions(+), 13 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index ddbecff8ee8a..0b6299268b5e 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -615,8 +615,8 @@ struct pf_ksrc_node { struct pf_addr raddr; union pf_rule_ptr rule; struct pfi_kif *kif; - u_int64_t bytes[2]; - u_int64_t packets[2]; + counter_u64_t bytes[2]; + counter_u64_t packets[2]; u_int32_t states; u_int32_t conn; struct pf_threshold conn_rate; diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 7d02bbab367d..6f393bd62698 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -702,6 +702,19 @@ pf_find_src_node(struct pf_addr *src, struct pf_rule *rule, sa_family_t af, return (n); } +static void +pf_free_src_node(struct pf_ksrc_node *sn) +{ + + for (int i = 0; i < 2; i++) { + if (sn->bytes[i]) + counter_u64_free(sn->bytes[i]); + if (sn->packets[i]) + counter_u64_free(sn->packets[i]); + } + uma_zfree(V_pf_sources_z, sn); +} + static int pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_rule *rule, struct pf_addr *src, sa_family_t af) @@ -730,6 +743,17 @@ pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_rule *rule, return (-1); } + for (int i = 0; i < 2; i++) { + (*sn)->bytes[i] = counter_u64_alloc(M_NOWAIT); + (*sn)->packets[i] = counter_u64_alloc(M_NOWAIT); + + if ((*sn)->bytes[i] == NULL || (*sn)->packets[i] == NULL) { + pf_free_src_node(*sn); + PF_HASHROW_UNLOCK(sh); + return (-1); + } + } + pf_init_threshold(&(*sn)->conn_rate, rule->max_src_conn_rate.limit, rule->max_src_conn_rate.seconds); @@ -773,7 +797,7 @@ pf_free_src_nodes(struct pf_ksrc_node_list *head) u_int count = 0; LIST_FOREACH_SAFE(sn, head, entry, tmp) { - uma_zfree(V_pf_sources_z, sn); + pf_free_src_node(sn); count++; } @@ -6189,12 +6213,16 @@ done: s->nat_rule.ptr->bytes[dirndx] += pd.tot_len; } if (s->src_node != NULL) { - s->src_node->packets[dirndx]++; - s->src_node->bytes[dirndx] += pd.tot_len; + counter_u64_add(s->src_node->packets[dirndx], + 1); + counter_u64_add(s->src_node->bytes[dirndx], + pd.tot_len); } if (s->nat_src_node != NULL) { - s->nat_src_node->packets[dirndx]++; - s->nat_src_node->bytes[dirndx] += pd.tot_len; + counter_u64_add(s->nat_src_node->packets[dirndx], + 1); + counter_u64_add(s->nat_src_node->bytes[dirndx], + pd.tot_len); } dirndx = (dir == s->direction) ? 0 : 1; counter_u64_add(s->packets[dirndx], 1); @@ -6585,12 +6613,16 @@ done: s->nat_rule.ptr->bytes[dirndx] += pd.tot_len; } if (s->src_node != NULL) { - s->src_node->packets[dirndx]++; - s->src_node->bytes[dirndx] += pd.tot_len; + counter_u64_add(s->src_node->packets[dirndx], + 1); + counter_u64_add(s->src_node->bytes[dirndx], + pd.tot_len); } if (s->nat_src_node != NULL) { - s->nat_src_node->packets[dirndx]++; - s->nat_src_node->bytes[dirndx] += pd.tot_len; + counter_u64_add(s->nat_src_node->packets[dirndx], + 1); + counter_u64_add(s->nat_src_node->bytes[dirndx], + pd.tot_len); } dirndx = (dir == s->direction) ? 0 : 1; counter_u64_add(s->packets[dirndx], 1); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index ed1bac339712..bb7034f27daf 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1161,8 +1161,11 @@ pf_src_node_copy(const struct pf_ksrc_node *in, struct pf_src_node *out) if (in->rule.ptr != NULL) out->rule.nr = in->rule.ptr->nr; - bcopy(&in->bytes, &out->bytes, sizeof(u_int64_t) * 2); - bcopy(&in->packets, &out->packets, sizeof(u_int64_t) * 2); + for (int i = 0; i < 2; i++) { + out->bytes[i] = counter_u64_fetch(in->bytes[i]); + out->packets[i] = counter_u64_fetch(in->packets[i]); + } + out->states = in->states; out->conn = in->conn; out->af = in->af; From owner-dev-commits-src-all@freebsd.org Tue Jan 5 22:37:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 932AA4CF482; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@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 4D9S7R2b2Dz3hQJ; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44BA213F4C; Tue, 5 Jan 2021 22:37:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 105MbtqL081596; Tue, 5 Jan 2021 22:37:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 105MbtKT081595; Tue, 5 Jan 2021 22:37:55 GMT (envelope-from git) Date: Tue, 5 Jan 2021 22:37:55 GMT Message-Id: <202101052237.105MbtKT081595@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 17ad7334ca62 - main - pf: Split pf_src_node into a kernel and userspace struct MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 17ad7334ca6225e0dc5caca12d1eb5886115f7af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 22:37:55 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=17ad7334ca6225e0dc5caca12d1eb5886115f7af commit 17ad7334ca6225e0dc5caca12d1eb5886115f7af Author: Kristof Provost AuthorDate: 2020-12-23 13:51:52 +0000 Commit: Kristof Provost CommitDate: 2021-01-05 22:35:36 +0000 pf: Split pf_src_node into a kernel and userspace struct Introduce a kernel version of struct pf_src_node (pf_ksrc_node). This will allow us to improve the in-kernel data structure without breaking userspace compatibility. Reviewed by: philip MFC after: 2 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D27707 --- sys/net/pfvar.h | 55 +++++++++----------------------------- sys/netpfil/pf/pf.c | 34 ++++++++++++------------ sys/netpfil/pf/pf.h | 50 +++++++++++++++++++++++++++++++++++ sys/netpfil/pf/pf_ioctl.c | 67 +++++++++++++++++++++++++++++++---------------- sys/netpfil/pf/pf_lb.c | 8 +++--- 5 files changed, 129 insertions(+), 85 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index eadd3c785d73..ddbecff8ee8a 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -54,21 +54,6 @@ #include #include -struct pf_addr { - union { - struct in_addr v4; - struct in6_addr v6; - u_int8_t addr8[16]; - u_int16_t addr16[8]; - u_int32_t addr32[4]; - } pfa; /* 128-bit address */ -#define v4 pfa.v4 -#define v6 pfa.v6 -#define addr8 pfa.addr8 -#define addr16 pfa.addr16 -#define addr32 pfa.addr32 -}; - #define PFI_AFLAG_NETWORK 0x01 #define PFI_AFLAG_BROADCAST 0x02 #define PFI_AFLAG_PEER 0x04 @@ -480,11 +465,6 @@ struct pf_osfp_ioctl { int fp_getnum; /* DIOCOSFPGET number */ }; -union pf_rule_ptr { - struct pf_rule *ptr; - u_int32_t nr; -}; - #define PF_ANCHOR_NAME_SIZE 64 struct pf_rule { @@ -628,17 +608,9 @@ struct pf_rule { #define PFSTATE_ADAPT_START 60000 /* default adaptive timeout start */ #define PFSTATE_ADAPT_END 120000 /* default adaptive timeout end */ -struct pf_threshold { - u_int32_t limit; -#define PF_THRESHOLD_MULT 1000 -#define PF_THRESHOLD_MAX 0xffffffff / PF_THRESHOLD_MULT - u_int32_t seconds; - u_int32_t count; - u_int32_t last; -}; - -struct pf_src_node { - LIST_ENTRY(pf_src_node) entry; +#ifdef _KERNEL +struct pf_ksrc_node { + LIST_ENTRY(pf_ksrc_node) entry; struct pf_addr addr; struct pf_addr raddr; union pf_rule_ptr rule; @@ -653,8 +625,7 @@ struct pf_src_node { sa_family_t af; u_int8_t ruletype; }; - -#define PFSNODE_HIWAT 10000 /* default source node table size */ +#endif struct pf_state_scrub { struct timeval pfss_last; /* time received last packet */ @@ -738,8 +709,8 @@ struct pf_state { struct pf_state_key *key[2]; /* addresses stack and wire */ struct pfi_kif *kif; struct pfi_kif *rt_kif; - struct pf_src_node *src_node; - struct pf_src_node *nat_src_node; + struct pf_ksrc_node *src_node; + struct pf_ksrc_node *nat_src_node; counter_u64_t packets[2]; counter_u64_t bytes[2]; u_int32_t creation; @@ -1581,9 +1552,9 @@ struct pf_ifspeed_v1 { #endif /* _KERNEL */ #ifdef _KERNEL -LIST_HEAD(pf_src_node_list, pf_src_node); +LIST_HEAD(pf_ksrc_node_list, pf_ksrc_node); struct pf_srchash { - struct pf_src_node_list nodes; + struct pf_ksrc_node_list nodes; struct mtx lock; }; @@ -1695,10 +1666,10 @@ pf_release_state(struct pf_state *s) extern struct pf_state *pf_find_state_byid(uint64_t, uint32_t); extern struct pf_state *pf_find_state_all(struct pf_state_key_cmp *, u_int, int *); -extern struct pf_src_node *pf_find_src_node(struct pf_addr *, +extern struct pf_ksrc_node *pf_find_src_node(struct pf_addr *, struct pf_rule *, sa_family_t, int); -extern void pf_unlink_src_node(struct pf_src_node *); -extern u_int pf_free_src_nodes(struct pf_src_node_list *); +extern void pf_unlink_src_node(struct pf_ksrc_node *); +extern u_int pf_free_src_nodes(struct pf_ksrc_node_list *); extern void pf_print_state(struct pf_state *); extern void pf_print_flags(u_int8_t); extern u_int16_t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t, @@ -1890,9 +1861,9 @@ int pf_step_out_of_anchor(struct pf_anchor_stackframe *, int *, int pf_map_addr(u_int8_t, struct pf_rule *, struct pf_addr *, struct pf_addr *, - struct pf_addr *, struct pf_src_node **); + struct pf_addr *, struct pf_ksrc_node **); struct pf_rule *pf_get_translation(struct pf_pdesc *, struct mbuf *, - int, int, struct pfi_kif *, struct pf_src_node **, + int, int, struct pfi_kif *, struct pf_ksrc_node **, struct pf_state_key **, struct pf_state_key **, struct pf_addr *, struct pf_addr *, uint16_t, uint16_t, struct pf_anchor_stackframe *); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 3cb423d8afa7..7d02bbab367d 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -249,7 +249,7 @@ static int pf_test_rule(struct pf_rule **, struct pf_state **, struct pf_ruleset **, struct inpcb *); static int pf_create_state(struct pf_rule *, struct pf_rule *, struct pf_rule *, struct pf_pdesc *, - struct pf_src_node *, struct pf_state_key *, + struct pf_ksrc_node *, struct pf_state_key *, struct pf_state_key *, struct mbuf *, int, u_int16_t, u_int16_t, int *, struct pfi_kif *, struct pf_state **, int, u_int16_t, u_int16_t, @@ -294,7 +294,7 @@ static struct pf_state *pf_find_state(struct pfi_kif *, struct pf_state_key_cmp *, u_int); static int pf_src_connlimit(struct pf_state **); static void pf_overload_task(void *v, int pending); -static int pf_insert_src_node(struct pf_src_node **, +static int pf_insert_src_node(struct pf_ksrc_node **, struct pf_rule *, struct pf_addr *, sa_family_t); static u_int pf_purge_expired_states(u_int, int); static void pf_purge_unlinked_rules(void); @@ -677,12 +677,12 @@ pf_overload_task(void *v, int pending) * Can return locked on failure, so that we can consistently * allocate and insert a new one. */ -struct pf_src_node * +struct pf_ksrc_node * pf_find_src_node(struct pf_addr *src, struct pf_rule *rule, sa_family_t af, int returnlocked) { struct pf_srchash *sh; - struct pf_src_node *n; + struct pf_ksrc_node *n; counter_u64_add(V_pf_status.scounters[SCNT_SRC_NODE_SEARCH], 1); @@ -703,7 +703,7 @@ pf_find_src_node(struct pf_addr *src, struct pf_rule *rule, sa_family_t af, } static int -pf_insert_src_node(struct pf_src_node **sn, struct pf_rule *rule, +pf_insert_src_node(struct pf_ksrc_node **sn, struct pf_rule *rule, struct pf_addr *src, sa_family_t af) { @@ -757,7 +757,7 @@ pf_insert_src_node(struct pf_src_node **sn, struct pf_rule *rule, } void -pf_unlink_src_node(struct pf_src_node *src) +pf_unlink_src_node(struct pf_ksrc_node *src) { PF_HASHROW_ASSERT(&V_pf_srchash[pf_hashsrc(&src->addr, src->af)]); @@ -767,9 +767,9 @@ pf_unlink_src_node(struct pf_src_node *src) } u_int -pf_free_src_nodes(struct pf_src_node_list *head) +pf_free_src_nodes(struct pf_ksrc_node_list *head) { - struct pf_src_node *sn, *tmp; + struct pf_ksrc_node *sn, *tmp; u_int count = 0; LIST_FOREACH_SAFE(sn, head, entry, tmp) { @@ -845,7 +845,7 @@ pf_initialize() /* Source nodes. */ V_pf_sources_z = uma_zcreate("pf source nodes", - sizeof(struct pf_src_node), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, + sizeof(struct pf_ksrc_node), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); V_pf_limits[PF_LIMIT_SRC_NODES].zone = V_pf_sources_z; uma_zone_set_max(V_pf_sources_z, PFSNODE_HIWAT); @@ -1596,9 +1596,9 @@ pf_state_expires(const struct pf_state *state) void pf_purge_expired_src_nodes() { - struct pf_src_node_list freelist; + struct pf_ksrc_node_list freelist; struct pf_srchash *sh; - struct pf_src_node *cur, *next; + struct pf_ksrc_node *cur, *next; int i; LIST_INIT(&freelist); @@ -1621,7 +1621,7 @@ pf_purge_expired_src_nodes() static void pf_src_tree_remove_state(struct pf_state *s) { - struct pf_src_node *sn; + struct pf_ksrc_node *sn; struct pf_srchash *sh; uint32_t timeout; @@ -3310,7 +3310,7 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction, sa_family_t af = pd->af; struct pf_rule *r, *a = NULL; struct pf_ruleset *ruleset = NULL; - struct pf_src_node *nsn = NULL; + struct pf_ksrc_node *nsn = NULL; struct tcphdr *th = pd->hdr.tcp; struct pf_state_key *sk = NULL, *nk = NULL; u_short reason; @@ -3675,13 +3675,13 @@ cleanup: static int pf_create_state(struct pf_rule *r, struct pf_rule *nr, struct pf_rule *a, - struct pf_pdesc *pd, struct pf_src_node *nsn, struct pf_state_key *nk, + struct pf_pdesc *pd, struct pf_ksrc_node *nsn, struct pf_state_key *nk, struct pf_state_key *sk, struct mbuf *m, int off, u_int16_t sport, u_int16_t dport, int *rewrite, struct pfi_kif *kif, struct pf_state **sm, int tag, u_int16_t bproto_sum, u_int16_t bip_sum, int hdrlen) { struct pf_state *s = NULL; - struct pf_src_node *sn = NULL; + struct pf_ksrc_node *sn = NULL; struct tcphdr *th = pd->hdr.tcp; u_int16_t mss = V_tcp_mssdflt; u_short reason; @@ -5447,7 +5447,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, struct ip *ip; struct ifnet *ifp = NULL; struct pf_addr naddr; - struct pf_src_node *sn = NULL; + struct pf_ksrc_node *sn = NULL; int error = 0; uint16_t ip_len, ip_off; @@ -5610,7 +5610,7 @@ pf_route6(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, struct ip6_hdr *ip6; struct ifnet *ifp = NULL; struct pf_addr naddr; - struct pf_src_node *sn = NULL; + struct pf_ksrc_node *sn = NULL; KASSERT(m && *m && r && oifp, ("%s: invalid parameters", __func__)); KASSERT(dir == PF_IN || dir == PF_OUT, ("%s: invalid direction", diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 253e88049b7c..7add0877224e 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -185,6 +185,8 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define PF_TABLE_NAME_SIZE 32 #define PF_QNAME_SIZE 64 +struct pf_rule; + struct pf_status { uint64_t counters[PFRES_MAX]; uint64_t lcounters[LCNT_MAX]; @@ -202,4 +204,52 @@ struct pf_status { uint8_t pf_chksum[PF_MD5_DIGEST_LENGTH]; }; +struct pf_addr { + union { + struct in_addr v4; + struct in6_addr v6; + u_int8_t addr8[16]; + u_int16_t addr16[8]; + u_int32_t addr32[4]; + } pfa; /* 128-bit address */ +#define v4 pfa.v4 +#define v6 pfa.v6 +#define addr8 pfa.addr8 +#define addr16 pfa.addr16 +#define addr32 pfa.addr32 +}; + +union pf_rule_ptr { + struct pf_rule *ptr; + u_int32_t nr; +}; + +struct pf_threshold { + u_int32_t limit; +#define PF_THRESHOLD_MULT 1000 +#define PF_THRESHOLD_MAX 0xffffffff / PF_THRESHOLD_MULT + u_int32_t seconds; + u_int32_t count; + u_int32_t last; +}; + +struct pf_src_node { + LIST_ENTRY(pf_src_node) entry; + struct pf_addr addr; + struct pf_addr raddr; + union pf_rule_ptr rule; + struct pfi_kif *kif; + u_int64_t bytes[2]; + u_int64_t packets[2]; + u_int32_t states; + u_int32_t conn; + struct pf_threshold conn_rate; + u_int32_t creation; + u_int32_t expire; + sa_family_t af; + u_int8_t ruletype; +}; + +#define PFSNODE_HIWAT 10000 /* default source node table size */ + #endif /* _NET_PF_H_ */ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 9e31d1c966d9..ed1bac339712 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -116,6 +116,8 @@ static int pf_commit_rules(u_int32_t, int, char *); static int pf_addr_setup(struct pf_ruleset *, struct pf_addr_wrap *, sa_family_t); static void pf_addr_copyout(struct pf_addr_wrap *); +static void pf_src_node_copy(const struct pf_ksrc_node *, + struct pf_src_node *); #ifdef ALTQ static int pf_export_kaltq(struct pf_altq *, struct pfioc_altq_v1 *, size_t); @@ -191,7 +193,7 @@ struct cdev *pf_dev; */ static void pf_clear_states(void); static int pf_clear_tables(void); -static void pf_clear_srcnodes(struct pf_src_node *); +static void pf_clear_srcnodes(struct pf_ksrc_node *); static void pf_kill_srcnodes(struct pfioc_src_node_kill *); static void pf_tbladdr_copyout(struct pf_addr_wrap *); @@ -1146,6 +1148,42 @@ pf_addr_copyout(struct pf_addr_wrap *addr) } } +static void +pf_src_node_copy(const struct pf_ksrc_node *in, struct pf_src_node *out) +{ + int secs = time_uptime, diff; + + bzero(out, sizeof(struct pf_src_node)); + + bcopy(&in->addr, &out->addr, sizeof(struct pf_addr)); + bcopy(&in->raddr, &out->raddr, sizeof(struct pf_addr)); + + if (in->rule.ptr != NULL) + out->rule.nr = in->rule.ptr->nr; + + bcopy(&in->bytes, &out->bytes, sizeof(u_int64_t) * 2); + bcopy(&in->packets, &out->packets, sizeof(u_int64_t) * 2); + out->states = in->states; + out->conn = in->conn; + out->af = in->af; + out->ruletype = in->ruletype; + + out->creation = secs - in->creation; + if (out->expire > secs) + out->expire -= secs; + else + out->expire = 0; + + /* Adjust the connection rate estimate. */ + diff = secs - in->conn_rate.last; + if (diff >= in->conn_rate.seconds) + out->conn_rate.count = 0; + else + out->conn_rate.count -= + in->conn_rate.count * diff / + in->conn_rate.seconds; +} + #ifdef ALTQ /* * Handle export of struct pf_kaltq to user binaries that may be using any @@ -3765,7 +3803,8 @@ DIOCCHANGEADDR_error: case DIOCGETSRCNODES: { struct pfioc_src_nodes *psn = (struct pfioc_src_nodes *)addr; struct pf_srchash *sh; - struct pf_src_node *n, *p, *pstore; + struct pf_ksrc_node *n; + struct pf_src_node *p, *pstore; uint32_t i, nr = 0; for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask; @@ -3791,28 +3830,12 @@ DIOCCHANGEADDR_error: i++, sh++) { PF_HASHROW_LOCK(sh); LIST_FOREACH(n, &sh->nodes, entry) { - int secs = time_uptime, diff; if ((nr + 1) * sizeof(*p) > (unsigned)psn->psn_len) break; - bcopy(n, p, sizeof(struct pf_src_node)); - if (n->rule.ptr != NULL) - p->rule.nr = n->rule.ptr->nr; - p->creation = secs - p->creation; - if (p->expire > secs) - p->expire -= secs; - else - p->expire = 0; + pf_src_node_copy(n, p); - /* Adjust the connection rate estimate. */ - diff = secs - n->conn_rate.last; - if (diff >= n->conn_rate.seconds) - p->conn_rate.count = 0; - else - p->conn_rate.count -= - n->conn_rate.count * diff / - n->conn_rate.seconds; p++; nr++; } @@ -4037,7 +4060,7 @@ pf_clear_tables(void) } static void -pf_clear_srcnodes(struct pf_src_node *n) +pf_clear_srcnodes(struct pf_ksrc_node *n) { struct pf_state *s; int i; @@ -4077,12 +4100,12 @@ pf_clear_srcnodes(struct pf_src_node *n) static void pf_kill_srcnodes(struct pfioc_src_node_kill *psnk) { - struct pf_src_node_list kill; + struct pf_ksrc_node_list kill; LIST_INIT(&kill); for (int i = 0; i <= pf_srchashmask; i++) { struct pf_srchash *sh = &V_pf_srchash[i]; - struct pf_src_node *sn, *tmp; + struct pf_ksrc_node *sn, *tmp; PF_HASHROW_LOCK(sh); LIST_FOREACH_SAFE(sn, &sh->nodes, entry, tmp) diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index 5b95b7405a68..e8188e9ff4fb 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -64,7 +64,7 @@ static struct pf_rule *pf_match_translation(struct pf_pdesc *, struct mbuf *, uint16_t, int, struct pf_anchor_stackframe *); static int pf_get_sport(sa_family_t, uint8_t, struct pf_rule *, struct pf_addr *, uint16_t, struct pf_addr *, uint16_t, struct pf_addr *, - uint16_t *, uint16_t, uint16_t, struct pf_src_node **); + uint16_t *, uint16_t, uint16_t, struct pf_ksrc_node **); #define mix(a,b,c) \ do { \ @@ -215,7 +215,7 @@ static int pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_rule *r, struct pf_addr *saddr, uint16_t sport, struct pf_addr *daddr, uint16_t dport, struct pf_addr *naddr, uint16_t *nport, uint16_t low, - uint16_t high, struct pf_src_node **sn) + uint16_t high, struct pf_ksrc_node **sn) { struct pf_state_key_cmp key; struct pf_addr init_addr; @@ -312,7 +312,7 @@ pf_get_sport(sa_family_t af, u_int8_t proto, struct pf_rule *r, int pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr, - struct pf_addr *naddr, struct pf_addr *init_addr, struct pf_src_node **sn) + struct pf_addr *naddr, struct pf_addr *init_addr, struct pf_ksrc_node **sn) { struct pf_pool *rpool = &r->rpool; struct pf_addr *raddr = NULL, *rmask = NULL; @@ -522,7 +522,7 @@ pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr, struct pf_rule * pf_get_translation(struct pf_pdesc *pd, struct mbuf *m, int off, int direction, - struct pfi_kif *kif, struct pf_src_node **sn, + struct pfi_kif *kif, struct pf_ksrc_node **sn, struct pf_state_key **skp, struct pf_state_key **nkp, struct pf_addr *saddr, struct pf_addr *daddr, uint16_t sport, uint16_t dport, struct pf_anchor_stackframe *anchor_stack) From owner-dev-commits-src-all@freebsd.org Tue Jan 5 23:11:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 69F034D444B; Tue, 5 Jan 2021 23:11:07 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (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 4D9Ssk3Yytz3pnW; Tue, 5 Jan 2021 23:11:06 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id C366E3C0199; Tue, 5 Jan 2021 23:11:00 +0000 (UTC) Date: Tue, 5 Jan 2021 23:11:00 +0000 From: Brooks Davis To: Alan Somers Cc: Jessica Clarke , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 022ca2fc7fe0 - main - Add aio_writev and aio_readv Message-ID: <20210105231100.GD94898@spindle.one-eyed-alien.net> References: <202101030259.1032x5hV006606@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="XWOWbaMNXpFDWE00" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 4D9Ssk3Yytz3pnW X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of brooks@spindle.one-eyed-alien.net has no SPF policy when checking 199.48.129.229) smtp.mailfrom=brooks@spindle.one-eyed-alien.net X-Spamd-Result: default: False [-3.90 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[brooks]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[freebsd.org]; RBL_DBL_DONT_QUERY_IPS(0.00)[199.48.129.229:from]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[199.48.129.229:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; SIGNED_PGP(-2.00)[]; FORGED_SENDER(0.30)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; RCVD_COUNT_ZERO(0.00)[0]; R_SPF_NA(0.00)[no SPF record]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[brooks@freebsd.org,brooks@spindle.one-eyed-alien.net]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 23:11:07 -0000 --XWOWbaMNXpFDWE00 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 02, 2021 at 10:09:04PM -0700, Alan Somers wrote: > On Sat, Jan 2, 2021 at 9:39 PM Jessica Clarke wrote: >=20 > > On 3 Jan 2021, at 02:59, Alan Somers wrote: > > > diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master > > > index b7ea5e939635..aaa0a1277461 100644 > > > --- a/sys/kern/syscalls.master > > > +++ b/sys/kern/syscalls.master > > > @@ -1477,7 +1477,17 @@ > > > _In_opt_ struct sigevent *sig > > > ); > > > } > > > -258-271 AUE_NULL UNIMPL nosys > > > +258 AUE_AIO_WRITEV STD { > > > + int aio_writev( > > > + _Inout_ struct aiocb *aiocbp > > > + ); > > > + } > > > +259 AUE_AIO_READV STD { > > > + int aio_readv( > > > + _Inout_ struct aiocb *aiocbp > > > + ); > > > + } > > > +260-271 AUE_NULL UNIMPL nosys > > > 272 AUE_O_GETDENTS COMPAT11 { > > > int getdents( > > > int fd, > > > > Should these not be added to the end? > > > > Jess > > >=20 > Should they be? I'm not aware of any requirement to add new syscalls to > the end. I put them here so they would be next to the other AIO syscalls. Yes. I'm sorry I missed this in the review. It's vastly easier to audit these files and address conflicts if they are append-only. We're also using these syscall numbers internally specifically to avoid conflicts with new syscalls. Please move them to the end. I do see that we only provide extremely outdated advice in the comments of syscalls.master. I'll take a look at improving this and the wiki page. Thanks, Brooks --XWOWbaMNXpFDWE00 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJf9PIEAAoJEKzQXbSebgfA/eUH/2Bi73K4kSotDeSO7wbxxeIp glg+uiB2fXFeSUH1IGwT6wcR1NgDSgaIOMw9N85e6zpoCVyaU+wwJD/I8i/sSWlS 9ZLhawDObcDR1CpDcoD+8AJ70wnbFQZx90RUXvbDxiUThHm2XoUiJPoRGx3LRFhd LiEWsWqGgcMPSsqB4tMBtgK3p2E/6SKXjkt+bppHraTp3Z8Bo88+lhdjEzYhB2AT FzgkC1RZQt+6MjwZmYUmMW1B7rLU2Za6nO0x2wWHhgfkqJI31cvNG+knAL76fA0j 3vFwxfU1+K4VFD58CmQhYZOnTPbrz756ivnzZF+u5IkhKl/Z7W3smozjE1aoQ/c= =Xoi+ -----END PGP SIGNATURE----- --XWOWbaMNXpFDWE00-- From owner-dev-commits-src-all@freebsd.org Tue Jan 5 23:26:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 37C014D4C57; Tue, 5 Jan 2021 23:26:51 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.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 4D9TCv0tyKz3r0j; Tue, 5 Jan 2021 23:26:50 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f54.google.com with SMTP id 11so1374875oty.9; Tue, 05 Jan 2021 15:26:50 -0800 (PST) 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=jwMGAnZPeGiz2QGUO+RmA4ZqehcDhs/c774a9Q/c6NI=; b=MLSmj14KuG5E8CajfCWxuU3OxNr3onVTFWaeKWtO/tjicaUPOAZPmJzr+bC4rxU+5C X9DsaP2QpwWnnQbez/VWiv2DalHjABLa4MTxDGmhFgBVb8MjZFmlE7pDRMy15JnhOzwI HSiL10FxLRvkoOQwl/LNG4N9cT3IW0e2KxfuCmw+LJnGkwJtdUhzKDUSqPuicRPNgxrH X9CuvGTdT6WTfxWHmbm5G9v84Ls7DjUwT4IQbfwzfx94z5OEci/QkKwxKjKSA8k51/ru Obay1VSCcZpRQI0sPn9nK/G7I8bxrjnVdfoYeCZYsewcskwGza2fl7HqL4S8+eDIC8uR WyyQ== X-Gm-Message-State: AOAM5310rPPxf9fcQH4EKVVY6/o8k8bRMSjRxgQP++jCz+g7EOUN0ZWe EP383vqgLvco1Ggu+ZWhZyaEFuI3HxjVtDh49Syl8d0WPWKI8w== X-Google-Smtp-Source: ABdhPJxmIi4s5MGEZZ2mEZl56JHBNYqcCpiU2PNFMl4KksbjxjLyukOGaJBdCoCK4DEFJ/7c15gQr25yzE49KxBbnWI= X-Received: by 2002:a9d:a61:: with SMTP id 88mr1424741otg.18.1609889209741; Tue, 05 Jan 2021 15:26:49 -0800 (PST) MIME-Version: 1.0 References: <202101030259.1032x5hV006606@gitrepo.freebsd.org> <20210105231100.GD94898@spindle.one-eyed-alien.net> In-Reply-To: <20210105231100.GD94898@spindle.one-eyed-alien.net> From: Alan Somers Date: Tue, 5 Jan 2021 16:26:38 -0700 Message-ID: Subject: Re: git: 022ca2fc7fe0 - main - Add aio_writev and aio_readv To: Brooks Davis Cc: Jessica Clarke , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4D9TCv0tyKz3r0j X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jan 2021 23:26:51 -0000 On Tue, Jan 5, 2021 at 4:11 PM Brooks Davis wrote: > On Sat, Jan 02, 2021 at 10:09:04PM -0700, Alan Somers wrote: > > On Sat, Jan 2, 2021 at 9:39 PM Jessica Clarke > wrote: > > > > > On 3 Jan 2021, at 02:59, Alan Somers wrote: > > > > diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master > > > > index b7ea5e939635..aaa0a1277461 100644 > > > > --- a/sys/kern/syscalls.master > > > > +++ b/sys/kern/syscalls.master > > > > @@ -1477,7 +1477,17 @@ > > > > _In_opt_ struct sigevent *sig > > > > ); > > > > } > > > > -258-271 AUE_NULL UNIMPL nosys > > > > +258 AUE_AIO_WRITEV STD { > > > > + int aio_writev( > > > > + _Inout_ struct aiocb *aiocbp > > > > + ); > > > > + } > > > > +259 AUE_AIO_READV STD { > > > > + int aio_readv( > > > > + _Inout_ struct aiocb *aiocbp > > > > + ); > > > > + } > > > > +260-271 AUE_NULL UNIMPL nosys > > > > 272 AUE_O_GETDENTS COMPAT11 { > > > > int getdents( > > > > int fd, > > > > > > Should these not be added to the end? > > > > > > Jess > > > > > > > Should they be? I'm not aware of any requirement to add new syscalls to > > the end. I put them here so they would be next to the other AIO > syscalls. > > Yes. I'm sorry I missed this in the review. It's vastly easier to audit > these files and address conflicts if they are append-only. We're also > using these syscall numbers internally specifically to avoid conflicts > with new syscalls. Please move them to the end. > > I do see that we only provide extremely outdated advice in the comments > of syscalls.master. I'll take a look at improving this and the wiki > page. > > Thanks, > Brooks > Ok, I'll move them. And could you please elaborate on how we're "using these syscall numbers internally"? -Alan From owner-dev-commits-src-all@freebsd.org Wed Jan 6 00:03:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 62EBD4D6D0C; Wed, 6 Jan 2021 00:03:20 +0000 (UTC) (envelope-from jhb@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 4D9V2026fMz3syn; Wed, 6 Jan 2021 00:03:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:11:fde3:f137:e47f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 6772A459F; Wed, 6 Jan 2021 00:03:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 022ca2fc7fe0 - main - Add aio_writev and aio_readv To: Alan Somers , Brooks Davis Cc: Jessica Clarke , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202101030259.1032x5hV006606@gitrepo.freebsd.org> <20210105231100.GD94898@spindle.one-eyed-alien.net> From: John Baldwin Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Tue, 5 Jan 2021 16:03:17 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 00:03:20 -0000 On 1/5/21 3:26 PM, Alan Somers wrote: > On Tue, Jan 5, 2021 at 4:11 PM Brooks Davis wrote: > >> On Sat, Jan 02, 2021 at 10:09:04PM -0700, Alan Somers wrote: >>> On Sat, Jan 2, 2021 at 9:39 PM Jessica Clarke >> wrote: >>> >>>> On 3 Jan 2021, at 02:59, Alan Somers wrote: >>>>> diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master >>>>> index b7ea5e939635..aaa0a1277461 100644 >>>>> --- a/sys/kern/syscalls.master >>>>> +++ b/sys/kern/syscalls.master >>>>> @@ -1477,7 +1477,17 @@ >>>>> _In_opt_ struct sigevent *sig >>>>> ); >>>>> } >>>>> -258-271 AUE_NULL UNIMPL nosys >>>>> +258 AUE_AIO_WRITEV STD { >>>>> + int aio_writev( >>>>> + _Inout_ struct aiocb *aiocbp >>>>> + ); >>>>> + } >>>>> +259 AUE_AIO_READV STD { >>>>> + int aio_readv( >>>>> + _Inout_ struct aiocb *aiocbp >>>>> + ); >>>>> + } >>>>> +260-271 AUE_NULL UNIMPL nosys >>>>> 272 AUE_O_GETDENTS COMPAT11 { >>>>> int getdents( >>>>> int fd, >>>> >>>> Should these not be added to the end? >>>> >>>> Jess >>>> >>> >>> Should they be? I'm not aware of any requirement to add new syscalls to >>> the end. I put them here so they would be next to the other AIO >> syscalls. >> >> Yes. I'm sorry I missed this in the review. It's vastly easier to audit >> these files and address conflicts if they are append-only. We're also >> using these syscall numbers internally specifically to avoid conflicts >> with new syscalls. Please move them to the end. >> >> I do see that we only provide extremely outdated advice in the comments >> of syscalls.master. I'll take a look at improving this and the wiki >> page. >> >> Thanks, >> Brooks >> > > Ok, I'll move them. And could you please elaborate on how we're "using > these syscall numbers internally"? CheriBSD has some custom syscalls for testing in those slots. There's not really a way you could have known that though. The comments in syscalls.master are not always helpful. For example, the comment above 250 is not clear at all. It was added in r14219 and only applied to 250 and 251 at the time. r244439 added 252-254 which do seem to fall under that umbrella, and then r25537 add a big blob of reserved slots so FreeBSD system calls started at 300, but without really defining what the range was for. Presumably it was for OpenBSD/NetBSD compat still, but we also abandoned that idea entirely in r330517. Since the comment is worded poorly some folks read it as reserving a larger range, see commit r152845 for example which doesn't seem merited given the history (and given that r151867 was not similarly asked to be reverted). Humm, that comment was removed in r330517 and then brought back in r332086. I do think we should explicitly reserve our existing holes for "vendor" system calls that forks can use without having to worry about future conflicts. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Wed Jan 6 03:17:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8F7C84DB640 for ; Wed, 6 Jan 2021 03:17:29 +0000 (UTC) (envelope-from git@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 4D9ZL13W1jz4YL9; Wed, 6 Jan 2021 03:17:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AD1717B9A; Wed, 6 Jan 2021 03:17:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1063HTSa042981; Wed, 6 Jan 2021 03:17:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1063HTEm042980; Wed, 6 Jan 2021 03:17:29 GMT (envelope-from git) Date: Wed, 6 Jan 2021 03:17:29 GMT Message-Id: <202101060317.1063HTEm042980@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Jung-uk Kim Subject: git: a61ec1492c58 - vendor/acpica - Import ACPICA 20210105. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/vendor/acpica X-Git-Reftype: branch X-Git-Commit: a61ec1492c58c40bd0d968794c380668c157e2ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 03:17:29 -0000 The branch vendor/acpica has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=a61ec1492c58c40bd0d968794c380668c157e2ef commit a61ec1492c58c40bd0d968794c380668c157e2ef Author: Jung-uk Kim AuthorDate: 2021-01-06 03:13:30 +0000 Commit: Jung-uk Kim CommitDate: 2021-01-06 03:13:30 +0000 Import ACPICA 20210105. --- changes.txt | 21 ++++++++++ source/common/acfileio.c | 2 +- source/common/acgetline.c | 2 +- source/common/adfile.c | 2 +- source/common/adisasm.c | 2 +- source/common/adwalk.c | 2 +- source/common/ahids.c | 2 +- source/common/ahpredef.c | 2 +- source/common/ahtable.c | 4 +- source/common/ahuuids.c | 2 +- source/common/cmfsize.c | 2 +- source/common/dmextern.c | 2 +- source/common/dmrestag.c | 2 +- source/common/dmswitch.c | 2 +- source/common/dmtable.c | 4 +- source/common/dmtables.c | 2 +- source/common/dmtbdump.c | 2 +- source/common/dmtbdump1.c | 2 +- source/common/dmtbdump2.c | 55 +------------------------- source/common/dmtbdump3.c | 55 +------------------------- source/common/dmtbinfo.c | 2 +- source/common/dmtbinfo1.c | 2 +- source/common/dmtbinfo2.c | 24 +---------- source/common/dmtbinfo3.c | 23 +---------- source/common/getopt.c | 2 +- source/compiler/aslallocate.c | 2 +- source/compiler/aslanalyze.c | 2 +- source/compiler/aslascii.c | 2 +- source/compiler/aslbtypes.c | 2 +- source/compiler/aslcache.c | 2 +- source/compiler/aslcodegen.c | 2 +- source/compiler/aslcompile.c | 2 +- source/compiler/aslcompiler.h | 2 +- source/compiler/aslcompiler.l | 2 +- source/compiler/aslcstyle.y | 2 +- source/compiler/asldebug.c | 2 +- source/compiler/asldefine.h | 2 +- source/compiler/aslerror.c | 2 +- source/compiler/aslexternal.c | 2 +- source/compiler/aslfileio.c | 2 +- source/compiler/aslfiles.c | 2 +- source/compiler/aslfold.c | 2 +- source/compiler/aslglobal.h | 2 +- source/compiler/aslhelp.c | 2 +- source/compiler/aslhelpers.y | 2 +- source/compiler/aslhex.c | 2 +- source/compiler/aslkeywords.y | 2 +- source/compiler/asllength.c | 2 +- source/compiler/asllisting.c | 2 +- source/compiler/asllistsup.c | 2 +- source/compiler/aslload.c | 2 +- source/compiler/asllookup.c | 2 +- source/compiler/aslmain.c | 2 +- source/compiler/aslmap.c | 2 +- source/compiler/aslmapenter.c | 2 +- source/compiler/aslmapoutput.c | 2 +- source/compiler/aslmaputils.c | 2 +- source/compiler/aslmessages.c | 2 +- source/compiler/aslmessages.h | 2 +- source/compiler/aslmethod.c | 2 +- source/compiler/aslnamesp.c | 2 +- source/compiler/asloffset.c | 2 +- source/compiler/aslopcodes.c | 2 +- source/compiler/asloperands.c | 2 +- source/compiler/aslopt.c | 2 +- source/compiler/asloptions.c | 2 +- source/compiler/aslparseop.c | 2 +- source/compiler/aslparser.y | 2 +- source/compiler/aslpld.c | 2 +- source/compiler/aslpredef.c | 2 +- source/compiler/aslprepkg.c | 2 +- source/compiler/aslprimaries.y | 2 +- source/compiler/aslprintf.c | 2 +- source/compiler/aslprune.c | 2 +- source/compiler/aslresource.c | 2 +- source/compiler/aslresources.y | 2 +- source/compiler/aslrestype1.c | 2 +- source/compiler/aslrestype1i.c | 2 +- source/compiler/aslrestype2.c | 2 +- source/compiler/aslrestype2d.c | 2 +- source/compiler/aslrestype2e.c | 2 +- source/compiler/aslrestype2q.c | 2 +- source/compiler/aslrestype2s.c | 2 +- source/compiler/aslrestype2w.c | 2 +- source/compiler/aslrules.y | 2 +- source/compiler/aslstartup.c | 2 +- source/compiler/aslstubs.c | 2 +- source/compiler/aslsupport.l | 2 +- source/compiler/aslsupport.y | 2 +- source/compiler/asltokens.y | 2 +- source/compiler/asltransform.c | 2 +- source/compiler/asltree.c | 2 +- source/compiler/asltypes.h | 2 +- source/compiler/asltypes.y | 2 +- source/compiler/aslutils.c | 2 +- source/compiler/asluuid.c | 2 +- source/compiler/aslwalks.c | 2 +- source/compiler/aslxref.c | 2 +- source/compiler/aslxrefout.c | 2 +- source/compiler/cvcompiler.c | 2 +- source/compiler/cvdisasm.c | 2 +- source/compiler/cvparser.c | 2 +- source/compiler/dtcompile.c | 2 +- source/compiler/dtcompiler.h | 12 +----- source/compiler/dtcompilerparser.l | 2 +- source/compiler/dtcompilerparser.y | 2 +- source/compiler/dtexpress.c | 2 +- source/compiler/dtfield.c | 2 +- source/compiler/dtio.c | 2 +- source/compiler/dtparser.l | 2 +- source/compiler/dtparser.y | 2 +- source/compiler/dtsubtable.c | 2 +- source/compiler/dttable.c | 2 +- source/compiler/dttable1.c | 2 +- source/compiler/dttable2.c | 52 +----------------------- source/compiler/dttemplate.c | 2 +- source/compiler/dttemplate.h | 29 +------------- source/compiler/dtutils.c | 2 +- source/compiler/preprocess.h | 2 +- source/compiler/prexpress.c | 2 +- source/compiler/prmacros.c | 2 +- source/compiler/prparser.l | 2 +- source/compiler/prparser.y | 2 +- source/compiler/prscan.c | 2 +- source/compiler/prutils.c | 2 +- source/components/debugger/dbcmds.c | 2 +- source/components/debugger/dbconvert.c | 2 +- source/components/debugger/dbdisply.c | 2 +- source/components/debugger/dbexec.c | 2 +- source/components/debugger/dbfileio.c | 2 +- source/components/debugger/dbhistry.c | 2 +- source/components/debugger/dbinput.c | 2 +- source/components/debugger/dbmethod.c | 2 +- source/components/debugger/dbnames.c | 2 +- source/components/debugger/dbobject.c | 2 +- source/components/debugger/dbstats.c | 2 +- source/components/debugger/dbtest.c | 2 +- source/components/debugger/dbutils.c | 2 +- source/components/debugger/dbxface.c | 2 +- source/components/disassembler/dmbuffer.c | 2 +- source/components/disassembler/dmcstyle.c | 2 +- source/components/disassembler/dmdeferred.c | 2 +- source/components/disassembler/dmnames.c | 2 +- source/components/disassembler/dmopcode.c | 2 +- source/components/disassembler/dmresrc.c | 2 +- source/components/disassembler/dmresrcl.c | 2 +- source/components/disassembler/dmresrcl2.c | 2 +- source/components/disassembler/dmresrcs.c | 2 +- source/components/disassembler/dmutils.c | 2 +- source/components/disassembler/dmwalk.c | 2 +- source/components/dispatcher/dsargs.c | 2 +- source/components/dispatcher/dscontrol.c | 2 +- source/components/dispatcher/dsdebug.c | 2 +- source/components/dispatcher/dsfield.c | 2 +- source/components/dispatcher/dsinit.c | 2 +- source/components/dispatcher/dsmethod.c | 2 +- source/components/dispatcher/dsmthdat.c | 2 +- source/components/dispatcher/dsobject.c | 2 +- source/components/dispatcher/dsopcode.c | 2 +- source/components/dispatcher/dspkginit.c | 2 +- source/components/dispatcher/dsutils.c | 2 +- source/components/dispatcher/dswexec.c | 2 +- source/components/dispatcher/dswload.c | 2 +- source/components/dispatcher/dswload2.c | 2 +- source/components/dispatcher/dswscope.c | 2 +- source/components/dispatcher/dswstate.c | 2 +- source/components/events/evevent.c | 2 +- source/components/events/evglock.c | 2 +- source/components/events/evgpe.c | 2 +- source/components/events/evgpeblk.c | 2 +- source/components/events/evgpeinit.c | 2 +- source/components/events/evgpeutil.c | 2 +- source/components/events/evhandler.c | 2 +- source/components/events/evmisc.c | 2 +- source/components/events/evregion.c | 2 +- source/components/events/evrgnini.c | 2 +- source/components/events/evsci.c | 2 +- source/components/events/evxface.c | 2 +- source/components/events/evxfevnt.c | 2 +- source/components/events/evxfgpe.c | 2 +- source/components/events/evxfregn.c | 2 +- source/components/executer/exconcat.c | 2 +- source/components/executer/exconfig.c | 2 +- source/components/executer/exconvrt.c | 2 +- source/components/executer/excreate.c | 2 +- source/components/executer/exdebug.c | 2 +- source/components/executer/exdump.c | 2 +- source/components/executer/exfield.c | 2 +- source/components/executer/exfldio.c | 2 +- source/components/executer/exmisc.c | 2 +- source/components/executer/exmutex.c | 2 +- source/components/executer/exnames.c | 2 +- source/components/executer/exoparg1.c | 2 +- source/components/executer/exoparg2.c | 2 +- source/components/executer/exoparg3.c | 2 +- source/components/executer/exoparg6.c | 2 +- source/components/executer/exprep.c | 2 +- source/components/executer/exregion.c | 2 +- source/components/executer/exresnte.c | 2 +- source/components/executer/exresolv.c | 2 +- source/components/executer/exresop.c | 2 +- source/components/executer/exserial.c | 2 +- source/components/executer/exstore.c | 2 +- source/components/executer/exstoren.c | 2 +- source/components/executer/exstorob.c | 2 +- source/components/executer/exsystem.c | 2 +- source/components/executer/extrace.c | 2 +- source/components/executer/exutils.c | 2 +- source/components/hardware/hwacpi.c | 2 +- source/components/hardware/hwesleep.c | 2 +- source/components/hardware/hwgpe.c | 2 +- source/components/hardware/hwpci.c | 2 +- source/components/hardware/hwregs.c | 2 +- source/components/hardware/hwsleep.c | 2 +- source/components/hardware/hwtimer.c | 2 +- source/components/hardware/hwvalid.c | 2 +- source/components/hardware/hwxface.c | 2 +- source/components/hardware/hwxfsleep.c | 2 +- source/components/namespace/nsaccess.c | 2 +- source/components/namespace/nsalloc.c | 2 +- source/components/namespace/nsarguments.c | 2 +- source/components/namespace/nsconvert.c | 2 +- source/components/namespace/nsdump.c | 2 +- source/components/namespace/nsdumpdv.c | 2 +- source/components/namespace/nseval.c | 2 +- source/components/namespace/nsinit.c | 2 +- source/components/namespace/nsload.c | 2 +- source/components/namespace/nsnames.c | 2 +- source/components/namespace/nsobject.c | 2 +- source/components/namespace/nsparse.c | 2 +- source/components/namespace/nspredef.c | 2 +- source/components/namespace/nsprepkg.c | 2 +- source/components/namespace/nsrepair.c | 2 +- source/components/namespace/nsrepair2.c | 2 +- source/components/namespace/nssearch.c | 2 +- source/components/namespace/nsutils.c | 2 +- source/components/namespace/nswalk.c | 2 +- source/components/namespace/nsxfeval.c | 2 +- source/components/namespace/nsxfname.c | 2 +- source/components/namespace/nsxfobj.c | 2 +- source/components/parser/psargs.c | 2 +- source/components/parser/psloop.c | 2 +- source/components/parser/psobject.c | 2 +- source/components/parser/psopcode.c | 2 +- source/components/parser/psopinfo.c | 2 +- source/components/parser/psparse.c | 2 +- source/components/parser/psscope.c | 2 +- source/components/parser/pstree.c | 2 +- source/components/parser/psutils.c | 2 +- source/components/parser/pswalk.c | 2 +- source/components/parser/psxface.c | 2 +- source/components/resources/rsaddr.c | 2 +- source/components/resources/rscalc.c | 2 +- source/components/resources/rscreate.c | 2 +- source/components/resources/rsdump.c | 2 +- source/components/resources/rsdumpinfo.c | 2 +- source/components/resources/rsinfo.c | 2 +- source/components/resources/rsio.c | 2 +- source/components/resources/rsirq.c | 2 +- source/components/resources/rslist.c | 2 +- source/components/resources/rsmemory.c | 2 +- source/components/resources/rsmisc.c | 2 +- source/components/resources/rsserial.c | 2 +- source/components/resources/rsutils.c | 2 +- source/components/resources/rsxface.c | 2 +- source/components/tables/tbdata.c | 2 +- source/components/tables/tbfadt.c | 2 +- source/components/tables/tbfind.c | 2 +- source/components/tables/tbinstal.c | 2 +- source/components/tables/tbprint.c | 2 +- source/components/tables/tbutils.c | 2 +- source/components/tables/tbxface.c | 2 +- source/components/tables/tbxfload.c | 2 +- source/components/tables/tbxfroot.c | 2 +- source/components/utilities/utaddress.c | 2 +- source/components/utilities/utalloc.c | 2 +- source/components/utilities/utascii.c | 2 +- source/components/utilities/utbuffer.c | 2 +- source/components/utilities/utcache.c | 2 +- source/components/utilities/utclib.c | 2 +- source/components/utilities/utcopy.c | 2 +- source/components/utilities/utdebug.c | 2 +- source/components/utilities/utdecode.c | 2 +- source/components/utilities/utdelete.c | 2 +- source/components/utilities/uterror.c | 2 +- source/components/utilities/uteval.c | 2 +- source/components/utilities/utexcep.c | 2 +- source/components/utilities/utglobal.c | 2 +- source/components/utilities/uthex.c | 2 +- source/components/utilities/utids.c | 2 +- source/components/utilities/utinit.c | 2 +- source/components/utilities/utlock.c | 2 +- source/components/utilities/utmath.c | 2 +- source/components/utilities/utmisc.c | 2 +- source/components/utilities/utmutex.c | 2 +- source/components/utilities/utnonansi.c | 2 +- source/components/utilities/utobject.c | 2 +- source/components/utilities/utosi.c | 2 +- source/components/utilities/utownerid.c | 2 +- source/components/utilities/utpredef.c | 2 +- source/components/utilities/utprint.c | 2 +- source/components/utilities/utresdecode.c | 2 +- source/components/utilities/utresrc.c | 2 +- source/components/utilities/utstate.c | 2 +- source/components/utilities/utstring.c | 2 +- source/components/utilities/utstrsuppt.c | 2 +- source/components/utilities/utstrtoul64.c | 2 +- source/components/utilities/uttrack.c | 2 +- source/components/utilities/utuuid.c | 2 +- source/components/utilities/utxface.c | 2 +- source/components/utilities/utxferror.c | 2 +- source/components/utilities/utxfinit.c | 2 +- source/components/utilities/utxfmutex.c | 2 +- source/include/acapps.h | 4 +- source/include/acbuffer.h | 2 +- source/include/acclib.h | 2 +- source/include/accommon.h | 2 +- source/include/acconfig.h | 2 +- source/include/acconvert.h | 2 +- source/include/acdebug.h | 2 +- source/include/acdisasm.h | 14 +------ source/include/acdispat.h | 2 +- source/include/acevents.h | 2 +- source/include/acexcep.h | 2 +- source/include/acglobal.h | 2 +- source/include/achware.h | 2 +- source/include/acinterp.h | 2 +- source/include/aclocal.h | 2 +- source/include/acmacros.h | 2 +- source/include/acnames.h | 2 +- source/include/acnamesp.h | 2 +- source/include/acobject.h | 2 +- source/include/acopcode.h | 2 +- source/include/acoutput.h | 2 +- source/include/acparser.h | 2 +- source/include/acpi.h | 2 +- source/include/acpiosxf.h | 2 +- source/include/acpixf.h | 4 +- source/include/acpredef.h | 2 +- source/include/acresrc.h | 2 +- source/include/acrestyp.h | 2 +- source/include/acstruct.h | 2 +- source/include/actables.h | 2 +- source/include/actbinfo.h | 4 +- source/include/actbl.h | 2 +- source/include/actbl1.h | 2 +- source/include/actbl2.h | 31 +-------------- source/include/actbl3.h | 30 +------------- source/include/actypes.h | 2 +- source/include/acutils.h | 2 +- source/include/acuuid.h | 2 +- source/include/amlcode.h | 2 +- source/include/amlresrc.h | 2 +- source/include/platform/accygwin.h | 2 +- source/include/platform/acdragonflyex.h | 2 +- source/include/platform/acefi.h | 2 +- source/include/platform/acefiex.h | 2 +- source/include/platform/acenv.h | 2 +- source/include/platform/acenvex.h | 2 +- source/include/platform/acfreebsd.h | 2 +- source/include/platform/acgcc.h | 2 +- source/include/platform/acgccex.h | 2 +- source/include/platform/achaiku.h | 2 +- source/include/platform/acintel.h | 2 +- source/include/platform/aclinux.h | 2 +- source/include/platform/aclinuxex.h | 2 +- source/include/platform/acmacosx.h | 2 +- source/include/platform/acmsvc.h | 2 +- source/include/platform/acmsvcex.h | 2 +- source/include/platform/acnetbsd.h | 2 +- source/include/platform/acos2.h | 2 +- source/include/platform/acqnx.h | 2 +- source/include/platform/acwin.h | 2 +- source/include/platform/acwin64.h | 2 +- source/os_specific/service_layers/osbsdtbl.c | 2 +- source/os_specific/service_layers/oslinuxtbl.c | 2 +- source/os_specific/service_layers/osunixdir.c | 2 +- source/os_specific/service_layers/osunixmap.c | 2 +- source/os_specific/service_layers/osunixxf.c | 2 +- source/os_specific/service_layers/oswindir.c | 2 +- source/os_specific/service_layers/oswintbl.c | 2 +- source/os_specific/service_layers/oswinxf.c | 2 +- source/tools/acpibin/abcompare.c | 2 +- source/tools/acpibin/abmain.c | 2 +- source/tools/acpibin/acpibin.h | 2 +- source/tools/acpidump/acpidump.h | 2 +- source/tools/acpidump/apdump.c | 2 +- source/tools/acpidump/apfiles.c | 2 +- source/tools/acpidump/apmain.c | 2 +- source/tools/acpiexec/aecommon.h | 2 +- source/tools/acpiexec/aeexception.c | 2 +- source/tools/acpiexec/aeexec.c | 2 +- source/tools/acpiexec/aehandlers.c | 2 +- source/tools/acpiexec/aeinitfile.c | 2 +- source/tools/acpiexec/aeinstall.c | 2 +- source/tools/acpiexec/aemain.c | 2 +- source/tools/acpiexec/aeregion.c | 2 +- source/tools/acpiexec/aetables.c | 2 +- source/tools/acpiexec/aetables.h | 2 +- source/tools/acpiexec/aetests.c | 2 +- source/tools/acpihelp/acpihelp.h | 2 +- source/tools/acpihelp/ahaml.c | 2 +- source/tools/acpihelp/ahamlops.c | 2 +- source/tools/acpihelp/ahasl.c | 2 +- source/tools/acpihelp/ahaslkey.c | 2 +- source/tools/acpihelp/ahaslops.c | 2 +- source/tools/acpihelp/ahdecode.c | 2 +- source/tools/acpihelp/ahgrammar.c | 2 +- source/tools/acpihelp/ahmain.c | 2 +- source/tools/acpisrc/acpisrc.h | 2 +- source/tools/acpisrc/ascase.c | 2 +- source/tools/acpisrc/asconvrt.c | 4 +- source/tools/acpisrc/asfile.c | 2 +- source/tools/acpisrc/asmain.c | 2 +- source/tools/acpisrc/asremove.c | 2 +- source/tools/acpisrc/astable.c | 12 ++---- source/tools/acpisrc/asutils.c | 2 +- source/tools/acpixtract/acpixtract.c | 2 +- source/tools/acpixtract/acpixtract.h | 2 +- source/tools/acpixtract/axmain.c | 2 +- source/tools/acpixtract/axutils.c | 2 +- source/tools/efihello/efihello.c | 2 +- source/tools/examples/examples.c | 2 +- source/tools/examples/examples.h | 2 +- source/tools/examples/exstubs.c | 2 +- source/tools/examples/extables.c | 2 +- 426 files changed, 452 insertions(+), 746 deletions(-) diff --git a/changes.txt b/changes.txt index d27547d31b76..e58f906382b5 100644 --- a/changes.txt +++ b/changes.txt @@ -1,3 +1,24 @@ +---------------------------------------- +05 January 2021. Summary of changes for version 20210105: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Updated all copyrights to 2021. This affects all ACPICA source code +modules. + +2) iASL Compiler/Disassembler and ACPICA tools: + +ASL test suite (ASLTS): Updated all copyrights to 2021. + +Tools and utilities: Updated all signon copyrights to 2021. + +iASL Table Compiler: Removed support for obsolete ACPI tables: VRTC, +MTMR. Al Stone. + + ---------------------------------------- 17 December 2020. Summary of changes for version 20201217: diff --git a/source/common/acfileio.c b/source/common/acfileio.c index 64339c6e5153..628cf7a41b25 100644 --- a/source/common/acfileio.c +++ b/source/common/acfileio.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/acgetline.c b/source/common/acgetline.c index e1ddaa69c703..88479d619a64 100644 --- a/source/common/acgetline.c +++ b/source/common/acgetline.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/adfile.c b/source/common/adfile.c index f5063a3fcc72..db6bcabc1efa 100644 --- a/source/common/adfile.c +++ b/source/common/adfile.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/adisasm.c b/source/common/adisasm.c index 015765ff5820..27a175a626b0 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/adwalk.c b/source/common/adwalk.c index 008c95c22188..c4d149e3d4d6 100644 --- a/source/common/adwalk.c +++ b/source/common/adwalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/ahids.c b/source/common/ahids.c index 38515a012834..1e6edaf711c1 100644 --- a/source/common/ahids.c +++ b/source/common/ahids.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/ahpredef.c b/source/common/ahpredef.c index 182a83ad4967..e6e2ffc75aa3 100644 --- a/source/common/ahpredef.c +++ b/source/common/ahpredef.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/ahtable.c b/source/common/ahtable.c index 32d5dedb96f1..ac3c416bb392 100644 --- a/source/common/ahtable.c +++ b/source/common/ahtable.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License @@ -229,7 +229,6 @@ const AH_TABLE AcpiGbl_SupportedTables[] = {ACPI_SIG_MPST, "Memory Power State Table"}, {ACPI_SIG_MSCT, "Maximum System Characteristics Table"}, {ACPI_SIG_MSDM, "Microsoft Data Management table"}, - {ACPI_SIG_MTMR, "MID Timer Table"}, {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, {ACPI_SIG_PDTT, "Platform Debug Trigger Table"}, @@ -252,7 +251,6 @@ const AH_TABLE AcpiGbl_SupportedTables[] = {ACPI_SIG_TCPA, "Trusted Computing Platform Alliance table"}, {ACPI_SIG_TPM2, "Trusted Platform Module hardware interface table"}, {ACPI_SIG_UEFI, "UEFI Boot Optimization Table"}, - {ACPI_SIG_VRTC, "Virtual Real-Time Clock Table"}, {ACPI_SIG_WAET, "Windows ACPI Emulated Devices Table"}, {ACPI_SIG_WDAT, "Watchdog Action Table"}, {ACPI_SIG_WDDT, "Watchdog Description Table"}, diff --git a/source/common/ahuuids.c b/source/common/ahuuids.c index 326ea3b355ac..427f91694233 100644 --- a/source/common/ahuuids.c +++ b/source/common/ahuuids.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/cmfsize.c b/source/common/cmfsize.c index 553e9a9ebd35..e0c66e31d780 100644 --- a/source/common/cmfsize.c +++ b/source/common/cmfsize.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/dmextern.c b/source/common/dmextern.c index e9d81b630791..36d586008cb6 100644 --- a/source/common/dmextern.c +++ b/source/common/dmextern.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/dmrestag.c b/source/common/dmrestag.c index fe6e74146d38..d8a044069c93 100644 --- a/source/common/dmrestag.c +++ b/source/common/dmrestag.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/dmswitch.c b/source/common/dmswitch.c index 5c49de102faa..2b894c65dcd5 100644 --- a/source/common/dmswitch.c +++ b/source/common/dmswitch.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/dmtable.c b/source/common/dmtable.c index 5896b2f257af..3e4c6c34153c 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License @@ -509,7 +509,6 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst}, {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct}, {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm}, - {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr}, {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt, AcpiDmDumpPdtt, DtCompilePdtt, TemplatePdtt}, @@ -530,7 +529,6 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa}, {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, AcpiDmDumpTpm2, DtCompileTpm2, TemplateTpm2}, {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, - {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc}, {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet}, {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat}, {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt}, diff --git a/source/common/dmtables.c b/source/common/dmtables.c index ee18d26c9657..fa04e0c88979 100644 --- a/source/common/dmtables.c +++ b/source/common/dmtables.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c index d62cfdbd39f5..abeb06fa5c38 100644 --- a/source/common/dmtbdump.c +++ b/source/common/dmtbdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/dmtbdump1.c b/source/common/dmtbdump1.c index 0219dd2d3c79..72d667e9759a 100644 --- a/source/common/dmtbdump1.c +++ b/source/common/dmtbdump1.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/dmtbdump2.c b/source/common/dmtbdump2.c index 45484825a1da..b8ece375a4f2 100644 --- a/source/common/dmtbdump2.c +++ b/source/common/dmtbdump2.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License @@ -1114,59 +1114,6 @@ AcpiDmDumpMsct ( } -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpMtmr - * - * PARAMETERS: Table - A MTMR table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a MTMR - * - ******************************************************************************/ - -void -AcpiDmDumpMtmr ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - UINT32 Offset = sizeof (ACPI_TABLE_MTMR); - ACPI_MTMR_ENTRY *Subtable; - - - /* Main table */ - - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Subtables */ - - Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset); - while (Offset < Table->Length) - { - /* Common subtable header */ - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, - sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Point to next subtable */ - - Offset += sizeof (ACPI_MTMR_ENTRY); - Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Subtable, - sizeof (ACPI_MTMR_ENTRY)); - } -} - - /******************************************************************************* * * FUNCTION: AcpiDmDumpNfit diff --git a/source/common/dmtbdump3.c b/source/common/dmtbdump3.c index 7c6d2848ee74..fde8f7a884ab 100644 --- a/source/common/dmtbdump3.c +++ b/source/common/dmtbdump3.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License @@ -601,59 +601,6 @@ AcpiDmDumpTpm2 ( } -/******************************************************************************* - * - * FUNCTION: AcpiDmDumpVrtc - * - * PARAMETERS: Table - A VRTC table - * - * RETURN: None - * - * DESCRIPTION: Format the contents of a VRTC - * - ******************************************************************************/ - -void -AcpiDmDumpVrtc ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status; - UINT32 Offset = sizeof (ACPI_TABLE_VRTC); - ACPI_VRTC_ENTRY *Subtable; - - - /* Main table */ - - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Subtables */ - - Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset); - while (Offset < Table->Length) - { - /* Common subtable header */ - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, - sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Point to next subtable */ - - Offset += sizeof (ACPI_VRTC_ENTRY); - Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Subtable, - sizeof (ACPI_VRTC_ENTRY)); - } -} - - /******************************************************************************* * * FUNCTION: AcpiDmDumpWdat diff --git a/source/common/dmtbinfo.c b/source/common/dmtbinfo.c index ed9dd1bcff31..347f9d367b17 100644 --- a/source/common/dmtbinfo.c +++ b/source/common/dmtbinfo.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/dmtbinfo1.c b/source/common/dmtbinfo1.c index 750e29d54c6f..5931c01e81d1 100644 --- a/source/common/dmtbinfo1.c +++ b/source/common/dmtbinfo1.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License diff --git a/source/common/dmtbinfo2.c b/source/common/dmtbinfo2.c index c000a921ca68..0d61cb7a3231 100644 --- a/source/common/dmtbinfo2.c +++ b/source/common/dmtbinfo2.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License @@ -909,28 +909,6 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[] = }; -/******************************************************************************* - * - * MTMR - MID Timer Table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMtmr[] = -{ - ACPI_DMT_TERMINATOR -}; - -/* MTMR Subtables - MTMR Entry */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoMtmr0[] = -{ - {ACPI_DMT_GAS, ACPI_MTMR0_OFFSET (PhysicalAddress), "PhysicalAddress", 0}, - {ACPI_DMT_UINT32, ACPI_MTMR0_OFFSET (Frequency), "Frequency", 0}, - {ACPI_DMT_UINT32, ACPI_MTMR0_OFFSET (Irq), "IRQ", 0}, - ACPI_DMT_TERMINATOR -}; - - /******************************************************************************* * * NFIT - NVDIMM Firmware Interface Table and Subtables - (ACPI 6.0) diff --git a/source/common/dmtbinfo3.c b/source/common/dmtbinfo3.c index f4092c240171..99661d06a3e4 100644 --- a/source/common/dmtbinfo3.c +++ b/source/common/dmtbinfo3.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. * All rights reserved. * * 2. License @@ -526,27 +526,6 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[] = }; -/******************************************************************************* - * - * VRTC - Virtual Real Time Clock Table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc[] = -{ - ACPI_DMT_TERMINATOR -}; - -/* VRTC Subtables - VRTC Entry */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc0[] = -{ - {ACPI_DMT_GAS, ACPI_VRTC0_OFFSET (PhysicalAddress), "PhysicalAddress", 0}, - {ACPI_DMT_UINT32, ACPI_VRTC0_OFFSET (Irq), "IRQ", 0}, - ACPI_DMT_TERMINATOR -}; - - /******************************************************************************* * * WAET - Windows ACPI Emulated devices Table diff --git a/source/common/getopt.c b/source/common/getopt.c index ca8e04a10adf..766ab8e35448 100644 --- a/source/common/getopt.c +++ b/source/common/getopt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp. *** 5574 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Jan 6 03:17:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9EDE84DB826 for ; Wed, 6 Jan 2021 03:17:29 +0000 (UTC) (envelope-from git@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 4D9ZL141wKz4YZg; Wed, 6 Jan 2021 03:17:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D26117C9D; Wed, 6 Jan 2021 03:17:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1063HTUm043002; Wed, 6 Jan 2021 03:17:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1063HTf2043001; Wed, 6 Jan 2021 03:17:29 GMT (envelope-from git) Date: Wed, 6 Jan 2021 03:17:29 GMT Message-Id: <202101060317.1063HTf2043001@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Jung-uk Kim Subject: git: 11a7ca92060b - Create tag vendor/acpica/20210105 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/tags/vendor/acpica/20210105 X-Git-Reftype: annotated tag X-Git-Commit: 11a7ca92060b885edb8be6eca51f65a8bf95231c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 03:17:29 -0000 The annotated tag vendor/acpica/20210105 has been created by jkim: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/acpica/20210105 tag vendor/acpica/20210105 Tagger: Jung-uk Kim TaggerDate: 2021-01-06 03:15:49 +0000 Tag ACPICA 20210105 commit a61ec1492c58c40bd0d968794c380668c157e2ef Author: Jung-uk Kim AuthorDate: 2021-01-06 03:13:30 +0000 Commit: Jung-uk Kim CommitDate: 2021-01-06 03:13:30 +0000 Import ACPICA 20210105. From owner-dev-commits-src-all@freebsd.org Wed Jan 6 04:51:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0A4EA4DD3A6; Wed, 6 Jan 2021 04:51:02 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D9cPx4Tvpz4fnP; Wed, 6 Jan 2021 04:51:01 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1609908659; bh=5RIB88G4qb2tInZUzPDguM0JpWkFHpB+jyHPElamhPs=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=bSS6tJOz8h5kFIh9rBUIy+w7W5xJT9z3JDVgowZe5YWM7PB5rkZTX/f6BU+w0BxzV 6RGSSe25YjjJAICPAFnoVtLbvEwKMEJLstqiqrFXcJXmvHrvWW2U+NuNuFY1Pm+NYM 3L60I1PbsVQPV7wWRbGp2V4FObekrPyHhIMkrD08= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([78.54.32.108]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N1wq3-1jzS0Y2CaH-012JT8; Wed, 06 Jan 2021 05:50:59 +0100 Date: Wed, 6 Jan 2021 05:50:51 +0100 From: "Hartmann, O." To: Kristof Provost Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel Message-ID: <20210106055051.51e28498@hermann.fritz.box> In-Reply-To: <202101052237.105MbsPa081440@gitrepo.freebsd.org> References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/hfzsmyUhBwP5pCfjizJvKl8"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Provags-ID: V03:K1:jgH/ibUrV0DZz9LzNcbSZqOCVhq+kyJwUnkPqyvcYwKCXQhb80F vXUw37xYzHQDSP5njLRz4KEN9L5SUbp33ajkhhFprb4JRz2Hben/yE4o6tpMao+NVJCpuQ+ ZaPlFw08AA5e0vBhhYQoMnSMKXJREfTRCh7Bz9EMBY74+9hh+UpgCKIXW3ER5FZuQG/mUD4 hGhYGUDiQLhQeN5V53Elg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:djRWK1OZ4pg=:sSUk99EQtIg0DT/lhVy0Q1 kX0c08qlB+AnjwmxQ8U3HcJ23lWHw1ZD7Jx0EptP7apiOFyjMtTTFep8OOhB2AaKrbudswXy6 O4lAFo+4YgzPquW44OMdohjqcX2ehE9wkwzw+BSI3Mc4WUR9SgnVtCWw3ErFVI9iKZQapD3Q8 QfvIgukzq6S5Zg4/BrsjXXu/jd/wHyV3YRfDDcm1wXFzkV4pvf5TzkPu/w7zGTiecta0rK32O ub/eygAN1eei209QpFCU10cUgu7zyp3OdYEhQ8WytDSr6DlAercnHFqIgBFu5yVncGiDU73nZ Ntkaw060MEoKON8zB+vbFuM/GofreYOHfYpTZApZqGzGsJ8QRnXx6v5mYAiVns/ATqxdVlFDI AAA5m8WkysCaxP3o/8VwJnw/bwvWlVOb0i+1IDLcSgQHrZDflLcxSKWp2kpMJmbEHFa7p4YdT 6cw1nKFBsakUJvk4Gla9RR1SH9mQDbRWzPcAYdTEeUg2g8Kf3l0R9sfiJZtz64Ng1X683eVQA wHTluA1D0XE+5ebUUBfMwEiHSPo3y0hleI6YC1bvSOK1BZavmQF6A3BUtkIXN6tMSDH3GXjwP O+IHWd6MGAakFG/Xcu5bX+zeFmrQSUAYUHOOMH2LMrCqH01/kxCzmbDFWNhu5U0cek9gOPSby mAkF9AwLWh/Mq/J5L+ppAjS/kpaa+BFNwOYVLTBLBkpTPqVYj0OAbEaGzJr/f+UoV5L6jN0tM v7sF3AJEz2Oen/rEvtSPoJ7jz+nfgf6k7joijKW7O3WLD5P7ankDomHMWofocHHk1AdzvS/CN Qu2kVcvrI3blYAKJJxPMPB3fCK+lGboltAS3HYmaNDYhTXKvXxbm7qSgTQt7cp8syHNpGWGq1 zQWtDNeeuHW8zQFMkF+w== X-Rspamd-Queue-Id: 4D9cPx4Tvpz4fnP X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 04:51:02 -0000 --Sig_/hfzsmyUhBwP5pCfjizJvKl8 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 5 Jan 2021 22:37:54 GMT Kristof Provost wrote: > The branch main has been updated by kp: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dfda7daf06301beef1bdad39891= 232a12c6925b22 >=20 > commit fda7daf06301beef1bdad39891232a12c6925b22 > Author: Kristof Provost > AuthorDate: 2020-12-24 15:02:04 +0000 > Commit: Kristof Provost > CommitDate: 2021-01-05 22:35:37 +0000 >=20 > pfctl: Stop sharing pf_ruleset.c with the kernel > =20 > Now that we've split up the datastructures used by the kernel and > userspace there's essentually no more overlap between the pf_ruleset.c > code used by userspace and kernelspace. > =20 > Copy the userspace bits to the pfctl directory and stop using the ker= nel > file. > =20 > Reviewed by: philip > MFC after: 2 weeks > Sponsored by: Orange Business Services > Differential Revision: https://reviews.freebsd.org/D27764 > --- > sbin/pfctl/Makefile | 3 - > sbin/pfctl/pf_ruleset.c | 343 ++++++++++++++++++++++++++++++++++++++= ++++++ > sys/netpfil/pf/pf_ruleset.c | 286 +----------------------------------- > 3 files changed, 349 insertions(+), 283 deletions(-) >=20 > diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile > index 8ca3b5d86285..14dc83eb97b0 100644 > --- a/sbin/pfctl/Makefile > +++ b/sbin/pfctl/Makefile > @@ -2,9 +2,6 @@ > =20 > .include > =20 > -# pf_ruleset.c is shared between kernel and pfctl > -.PATH: ${SRCTOP}/sys/netpfil/pf > - > PACKAGE=3Dpf > CONFS=3D pf.os > PROG=3D pfctl > diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c > new file mode 100644 > index 000000000000..7c337d7a2da7 > --- /dev/null > +++ b/sbin/pfctl/pf_ruleset.c > @@ -0,0 +1,343 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright (c) 2001 Daniel Hartmeier > + * Copyright (c) 2002,2003 Henning Brauer > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * - Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * - 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 COPYRIGHT HOLDERS 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 > + * COPYRIGHT HOLDERS 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. > + * > + * Effort sponsored in part by the Defense Advanced Research Projects > + * Agency (DARPA) and Air Force Research Laboratory, Air Force > + * Materiel Command, USAF, under agreement number F30602-01-2-0537. > + * > + * $OpenBSD: pf_ruleset.c,v 1.2 2008/12/18 15:31:37 dhill Exp $ > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#ifdef INET6 > +#include > +#endif /* INET6 */ > + > +#include > +#include > +#include > +#include > +#include > +#define rs_malloc(x) calloc(1, x) > +#define rs_free(x) free(x) > + > +#ifdef PFDEBUG > +#include > +#define DPFPRINTF(format, x...) fprintf(stderr, format , ##x) > +#else > +#define DPFPRINTF(format, x...) ((void)0) > +#endif /* PFDEBUG */ > + > +struct pf_anchor_global pf_anchors; > +struct pf_anchor pf_main_anchor; > +#undef V_pf_anchors > +#define V_pf_anchors pf_anchors > +#undef pf_main_ruleset > +#define pf_main_ruleset pf_main_anchor.ruleset > + > +static __inline int pf_anchor_compare(struct pf_anchor *, > + struct pf_anchor *); > +static struct pf_anchor *pf_find_anchor(const char *); > + > +RB_GENERATE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare= ); > +RB_GENERATE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); > + > +static __inline int > +pf_anchor_compare(struct pf_anchor *a, struct pf_anchor *b) > +{ > + int c =3D strcmp(a->path, b->path); > + > + return (c ? (c < 0 ? -1 : 1) : 0); > +} > + > +int > +pf_get_ruleset_number(u_int8_t action) > +{ > + switch (action) { > + case PF_SCRUB: > + case PF_NOSCRUB: > + return (PF_RULESET_SCRUB); > + break; > + case PF_PASS: > + case PF_DROP: > + return (PF_RULESET_FILTER); > + break; > + case PF_NAT: > + case PF_NONAT: > + return (PF_RULESET_NAT); > + break; > + case PF_BINAT: > + case PF_NOBINAT: > + return (PF_RULESET_BINAT); > + break; > + case PF_RDR: > + case PF_NORDR: > + return (PF_RULESET_RDR); > + break; > + default: > + return (PF_RULESET_MAX); > + break; > + } > +} > + > +void > +pf_init_ruleset(struct pf_ruleset *ruleset) > +{ > + int i; > + > + memset(ruleset, 0, sizeof(struct pf_ruleset)); > + for (i =3D 0; i < PF_RULESET_MAX; i++) { > + TAILQ_INIT(&ruleset->rules[i].queues[0]); > + TAILQ_INIT(&ruleset->rules[i].queues[1]); > + ruleset->rules[i].active.ptr =3D &ruleset->rules[i].queues[0]; > + ruleset->rules[i].inactive.ptr =3D &ruleset->rules[i].queues[1]; > + } > +} > + > +static struct pf_anchor * > +pf_find_anchor(const char *path) > +{ > + struct pf_anchor *key, *found; > + > + key =3D (struct pf_anchor *)rs_malloc(sizeof(*key)); > + if (key =3D=3D NULL) > + return (NULL); > + strlcpy(key->path, path, sizeof(key->path)); > + found =3D RB_FIND(pf_anchor_global, &V_pf_anchors, key); > + rs_free(key); > + return (found); > +} > + > +struct pf_ruleset * > +pf_find_ruleset(const char *path) > +{ > + struct pf_anchor *anchor; > + > + while (*path =3D=3D '/') > + path++; > + if (!*path) > + return (&pf_main_ruleset); > + anchor =3D pf_find_anchor(path); > + if (anchor =3D=3D NULL) > + return (NULL); > + else > + return (&anchor->ruleset); > +} > + > +struct pf_ruleset * > +pf_find_or_create_ruleset(const char *path) > +{ > + char *p, *q, *r; > + struct pf_ruleset *ruleset; > + struct pf_anchor *anchor =3D NULL, *dup, *parent =3D NULL; > + > + if (path[0] =3D=3D 0) > + return (&pf_main_ruleset); > + while (*path =3D=3D '/') > + path++; > + ruleset =3D pf_find_ruleset(path); > + if (ruleset !=3D NULL) > + return (ruleset); > + p =3D (char *)rs_malloc(MAXPATHLEN); > + if (p =3D=3D NULL) > + return (NULL); > + strlcpy(p, path, MAXPATHLEN); > + while (parent =3D=3D NULL && (q =3D strrchr(p, '/')) !=3D NULL) { > + *q =3D 0; > + if ((ruleset =3D pf_find_ruleset(p)) !=3D NULL) { > + parent =3D ruleset->anchor; > + break; > + } > + } > + if (q =3D=3D NULL) > + q =3D p; > + else > + q++; > + strlcpy(p, path, MAXPATHLEN); > + if (!*q) { > + rs_free(p); > + return (NULL); > + } > + while ((r =3D strchr(q, '/')) !=3D NULL || *q) { > + if (r !=3D NULL) > + *r =3D 0; > + if (!*q || strlen(q) >=3D PF_ANCHOR_NAME_SIZE || > + (parent !=3D NULL && strlen(parent->path) >=3D > + MAXPATHLEN - PF_ANCHOR_NAME_SIZE - 1)) { > + rs_free(p); > + return (NULL); > + } > + anchor =3D (struct pf_anchor *)rs_malloc(sizeof(*anchor)); > + if (anchor =3D=3D NULL) { > + rs_free(p); > + return (NULL); > + } > + RB_INIT(&anchor->children); > + strlcpy(anchor->name, q, sizeof(anchor->name)); > + if (parent !=3D NULL) { > + strlcpy(anchor->path, parent->path, > + sizeof(anchor->path)); > + strlcat(anchor->path, "/", sizeof(anchor->path)); > + } > + strlcat(anchor->path, anchor->name, sizeof(anchor->path)); > + if ((dup =3D RB_INSERT(pf_anchor_global, &V_pf_anchors, anchor)) !=3D > + NULL) { > + printf("pf_find_or_create_ruleset: RB_INSERT1 " > + "'%s' '%s' collides with '%s' '%s'\n", > + anchor->path, anchor->name, dup->path, dup->name); > + rs_free(anchor); > + rs_free(p); > + return (NULL); > + } > + if (parent !=3D NULL) { > + anchor->parent =3D parent; > + if ((dup =3D RB_INSERT(pf_anchor_node, &parent->children, > + anchor)) !=3D NULL) { > + printf("pf_find_or_create_ruleset: " > + "RB_INSERT2 '%s' '%s' collides with " > + "'%s' '%s'\n", anchor->path, anchor->name, > + dup->path, dup->name); > + RB_REMOVE(pf_anchor_global, &V_pf_anchors, > + anchor); > + rs_free(anchor); > + rs_free(p); > + return (NULL); > + } > + } > + pf_init_ruleset(&anchor->ruleset); > + anchor->ruleset.anchor =3D anchor; > + parent =3D anchor; > + if (r !=3D NULL) > + q =3D r + 1; > + else > + *q =3D 0; > + } > + rs_free(p); > + return (&anchor->ruleset); > +} > + > +void > +pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) > +{ > + struct pf_anchor *parent; > + int i; > + > + while (ruleset !=3D NULL) { > + if (ruleset =3D=3D &pf_main_ruleset || ruleset->anchor =3D=3D NULL || > + !RB_EMPTY(&ruleset->anchor->children) || > + ruleset->anchor->refcnt > 0 || ruleset->tables > 0 || > + ruleset->topen) > + return; > + for (i =3D 0; i < PF_RULESET_MAX; ++i) > + if (!TAILQ_EMPTY(ruleset->rules[i].active.ptr) || > + !TAILQ_EMPTY(ruleset->rules[i].inactive.ptr) || > + ruleset->rules[i].inactive.open) > + return; > + RB_REMOVE(pf_anchor_global, &V_pf_anchors, ruleset->anchor); > + if ((parent =3D ruleset->anchor->parent) !=3D NULL) > + RB_REMOVE(pf_anchor_node, &parent->children, > + ruleset->anchor); > + rs_free(ruleset->anchor); > + if (parent =3D=3D NULL) > + return; > + ruleset =3D &parent->ruleset; > + } > +} > +int > +pf_anchor_setup(struct pf_rule *r, const struct pf_ruleset *s, > + const char *name) > +{ > + char *p, *path; > + struct pf_ruleset *ruleset; > + > + r->anchor =3D NULL; > + r->anchor_relative =3D 0; > + r->anchor_wildcard =3D 0; > + if (!name[0]) > + return (0); > + path =3D (char *)rs_malloc(MAXPATHLEN); > + if (path =3D=3D NULL) > + return (1); > + if (name[0] =3D=3D '/') > + strlcpy(path, name + 1, MAXPATHLEN); > + else { > + /* relative path */ > + r->anchor_relative =3D 1; > + if (s->anchor =3D=3D NULL || !s->anchor->path[0]) > + path[0] =3D 0; > + else > + strlcpy(path, s->anchor->path, MAXPATHLEN); > + while (name[0] =3D=3D '.' && name[1] =3D=3D '.' && name[2] =3D=3D '/')= { > + if (!path[0]) { > + printf("pf_anchor_setup: .. beyond root\n"); > + rs_free(path); > + return (1); > + } > + if ((p =3D strrchr(path, '/')) !=3D NULL) > + *p =3D 0; > + else > + path[0] =3D 0; > + r->anchor_relative++; > + name +=3D 3; > + } > + if (path[0]) > + strlcat(path, "/", MAXPATHLEN); > + strlcat(path, name, MAXPATHLEN); > + } > + if ((p =3D strrchr(path, '/')) !=3D NULL && !strcmp(p, "/*")) { > + r->anchor_wildcard =3D 1; > + *p =3D 0; > + } > + ruleset =3D pf_find_or_create_ruleset(path); > + rs_free(path); > + if (ruleset =3D=3D NULL || ruleset->anchor =3D=3D NULL) { > + printf("pf_anchor_setup: ruleset\n"); > + return (1); > + } > + r->anchor =3D ruleset->anchor; > + r->anchor->refcnt++; > + return (0); > +} > diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c > index b2604795811a..31a4ed879937 100644 > --- a/sys/netpfil/pf/pf_ruleset.c > +++ b/sys/netpfil/pf/pf_ruleset.c > @@ -41,10 +41,8 @@ __FBSDID("$FreeBSD$"); > =20 > #include > #include > -#ifdef _KERNEL > -# include > -# include > -#endif /* _KERNEL */ > +#include > +#include > #include > =20 > #include > @@ -60,71 +58,26 @@ __FBSDID("$FreeBSD$"); > #include > #endif /* INET6 */ > =20 > -#ifdef _KERNEL > +#ifndef _KERNEL > +#error "Kernel only file. Please use sbin/pfctl/pf_ruleset.c instead." > +#endif > + > #define DPFPRINTF(format, x...) \ > if (V_pf_status.debug >=3D PF_DEBUG_NOISY) \ > printf(format , ##x) > #define rs_malloc(x) malloc(x, M_TEMP, M_NOWAIT|M_ZERO) > #define rs_free(x) free(x, M_TEMP) > =20 > -#else > -/* Userland equivalents so we can lend code to pfctl et al. */ > - > -#include > -#include > -#include > -#include > -#include > -#define rs_malloc(x) calloc(1, x) > -#define rs_free(x) free(x) > - > -#ifdef PFDEBUG > -#include > -#define DPFPRINTF(format, x...) fprintf(stderr, format , ##x) > -#else > -#define DPFPRINTF(format, x...) ((void)0) > -#endif /* PFDEBUG */ > -#endif /* _KERNEL */ > - > -#ifdef _KERNEL > VNET_DEFINE(struct pf_kanchor_global, pf_anchors); > VNET_DEFINE(struct pf_kanchor, pf_main_anchor); > -#else /* ! _KERNEL */ > -struct pf_anchor_global pf_anchors; > -struct pf_anchor pf_main_anchor; > -#undef V_pf_anchors > -#define V_pf_anchors pf_anchors > -#undef pf_main_ruleset > -#define pf_main_ruleset pf_main_anchor.ruleset > -#endif /* _KERNEL */ > - > =20 > -#ifdef _KERNEL > static __inline int pf_kanchor_compare(struct pf_kanchor *, > struct pf_kanchor *); > static struct pf_kanchor *pf_find_kanchor(const char *); > =20 > RB_GENERATE(pf_kanchor_global, pf_kanchor, entry_global, pf_kanchor_comp= are); > RB_GENERATE(pf_kanchor_node, pf_kanchor, entry_node, pf_kanchor_compare); > -#else > -static __inline int pf_anchor_compare(struct pf_anchor *, > - struct pf_anchor *); > -static struct pf_anchor *pf_find_anchor(const char *); > =20 > -RB_GENERATE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare= ); > -RB_GENERATE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); > -#endif > - > - > -#ifndef _KERNEL > -static __inline int > -pf_anchor_compare(struct pf_anchor *a, struct pf_anchor *b) > -{ > - int c =3D strcmp(a->path, b->path); > - > - return (c ? (c < 0 ? -1 : 1) : 0); > -} > -#else > static __inline int > pf_kanchor_compare(struct pf_kanchor *a, struct pf_kanchor *b) > { > @@ -132,7 +85,6 @@ pf_kanchor_compare(struct pf_kanchor *a, struct pf_kan= chor *b) > =20 > return (c ? (c < 0 ? -1 : 1) : 0); > } > -#endif > =20 > int > pf_get_ruleset_number(u_int8_t action) > @@ -164,35 +116,6 @@ pf_get_ruleset_number(u_int8_t action) > } > } > =20 > -#ifndef _KERNEL > -void > -pf_init_ruleset(struct pf_ruleset *ruleset) > -{ > - int i; > - > - memset(ruleset, 0, sizeof(struct pf_ruleset)); > - for (i =3D 0; i < PF_RULESET_MAX; i++) { > - TAILQ_INIT(&ruleset->rules[i].queues[0]); > - TAILQ_INIT(&ruleset->rules[i].queues[1]); > - ruleset->rules[i].active.ptr =3D &ruleset->rules[i].queues[0]; > - ruleset->rules[i].inactive.ptr =3D &ruleset->rules[i].queues[1]; > - } > -} > - > -static struct pf_anchor * > -pf_find_anchor(const char *path) > -{ > - struct pf_anchor *key, *found; > - > - key =3D (struct pf_anchor *)rs_malloc(sizeof(*key)); > - if (key =3D=3D NULL) > - return (NULL); > - strlcpy(key->path, path, sizeof(key->path)); > - found =3D RB_FIND(pf_anchor_global, &V_pf_anchors, key); > - rs_free(key); > - return (found); > -} > -#else > static struct pf_kanchor * > pf_find_kanchor(const char *path) > { > @@ -220,10 +143,7 @@ pf_init_kruleset(struct pf_kruleset *ruleset) > ruleset->rules[i].inactive.ptr =3D &ruleset->rules[i].queues[1]; > } > } > -#endif > =20 > - > -#ifdef _KERNEL > struct pf_kruleset * > pf_find_kruleset(const char *path) > { > @@ -476,197 +396,3 @@ pf_kanchor_remove(struct pf_krule *r) > pf_remove_if_empty_kruleset(&r->anchor->ruleset); > r->anchor =3D NULL; > } > - > -#else > - > -struct pf_ruleset * > -pf_find_ruleset(const char *path) > -{ > - struct pf_anchor *anchor; > - > - while (*path =3D=3D '/') > - path++; > - if (!*path) > - return (&pf_main_ruleset); > - anchor =3D pf_find_anchor(path); > - if (anchor =3D=3D NULL) > - return (NULL); > - else > - return (&anchor->ruleset); > -} > - > -struct pf_ruleset * > -pf_find_or_create_ruleset(const char *path) > -{ > - char *p, *q, *r; > - struct pf_ruleset *ruleset; > - struct pf_anchor *anchor =3D NULL, *dup, *parent =3D NULL; > - > - if (path[0] =3D=3D 0) > - return (&pf_main_ruleset); > - while (*path =3D=3D '/') > - path++; > - ruleset =3D pf_find_ruleset(path); > - if (ruleset !=3D NULL) > - return (ruleset); > - p =3D (char *)rs_malloc(MAXPATHLEN); > - if (p =3D=3D NULL) > - return (NULL); > - strlcpy(p, path, MAXPATHLEN); > - while (parent =3D=3D NULL && (q =3D strrchr(p, '/')) !=3D NULL) { > - *q =3D 0; > - if ((ruleset =3D pf_find_ruleset(p)) !=3D NULL) { > - parent =3D ruleset->anchor; > - break; > - } > - } > - if (q =3D=3D NULL) > - q =3D p; > - else > - q++; > - strlcpy(p, path, MAXPATHLEN); > - if (!*q) { > - rs_free(p); > - return (NULL); > - } > - while ((r =3D strchr(q, '/')) !=3D NULL || *q) { > - if (r !=3D NULL) > - *r =3D 0; > - if (!*q || strlen(q) >=3D PF_ANCHOR_NAME_SIZE || > - (parent !=3D NULL && strlen(parent->path) >=3D > - MAXPATHLEN - PF_ANCHOR_NAME_SIZE - 1)) { > - rs_free(p); > - return (NULL); > - } > - anchor =3D (struct pf_anchor *)rs_malloc(sizeof(*anchor)); > - if (anchor =3D=3D NULL) { > - rs_free(p); > - return (NULL); > - } > - RB_INIT(&anchor->children); > - strlcpy(anchor->name, q, sizeof(anchor->name)); > - if (parent !=3D NULL) { > - strlcpy(anchor->path, parent->path, > - sizeof(anchor->path)); > - strlcat(anchor->path, "/", sizeof(anchor->path)); > - } > - strlcat(anchor->path, anchor->name, sizeof(anchor->path)); > - if ((dup =3D RB_INSERT(pf_anchor_global, &V_pf_anchors, anchor)) !=3D > - NULL) { > - printf("pf_find_or_create_ruleset: RB_INSERT1 " > - "'%s' '%s' collides with '%s' '%s'\n", > - anchor->path, anchor->name, dup->path, dup->name); > - rs_free(anchor); > - rs_free(p); > - return (NULL); > - } > - if (parent !=3D NULL) { > - anchor->parent =3D parent; > - if ((dup =3D RB_INSERT(pf_anchor_node, &parent->children, > - anchor)) !=3D NULL) { > - printf("pf_find_or_create_ruleset: " > - "RB_INSERT2 '%s' '%s' collides with " > - "'%s' '%s'\n", anchor->path, anchor->name, > - dup->path, dup->name); > - RB_REMOVE(pf_anchor_global, &V_pf_anchors, > - anchor); > - rs_free(anchor); > - rs_free(p); > - return (NULL); > - } > - } > - pf_init_ruleset(&anchor->ruleset); > - anchor->ruleset.anchor =3D anchor; > - parent =3D anchor; > - if (r !=3D NULL) > - q =3D r + 1; > - else > - *q =3D 0; > - } > - rs_free(p); > - return (&anchor->ruleset); > -} > - > -void > -pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) > -{ > - struct pf_anchor *parent; > - int i; > - > - while (ruleset !=3D NULL) { > - if (ruleset =3D=3D &pf_main_ruleset || ruleset->anchor =3D=3D NULL || > - !RB_EMPTY(&ruleset->anchor->children) || > - ruleset->anchor->refcnt > 0 || ruleset->tables > 0 || > - ruleset->topen) > - return; > - for (i =3D 0; i < PF_RULESET_MAX; ++i) > - if (!TAILQ_EMPTY(ruleset->rules[i].active.ptr) || > - !TAILQ_EMPTY(ruleset->rules[i].inactive.ptr) || > - ruleset->rules[i].inactive.open) > - return; > - RB_REMOVE(pf_anchor_global, &V_pf_anchors, ruleset->anchor); > - if ((parent =3D ruleset->anchor->parent) !=3D NULL) > - RB_REMOVE(pf_anchor_node, &parent->children, > - ruleset->anchor); > - rs_free(ruleset->anchor); > - if (parent =3D=3D NULL) > - return; > - ruleset =3D &parent->ruleset; > - } > -} > -int > -pf_anchor_setup(struct pf_rule *r, const struct pf_ruleset *s, > - const char *name) > -{ > - char *p, *path; > - struct pf_ruleset *ruleset; > - > - r->anchor =3D NULL; > - r->anchor_relative =3D 0; > - r->anchor_wildcard =3D 0; > - if (!name[0]) > - return (0); > - path =3D (char *)rs_malloc(MAXPATHLEN); > - if (path =3D=3D NULL) > - return (1); > - if (name[0] =3D=3D '/') > - strlcpy(path, name + 1, MAXPATHLEN); > - else { > - /* relative path */ > - r->anchor_relative =3D 1; > - if (s->anchor =3D=3D NULL || !s->anchor->path[0]) > - path[0] =3D 0; > - else > - strlcpy(path, s->anchor->path, MAXPATHLEN); > - while (name[0] =3D=3D '.' && name[1] =3D=3D '.' && name[2] =3D=3D '/')= { > - if (!path[0]) { > - printf("pf_anchor_setup: .. beyond root\n"); > - rs_free(path); > - return (1); > - } > - if ((p =3D strrchr(path, '/')) !=3D NULL) > - *p =3D 0; > - else > - path[0] =3D 0; > - r->anchor_relative++; > - name +=3D 3; > - } > - if (path[0]) > - strlcat(path, "/", MAXPATHLEN); > - strlcat(path, name, MAXPATHLEN); > - } > - if ((p =3D strrchr(path, '/')) !=3D NULL && !strcmp(p, "/*")) { > - r->anchor_wildcard =3D 1; > - *p =3D 0; > - } > - ruleset =3D pf_find_or_create_ruleset(path); > - rs_free(path); > - if (ruleset =3D=3D NULL || ruleset->anchor =3D=3D NULL) { > - printf("pf_anchor_setup: ruleset\n"); > - return (1); > - } > - r->anchor =3D ruleset->anchor; > - r->anchor->refcnt++; > - return (0); > -} > -#endif > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebs= d.org" It seems that now make buildkernel fails (at least for me): [...] =3D=3D=3D> lib/libelftc (all) --- all_subdir_sbin --- /usr/src/sys/netpfil/pf/pf_ruleset.c:62:2: error: "Kernel only file. Please= use sbin/pfctl/pf_ruleset.c instead." #error "Kernel only file. Please use sbin/pfctl/pf_ruleset.c instead." ^ /usr/src/sys/netpfil/pf/pf_ruleset.c:71:39: warning: type specifier missing= , defaults to 'int' [-Wimplicit-int] VNET_DEFINE(struct pf_kanchor_global, pf_anchors); ^ /usr/src/sys/netpfil/pf/pf_ruleset.c:71:1: warning: type specifier missing,= defaults to 'int' [-Wimplicit-int] VNET_DEFINE(struct pf_kanchor_global, pf_anchors); ^ /usr/src/sys/netpfil/pf/pf_ruleset.c:72:33: warning: type specifier missing= , defaults to 'int' [-Wimplicit-int] VNET_DEFINE(struct pf_kanchor, pf_main_anch= or); ^ /usr/src/sys/netpfil/pf/pf_ruleset.c:72:1: warning: type specifier missing,= defaults to 'int' [-Wimplicit-int] VNET_DEFINE(struct pf_kanchor, pf_main_anch= or); ^ /usr/src/sys/netpfil/pf/pf_ruleset.c:72:1: error: conflicting types for 'VN= ET_DEFINE' /usr/src/sys/netpfil/pf/pf_ruleset.c:71:1: note: previous declaration is he= re VNET_DEFINE(struct pf_kanchor_global, pf_anchors); Regards, oh --Sig_/hfzsmyUhBwP5pCfjizJvKl8 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCX/VBqwAKCRA4N1ZZPba5 RzOiAP9n0UxTD5m9a16A3HkyIlDIDUJ+VqboruGD9AVpzM7ggQEAzZBRJaZkWS3N TSwA/JkuIIOfQzzYjEX0AcQpDqGBZws= =PIiD -----END PGP SIGNATURE----- --Sig_/hfzsmyUhBwP5pCfjizJvKl8-- From owner-dev-commits-src-all@freebsd.org Wed Jan 6 06:28:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 365EB4C4C4C; Wed, 6 Jan 2021 06:28:30 +0000 (UTC) (envelope-from kp@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 4D9fZQ0xnKz4m19; Wed, 6 Jan 2021 06:28:30 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id EDA876B3F; Wed, 6 Jan 2021 06:28:29 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 072C8BDD0; Wed, 6 Jan 2021 07:28:27 +0100 (CET) From: "Kristof Provost" To: "Hartmann, O." Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel Date: Wed, 06 Jan 2021 07:28:27 +0100 X-Mailer: MailMate (1.13.2r5673) Message-ID: <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> In-Reply-To: <20210106055051.51e28498@hermann.fritz.box> References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> <20210106055051.51e28498@hermann.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 06:28:30 -0000 On 6 Jan 2021, at 5:50, Hartmann, O. wrote: > On Tue, 5 Jan 2021 22:37:54 GMT > Kristof Provost wrote: > >> The branch main has been updated by kp: >> >> URL: = >> https://cgit.FreeBSD.org/src/commit/?id=3Dfda7daf06301beef1bdad3989123= 2a12c6925b22 >> >> commit fda7daf06301beef1bdad39891232a12c6925b22 >> Author: Kristof Provost >> AuthorDate: 2020-12-24 15:02:04 +0000 >> Commit: Kristof Provost >> CommitDate: 2021-01-05 22:35:37 +0000 >> >> pfctl: Stop sharing pf_ruleset.c with the kernel >> >> Now that we've split up the datastructures used by the kernel and >> userspace there's essentually no more overlap between the = >> pf_ruleset.c >> code used by userspace and kernelspace. >> >> Copy the userspace bits to the pfctl directory and stop using the = >> kernel >> file. >> >> Reviewed by: philip >> MFC after: 2 weeks >> Sponsored by: Orange Business Services >> Differential Revision: https://reviews.freebsd.org/D27764 >> --- >> sbin/pfctl/Makefile | 3 - >> sbin/pfctl/pf_ruleset.c | 343 = >> ++++++++++++++++++++++++++++++++++++++++++++ >> sys/netpfil/pf/pf_ruleset.c | 286 = >> +----------------------------------- >> 3 files changed, 349 insertions(+), 283 deletions(-) >> > > It seems that now make buildkernel fails (at least for me): > > > [...] > =3D=3D=3D> lib/libelftc (all) > --- all_subdir_sbin --- > /usr/src/sys/netpfil/pf/pf_ruleset.c:62:2: error: "Kernel only file. = > Please use > sbin/pfctl/pf_ruleset.c instead." #error "Kernel only file. Please use > sbin/pfctl/pf_ruleset.c instead." ^ > /usr/src/sys/netpfil/pf/pf_ruleset.c:71:39: warning: type specifier = > missing, defaults to > 'int' [-Wimplicit-int] VNET_DEFINE(struct pf_kanchor_global, = > pf_anchors); > ^ > /usr/src/sys/netpfil/pf/pf_ruleset.c:71:1: warning: type specifier = > missing, defaults to > 'int' [-Wimplicit-int] VNET_DEFINE(struct pf_kanchor_global, = > pf_anchors); > ^ > /usr/src/sys/netpfil/pf/pf_ruleset.c:72:33: warning: type specifier = > missing, defaults to > 'int' [-Wimplicit-int] VNET_DEFINE(struct pf_kanchor, = > pf_main_anchor); > ^ > /usr/src/sys/netpfil/pf/pf_ruleset.c:72:1: warning: type specifier = > missing, defaults to > 'int' [-Wimplicit-int] VNET_DEFINE(struct pf_kanchor, = > pf_main_anchor); > ^ > /usr/src/sys/netpfil/pf/pf_ruleset.c:72:1: error: conflicting types = > for 'VNET_DEFINE' > /usr/src/sys/netpfil/pf/pf_ruleset.c:71:1: note: previous declaration = > is here > VNET_DEFINE(struct pf_kanchor_global, pf_anchors); > > What architecture are you building for? What kernel config? Do you have = anything in src.conf or make.conf? Regards, Kristof From owner-dev-commits-src-all@freebsd.org Wed Jan 6 07:36:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C58214C6636; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@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 4D9h4W3W5gz4qHK; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FAF21AD5A; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1067aBET077327; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1067aB81077326; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git) Date: Wed, 6 Jan 2021 07:36:11 GMT Message-Id: <202101060736.1067aB81077326@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: deabdc686874 - main - cache: stop pre-checking seqc when starting the lookup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: deabdc686874411bd32775c3bdd04c04d9eff3e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 07:36:12 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=deabdc686874411bd32775c3bdd04c04d9eff3e5 commit deabdc686874411bd32775c3bdd04c04d9eff3e5 Author: Mateusz Guzik AuthorDate: 2021-01-06 06:12:58 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-06 07:28:07 +0000 cache: stop pre-checking seqc when starting the lookup Tested by: pho --- sys/kern/vfs_cache.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 710c499d6bb5..138a55f94dbd 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5032,7 +5032,7 @@ cache_fplookup_skip_slashes(struct cache_fpl *fpl) ndp->ni_next = cnp->cn_nameptr; /* - * Retry the lookup, similar to dot lookups. + * See cache_fplookup_dot. */ fpl->tvp = fpl->dvp; fpl->tvp_seqc = fpl->dvp_seqc; @@ -5139,11 +5139,14 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) cache_fpl_checkpoint(fpl, &fpl->snd); + /* + * The vnode is hand is almost always stable, skip checking for it. + * Worst case this postpones the check towards the end of the iteration + * of the main loop. + */ fpl->dvp = dvp; - fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp); - if (seqc_in_modify(fpl->dvp_seqc)) { - return (cache_fpl_aborted(fpl)); - } + fpl->dvp_seqc = vn_seqc_read_notmodify(fpl->dvp); + mp = atomic_load_ptr(&dvp->v_mount); if (__predict_false(mp == NULL || !cache_fplookup_mp_supported(mp))) { return (cache_fpl_aborted(fpl)); From owner-dev-commits-src-all@freebsd.org Wed Jan 6 07:36:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 47F224C64E9; Wed, 6 Jan 2021 07:36:12 +0000 (UTC) (envelope-from git@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 4D9h4X054Jz4qKc; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEF381AE69; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1067aBTA077412; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1067aBwB077411; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git) Date: Wed, 6 Jan 2021 07:36:11 GMT Message-Id: <202101060736.1067aBwB077411@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: dbbbc07cc3e5 - main - cache: split handling of 0 and non-0 error codes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dbbbc07cc3e5e6843ca95550ca2f50e329e93a9e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 07:36:12 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=dbbbc07cc3e5e6843ca95550ca2f50e329e93a9e commit dbbbc07cc3e5e6843ca95550ca2f50e329e93a9e Author: Mateusz Guzik AuthorDate: 2020-12-31 20:41:32 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-06 06:07:24 +0000 cache: split handling of 0 and non-0 error codes Tested by: pho --- sys/kern/vfs_cache.c | 81 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 29 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 9d54997c518c..ad661339b492 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3601,6 +3601,7 @@ struct cache_fpl { enum cache_fpl_status status:8; bool in_smr; bool fsearch; + bool savename; }; static bool cache_fplookup_is_mp(struct cache_fpl *fpl); @@ -3773,20 +3774,39 @@ cache_fpl_partial_impl(struct cache_fpl *fpl, int line) #define cache_fpl_partial(x) cache_fpl_partial_impl((x), __LINE__) static int -cache_fpl_handled_impl(struct cache_fpl *fpl, int error, int line) +cache_fpl_handled_impl(struct cache_fpl *fpl, int line) { KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET, ("%s: setting to handled at %d, but already set to %d at %d\n", __func__, line, fpl->status, fpl->line)); cache_fpl_smr_assert_not_entered(fpl); + fpl->status = CACHE_FPL_STATUS_HANDLED; + fpl->line = line; + return (0); +} + +#define cache_fpl_handled(x) cache_fpl_handled_impl((x), __LINE__) + +static int +cache_fpl_handled_error_impl(struct cache_fpl *fpl, int error, int line) +{ + + KASSERT(fpl->status == CACHE_FPL_STATUS_UNSET, + ("%s: setting to handled at %d, but already set to %d at %d\n", + __func__, line, fpl->status, fpl->line)); + MPASS(error != 0); MPASS(error != CACHE_FPL_FAILED); + cache_fpl_smr_assert_not_entered(fpl); fpl->status = CACHE_FPL_STATUS_HANDLED; fpl->line = line; + fpl->dvp = NULL; + fpl->tvp = NULL; + fpl->savename = false; return (error); } -#define cache_fpl_handled(x, e) cache_fpl_handled_impl((x), (e), __LINE__) +#define cache_fpl_handled_error(x, e) cache_fpl_handled_error_impl((x), (e), __LINE__) static bool cache_fpl_terminated(struct cache_fpl *fpl) @@ -3898,7 +3918,7 @@ cache_fplookup_negative_promote(struct cache_fpl *fpl, struct namecache *oncp, cache_fpl_smr_exit(fpl); if (cache_neg_promote_cond(dvp, cnp, oncp, hash)) - return (cache_fpl_handled(fpl, ENOENT)); + return (cache_fpl_handled_error(fpl, ENOENT)); else return (cache_fpl_aborted(fpl)); } @@ -3994,7 +4014,7 @@ cache_fplookup_final_child(struct cache_fpl *fpl, enum vgetstate tvs) return (cache_fpl_aborted(fpl)); } - return (cache_fpl_handled(fpl, 0)); + return (cache_fpl_handled(fpl)); } /* @@ -4044,12 +4064,12 @@ cache_fplookup_final_modifying(struct cache_fpl *fpl) if (cnp->cn_nameiop == CREATE) { return (cache_fpl_aborted(fpl)); } - return (cache_fpl_handled(fpl, EROFS)); + return (cache_fpl_handled_error(fpl, EROFS)); } if (fpl->tvp != NULL && (cnp->cn_flags & FAILIFEXISTS) != 0) { cache_fpl_smr_exit(fpl); - return (cache_fpl_handled(fpl, EEXIST)); + return (cache_fpl_handled_error(fpl, EEXIST)); } /* @@ -4099,25 +4119,27 @@ cache_fplookup_final_modifying(struct cache_fpl *fpl) case ENOTDIR: case ENOENT: vput(dvp); - return (cache_fpl_handled(fpl, error)); + return (cache_fpl_handled_error(fpl, error)); default: vput(dvp); return (cache_fpl_aborted(fpl)); } fpl->tvp = tvp; + fpl->savename = (cnp->cn_flags & SAVENAME) != 0; if (tvp == NULL) { if ((cnp->cn_flags & SAVESTART) != 0) { ndp->ni_startdir = dvp; vrefact(ndp->ni_startdir); cnp->cn_flags |= SAVENAME; + fpl->savename = true; } MPASS(error == EJUSTRETURN); if ((cnp->cn_flags & LOCKPARENT) == 0) { VOP_UNLOCK(dvp); } - return (cache_fpl_handled(fpl, 0)); + return (cache_fpl_handled(fpl)); } /* @@ -4148,7 +4170,7 @@ cache_fplookup_final_modifying(struct cache_fpl *fpl) if ((cnp->cn_flags & FAILIFEXISTS) != 0) { vput(dvp); vput(tvp); - return (cache_fpl_handled(fpl, EEXIST)); + return (cache_fpl_handled_error(fpl, EEXIST)); } if ((cnp->cn_flags & LOCKLEAF) == 0) { @@ -4163,9 +4185,10 @@ cache_fplookup_final_modifying(struct cache_fpl *fpl) ndp->ni_startdir = dvp; vrefact(ndp->ni_startdir); cnp->cn_flags |= SAVENAME; + fpl->savename = true; } - return (cache_fpl_handled(fpl, 0)); + return (cache_fpl_handled(fpl)); } static int __noinline @@ -4302,7 +4325,7 @@ cache_fplookup_degenerate(struct cache_fpl *fpl) if (__predict_false(cnp->cn_nameiop != LOOKUP)) { cache_fpl_smr_exit(fpl); - return (cache_fpl_handled(fpl, EISDIR)); + return (cache_fpl_handled_error(fpl, EISDIR)); } MPASS((cnp->cn_flags & SAVESTART) == 0); @@ -4328,7 +4351,7 @@ cache_fplookup_degenerate(struct cache_fpl *fpl) } else { vget_finish_ref(dvp, dvs); } - return (cache_fpl_handled(fpl, 0)); + return (cache_fpl_handled(fpl)); } static int __noinline @@ -4356,7 +4379,7 @@ cache_fplookup_noentry(struct cache_fpl *fpl) */ if (__predict_false(cnp->cn_namelen > NAME_MAX)) { cache_fpl_smr_exit(fpl); - return (cache_fpl_handled(fpl, ENAMETOOLONG)); + return (cache_fpl_handled_error(fpl, ENAMETOOLONG)); } if (cnp->cn_nameiop != LOOKUP) { @@ -4417,13 +4440,16 @@ cache_fplookup_noentry(struct cache_fpl *fpl) case ENOTDIR: case ENOENT: vput(dvp); - return (cache_fpl_handled(fpl, error)); + return (cache_fpl_handled_error(fpl, error)); default: vput(dvp); return (cache_fpl_aborted(fpl)); } fpl->tvp = tvp; + if (!fpl->savename) { + MPASS((cnp->cn_flags & SAVENAME) == 0); + } if (tvp == NULL) { MPASS(error == EJUSTRETURN); @@ -4432,7 +4458,7 @@ cache_fplookup_noentry(struct cache_fpl *fpl) } else if ((cnp->cn_flags & LOCKPARENT) == 0) { VOP_UNLOCK(dvp); } - return (cache_fpl_handled(fpl, 0)); + return (cache_fpl_handled(fpl)); } if (__predict_false(!cache_fplookup_vnode_supported(tvp) || @@ -4451,7 +4477,7 @@ cache_fplookup_noentry(struct cache_fpl *fpl) } else if ((cnp->cn_flags & LOCKPARENT) == 0) { VOP_UNLOCK(dvp); } - return (cache_fpl_handled(fpl, 0)); + return (cache_fpl_handled(fpl)); } static int __noinline @@ -4575,7 +4601,7 @@ cache_fplookup_neg(struct cache_fpl *fpl, struct namecache *ncp, uint32_t hash) } cache_neg_hit_finish(ncp); cache_fpl_smr_exit(fpl); - return (cache_fpl_handled(fpl, ENOENT)); + return (cache_fpl_handled_error(fpl, ENOENT)); } static int @@ -4941,7 +4967,7 @@ cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) */ if (__predict_false(cnp->cn_namelen > NAME_MAX)) { cache_fpl_smr_exit(fpl); - return (cache_fpl_handled(fpl, ENAMETOOLONG)); + return (cache_fpl_handled_error(fpl, ENAMETOOLONG)); } /* @@ -5001,7 +5027,7 @@ cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) error = cache_fpl_aborted(fpl); } else { cache_fpl_smr_exit(fpl); - cache_fpl_handled(fpl, error); + cache_fpl_handled_error(fpl, error); } break; } @@ -5169,7 +5195,6 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, fpl.in_smr = false; fpl.ndp = ndp; fpl.cnp = cnp = &ndp->ni_cnd; - MPASS(ndp->ni_lcf == 0); MPASS(curthread == cnp->cn_thread); KASSERT ((cnp->cn_flags & CACHE_FPL_INTERNAL_CN_FLAGS) == 0, @@ -5190,6 +5215,7 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, cache_fpl_smr_enter_initial(&fpl); fpl.fsearch = false; + fpl.savename = (cnp->cn_flags & SAVENAME) != 0; fpl.pwd = pwdp; pwd = pwd_get_smr(); *(fpl.pwd) = pwd; @@ -5224,21 +5250,18 @@ out: if (__predict_true(fpl.status == CACHE_FPL_STATUS_HANDLED)) { MPASS(error != CACHE_FPL_FAILED); - /* - * A common error is ENOENT. - */ if (error != 0) { - ndp->ni_dvp = NULL; - ndp->ni_vp = NULL; - cache_fpl_cleanup_cnp(cnp); - return (error); + MPASS(fpl.dvp == NULL); + MPASS(fpl.tvp == NULL); + MPASS(fpl.savename == false); } ndp->ni_dvp = fpl.dvp; ndp->ni_vp = fpl.tvp; - if (cnp->cn_flags & SAVENAME) + if (fpl.savename) { cnp->cn_flags |= HASBUF; - else + } else { cache_fpl_cleanup_cnp(cnp); + } } return (error); } From owner-dev-commits-src-all@freebsd.org Wed Jan 6 07:36:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ED6B04C6376; Wed, 6 Jan 2021 07:36:12 +0000 (UTC) (envelope-from git@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 4D9h4X1664z4qF5; Wed, 6 Jan 2021 07:36:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9F621AC43; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1067aBrS077446; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1067aBOA077445; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git) Date: Wed, 6 Jan 2021 07:36:11 GMT Message-Id: <202101060736.1067aBOA077445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 05803be000f8 - main - cache: stop setting cn_nameptr on entry as matches cn_pnbuf already MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 05803be000f8e4a0a5e48a9ed9f857fcbf8e5134 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 07:36:13 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=05803be000f8e4a0a5e48a9ed9f857fcbf8e5134 commit 05803be000f8e4a0a5e48a9ed9f857fcbf8e5134 Author: Mateusz Guzik AuthorDate: 2021-01-05 08:47:01 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-06 06:03:41 +0000 cache: stop setting cn_nameptr on entry as matches cn_pnbuf already While here tidy up other asserts. --- sys/kern/vfs_cache.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 1ad72630e1dc..7260896df452 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5165,18 +5165,19 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, struct nameidata_saved orig; int error; - MPASS(ndp->ni_lcf == 0); - fpl.status = CACHE_FPL_STATUS_UNSET; fpl.ndp = ndp; - fpl.cnp = &ndp->ni_cnd; - MPASS(curthread == fpl.cnp->cn_thread); - KASSERT ((fpl.cnp->cn_flags & CACHE_FPL_INTERNAL_CN_FLAGS) == 0, - ("%s: internal flags found in cn_flags %" PRIx64, __func__, - fpl.cnp->cn_flags)); + fpl.cnp = cnp = &ndp->ni_cnd; - if ((fpl.cnp->cn_flags & SAVESTART) != 0) - MPASS(fpl.cnp->cn_nameiop != LOOKUP); + MPASS(ndp->ni_lcf == 0); + MPASS(curthread == cnp->cn_thread); + KASSERT ((cnp->cn_flags & CACHE_FPL_INTERNAL_CN_FLAGS) == 0, + ("%s: internal flags found in cn_flags %" PRIx64, __func__, + cnp->cn_flags)); + if ((cnp->cn_flags & SAVESTART) != 0) { + MPASS(cnp->cn_nameiop != LOOKUP); + } + MPASS(cnp->cn_nameptr == cnp->cn_pnbuf); if (!cache_can_fplookup(&fpl)) { SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); @@ -5193,8 +5194,6 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, ndp->ni_rootdir = pwd->pwd_rdir; ndp->ni_topdir = pwd->pwd_jdir; - cnp = fpl.cnp; - cnp->cn_nameptr = cnp->cn_pnbuf; if (cnp->cn_pnbuf[0] == '/') { dvp = cache_fpl_handle_root(&fpl); ndp->ni_resflags |= NIRES_ABS; From owner-dev-commits-src-all@freebsd.org Wed Jan 6 07:36:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2C2EB4C6374; Wed, 6 Jan 2021 07:36:12 +0000 (UTC) (envelope-from git@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 4D9h4W66CMz4qHP; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D6011AE98; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1067aB9K077395; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1067aBrG077394; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git) Date: Wed, 6 Jan 2021 07:36:11 GMT Message-Id: <202101060736.1067aBrG077394@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 33f3e81df531 - main - cache: combine fast path enabled status into one flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33f3e81df531d62a53390de20812d4e94720e1d3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 07:36:12 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=33f3e81df531d62a53390de20812d4e94720e1d3 commit 33f3e81df531d62a53390de20812d4e94720e1d3 Author: Mateusz Guzik AuthorDate: 2021-01-01 07:06:12 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-06 07:28:06 +0000 cache: combine fast path enabled status into one flag Tested by: pho --- sys/kern/vfs_cache.c | 51 ++++++++++++++++++++++++++++++---------- sys/security/mac/mac_framework.c | 3 +++ sys/sys/vnode.h | 1 + 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index ad661339b492..40298cd9fbdc 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3571,12 +3571,45 @@ DB_SHOW_COMMAND(vpath, db_show_vpath) #endif -static bool __read_frequently cache_fast_lookup = true; -SYSCTL_BOOL(_vfs, OID_AUTO, cache_fast_lookup, CTLFLAG_RW, - &cache_fast_lookup, 0, ""); +static int cache_fast_lookup = 1; +static char __read_frequently cache_fast_lookup_enabled = true; #define CACHE_FPL_FAILED -2020 +void +cache_fast_lookup_enabled_recalc(void) +{ + int lookup_flag; + int mac_on; + +#ifdef MAC + mac_on = mac_vnode_check_lookup_enabled(); +#else + mac_on = 0; +#endif + + lookup_flag = atomic_load_int(&cache_fast_lookup); + if (lookup_flag && !mac_on) { + atomic_store_char(&cache_fast_lookup_enabled, true); + } else { + atomic_store_char(&cache_fast_lookup_enabled, false); + } +} + +static int +syscal_vfs_cache_fast_lookup(SYSCTL_HANDLER_ARGS) +{ + int error, old; + + old = atomic_load_int(&cache_fast_lookup); + error = sysctl_handle_int(oidp, arg1, arg2, req); + if (error == 0 && req->newptr && old != atomic_load_int(&cache_fast_lookup)) + cache_fast_lookup_enabled_recalc(); + return (error); +} +SYSCTL_PROC(_vfs, OID_AUTO, cache_fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, + &cache_fast_lookup, 0, syscal_vfs_cache_fast_lookup, "IU", ""); + /* * Components of nameidata (or objects it can point to) which may * need restoring in case fast path lookup fails. @@ -3854,16 +3887,10 @@ cache_can_fplookup(struct cache_fpl *fpl) cnp = fpl->cnp; td = cnp->cn_thread; - if (!cache_fast_lookup) { - cache_fpl_aborted_early(fpl); - return (false); - } -#ifdef MAC - if (mac_vnode_check_lookup_enabled()) { + if (!atomic_load_char(&cache_fast_lookup_enabled)) { cache_fpl_aborted_early(fpl); return (false); } -#endif if ((cnp->cn_flags & ~CACHE_FPL_SUPPORTED_CN_FLAGS) != 0) { cache_fpl_aborted_early(fpl); return (false); @@ -5205,9 +5232,9 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, } MPASS(cnp->cn_nameptr == cnp->cn_pnbuf); - if (!cache_can_fplookup(&fpl)) { - SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); + if (__predict_false(!cache_can_fplookup(&fpl))) { *status = fpl.status; + SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); return (EOPNOTSUPP); } diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c index 3ec932147637..c1d52eff383e 100644 --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.c @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -399,6 +400,8 @@ mac_policy_update(void) mac_labeled |= mac_policy_getlabeled(mpc); mac_policy_count++; } + + cache_fast_lookup_enabled_recalc(); } /* diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 9be22f02e8d4..cb71d80c244f 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -657,6 +657,7 @@ cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) { } #endif +void cache_fast_lookup_enabled_recalc(void); 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); From owner-dev-commits-src-all@freebsd.org Wed Jan 6 07:36:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 204794C6373; Wed, 6 Jan 2021 07:36:12 +0000 (UTC) (envelope-from git@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 4D9h4W5Y45z4qQm; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74C5B1AD5B; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1067aBh5077378; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1067aBGF077377; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git) Date: Wed, 6 Jan 2021 07:36:11 GMT Message-Id: <202101060736.1067aBGF077377@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 71a6a0b5452d - main - cache: skip checking for spurious slashes if possible MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71a6a0b5452d7e7e2ca5fc15680cfc70f72eeb1b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 07:36:12 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=71a6a0b5452d7e7e2ca5fc15680cfc70f72eeb1b commit 71a6a0b5452d7e7e2ca5fc15680cfc70f72eeb1b Author: Mateusz Guzik AuthorDate: 2021-01-01 04:05:04 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-06 07:28:06 +0000 cache: skip checking for spurious slashes if possible Tested by: pho --- sys/kern/vfs_cache.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 40298cd9fbdc..710c499d6bb5 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3640,6 +3640,7 @@ struct cache_fpl { static bool cache_fplookup_is_mp(struct cache_fpl *fpl); static int cache_fplookup_cross_mount(struct cache_fpl *fpl); static int cache_fplookup_partial_setup(struct cache_fpl *fpl); +static int cache_fplookup_skip_slashes(struct cache_fpl *fpl); static void cache_fpl_cleanup_cnp(struct componentname *cnp) @@ -4006,6 +4007,17 @@ cache_fplookup_partial_setup(struct cache_fpl *fpl) if (cache_fpl_isdotdot(cnp)) cnp->cn_flags |= ISDOTDOT; + /* + * Skip potential extra slashes parsing did not take care of. + * cache_fplookup_skip_slashes explains the mechanism. + */ + if (__predict_false(*(cnp->cn_nameptr) == '/')) { + do { + cnp->cn_nameptr++; + ndp->ni_pathlen--; + } while (*(cnp->cn_nameptr) == '/'); + } + return (0); } @@ -4064,6 +4076,7 @@ cache_fplookup_final_modifying(struct cache_fpl *fpl) dvp = fpl->dvp; dvp_seqc = fpl->dvp_seqc; + MPASS(*(cnp->cn_nameptr) != '/'); MPASS(cache_fpl_islastcn(ndp)); if ((cnp->cn_flags & LOCKPARENT) == 0) MPASS((cnp->cn_flags & WANTPARENT) != 0); @@ -4309,6 +4322,8 @@ cache_fplookup_final(struct cache_fpl *fpl) dvp_seqc = fpl->dvp_seqc; tvp = fpl->tvp; + MPASS(*(cnp->cn_nameptr) != '/'); + if (cnp->cn_nameiop != LOOKUP) { return (cache_fplookup_final_modifying(fpl)); } @@ -4397,6 +4412,7 @@ cache_fplookup_noentry(struct cache_fpl *fpl) dvp = fpl->dvp; dvp_seqc = fpl->dvp_seqc; + MPASS(*(cnp->cn_nameptr) != '/'); MPASS((cnp->cn_flags & MAKEENTRY) == 0); MPASS((cnp->cn_flags & ISDOTDOT) == 0); MPASS(!cache_fpl_isdotdot(cnp)); @@ -4664,6 +4680,9 @@ cache_fplookup_next(struct cache_fpl *fpl) } if (__predict_false(ncp == NULL)) { + if (cnp->cn_nameptr[0] == '/') { + return (cache_fplookup_skip_slashes(fpl)); + } return (cache_fplookup_noentry(fpl)); } @@ -4969,10 +4988,56 @@ cache_fplookup_parse_advance(struct cache_fpl *fpl) cnp = fpl->cnp; cnp->cn_nameptr = ndp->ni_next; - while (*cnp->cn_nameptr == '/') { + KASSERT(*(cnp->cn_nameptr) == '/', + ("%s: should have seen slash at %p ; buf %p [%s]\n", __func__, + cnp->cn_nameptr, cnp->cn_pnbuf, cnp->cn_pnbuf)); + cnp->cn_nameptr++; + ndp->ni_pathlen--; +} + +/* + * Skip spurious slashes in a pathname (e.g., "foo///bar") and retry. + * + * Lockless lookup tries to elide checking for spurious slashes and should they + * be present is guaranteed to fail to find an entry. In this case the caller + * must check if the name starts with a slash and this call routine. It is + * going to fast forward across the spurious slashes and set the state up for + * retry. + */ +static int __noinline +cache_fplookup_skip_slashes(struct cache_fpl *fpl) +{ + struct nameidata *ndp; + struct componentname *cnp; + + ndp = fpl->ndp; + cnp = fpl->cnp; + + MPASS(*(cnp->cn_nameptr) == '/'); + do { cnp->cn_nameptr++; ndp->ni_pathlen--; - } + } while (*(cnp->cn_nameptr) == '/'); + + /* + * Go back to one slash so that cache_fplookup_parse_advance has + * something to skip. + */ + cnp->cn_nameptr--; + ndp->ni_pathlen++; + + /* + * cache_fplookup_parse_advance starts from ndp->ni_next + */ + ndp->ni_next = cnp->cn_nameptr; + + /* + * Retry the lookup, similar to dot lookups. + */ + fpl->tvp = fpl->dvp; + fpl->tvp_seqc = fpl->dvp_seqc; + + return (0); } /* From owner-dev-commits-src-all@freebsd.org Wed Jan 6 07:36:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 55C274C6737; Wed, 6 Jan 2021 07:36:13 +0000 (UTC) (envelope-from git@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 4D9h4W4d5lz4qHN; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50ED41AFEB; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1067aBcW077344; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1067aBSH077343; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git) Date: Wed, 6 Jan 2021 07:36:11 GMT Message-Id: <202101060736.1067aBSH077343@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: c6d3272b733a - main - vfs: add vn_seqc_read_notmodify MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6d3272b733add64b1e44e36d878a48fea966dec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 07:36:13 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c6d3272b733add64b1e44e36d878a48fea966dec commit c6d3272b733add64b1e44e36d878a48fea966dec Author: Mateusz Guzik AuthorDate: 2021-01-06 06:12:49 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-06 07:28:07 +0000 vfs: add vn_seqc_read_notmodify --- sys/sys/vnode.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index cb71d80c244f..ff1323cb8719 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -783,6 +783,7 @@ void vn_seqc_write_begin(struct vnode *vp); void vn_seqc_write_end_locked(struct vnode *vp); void vn_seqc_write_end(struct vnode *vp); #define vn_seqc_read_any(vp) seqc_read_any(&(vp)->v_seqc) +#define vn_seqc_read_notmodify(vp) seqc_read_notmodify(&(vp)->v_seqc) #define vn_seqc_consistent(vp, seq) seqc_consistent(&(vp)->v_seqc, seq) #define vn_rangelock_unlock(vp, cookie) \ From owner-dev-commits-src-all@freebsd.org Wed Jan 6 07:36:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 176654C61AE; Wed, 6 Jan 2021 07:36:12 +0000 (UTC) (envelope-from git@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 4D9h4W4yj5z4qBc; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67D7E1AE97; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1067aBHQ077361; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1067aBCF077360; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git) Date: Wed, 6 Jan 2021 07:36:11 GMT Message-Id: <202101060736.1067aBCF077360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 65f775157e0d - main - seqc: add seqc_read_notmodify MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 65f775157e0d239f311e912086600f620d0c15cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 07:36:12 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=65f775157e0d239f311e912086600f620d0c15cf commit 65f775157e0d239f311e912086600f620d0c15cf Author: Mateusz Guzik AuthorDate: 2021-01-06 06:11:15 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-06 07:28:06 +0000 seqc: add seqc_read_notmodify The routine can be used when the caller does not expect to ever have to wait for anything. Checking later with seqc_consistent retains all the guarantees. --- sys/sys/seqc.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/sys/seqc.h b/sys/sys/seqc.h index a04e342ad7d3..3cfaaf3acbda 100644 --- a/sys/sys/seqc.h +++ b/sys/sys/seqc.h @@ -81,6 +81,13 @@ seqc_read_any(const seqc_t *seqcp) return (atomic_load_acq_int(__DECONST(seqc_t *, seqcp))); } +static __inline seqc_t +seqc_read_notmodify(const seqc_t *seqcp) +{ + + return (atomic_load_acq_int(__DECONST(seqc_t *, seqcp)) & ~1); +} + static __inline seqc_t seqc_read(const seqc_t *seqcp) { From owner-dev-commits-src-all@freebsd.org Wed Jan 6 07:36:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 383354C64E8; Wed, 6 Jan 2021 07:36:12 +0000 (UTC) (envelope-from git@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 4D9h4X07yGz4qHQ; Wed, 6 Jan 2021 07:36:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1EC11AA68; Wed, 6 Jan 2021 07:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1067aBel077429; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1067aBCc077428; Wed, 6 Jan 2021 07:36:11 GMT (envelope-from git) Date: Wed, 6 Jan 2021 07:36:11 GMT Message-Id: <202101060736.1067aBCc077428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: a1a8f8ada13d - main - cache: deinline state handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1a8f8ada13da1cce2cd3a4b4335a1243bd34f3e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 07:36:12 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a1a8f8ada13da1cce2cd3a4b4335a1243bd34f3e commit a1a8f8ada13da1cce2cd3a4b4335a1243bd34f3e Author: Mateusz Guzik AuthorDate: 2020-12-31 20:23:08 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-06 06:05:22 +0000 cache: deinline state handling The intent is to reduce branchfest when finishing the lookup. Tested by: pho --- sys/kern/vfs_cache.c | 157 ++++++++++++++++++++++++++------------------------- 1 file changed, 81 insertions(+), 76 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 7260896df452..9d54997c518c 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3590,18 +3590,23 @@ struct nameidata_saved { struct cache_fpl { struct nameidata *ndp; struct componentname *cnp; - struct pwd *pwd; + struct pwd **pwd; struct vnode *dvp; struct vnode *tvp; seqc_t dvp_seqc; seqc_t tvp_seqc; struct nameidata_saved snd; + struct nameidata_saved snd_orig; int line; enum cache_fpl_status status:8; bool in_smr; bool fsearch; }; +static bool cache_fplookup_is_mp(struct cache_fpl *fpl); +static int cache_fplookup_cross_mount(struct cache_fpl *fpl); +static int cache_fplookup_partial_setup(struct cache_fpl *fpl); + static void cache_fpl_cleanup_cnp(struct componentname *cnp) { @@ -3676,9 +3681,24 @@ cache_fpl_restore_abort(struct cache_fpl *fpl, struct nameidata_saved *snd) MPASS(_fpl->in_smr == false); \ VFS_SMR_ASSERT_NOT_ENTERED(); \ }) +static void +cache_fpl_assert_status(struct cache_fpl *fpl) +{ + + switch (fpl->status) { + case CACHE_FPL_STATUS_UNSET: + __assert_unreachable(); + break; + case CACHE_FPL_STATUS_ABORTED: + case CACHE_FPL_STATUS_PARTIAL: + case CACHE_FPL_STATUS_HANDLED: + break; + } +} #else #define cache_fpl_smr_assert_entered(fpl) do { } while (0) #define cache_fpl_smr_assert_not_entered(fpl) do { } while (0) +#define cache_fpl_assert_status(fpl) do { } while (0) #endif #define cache_fpl_smr_enter_initial(fpl) ({ \ @@ -3702,6 +3722,23 @@ cache_fpl_restore_abort(struct cache_fpl *fpl, struct nameidata_saved *snd) }) static int +cache_fpl_aborted_early_impl(struct cache_fpl *fpl, int line) +{ + + if (fpl->status != CACHE_FPL_STATUS_UNSET) { + KASSERT(fpl->status == CACHE_FPL_STATUS_PARTIAL, + ("%s: converting to abort from %d at %d, set at %d\n", + __func__, fpl->status, line, fpl->line)); + } + cache_fpl_smr_assert_not_entered(fpl); + fpl->status = CACHE_FPL_STATUS_ABORTED; + fpl->line = line; + return (CACHE_FPL_FAILED); +} + +#define cache_fpl_aborted_early(x) cache_fpl_aborted_early_impl((x), __LINE__) + +static int __noinline cache_fpl_aborted_impl(struct cache_fpl *fpl, int line) { @@ -3712,12 +3749,15 @@ cache_fpl_aborted_impl(struct cache_fpl *fpl, int line) } fpl->status = CACHE_FPL_STATUS_ABORTED; fpl->line = line; + if (fpl->in_smr) + cache_fpl_smr_exit(fpl); + cache_fpl_restore_abort(fpl, &fpl->snd_orig); return (CACHE_FPL_FAILED); } #define cache_fpl_aborted(x) cache_fpl_aborted_impl((x), __LINE__) -static int +static int __noinline cache_fpl_partial_impl(struct cache_fpl *fpl, int line) { @@ -3727,7 +3767,7 @@ cache_fpl_partial_impl(struct cache_fpl *fpl, int line) cache_fpl_smr_assert_entered(fpl); fpl->status = CACHE_FPL_STATUS_PARTIAL; fpl->line = line; - return (CACHE_FPL_FAILED); + return (cache_fplookup_partial_setup(fpl)); } #define cache_fpl_partial(x) cache_fpl_partial_impl((x), __LINE__) @@ -3766,9 +3806,6 @@ cache_fpl_terminated(struct cache_fpl *fpl) _Static_assert((CACHE_FPL_SUPPORTED_CN_FLAGS & CACHE_FPL_INTERNAL_CN_FLAGS) == 0, "supported and internal flags overlap"); -static bool cache_fplookup_is_mp(struct cache_fpl *fpl); -static int cache_fplookup_cross_mount(struct cache_fpl *fpl); - static bool cache_fpl_islastcn(struct nameidata *ndp) { @@ -3798,29 +3835,29 @@ cache_can_fplookup(struct cache_fpl *fpl) td = cnp->cn_thread; if (!cache_fast_lookup) { - cache_fpl_aborted(fpl); + cache_fpl_aborted_early(fpl); return (false); } #ifdef MAC if (mac_vnode_check_lookup_enabled()) { - cache_fpl_aborted(fpl); + cache_fpl_aborted_early(fpl); return (false); } #endif if ((cnp->cn_flags & ~CACHE_FPL_SUPPORTED_CN_FLAGS) != 0) { - cache_fpl_aborted(fpl); + cache_fpl_aborted_early(fpl); return (false); } if (IN_CAPABILITY_MODE(td)) { - cache_fpl_aborted(fpl); + cache_fpl_aborted_early(fpl); return (false); } if (AUDITING_TD(td)) { - cache_fpl_aborted(fpl); + cache_fpl_aborted_early(fpl); return (false); } if (ndp->ni_startdir != NULL) { - cache_fpl_aborted(fpl); + cache_fpl_aborted_early(fpl); return (false); } return (true); @@ -3836,7 +3873,6 @@ cache_fplookup_dirfd(struct cache_fpl *fpl, struct vnode **vpp) ndp = fpl->ndp; error = fgetvp_lookup_smr(ndp->ni_dirfd, ndp, vpp, &fsearch); if (__predict_false(error != 0)) { - cache_fpl_smr_exit(fpl); return (cache_fpl_aborted(fpl)); } fpl->fsearch = fsearch; @@ -3882,12 +3918,11 @@ cache_fplookup_partial_setup(struct cache_fpl *fpl) ndp = fpl->ndp; cnp = fpl->cnp; - pwd = fpl->pwd; + pwd = *(fpl->pwd); dvp = fpl->dvp; dvp_seqc = fpl->dvp_seqc; if (!pwd_hold_smr(pwd)) { - cache_fpl_smr_exit(fpl); return (cache_fpl_aborted(fpl)); } @@ -4981,7 +5016,6 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) struct mount *mp; int error; - error = CACHE_FPL_FAILED; ndp = fpl->ndp; cnp = fpl->cnp; @@ -4990,20 +5024,18 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) fpl->dvp = dvp; fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp); if (seqc_in_modify(fpl->dvp_seqc)) { - cache_fpl_aborted(fpl); - goto out; + return (cache_fpl_aborted(fpl)); } mp = atomic_load_ptr(&dvp->v_mount); if (__predict_false(mp == NULL || !cache_fplookup_mp_supported(mp))) { - cache_fpl_aborted(fpl); - goto out; + return (cache_fpl_aborted(fpl)); } VNPASS(cache_fplookup_vnode_supported(fpl->dvp), fpl->dvp); error = cache_fplookup_preparse(fpl); if (__predict_false(cache_fpl_terminated(fpl))) { - goto out; + return (error); } for (;;) { @@ -5043,39 +5075,8 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) cache_fplookup_parse_advance(fpl); cache_fpl_checkpoint(fpl, &fpl->snd); } -out: - switch (fpl->status) { - case CACHE_FPL_STATUS_UNSET: - __assert_unreachable(); - break; - case CACHE_FPL_STATUS_PARTIAL: - cache_fpl_smr_assert_entered(fpl); - return (cache_fplookup_partial_setup(fpl)); - case CACHE_FPL_STATUS_ABORTED: - if (fpl->in_smr) - cache_fpl_smr_exit(fpl); - return (CACHE_FPL_FAILED); - case CACHE_FPL_STATUS_HANDLED: - MPASS(error != CACHE_FPL_FAILED); - cache_fpl_smr_assert_not_entered(fpl); - /* - * A common error is ENOENT. - */ - if (error != 0) { - ndp->ni_dvp = NULL; - ndp->ni_vp = NULL; - cache_fpl_cleanup_cnp(cnp); - return (error); - } - ndp->ni_dvp = fpl->dvp; - ndp->ni_vp = fpl->tvp; - if (cnp->cn_flags & SAVENAME) - cnp->cn_flags |= HASBUF; - else - cache_fpl_cleanup_cnp(cnp); - return (error); - } - __assert_unreachable(); + + return (error); } /* @@ -5162,10 +5163,10 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, struct pwd *pwd; struct vnode *dvp; struct componentname *cnp; - struct nameidata_saved orig; int error; fpl.status = CACHE_FPL_STATUS_UNSET; + fpl.in_smr = false; fpl.ndp = ndp; fpl.cnp = cnp = &ndp->ni_cnd; @@ -5185,12 +5186,13 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, return (EOPNOTSUPP); } - cache_fpl_checkpoint(&fpl, &orig); + cache_fpl_checkpoint(&fpl, &fpl.snd_orig); cache_fpl_smr_enter_initial(&fpl); fpl.fsearch = false; + fpl.pwd = pwdp; pwd = pwd_get_smr(); - fpl.pwd = pwd; + *(fpl.pwd) = pwd; ndp->ni_rootdir = pwd->pwd_rdir; ndp->ni_topdir = pwd->pwd_jdir; @@ -5209,31 +5211,34 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, } SDT_PROBE4(vfs, namei, lookup, entry, dvp, cnp->cn_pnbuf, cnp->cn_flags, true); - error = cache_fplookup_impl(dvp, &fpl); out: cache_fpl_smr_assert_not_entered(&fpl); - SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); - + cache_fpl_assert_status(&fpl); *status = fpl.status; - switch (fpl.status) { - case CACHE_FPL_STATUS_UNSET: - __assert_unreachable(); - break; - case CACHE_FPL_STATUS_HANDLED: - if (error != 0) - MPASS(ndp->ni_vp == NULL); - SDT_PROBE3(vfs, namei, lookup, return, error, ndp->ni_vp, true); - break; - case CACHE_FPL_STATUS_PARTIAL: - *pwdp = fpl.pwd; + if (SDT_PROBES_ENABLED()) { + SDT_PROBE3(vfs, fplookup, lookup, done, ndp, fpl.line, fpl.status); + if (fpl.status == CACHE_FPL_STATUS_HANDLED) + SDT_PROBE3(vfs, namei, lookup, return, error, ndp->ni_vp, true); + } + + if (__predict_true(fpl.status == CACHE_FPL_STATUS_HANDLED)) { + MPASS(error != CACHE_FPL_FAILED); /* - * Status restored by cache_fplookup_partial_setup. + * A common error is ENOENT. */ - break; - case CACHE_FPL_STATUS_ABORTED: - cache_fpl_restore_abort(&fpl, &orig); - break; + if (error != 0) { + ndp->ni_dvp = NULL; + ndp->ni_vp = NULL; + cache_fpl_cleanup_cnp(cnp); + return (error); + } + ndp->ni_dvp = fpl.dvp; + ndp->ni_vp = fpl.tvp; + if (cnp->cn_flags & SAVENAME) + cnp->cn_flags |= HASBUF; + else + cache_fpl_cleanup_cnp(cnp); } return (error); } From owner-dev-commits-src-all@freebsd.org Wed Jan 6 08:20:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 41F434C867A; Wed, 6 Jan 2021 08:20:24 +0000 (UTC) (envelope-from git@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 4D9j3X1QTgz4tdB; Wed, 6 Jan 2021 08:20:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FF491B5B4; Wed, 6 Jan 2021 08:20:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1068KOE5036930; Wed, 6 Jan 2021 08:20:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1068KOLr036929; Wed, 6 Jan 2021 08:20:24 GMT (envelope-from git) Date: Wed, 6 Jan 2021 08:20:24 GMT Message-Id: <202101060820.1068KOLr036929@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 99870c70bac7 - main - loader: rewrite vidc_install_font MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 99870c70bac7440bb2224d990a503d87c5488323 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 08:20:24 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=99870c70bac7440bb2224d990a503d87c5488323 commit 99870c70bac7440bb2224d990a503d87c5488323 Author: Toomas Soome AuthorDate: 2021-01-05 22:09:30 +0000 Commit: Toomas Soome CommitDate: 2021-01-06 08:20:04 +0000 loader: rewrite vidc_install_font Instead of trying to set reasonable register values, save significant register values, then prepare for font upload and then restore registers from saved data. This seems to fix text mode for most cases where text mode breakage was reported. --- stand/i386/libi386/vidconsole.c | 66 +++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/stand/i386/libi386/vidconsole.c b/stand/i386/libi386/vidconsole.c index e373bc638ee4..3eff40588dfc 100644 --- a/stand/i386/libi386/vidconsole.c +++ b/stand/i386/libi386/vidconsole.c @@ -772,7 +772,7 @@ vga_cp437_to_uni(uint8_t c) static void vidc_install_font(void) { - static uint8_t fsreg[8] = {0x0, 0x30, 0x5, 0x35, 0xa, 0x3a, 0xf, 0x3f}; + uint8_t reg[7]; const uint8_t *from; uint8_t volatile *to; uint16_t c; @@ -788,34 +788,48 @@ vidc_install_font(void) return; /* Sync-reset the sequencer registers */ - vga_set_seq(VGA_REG_BASE, 0x00, 0x01); + vga_set_seq(VGA_REG_BASE, VGA_SEQ_RESET, VGA_SEQ_RST_NAR); + + reg[0] = vga_get_seq(VGA_REG_BASE, VGA_SEQ_MAP_MASK); + reg[1] = vga_get_seq(VGA_REG_BASE, VGA_SEQ_CLOCKING_MODE); + reg[2] = vga_get_seq(VGA_REG_BASE, VGA_SEQ_MEMORY_MODE); + reg[3] = vga_get_grc(VGA_REG_BASE, VGA_GC_READ_MAP_SELECT); + reg[4] = vga_get_grc(VGA_REG_BASE, VGA_GC_MODE); + reg[5] = vga_get_grc(VGA_REG_BASE, VGA_GC_MISCELLANEOUS); + reg[6] = vga_get_atr(VGA_REG_BASE, VGA_AC_MODE_CONTROL); + + /* Screen off */ + vga_set_seq(VGA_REG_BASE, VGA_SEQ_CLOCKING_MODE, + reg[1] | VGA_SEQ_CM_SO); + /* * enable write to plane2, since fonts * could only be loaded into plane2 */ - vga_set_seq(VGA_REG_BASE, 0x02, 0x04); + vga_set_seq(VGA_REG_BASE, VGA_SEQ_MAP_MASK, VGA_SEQ_MM_EM2); /* * sequentially access data in the bit map being * selected by MapMask register (index 0x02) */ - vga_set_seq(VGA_REG_BASE, 0x04, 0x07); + vga_set_seq(VGA_REG_BASE, VGA_SEQ_MEMORY_MODE, 0x07); /* Sync-reset ended, and allow the sequencer to operate */ - vga_set_seq(VGA_REG_BASE, 0x00, 0x03); + vga_set_seq(VGA_REG_BASE, VGA_SEQ_RESET, + VGA_SEQ_RST_SR | VGA_SEQ_RST_NAR); /* * select plane 2 on Read Mode 0 */ - vga_set_grc(VGA_REG_BASE, 0x04, 0x02); + vga_set_grc(VGA_REG_BASE, VGA_GC_READ_MAP_SELECT, 0x02); /* * system addresses sequentially access data, follow * Memory Mode register bit 2 in the sequencer */ - vga_set_grc(VGA_REG_BASE, 0x05, 0x00); + vga_set_grc(VGA_REG_BASE, VGA_GC_MODE, 0x00); /* * set range of host memory addresses decoded by VGA * hardware -- A0000h-BFFFFh (128K region) */ - vga_set_grc(VGA_REG_BASE, 0x06, 0x00); + vga_set_grc(VGA_REG_BASE, VGA_GC_MISCELLANEOUS, 0x00); /* * This assumes 8x16 characters, which yield the traditional 80x25 @@ -833,35 +847,23 @@ vidc_install_font(void) *to++ = *from++; } + vga_set_atr(VGA_REG_BASE, VGA_AC_MODE_CONTROL, reg[6]); + /* Sync-reset the sequencer registers */ - vga_set_seq(VGA_REG_BASE, 0x00, 0x01); - /* enable write to plane 0 and 1 */ - vga_set_seq(VGA_REG_BASE, 0x02, 0x03); - /* - * enable character map selection - * and odd/even addressing - */ - vga_set_seq(VGA_REG_BASE, 0x04, 0x03); - /* - * select font map - */ - vga_set_seq(VGA_REG_BASE, 0x03, fsreg[s]); + vga_set_seq(VGA_REG_BASE, VGA_SEQ_RESET, VGA_SEQ_RST_NAR); + vga_set_seq(VGA_REG_BASE, VGA_SEQ_MAP_MASK, reg[0]); + vga_set_seq(VGA_REG_BASE, VGA_SEQ_MEMORY_MODE, reg[2]); /* Sync-reset ended, and allow the sequencer to operate */ - vga_set_seq(VGA_REG_BASE, 0x00, 0x03); + vga_set_seq(VGA_REG_BASE, VGA_SEQ_RESET, + VGA_SEQ_RST_SR | VGA_SEQ_RST_NAR); /* restore graphic registers */ + vga_set_grc(VGA_REG_BASE, VGA_GC_READ_MAP_SELECT, reg[3]); + vga_set_grc(VGA_REG_BASE, VGA_GC_MODE, reg[4]); + vga_set_grc(VGA_REG_BASE, VGA_GC_MISCELLANEOUS, (reg[5] & 0x03) | 0x0c); - /* select plane 0 */ - vga_set_grc(VGA_REG_BASE, 0x04, 0x00); - /* enable odd/even addressing mode */ - vga_set_grc(VGA_REG_BASE, 0x05, 0x10); - /* - * range of host memory addresses decoded by VGA - * hardware -- B8000h-BFFFFh (32K region) - */ - vga_set_grc(VGA_REG_BASE, 0x06, 0x0e); - /* enable all color plane */ - vga_set_atr(VGA_REG_BASE, 0x12, 0x0f); + /* Screen on */ + vga_set_seq(VGA_REG_BASE, VGA_SEQ_CLOCKING_MODE, reg[1] & 0xdf); } bool From owner-dev-commits-src-all@freebsd.org Wed Jan 6 09:20:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9DB184C9D3F; Wed, 6 Jan 2021 09:20:16 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D9kNc2Mb2z3FR0; Wed, 6 Jan 2021 09:20:15 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1609924814; bh=6dbKO1Z9/QwNguDMBEAbx4LEI6qe7c80katWmoNbyhE=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=axw4NyF/BFQydTbTdPrR3dejleYB6qgZrRNCDEdXhx5bEikfw9b0dEOxZUsx0oQLI aTHSExbOOLj9yU6KyovqkXZ9vm1EUa0dTxnIsu6KdxmRqnZ1NW7ednZnrREarup/8z UULS5WRjp+9H36Yb4OuQMOdJvFkBf4gxBrTgxrOI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([78.54.32.108]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M42nY-1kx4zG2Fqy-0001gL; Wed, 06 Jan 2021 10:20:14 +0100 Date: Wed, 6 Jan 2021 10:20:02 +0100 From: "Hartmann, O." To: "Kristof Provost" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel Message-ID: <20210106102002.5af4db05@hermann.fritz.box> In-Reply-To: <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> <20210106055051.51e28498@hermann.fritz.box> <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/b7U+sqDA68er+geJHYt+r_A"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Provags-ID: V03:K1:YvPl95q88X+QlwHVUDE/p0rhErZLvJcuOgTcMgXpxEbi1yKV8dv 62zHEugvEhMUv/nwUYyBWlrimK0jAC3QyWmaHJt+IpOhBaFlUJ7xZZ84hx9KYnCM2AdF1pR Fdzj46QIRqIaCKrdaP6JSujpK7Eg781zIf0sW7f3C5TpmPuYTV6DoCkegaN1PriGw+6zzy9 IYMGckFSIcxJM5zEAfcaw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:LUgV1Z9C0uQ=:SF/1VxDGClRNd0kRn33rbN SH5o8z5WZovMhJ3rkPMFQ3jDHB6DoDxeb31wxEb2KII7ZupjuUd8I9qmEh+cxU1E81n6Bp0Jj 3uZBhI5611MVjYhGeRc+Z5nzh9KeUiJBzOrkUE86t5VaP/Vm+PxqdSe278PZ9CchWtWcdZjHo AFOhpx3YEyOy8yxhThHeC/Q9jTMls2S2tJmxo5plavctXQgDsB3EomtkLK1tauzlnn0++vmrK JrWmB8jhCCpXdRGEGnrsWEIk5s5kRk0mMgm6M/12pDj3VMTCj5NT0P2bfxSMWOSG6NdHDmsI4 1iZz4rdnPoVk4GcBO4BYAHAVnVhLUp+Iw6eAQOZqU5r8APNw/vjVYgVdXp8lhgwR7tjASyL+S zSn8LaBHeoz82QSAdf1ClfOpWewSP3RXuYznAEfcEadXQW5wztpKokMAmqQKvCSFpk9aKejFG LgpgZZvT5tuWo/9GzMm1hXNG7Umd4eC8O7tBzVnakfK+XmIIDx4rU4lbgnk6Udb0rm8L5j48S WkbWcQ5UOVZfvRrO3J1HRKOfkEjP5nKEtvfv+/jg4Z/2Q5fBhgOoUcGJTq5qH6PTVgIVRwCZq cqG4At1q2jiit6H4Q0ATCCscQ5dOnUvH4L3lFHBqXs1Djq+OIchJT203kA/m6MYvpiimYvST6 65ycINfLb2109kVDJ+6uL9teC2Kya7LEZfObsODGCSolJMetcKvkSWiox8wmErfx9PB6YaQVq BbR7riLQ+XDoqfpOK3OrHCuEZ7J8jePpshgrQox1YszRzq1FcetsFUa2D8/8jIh/FI9HfFu4N KMBulsbSTtnpzOb8Z4nmczwGqvAxAAq+b6etZh38uisLo/MY4Gm/YPw4V9I1pZeOCuVOyoPN+ Lfjb0NyQ7i6e0aH7V0FQ== X-Rspamd-Queue-Id: 4D9kNc2Mb2z3FR0 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 09:20:16 -0000 --Sig_/b7U+sqDA68er+geJHYt+r_A Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 06 Jan 2021 07:28:27 +0100 "Kristof Provost" wrote: > On 6 Jan 2021, at 5:50, Hartmann, O. wrote: > > On Tue, 5 Jan 2021 22:37:54 GMT > > Kristof Provost wrote: > > =20 > >> The branch main has been updated by kp: > >> > >> URL:=20 > >> https://cgit.FreeBSD.org/src/commit/?id=3Dfda7daf06301beef1bdad3989123= 2a12c6925b22 > >> > >> commit fda7daf06301beef1bdad39891232a12c6925b22 > >> Author: Kristof Provost > >> AuthorDate: 2020-12-24 15:02:04 +0000 > >> Commit: Kristof Provost > >> CommitDate: 2021-01-05 22:35:37 +0000 > >> > >> pfctl: Stop sharing pf_ruleset.c with the kernel > >> > >> Now that we've split up the datastructures used by the kernel and > >> userspace there's essentually no more overlap between the=20 > >> pf_ruleset.c > >> code used by userspace and kernelspace. > >> > >> Copy the userspace bits to the pfctl directory and stop using the= =20 > >> kernel > >> file. > >> > >> Reviewed by: philip > >> MFC after: 2 weeks > >> Sponsored by: Orange Business Services > >> Differential Revision: https://reviews.freebsd.org/D27764 > >> --- > >> sbin/pfctl/Makefile | 3 - > >> sbin/pfctl/pf_ruleset.c | 343=20 > >> ++++++++++++++++++++++++++++++++++++++++++++ > >> sys/netpfil/pf/pf_ruleset.c | 286=20 > >> +----------------------------------- > >> 3 files changed, 349 insertions(+), 283 deletions(-) > >> =20 > > > > It seems that now make buildkernel fails (at least for me): > > > > > > [...] =20 > > =3D=3D=3D> lib/libelftc (all) =20 > > --- all_subdir_sbin --- > > /usr/src/sys/netpfil/pf/pf_ruleset.c:62:2: error: "Kernel only file.=20 > > Please use > > sbin/pfctl/pf_ruleset.c instead." #error "Kernel only file. Please use > > sbin/pfctl/pf_ruleset.c instead." ^ > > /usr/src/sys/netpfil/pf/pf_ruleset.c:71:39: warning: type specifier=20 > > missing, defaults to > > 'int' [-Wimplicit-int] VNET_DEFINE(struct pf_kanchor_global, =20 > > pf_anchors); > > ^ > > /usr/src/sys/netpfil/pf/pf_ruleset.c:71:1: warning: type specifier=20 > > missing, defaults to > > 'int' [-Wimplicit-int] VNET_DEFINE(struct pf_kanchor_global, =20 > > pf_anchors); > > ^ > > /usr/src/sys/netpfil/pf/pf_ruleset.c:72:33: warning: type specifier=20 > > missing, defaults to > > 'int' [-Wimplicit-int] VNET_DEFINE(struct pf_kanchor, =20 > > pf_main_anchor); > > ^ > > /usr/src/sys/netpfil/pf/pf_ruleset.c:72:1: warning: type specifier=20 > > missing, defaults to > > 'int' [-Wimplicit-int] VNET_DEFINE(struct pf_kanchor, =20 > > pf_main_anchor); > > ^ > > /usr/src/sys/netpfil/pf/pf_ruleset.c:72:1: error: conflicting types=20 > > for 'VNET_DEFINE' > > /usr/src/sys/netpfil/pf/pf_ruleset.c:71:1: note: previous declaration=20 > > is here > > VNET_DEFINE(struct pf_kanchor_global, pf_anchors); > > > > =20 > What architecture are you building for? What kernel config? Do you have=20 > anything in src.conf or make.conf? >=20 > Regards, > Kristof amd64. kernel config is custom, no debug, IPFW, MAC. pf is not used, we use IPFW. = make.conf has only port related stuff. src.conf looks like this: # CPUTYPE?=3D native # CFLAGS+=3D -O3 # for the kernel COPTFLAGS+=3D -O3 # #CXXFLAGS+=3D -std=3Dc++17 # WITH_CLANG_EXTRAS=3D YES WITH_LLDB=3D YES # #WITH_BSD_GREP=3D YES # WITH_OFED_EXTRA=3D YES WITH_NAND=3D YES #WITH_CTF=3D YES # WITH_NVME=3D YES # WITH_BEARSSL=3D YES #Build dynamically linked binaries as Position-Independent Executable (PIE) WITH_PIE=3D YES # WITH_SVN=3D YES # WITH_SORT_THREADS=3D YES # WITH_ZONEINFO_LEAPSECONDS_SUPPORT=3D YES # WITH_MALLOC_PRODUCTION=3D YES # WITHOUT_ASSERT_DEBUG=3D YES WITHOUT_TESTS=3D YES WITHOUT_DEBUG_FILES=3D YES # WITHOUT_CLEAN=3D YES # WITHOUT_REPRODUCIBLE_BUILD=3D YES # # KERNCONF=3D THOR KERNCONFDIR=3D /etc/config/amd64/kernel_conf/ # PORTS_MODULES=3D PORTS_MODULES+=3D x11/nvidia-driver PORTS_MODULES+=3D emulators/virtualbox-ose-kmod Kind regards and thanks in advance, oh --Sig_/b7U+sqDA68er+geJHYt+r_A Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCX/WAwgAKCRA4N1ZZPba5 R1TAAP42LhMBeBlkZOsJWr53+yU4P/3uc+lYA8wSOTMzqpeuFQD/QKQBAh4Tu8Uh oNVpE7vInwlg+ZIGI735tspitYPfLw4= =qJbp -----END PGP SIGNATURE----- --Sig_/b7U+sqDA68er+geJHYt+r_A-- From owner-dev-commits-src-all@freebsd.org Wed Jan 6 09:22:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0D3474C9EC6; Wed, 6 Jan 2021 09:22:00 +0000 (UTC) (envelope-from kp@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 4D9kQb6ypVz3Fll; Wed, 6 Jan 2021 09:21:59 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id CDA548A94; Wed, 6 Jan 2021 09:21:59 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 532CCBDDA; Wed, 6 Jan 2021 10:21:58 +0100 (CET) From: "Kristof Provost" To: "Hartmann, O." Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel Date: Wed, 06 Jan 2021 10:21:57 +0100 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: <20210106102002.5af4db05@hermann.fritz.box> References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> <20210106055051.51e28498@hermann.fritz.box> <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> <20210106102002.5af4db05@hermann.fritz.box> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 09:22:00 -0000 On 6 Jan 2021, at 10:20, Hartmann, O. wrote: > > amd64. > kernel config is custom, no debug, IPFW, MAC. pf is not used, we use IPFW. Please share your kernel config as well. Best regards, Kristof From owner-dev-commits-src-all@freebsd.org Wed Jan 6 10:34:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 713EB4CB630; Wed, 6 Jan 2021 10:34:22 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "vtr.rulingia.com", Issuer "R3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D9m2512zHz3KGX; Wed, 6 Jan 2021 10:34:20 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp239-208.static.internode.on.net [59.167.239.208]) by vtr.rulingia.com (8.15.2/8.15.2) with ESMTPS id 106AY3DH018415 (version=TLSv1.3 cipher=AEAD-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 6 Jan 2021 21:34:09 +1100 (AEDT) (envelope-from peter@rulingia.com) DKIM-Filter: OpenDKIM Filter v2.10.3 vtr.rulingia.com 106AY3DH018415 X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.16.1/8.16.1) with ESMTPS id 106AXvZv078105 (version=TLSv1.3 cipher=AEAD-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 6 Jan 2021 21:33:58 +1100 (AEDT) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.16.1/8.16.1/Submit) id 106AXvWH078104; Wed, 6 Jan 2021 21:33:57 +1100 (AEDT) (envelope-from peter) Date: Wed, 6 Jan 2021 21:33:57 +1100 From: Peter Jeremy To: Toomas Soome Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console Message-ID: References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="1s0CxTeRgWGePjJN" Content-Disposition: inline In-Reply-To: <202101022009.102K9PRl075016@gitrepo.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp X-Rspamd-Queue-Id: 4D9m2512zHz3KGX X-Spamd-Bar: ------ X-Spamd-Result: default: False [-6.10 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[rulingia.com:s=default]; FREEFALL_USER(0.00)[peter]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000]; SPAMHAUS_ZRD(0.00)[2001:19f0:5801:ebe:5400:1ff:fe53:30fd:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[rulingia.com:+]; DMARC_POLICY_ALLOW(-0.50)[rulingia.com,quarantine]; NEURAL_HAM_SHORT(-1.00)[-1.000]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:19f0:5801:ebe:5400:1ff:fe53:30fd:from]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5800::/38, country:US]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 10:34:22 -0000 --1s0CxTeRgWGePjJN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote: >The branch main has been updated by tsoome: > >URL: https://cgit.FreeBSD.org/src/commit/?id=3D3630506b9daec9167a89bc45256= 38ea45a00769e Note that this commit adds a hard build dependency on vtfontcvt(8) but that tool is depends on the WITH_VT build option. I suspect that stand/fonts should be likewise dependent on WITH_VT --=20 Peter Jeremy --1s0CxTeRgWGePjJN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAl/1kg9fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi CzTbsQ/9FauTgc2t+CwA8bE3zYaccI93MZVijDz52WGHchcMdeTsD6rFVyJ4LQdr JCM0Jac9qv8K6ca5yZYe02diiIJSDP/nJeS8G3g6J+9jIBftzOO7UFqpdlj6GsTJ N0ThfAmEdQNt4KY2kXsv1+M2BiljAWMs0WEc7Sq7jX1AN4lVQPZT4rpPLeSnjVRY 9t/8zu6GTb91tdPAFHk51PW5LN4UCjr4f9sE9owhidLNNdnFIPwDWaj45NzgNoCj U9WLhzPDCj04gcRxNNO7idRh1zoHYk1QAEpJdjCuxklxJJYh/NYzouZzUzGaGek5 /NVELI+4/9YwfFLG0H2wSiH+zPceXBCytTggmW52cRYNS+5n9dgITs29FlHxvKd9 ULMUFq93v/f2gbeZaHaWgmw0/FJuOeckISn2gbqt4kZtjUWaU+n2AvsR+vm9Ki7U jP/4BbLWNr6u2Wc9+gue0ndi4BgRmgp7w0N9vmWMMRcTCGRf2sgo1rqBCzP7p8gx 6K78Qsenic0mQrO8/asaM1qM4ambvwRMwG3wLC9Qg986FJZFgnPpxDv3JQLzNQeY 3hpY7CG6Ww8STvYjyPcFSJJefZhRHsCEN6H73xY3cZ0nm0DJufISjOtafgrM0ly4 nzCfO9aK2gUcsWz7qah6ox47JNE+teoU6EFZeTjSc52Ec1NL9IM= =ZRRm -----END PGP SIGNATURE----- --1s0CxTeRgWGePjJN-- From owner-dev-commits-src-all@freebsd.org Wed Jan 6 10:48:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EC4244CBF8C; Wed, 6 Jan 2021 10:48:14 +0000 (UTC) (envelope-from git@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 4D9mL66856z3Kwm; Wed, 6 Jan 2021 10:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5CAD1D251; Wed, 6 Jan 2021 10:48:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106AmEH6022738; Wed, 6 Jan 2021 10:48:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106AmEW0022737; Wed, 6 Jan 2021 10:48:14 GMT (envelope-from git) Date: Wed, 6 Jan 2021 10:48:14 GMT Message-Id: <202101061048.106AmEW0022737@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: ae994fdc5bd2 - main - pkg(7): rework the arguments handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ae994fdc5bd2ccc0ac0b8745fd1f1be67ad6e071 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 10:48:15 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=ae994fdc5bd2ccc0ac0b8745fd1f1be67ad6e071 commit ae994fdc5bd2ccc0ac0b8745fd1f1be67ad6e071 Author: Baptiste Daroussin AuthorDate: 2021-01-06 10:35:22 +0000 Commit: Baptiste Daroussin CommitDate: 2021-01-06 10:47:34 +0000 pkg(7): rework the arguments handling Rework the arguments handling around using getopt_long: * add long option support * add -4 and -6 support to enforce ipv4 or ipv6 While here fix a regression which occured between FreeBSD 12.1 and FreeBSD 12.2 where pkg bootstrap -y stopped working PR: 252270 MFC after: 2 weeks Submitted by: evilham Differential Revision: https://reviews.freebsd.org/D27860 --- usr.sbin/pkg/pkg.7 | 25 ++++++++++-- usr.sbin/pkg/pkg.c | 117 ++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 102 insertions(+), 40 deletions(-) diff --git a/usr.sbin/pkg/pkg.7 b/usr.sbin/pkg/pkg.7 index f7116f5da828..c672306ac08d 100644 --- a/usr.sbin/pkg/pkg.7 +++ b/usr.sbin/pkg/pkg.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 6, 2020 +.Dd December 31, 2020 .Dt PKG 7 .Os .Sh NAME @@ -36,12 +36,15 @@ .Nm add .Op Fl f +.Op Fl y .Ao Pa pkg.txz Ac .Nm .Fl N .Nm +.Op Fl 4 | Fl 6 bootstrap .Op Fl f +.Op Fl y .Sh DESCRIPTION .Nm is the package management tool. @@ -65,7 +68,7 @@ is not installed yet, it will be fetched, have its signature verified, installed, and then have the original command forwarded to it. If already installed, the command requested will be forwarded to the real .Xr pkg 8 . -.It Nm Li add Oo Fl f Oc Ao Pa pkg.txz Ac +.It Nm Li add Oo Fl f Oc Oo Fl y Oc Ao Pa pkg.txz Ac Install .Xr pkg 8 from a local package instead of fetching from remote. @@ -76,21 +79,37 @@ If the flag is specified, then .Xr pkg 8 will be installed regardless if it is already installed. +If the +.Fl y +flag is specified, no confirmation will be asked when bootstrapping +.Xr pkg 8 . .It Nm Fl N Do not bootstrap, just determine if .Xr pkg 8 is actually installed or not. Returns 0 and the number of packages installed if it is, otherwise 1. -.It Nm Li bootstrap Op Fl f +.It Nm Oo Fl 4 | Fl 6 Oc Li bootstrap Oo Fl f Oc Oo Fl y Oc Attempt to bootstrap and do not forward anything to .Xr pkg 8 after it is installed. +With +.Fl 4 +and +.Fl 6 , +.Nm +will force IPv4 or IPv6 respectively to fetch +.Xr pkg 8 +and its signatures as needed. If the .Fl f flag is specified, then .Xr pkg 8 will be fetched and installed regardless if it is already installed. +If the +.Fl y +flag is specified, no confirmation will be asked when bootstrapping +.Xr pkg 8 . .El .Sh CONFIGURATION Configuration varies in whether it is in a repository configuration file diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index a35efd8f91a8..788fdb39ebb9 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -173,7 +174,7 @@ install_pkg_static(const char *path, const char *pkgpath, bool force) } static int -fetch_to_fd(const char *url, char *path) +fetch_to_fd(const char *url, char *path, const char *fetchOpts) { struct url *u; struct dns_srvinfo *mirrors, *current; @@ -225,7 +226,7 @@ fetch_to_fd(const char *url, char *path) u->port = current->port; } - remote = fetchXGet(u, &st, ""); + remote = fetchXGet(u, &st, fetchOpts); if (remote == NULL) { --retry; if (retry <= 0) @@ -828,7 +829,7 @@ cleanup: } static int -bootstrap_pkg(bool force) +bootstrap_pkg(bool force, const char *fetchOpts) { int fd_pkg, fd_sig; int ret; @@ -865,7 +866,7 @@ bootstrap_pkg(bool force) snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX", getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - if ((fd_pkg = fetch_to_fd(url, tmppkg)) == -1) + if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) == -1) goto fetchfail; if (signature_type != NULL && @@ -877,7 +878,7 @@ bootstrap_pkg(bool force) snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig", packagesite); - if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { + if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { fprintf(stderr, "Signature for pkg not " "available.\n"); goto fetchfail; @@ -893,7 +894,7 @@ bootstrap_pkg(bool force) snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.pubkeysig", packagesite); - if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { + if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { fprintf(stderr, "Signature for pkg not " "available.\n"); goto fetchfail; @@ -948,6 +949,14 @@ static const char non_interactive_message[] = "Please set ASSUME_ALWAYS_YES=yes environment variable to be able to bootstrap " "in non-interactive (stdin not being a tty)\n"; +static const char args_bootstrap_message[] = +"Too many arguments\n" +"Usage: pkg [-4|-6] bootstrap [-f] [-y]\n"; + +static const char args_add_message[] = +"Too many arguments\n" +"Usage: pkg add [-f] [-y] {pkg.txz}\n"; + static int pkg_query_yes_no(void) { @@ -1037,27 +1046,74 @@ main(int argc, char *argv[]) { char pkgpath[MAXPATHLEN]; const char *pkgarg; - int i; - bool bootstrap_only, force, yes; + bool activation_test, add_pkg, bootstrap_only, force, yes; + signed char ch; + const char *fetchOpts; + char *command; + activation_test = false; + add_pkg = false; bootstrap_only = false; + command = NULL; + fetchOpts = ""; force = false; pkgarg = NULL; yes = false; + struct option longopts[] = { + { "force", no_argument, NULL, 'f' }, + { "only-ipv4", no_argument, NULL, '4' }, + { "only-ipv6", no_argument, NULL, '6' }, + { "yes", no_argument, NULL, 'y' }, + { NULL, 0, NULL, 0 }, + }; + snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", getlocalbase()); - if (argc > 1 && strcmp(argv[1], "bootstrap") == 0) { - bootstrap_only = true; - if (argc > 3) { - fprintf(stderr, "Too many arguments\nUsage: pkg bootstrap [-f]\n"); - exit(EXIT_FAILURE); - } - if (argc == 3 && strcmp(argv[2], "-f") == 0) { + while ((ch = getopt_long(argc, argv, "-:fyN46", longopts, NULL)) != -1) { + switch (ch) { + case 'f': force = true; - } else if (argc == 3) { - fprintf(stderr, "Invalid argument specified\nUsage: pkg bootstrap [-f]\n"); - exit(EXIT_FAILURE); + break; + case 'N': + activation_test = true; + break; + case 'y': + yes = true; + break; + case '4': + fetchOpts = "4"; + break; + case '6': + fetchOpts = "6"; + break; + case 1: + // Non-option arguments, first one is the command + if (command == NULL) { + command = argv[optind-1]; + if (strcmp(command, "add") == 0) { + add_pkg = true; + } + else if (strcmp(command, "bootstrap") == 0) { + bootstrap_only = true; + } + } + // bootstrap doesn't accept other arguments + else if (bootstrap_only) { + fprintf(stderr, args_bootstrap_message); + exit(EXIT_FAILURE); + } + // For add, we accept exactly one further argument + else if (add_pkg && pkgarg != NULL) { + fprintf(stderr, args_add_message); + exit(EXIT_FAILURE); + } + else if (add_pkg) { + pkgarg = argv[optind-1]; + } + break; + default: + break; } } @@ -1065,19 +1121,14 @@ main(int argc, char *argv[]) /* * To allow 'pkg -N' to be used as a reliable test for whether * a system is configured to use pkg, don't bootstrap pkg - * when that argument is given as argv[1]. + * when that that option is passed. */ - if (argv[1] != NULL && strcmp(argv[1], "-N") == 0) + if (activation_test) errx(EXIT_FAILURE, "pkg is not installed"); config_init(); - if (argc > 1 && strcmp(argv[1], "add") == 0) { - if (argc > 2 && strcmp(argv[2], "-f") == 0) { - force = true; - pkgarg = argv[3]; - } else - pkgarg = argv[2]; + if (add_pkg) { if (pkgarg == NULL) { fprintf(stderr, "Path to pkg.txz required\n"); exit(EXIT_FAILURE); @@ -1095,16 +1146,8 @@ main(int argc, char *argv[]) * not tty. Check the environment to see if user has answer * tucked in there already. */ - config_bool(ASSUME_ALWAYS_YES, &yes); - if (!yes) { - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-y") == 0 || - strcmp(argv[i], "--yes") == 0) { - yes = true; - break; - } - } - } + if (!yes) + config_bool(ASSUME_ALWAYS_YES, &yes); if (!yes) { if (!isatty(fileno(stdin))) { fprintf(stderr, non_interactive_message); @@ -1115,7 +1158,7 @@ main(int argc, char *argv[]) if (pkg_query_yes_no() == 0) exit(EXIT_FAILURE); } - if (bootstrap_pkg(force) != 0) + if (bootstrap_pkg(force, fetchOpts) != 0) exit(EXIT_FAILURE); config_finish(); From owner-dev-commits-src-all@freebsd.org Wed Jan 6 12:36:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4EA274CF857; Wed, 6 Jan 2021 12:36:24 +0000 (UTC) (envelope-from git@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 4D9pkw1lSPz3j9v; Wed, 6 Jan 2021 12:36:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EF731EBCB; Wed, 6 Jan 2021 12:36:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106CaO1x064808; Wed, 6 Jan 2021 12:36:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106CaO6O064807; Wed, 6 Jan 2021 12:36:24 GMT (envelope-from git) Date: Wed, 6 Jan 2021 12:36:24 GMT Message-Id: <202101061236.106CaO6O064807@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 31c2bcad7e44 - main - loader: remove left over call to unsetenv() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31c2bcad7e440fbba547c8557b29c34871b53648 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 12:36:24 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=31c2bcad7e440fbba547c8557b29c34871b53648 commit 31c2bcad7e440fbba547c8557b29c34871b53648 Author: Toomas Soome AuthorDate: 2021-01-06 11:56:48 +0000 Commit: Toomas Soome CommitDate: 2021-01-06 12:35:26 +0000 loader: remove left over call to unsetenv() We do not touch kern.vt.fb.default_mode. --- stand/i386/libi386/vidconsole.c | 1 - 1 file changed, 1 deletion(-) diff --git a/stand/i386/libi386/vidconsole.c b/stand/i386/libi386/vidconsole.c index 3eff40588dfc..a965c1d2e4f2 100644 --- a/stand/i386/libi386/vidconsole.c +++ b/stand/i386/libi386/vidconsole.c @@ -912,7 +912,6 @@ cons_update_mode(bool use_gfx_mode) unsetenv("screen.height"); unsetenv("screen.width"); unsetenv("screen.depth"); - unsetenv("kern.vt.fb.default_mode"); vidc_install_font(); } From owner-dev-commits-src-all@freebsd.org Wed Jan 6 12:39:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D42BD4CF87C; Wed, 6 Jan 2021 12:39:49 +0000 (UTC) (envelope-from git@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 4D9pps5dn0z3jgn; Wed, 6 Jan 2021 12:39:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B427C1E369; Wed, 6 Jan 2021 12:39:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106CdngI065401; Wed, 6 Jan 2021 12:39:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106CdnVF065400; Wed, 6 Jan 2021 12:39:49 GMT (envelope-from git) Date: Wed, 6 Jan 2021 12:39:49 GMT Message-Id: <202101061239.106CdnVF065400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: babda0952f83 - main - loader: instead of hw.vga.textmode, use screen.textmode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: babda0952f8355a89b3241d5e8943c7da0fa4f6b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 12:39:49 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=babda0952f8355a89b3241d5e8943c7da0fa4f6b commit babda0952f8355a89b3241d5e8943c7da0fa4f6b Author: Toomas Soome AuthorDate: 2021-01-06 11:46:34 +0000 Commit: Toomas Soome CommitDate: 2021-01-06 12:38:55 +0000 loader: instead of hw.vga.textmode, use screen.textmode hw.vga.textmode is directing VT VGA backend to use text mode. The default screen mode for BIOS loader is text, and default screen mode for VT VGA backend is graphics (unless we are running on hypervisor or hw.vga.textmode is set to 1). Using hw.vga.textmode for loader does remove possibility to have graphical mode VT VGA with text mode loader. screen.textmode can have possible values "0" to disable text mode, and "1" to set text mode. --- stand/defaults/loader.conf.5 | 29 ++++++++++++++++++++++++++--- stand/i386/libi386/vbe.c | 11 +++++------ 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index 22fe9812a33a..2adfbacc3a62 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd December 31, 2020 +.Dd Januar 6, 2020 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -237,10 +237,33 @@ selects the video console which prevents any input and hides all output replacing it with .Dq spinning character (useful for embedded products and such). +.It Va screen.font +Set font size for framebuffer mode. +Default font size is selected based on screen resolution, to achieve +terminal dimensions 80x24. +.It Va screen.textmode +Value "0" will trigger BIOS loader to switch to use VESA BIOS Extension (VBE) +frame buffer mode for console. +The same effect can be achieved by setting +.Va vbe_max_resolution . +.Pp +Value "1" will force BIOS loader to use VGA text mode. +.Pp +If +.Va vbe_max_resolution +is not set, the loader will try to set screen resolution based on EDID +information. +If EDID is not available, the default resolution is 800x600 (if available). +.It Va screen.height +.It Va screen.width +.It Va screen.depth +.Va screen.height , +.Va screen.width , +.Va screen.depth +are set by loader when loader is using framebuffer mode to draw the screen. .It Va efi_max_resolution .It Va vbe_max_resolution -Specify the maximum desired resolution for the EFI or VESA BIOS Extension (VBE) -framebuffer console. +Specify the maximum desired resolution for the EFI or VBE framebuffer console. The following values are accepted: .Bl -column "WidthxHeight" .It Sy Value Ta Sy Resolution diff --git a/stand/i386/libi386/vbe.c b/stand/i386/libi386/vbe.c index 232f13dab077..6a70cfe6f3e9 100644 --- a/stand/i386/libi386/vbe.c +++ b/stand/i386/libi386/vbe.c @@ -274,7 +274,7 @@ bios_set_text_mode(int mode) gfx_state.tg_fb.fb_mask_green = (1 << palette_format) - 1 << 8; gfx_state.tg_fb.fb_mask_blue = (1 << palette_format) - 1 << 0; gfx_state.tg_ctype = CT_INDEXED; - env_setenv("hw.vga.textmode", EV_VOLATILE | EV_NOHOOK, "1", NULL, NULL); + env_setenv("screen.textmode", EV_VOLATILE | EV_NOHOOK, "1", NULL, NULL); } /* Function 00h - Return VBE Controller Information */ @@ -378,7 +378,7 @@ biosvbe_set_mode(int mode, struct crtciinfoblock *ci) if (biosvbe_palette_format(&m) == VBE_SUCCESS) palette_format = m; } - env_setenv("hw.vga.textmode", EV_VOLATILE | EV_NOHOOK, "0", NULL, NULL); + env_setenv("screen.textmode", EV_VOLATILE | EV_NOHOOK, "0", NULL, NULL); return (rv); } @@ -508,19 +508,18 @@ mode_set(struct env_var *ev, int flags __unused, const void *value) { int mode; - if (strcmp(ev->ev_name, "hw.vga.textmode") == 0) { + if (strcmp(ev->ev_name, "screen.textmode") == 0) { unsigned long v; char *end; if (value == NULL) return (0); - /* VT(4) describes hw.vga.textmode values 0 or 1. */ errno = 0; v = strtoul(value, &end, 0); if (errno != 0 || *(char *)value == '\0' || *end != '\0' || (v != 0 && v != 1)) return (EINVAL); - env_setenv("hw.vga.textmode", EV_VOLATILE | EV_NOHOOK, + env_setenv("screen.textmode", EV_VOLATILE | EV_NOHOOK, value, NULL, NULL); if (v == 1) { reset_font_flags(); @@ -574,7 +573,7 @@ vbe_init(void) vbe_mode = NULL; } - env_setenv("hw.vga.textmode", EV_VOLATILE, "1", mode_set, + env_setenv("screen.textmode", EV_VOLATILE, "1", mode_set, env_nounset); env_setenv("vbe_max_resolution", EV_VOLATILE, NULL, mode_set, env_nounset); From owner-dev-commits-src-all@freebsd.org Wed Jan 6 12:50:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E4DF64CFFDD for ; Wed, 6 Jan 2021 12:50:50 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-ztdg10011901.me.com (pv50p00im-ztdg10011901.me.com [17.58.6.50]) (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 4D9q3Z0Vszz3k6M for ; Wed, 6 Jan 2021 12:50:49 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-ztdg10011901.me.com (Postfix) with ESMTPSA id 09FF8800673; Wed, 6 Jan 2021 12:50:40 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console From: Toomas Soome In-Reply-To: Date: Wed, 6 Jan 2021 14:50:38 +0200 Cc: Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> To: Peter Jeremy X-Mailer: Apple Mail (2.3654.40.0.2.32) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2021-01-06_06:2021-01-06, 2021-01-06 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=705 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2006250000 definitions=main-2101060078 X-Rspamd-Queue-Id: 4D9q3Z0Vszz3k6M X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[me.com]; MV_CASE(0.50)[]; RWL_MAILSPIKE_GOOD(0.00)[17.58.6.50:from]; R_SPF_ALLOW(-0.20)[+ip4:17.58.0.0/16]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[me.com:+]; DMARC_POLICY_ALLOW(-0.50)[me.com,quarantine]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[17.58.6.50:from]; FREEMAIL_ENVFROM(0.00)[me.com]; ASN(0.00)[asn:714, ipnet:17.58.0.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[80.235.52.148:received]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[me.com:s=1a1hai]; FREEFALL_USER(0.00)[tsoome]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_NONE(0.00)[me.com:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[17.58.6.50:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 12:50:51 -0000 > On 6. Jan 2021, at 12:33, Peter Jeremy wrote: >=20 > On 2021-Jan-02 20:09:25 +0000, Toomas Soome = wrote: >> The branch main has been updated by tsoome: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D3630506b9daec9167a89bc4525638ea4= 5a00769e >=20 > Note that this commit adds a hard build dependency on vtfontcvt(8) > but that tool is depends on the WITH_VT build option. I suspect > that stand/fonts should be likewise dependent on WITH_VT >=20 > --=20 > Peter Jeremy Thanks for pointing this out. We actually need to build vtfontcvt = unconditionally, in addition to font files, we also need it to generate = C code for built in font (used when there are no /boot/fonts). thanks, toomas= From owner-dev-commits-src-all@freebsd.org Wed Jan 6 12:52:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EE93B4D01D9; Wed, 6 Jan 2021 12:52:27 +0000 (UTC) (envelope-from git@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 4D9q5R6N3Nz3kPH; Wed, 6 Jan 2021 12:52:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD8C81EE55; Wed, 6 Jan 2021 12:52:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106CqRFk089736; Wed, 6 Jan 2021 12:52:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106CqR3t089735; Wed, 6 Jan 2021 12:52:27 GMT (envelope-from git) Date: Wed, 6 Jan 2021 12:52:27 GMT Message-Id: <202101061252.106CqR3t089735@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: f1829643c476 - main - vtfontcvt is part of bootstrap toolset and should always be built MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f1829643c4761cd00d1166fe4042d872e5871daa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 12:52:28 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=f1829643c4761cd00d1166fe4042d872e5871daa commit f1829643c4761cd00d1166fe4042d872e5871daa Author: Toomas Soome AuthorDate: 2021-01-06 12:45:40 +0000 Commit: Toomas Soome CommitDate: 2021-01-06 12:52:13 +0000 vtfontcvt is part of bootstrap toolset and should always be built Reported by: Peter Jeremy --- Makefile.inc1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index a19fde9195cf..1bf174419da0 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2190,9 +2190,9 @@ ${_bt}-usr.sbin/config: ${_bt}-lib/libnv ${_bt}-lib/libsbuf _strfile= usr.bin/fortune/strfile .endif -.if ${MK_VT} != "no" +# vtfontcvt is used to build font files for loader and to generate +# C source for loader built in font (8x16.c). _vtfontcvt= usr.bin/vtfontcvt -.endif # If we are not building the bootstrap because BOOTSTRAPPING is sufficient # we symlink the host version to $WORLDTMP instead. By doing this we can also From owner-dev-commits-src-all@freebsd.org Wed Jan 6 12:58:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A30D84D045E; Wed, 6 Jan 2021 12:58:51 +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 4D9qDq3S0Wz3ktm; Wed, 6 Jan 2021 12:58:51 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (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 60441A2FE; Wed, 6 Jan 2021 12:58:51 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f179.google.com with SMTP id h4so2326045qkk.4; Wed, 06 Jan 2021 04:58:51 -0800 (PST) X-Gm-Message-State: AOAM530bvjp9CeZcUlNArirGv/CY0uRhBZkq57UAR5vbMyUnzKV74Rr9 WGfRxYWchcM5TfCEtpfTDMAHs4yX8/BGXczwAXc= X-Google-Smtp-Source: ABdhPJxX35zWKrtK+5NvplAe2wHUfcMBJqfndXcVj2cFw6zxcRNAhjqvpFNRO4PgykDooj5eFqVl+zb4aFohdmbWOFo= X-Received: by 2002:a37:6713:: with SMTP id b19mr3911301qkc.493.1609937931064; Wed, 06 Jan 2021 04:58:51 -0800 (PST) MIME-Version: 1.0 References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> <20210106055051.51e28498@hermann.fritz.box> <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> <20210106102002.5af4db05@hermann.fritz.box> In-Reply-To: From: Kyle Evans Date: Wed, 6 Jan 2021 06:58:40 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel To: Kristof Provost Cc: "Hartmann, O." , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 12:58:51 -0000 I note that the original report says buildkernel, but the log exercpt is from buildworld. Looks like pf_ruleset.c kept the name, so this needs a dependency cleanup rule in tools/build to build the right one on WITHOUT_CLEAN builds. On Wed, Jan 6, 2021, 03:22 Kristof Provost wrote: > On 6 Jan 2021, at 10:20, Hartmann, O. wrote: > > > > amd64. > > kernel config is custom, no debug, IPFW, MAC. pf is not used, we use > IPFW. > Please share your kernel config as well. > > Best regards, > Kristof > From owner-dev-commits-src-all@freebsd.org Wed Jan 6 14:30:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5FCBC4D260D; Wed, 6 Jan 2021 14:30:09 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (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 4D9sG86TY5z3sGK; Wed, 6 Jan 2021 14:30:08 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id x9p6keAnxtdldx9p8kSxkH; Wed, 06 Jan 2021 07:30:06 -0700 X-Authority-Analysis: v=2.4 cv=INe8tijG c=1 sm=1 tr=0 ts=5ff5c96e a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=22F6wS5Cy-0s9iqQiOoA:9 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 57EA71264; Wed, 6 Jan 2021 06:30:03 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 106EU2Og058101; Wed, 6 Jan 2021 06:30:02 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101061430.106EU2Og058101@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: Kyle Evans cc: Kristof Provost , "Hartmann, O." , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel In-reply-to: References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> <20210106055051.51e28498@hermann.fritz.box> <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> <20210106102002.5af4db05@hermann.fritz.box> Comments: In-reply-to Kyle Evans message dated "Wed, 06 Jan 2021 06:58:40 -0600." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 06 Jan 2021 06:30:02 -0800 X-CMAE-Envelope: MS4xfJWB9obABZaAkfFes97zPfGrCYnOimrd9xk29/ohQKOUHPh12OIvXkzK5APYDs0rzWWiVq9YdTuJHnIiYgu5y70d2c4vApVntWcCnlQcoTAHUNo4zggK HVcRtDhLt/kNBUODn3Yu8gxXgLHdl6alApLJcNInipUYk4tT3vJavIaUfAunVzMo2GwUlMzPKXtAZAj2aq3PE9aaxjceHHG5J5Fpo0WYd3/MSSNcDS0wzxIj 0bnAl3hskrCIO0VvTdi1gLTS/dNhGrigbDd+DIOf7KRAR8CHCSiGtwOQ/Zb+nqZ2NOT3uNlttlew790YaWm1OnuPfOYydAnwdc5kkhZdCvVzjHccLXVnb7Nx ymuAl6Eqbe6FhNrlTSmanjegLPoOG3UYM+GiI9H7/lisxOQFRfk= X-Rspamd-Queue-Id: 4D9sG86TY5z3sGK X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 14:30:09 -0000 Yes, this is the problem. -- 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. In message , Kyle Evans writes: > I note that the original report says buildkernel, but the log exercpt is > from buildworld. Looks like pf_ruleset.c kept the name, so this needs a > dependency cleanup rule in tools/build to build the right one on > WITHOUT_CLEAN builds. > > On Wed, Jan 6, 2021, 03:22 Kristof Provost wrote: > > > On 6 Jan 2021, at 10:20, Hartmann, O. wrote: > > > > > > amd64. > > > kernel config is custom, no debug, IPFW, MAC. pf is not used, we use > > IPFW. > > Please share your kernel config as well. > > > > Best regards, > > Kristof > > From owner-dev-commits-src-all@freebsd.org Wed Jan 6 14:57:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 43E2F4D3502; Wed, 6 Jan 2021 14:57:53 +0000 (UTC) (envelope-from git@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 4D9st91Ts5z3vKY; Wed, 6 Jan 2021 14:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2645B205D9; Wed, 6 Jan 2021 14:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106Evrsb047803; Wed, 6 Jan 2021 14:57:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106EvrsE047802; Wed, 6 Jan 2021 14:57:53 GMT (envelope-from git) Date: Wed, 6 Jan 2021 14:57:53 GMT Message-Id: <202101061457.106EvrsE047802@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f0350417eb3c - stable/12 - acpi: Ensure that adjacent memory affinity table entries are coalesced MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f0350417eb3c39c6a03d311da79638fa7cdb0f3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 14:57:53 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f0350417eb3c39c6a03d311da79638fa7cdb0f3c commit f0350417eb3c39c6a03d311da79638fa7cdb0f3c Author: Mark Johnston AuthorDate: 2020-12-18 16:04:48 +0000 Commit: Mark Johnston CommitDate: 2021-01-06 14:41:09 +0000 acpi: Ensure that adjacent memory affinity table entries are coalesced The SRAT may contain multiple distinct entries that together describe a contiguous region of physical memory. In this case we were not coalescing the corresponding entries in the memory affinity table, which led to fragmented phys_avail[] entries. Since r338431 the vm_phys_segs[] entries derived from phys_avail[] will be coalesced, resulting in a situation where vm_phys_segs[] entries do not have a covering phys_avail[] entry. vm_page_startup() will not add such segments to the physical memory allocator, leaving them unused. Reported by: Don Morris Reviewed by: kib, vangyzen (cherry picked from commit 0f8b212a1e41d6eabf2a17442bcbe4f128f023f8) --- sys/dev/acpica/acpi_pxm.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/sys/dev/acpica/acpi_pxm.c b/sys/dev/acpica/acpi_pxm.c index 04be00e96b50..808886d744f0 100644 --- a/sys/dev/acpica/acpi_pxm.c +++ b/sys/dev/acpica/acpi_pxm.c @@ -265,6 +265,7 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg) ACPI_SRAT_MEM_AFFINITY *mem; ACPI_SRAT_GICC_AFFINITY *gicc; static struct cpu_info *cpup; + uint64_t base, length; int domain, i, slot; switch (entry->Type) { @@ -327,20 +328,22 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg) break; case ACPI_SRAT_TYPE_MEMORY_AFFINITY: mem = (ACPI_SRAT_MEM_AFFINITY *)entry; + base = mem->BaseAddress; + length = mem->Length; + domain = mem->ProximityDomain; + if (bootverbose) printf( "SRAT: Found memory domain %d addr 0x%jx len 0x%jx: %s\n", - mem->ProximityDomain, (uintmax_t)mem->BaseAddress, - (uintmax_t)mem->Length, + domain, (uintmax_t)base, (uintmax_t)length, (mem->Flags & ACPI_SRAT_MEM_ENABLED) ? "enabled" : "disabled"); if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED)) break; - if (mem->BaseAddress >= maxphyaddr || - !overlaps_phys_avail(mem->BaseAddress, - mem->BaseAddress + mem->Length)) { + if (base >= maxphyaddr || + !overlaps_phys_avail(base, base + length)) { printf("SRAT: Ignoring memory at addr 0x%jx\n", - (uintmax_t)mem->BaseAddress); + (uintmax_t)base); break; } if (num_mem == VM_PHYSSEG_MAX) { @@ -350,10 +353,20 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg) } slot = num_mem; for (i = 0; i < num_mem; i++) { - if (mem_info[i].end <= mem->BaseAddress) + if (mem_info[i].domain == domain) { + /* Try to extend an existing segment. */ + if (base == mem_info[i].end) { + mem_info[i].end += length; + return; + } + if (base + length == mem_info[i].start) { + mem_info[i].start -= length; + return; + } + } + if (mem_info[i].end <= base) continue; - if (mem_info[i].start < - (mem->BaseAddress + mem->Length)) { + if (mem_info[i].start < base + length) { printf("SRAT: Overlapping memory entries\n"); *(int *)arg = ENXIO; return; @@ -362,9 +375,9 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg) } for (i = num_mem; i > slot; i--) mem_info[i] = mem_info[i - 1]; - mem_info[slot].start = mem->BaseAddress; - mem_info[slot].end = mem->BaseAddress + mem->Length; - mem_info[slot].domain = mem->ProximityDomain; + mem_info[slot].start = base; + mem_info[slot].end = base + length; + mem_info[slot].domain = domain; num_mem++; break; } From owner-dev-commits-src-all@freebsd.org Wed Jan 6 14:57:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1095D4D32AE; Wed, 6 Jan 2021 14:57:53 +0000 (UTC) (envelope-from git@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 4D9st900Wdz3vFT; Wed, 6 Jan 2021 14:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5190205D8; Wed, 6 Jan 2021 14:57:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106EvqFX047752; Wed, 6 Jan 2021 14:57:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106EvqLt047751; Wed, 6 Jan 2021 14:57:52 GMT (envelope-from git) Date: Wed, 6 Jan 2021 14:57:52 GMT Message-Id: <202101061457.106EvqLt047751@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: c49c4e095e6c - stable/12 - qatfw: Fix firmware autoloading for qat_c2xxx devices MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c49c4e095e6ccabc9640c0108ea6023193978825 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 14:57:53 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c49c4e095e6ccabc9640c0108ea6023193978825 commit c49c4e095e6ccabc9640c0108ea6023193978825 Author: Mark Johnston AuthorDate: 2020-12-23 16:31:47 +0000 Commit: Mark Johnston CommitDate: 2021-01-06 14:44:35 +0000 qatfw: Fix firmware autoloading for qat_c2xxx devices r368193 was suppsed to rename the MOF firmware image, but the qat_c2xxxfw makefile defined the two images in the wrong order so the MMP image was renamed instead. (cherry picked from commit 3b216bfb6cce24aa84519315138be8d23ac5d613) --- sys/modules/qatfw/qat_c2xxx/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/modules/qatfw/qat_c2xxx/Makefile b/sys/modules/qatfw/qat_c2xxx/Makefile index 094d2ecdfdf6..fe73d1ef6aea 100644 --- a/sys/modules/qatfw/qat_c2xxx/Makefile +++ b/sys/modules/qatfw/qat_c2xxx/Makefile @@ -3,8 +3,8 @@ .PATH: ${SRCTOP}/sys/contrib/dev/qat KMOD= qat_c2xxxfw -IMG1= mmp_firmware_c2xxx -IMG2= mof_firmware_c2xxx +IMG1= mof_firmware_c2xxx +IMG2= mmp_firmware_c2xxx FIRMWS= ${IMG1}.bin:${KMOD}:111 ${IMG2}.bin:${IMG2}:111 From owner-dev-commits-src-all@freebsd.org Wed Jan 6 14:57:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1F4264D3501; Wed, 6 Jan 2021 14:57:53 +0000 (UTC) (envelope-from git@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 4D9st90RVZz3vN2; Wed, 6 Jan 2021 14:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0234520536; Wed, 6 Jan 2021 14:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106EvqhL047769; Wed, 6 Jan 2021 14:57:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106EvqsE047768; Wed, 6 Jan 2021 14:57:52 GMT (envelope-from git) Date: Wed, 6 Jan 2021 14:57:52 GMT Message-Id: <202101061457.106EvqsE047768@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d78aee09c08b - stable/12 - ffs: Avoid out-of-bounds accesses in the fs_active bitmap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d78aee09c08b575c9bbc4c90a92f6253dfd8fa3b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 14:57:53 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d78aee09c08b575c9bbc4c90a92f6253dfd8fa3b commit d78aee09c08b575c9bbc4c90a92f6253dfd8fa3b Author: Mark Johnston AuthorDate: 2020-12-23 16:13:00 +0000 Commit: Mark Johnston CommitDate: 2021-01-06 14:43:22 +0000 ffs: Avoid out-of-bounds accesses in the fs_active bitmap We use a bitmap to track which cylinder groups have changed between snapshot creation and filesystem suspension. The "legs" of the bitmap are four bytes wide (see ACTIVESET()) so we must round up the allocation size to a multiple of four bytes. I believe this bug is harmless since UMA/kmem_* will both pad the allocation and zero the full allocation. Note that malloc() does inline zeroing when the allocation size is known at compile-time. Reported by: pho (using KASAN) Reviewed by: kib, mckusick (cherry picked from commit ace3d9475ceecd9bcb766bb82a1c8f87e8f560be) --- sys/ufs/ffs/ffs_snapshot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 3cb999a01c56..749ab28fab56 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -377,8 +377,8 @@ restart: * touch up the few cylinder groups that changed during * the suspension period. */ - len = howmany(fs->fs_ncg, NBBY); - space = malloc(len, M_DEVBUF, M_WAITOK|M_ZERO); + len = roundup2(howmany(fs->fs_ncg, NBBY), sizeof(int)); + space = malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); UFS_LOCK(ump); fs->fs_active = space; UFS_UNLOCK(ump); From owner-dev-commits-src-all@freebsd.org Wed Jan 6 14:57:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 359554D32AF; Wed, 6 Jan 2021 14:57:53 +0000 (UTC) (envelope-from git@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 4D9st910Qfz3vKX; Wed, 6 Jan 2021 14:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 152441FFFD; Wed, 6 Jan 2021 14:57:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106EvrBi047786; Wed, 6 Jan 2021 14:57:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106EvrJN047785; Wed, 6 Jan 2021 14:57:53 GMT (envelope-from git) Date: Wed, 6 Jan 2021 14:57:53 GMT Message-Id: <202101061457.106EvrJN047785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 62489e19ebe2 - stable/12 - netgraph: Fix ng_ether's shutdown handing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 62489e19ebe287034833d07aeb74ca0f0599be6e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 14:57:53 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=62489e19ebe287034833d07aeb74ca0f0599be6e commit 62489e19ebe287034833d07aeb74ca0f0599be6e Author: Mark Johnston AuthorDate: 2020-12-23 05:11:16 +0000 Commit: Mark Johnston CommitDate: 2021-01-06 14:41:53 +0000 netgraph: Fix ng_ether's shutdown handing When tearing down a VNET, netgraph sends shutdown messages to all of the nodes before detaching interfaces (SI_SUB_NETGRAPH comes before SI_SUB_INIT_IF in teardown order). ng_ether nodes handle this by destroying themselves without detaching from the parent ifnet. Then, when ifnets go away they detach their ng_ether nodes again, triggering a use-after-free. Handle this by modifying ng_ether_shutdown() to detach from the ifnet. If the shutdown was triggered by an ifnet being destroyed, we will clear priv->ifp in the ng_ether detach callback, so priv->ifp may be NULL. Also get rid of the printf in vnet_netgraph_uninit(). It can be triggered trivially by ng_ether since ng_ether_shutdown() persists the node unless NG_REALLY_DIE is set. PR: 233622 Reviewed by: afedorov, kp, Lutz Donnerhacke (cherry picked from commit cd698c51790e956fed0975f451d3dfc361dc7c24) --- sys/netgraph/ng_base.c | 4 +--- sys/netgraph/ng_ether.c | 13 ++++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index a3ff2532ecbd..cc8df1e45aa6 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -3166,12 +3166,10 @@ vnet_netgraph_uninit(const void *unused __unused) /* Attempt to kill it only if it is a regular node */ if (node != NULL) { if (node == last_killed) { - /* This should never happen */ - printf("ng node %s needs NGF_REALLY_DIE\n", - node->nd_name); if (node->nd_flags & NGF_REALLY_DIE) panic("ng node %s won't die", node->nd_name); + /* The node persisted itself. Try again. */ node->nd_flags |= NGF_REALLY_DIE; } ng_rmnode(node, NULL, NULL, 0); diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c index 575f3740a6f1..770cd2bbbafd 100644 --- a/sys/netgraph/ng_ether.c +++ b/sys/netgraph/ng_ether.c @@ -414,8 +414,7 @@ ng_ether_ifnet_arrival_event(void *arg __unused, struct ifnet *ifp) node_p node; /* Only ethernet interfaces are of interest. */ - if (ifp->if_type != IFT_ETHER - && ifp->if_type != IFT_L2VLAN) + if (ifp->if_type != IFT_ETHER && ifp->if_type != IFT_L2VLAN) return; /* @@ -753,13 +752,13 @@ ng_ether_shutdown(node_p node) if (node->nd_flags & NGF_REALLY_DIE) { /* - * WE came here because the ethernet card is being unloaded, - * so stop being persistent. - * Actually undo all the things we did on creation. - * Assume the ifp has already been freed. + * The ifnet is going away, perhaps because the driver was + * unloaded or its vnet is being torn down. */ NG_NODE_SET_PRIVATE(node, NULL); - free(priv, M_NETGRAPH); + if (priv->ifp != NULL) + IFP2NG(priv->ifp) = NULL; + free(priv, M_NETGRAPH); NG_NODE_UNREF(node); /* free node itself */ return (0); } From owner-dev-commits-src-all@freebsd.org Wed Jan 6 14:57:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E014F4D28FA; Wed, 6 Jan 2021 14:57:52 +0000 (UTC) (envelope-from git@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 4D9st860dwz3v4d; Wed, 6 Jan 2021 14:57:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0E89203D9; Wed, 6 Jan 2021 14:57:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106EvqbH047718; Wed, 6 Jan 2021 14:57:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106EvqP9047717; Wed, 6 Jan 2021 14:57:52 GMT (envelope-from git) Date: Wed, 6 Jan 2021 14:57:52 GMT Message-Id: <202101061457.106EvqP9047717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: acaac0eefa1f - stable/12 - Ensure that dirent's d_off field is initialized MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: acaac0eefa1f2675dfc49faa077e3fb10949d540 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 14:57:52 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=acaac0eefa1f2675dfc49faa077e3fb10949d540 commit acaac0eefa1f2675dfc49faa077e3fb10949d540 Author: Mark Johnston AuthorDate: 2021-01-03 16:32:30 +0000 Commit: Mark Johnston CommitDate: 2021-01-06 14:45:27 +0000 Ensure that dirent's d_off field is initialized We have the d_off field in struct dirent for providing the seek offset of the next directory entry. Several filesystems were not initializing the field, which ends up being copied out to userland. Reported by: Syed Faraz Abrar Reviewed by: kib (cherry picked from commit 90f580b954090e669da234f6c8e8d0379ff9d8bc) --- sys/fs/autofs/autofs_vnops.c | 1 + sys/fs/smbfs/smbfs_io.c | 2 ++ sys/fs/tmpfs/tmpfs_subr.c | 50 ++++++++++++++++++++++++++++---------------- sys/kern/uipc_mqueue.c | 1 + 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/sys/fs/autofs/autofs_vnops.c b/sys/fs/autofs/autofs_vnops.c index 09d77b9fccf8..ac5886f96054 100644 --- a/sys/fs/autofs/autofs_vnops.c +++ b/sys/fs/autofs/autofs_vnops.c @@ -369,6 +369,7 @@ autofs_readdir_one(struct uio *uio, const char *name, int fileno, return (EINVAL); dirent.d_fileno = fileno; + dirent.d_off = uio->uio_offset + reclen; dirent.d_reclen = reclen; dirent.d_type = DT_DIR; dirent.d_namlen = namlen; diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c index 790538d7ce8b..78a11309edc3 100644 --- a/sys/fs/smbfs/smbfs_io.c +++ b/sys/fs/smbfs/smbfs_io.c @@ -103,6 +103,7 @@ smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) (np->n_parent ? np->n_parentino : 2); if (de.d_fileno == 0) de.d_fileno = 0x7ffffffd + offset; + de.d_off = offset + 1; de.d_namlen = offset + 1; de.d_name[0] = '.'; de.d_name[1] = '.'; @@ -153,6 +154,7 @@ smbfs_readvdir(struct vnode *vp, struct uio *uio, struct ucred *cred) bzero((caddr_t)&de, DE_SIZE); de.d_reclen = DE_SIZE; de.d_fileno = ctx->f_attr.fa_ino; + de.d_off = offset + 1; de.d_type = (ctx->f_attr.fa_attr & SMB_FA_DIR) ? DT_DIR : DT_REG; de.d_namlen = ctx->f_nmlen; bcopy(ctx->f_name, de.d_name, de.d_namlen); diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 10405abed00f..bea1189d2e82 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -1188,6 +1188,7 @@ tmpfs_dir_getdotdent(struct tmpfs_mount *tm, struct tmpfs_node *node, MPASS(uio->uio_offset == TMPFS_DIRCOOKIE_DOT); dent.d_fileno = node->tn_id; + dent.d_off = TMPFS_DIRCOOKIE_DOTDOT; dent.d_type = DT_DIR; dent.d_namlen = 1; dent.d_name[0] = '.'; @@ -1213,7 +1214,7 @@ tmpfs_dir_getdotdent(struct tmpfs_mount *tm, struct tmpfs_node *node, */ static int tmpfs_dir_getdotdotdent(struct tmpfs_mount *tm, struct tmpfs_node *node, - struct uio *uio) + struct uio *uio, off_t next) { struct tmpfs_node *parent; struct dirent dent; @@ -1234,6 +1235,7 @@ tmpfs_dir_getdotdotdent(struct tmpfs_mount *tm, struct tmpfs_node *node, dent.d_fileno = parent->tn_id; TMPFS_NODE_UNLOCK(parent); + dent.d_off = next; dent.d_type = DT_DIR; dent.d_namlen = 2; dent.d_name[0] = '.'; @@ -1263,7 +1265,7 @@ tmpfs_dir_getdents(struct tmpfs_mount *tm, struct tmpfs_node *node, struct uio *uio, int maxcookies, u_long *cookies, int *ncookies) { struct tmpfs_dir_cursor dc; - struct tmpfs_dirent *de; + struct tmpfs_dirent *de, *nde; off_t off; int error; @@ -1284,18 +1286,19 @@ tmpfs_dir_getdents(struct tmpfs_mount *tm, struct tmpfs_node *node, error = tmpfs_dir_getdotdent(tm, node, uio); if (error != 0) return (error); - uio->uio_offset = TMPFS_DIRCOOKIE_DOTDOT; + uio->uio_offset = off = TMPFS_DIRCOOKIE_DOTDOT; if (cookies != NULL) - cookies[(*ncookies)++] = off = uio->uio_offset; + cookies[(*ncookies)++] = off; /* FALLTHROUGH */ case TMPFS_DIRCOOKIE_DOTDOT: - error = tmpfs_dir_getdotdotdent(tm, node, uio); + de = tmpfs_dir_first(node, &dc); + off = tmpfs_dirent_cookie(de); + error = tmpfs_dir_getdotdotdent(tm, node, uio, off); if (error != 0) return (error); - de = tmpfs_dir_first(node, &dc); - uio->uio_offset = tmpfs_dirent_cookie(de); + uio->uio_offset = off; if (cookies != NULL) - cookies[(*ncookies)++] = off = uio->uio_offset; + cookies[(*ncookies)++] = off; /* EOF. */ if (de == NULL) return (0); @@ -1310,13 +1313,17 @@ tmpfs_dir_getdents(struct tmpfs_mount *tm, struct tmpfs_node *node, off = tmpfs_dirent_cookie(de); } - /* Read as much entries as possible; i.e., until we reach the end of - * the directory or we exhaust uio space. */ + /* + * Read as much entries as possible; i.e., until we reach the end of the + * directory or we exhaust uio space. + */ do { struct dirent d; - /* Create a dirent structure representing the current - * tmpfs_node and fill it. */ + /* + * Create a dirent structure representing the current tmpfs_node + * and fill it. + */ if (de->td_node == NULL) { d.d_fileno = 1; d.d_type = DT_WHT; @@ -1360,20 +1367,27 @@ tmpfs_dir_getdents(struct tmpfs_mount *tm, struct tmpfs_node *node, MPASS(de->td_namelen < sizeof(d.d_name)); (void)memcpy(d.d_name, de->ud.td_name, de->td_namelen); d.d_reclen = GENERIC_DIRSIZ(&d); - dirent_terminate(&d); - /* Stop reading if the directory entry we are treating is - * bigger than the amount of data that can be returned. */ + /* + * Stop reading if the directory entry we are treating is bigger + * than the amount of data that can be returned. + */ if (d.d_reclen > uio->uio_resid) { error = EJUSTRETURN; break; } - /* Copy the new dirent structure into the output buffer and - * advance pointers. */ + nde = tmpfs_dir_next(node, &dc); + d.d_off = tmpfs_dirent_cookie(nde); + dirent_terminate(&d); + + /* + * Copy the new dirent structure into the output buffer and + * advance pointers. + */ error = uiomove(&d, d.d_reclen, uio); if (error == 0) { - de = tmpfs_dir_next(node, &dc); + de = nde; if (cookies != NULL) { off = tmpfs_dirent_cookie(de); MPASS(*ncookies < maxcookies); diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c index 67c828cae222..84f51fafb636 100644 --- a/sys/kern/uipc_mqueue.c +++ b/sys/kern/uipc_mqueue.c @@ -1426,6 +1426,7 @@ mqfs_readdir(struct vop_readdir_args *ap) if (!pn->mn_fileno) mqfs_fileno_alloc(mi, pn); entry.d_fileno = pn->mn_fileno; + entry.d_off = offset + entry.d_reclen; for (i = 0; i < MQFS_NAMELEN - 1 && pn->mn_name[i] != '\0'; ++i) entry.d_name[i] = pn->mn_name[i]; entry.d_namlen = i; From owner-dev-commits-src-all@freebsd.org Wed Jan 6 14:57:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F3D904D3500; Wed, 6 Jan 2021 14:57:52 +0000 (UTC) (envelope-from git@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 4D9st86bz2z3vCC; Wed, 6 Jan 2021 14:57:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1E69205D7; Wed, 6 Jan 2021 14:57:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106EvqsG047735; Wed, 6 Jan 2021 14:57:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106EvqAQ047734; Wed, 6 Jan 2021 14:57:52 GMT (envelope-from git) Date: Wed, 6 Jan 2021 14:57:52 GMT Message-Id: <202101061457.106EvqAQ047734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 5ece34669c27 - stable/12 - msdosfs: Fix a leak of dirent padding bytes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5ece34669c27a61f78cd0f6e0759c17f7787aebb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 14:57:53 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5ece34669c27a61f78cd0f6e0759c17f7787aebb commit 5ece34669c27a61f78cd0f6e0759c17f7787aebb Author: Mark Johnston AuthorDate: 2020-12-27 21:52:30 +0000 Commit: Mark Johnston CommitDate: 2021-01-06 14:45:04 +0000 msdosfs: Fix a leak of dirent padding bytes This was missed in r340856 / commit 6d2e2df764199f0a15fd743e79599391959cc17d. Three bytes from the kernel stack may be leaked when reading directory entries. Reported by: Syed Faraz Abrar (cherry picked from commit 599f90446376370eb365a0fde857ea2b5766873a) --- sys/fs/msdosfs/msdosfs_vnops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 40757420adce..d700f6a62d5c 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1687,6 +1687,7 @@ msdosfs_readdir(struct vop_readdir_args *ap) dirbuf.d_reclen = GENERIC_DIRSIZ(&dirbuf); /* NOTE: d_off is the offset of the *next* entry. */ dirbuf.d_off = offset + sizeof(struct direntry); + dirent_terminate(&dirbuf); if (uio->uio_resid < dirbuf.d_reclen) { brelse(bp); goto out; From owner-dev-commits-src-all@freebsd.org Wed Jan 6 15:19:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 259A54D42DE; Wed, 6 Jan 2021 15:19:12 +0000 (UTC) (envelope-from git@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 4D9tLm0W6zz4Rfw; Wed, 6 Jan 2021 15:19:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 048F620D87; Wed, 6 Jan 2021 15:19:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106FJBVF073434; Wed, 6 Jan 2021 15:19:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106FJBRE073433; Wed, 6 Jan 2021 15:19:11 GMT (envelope-from git) Date: Wed, 6 Jan 2021 15:19:11 GMT Message-Id: <202101061519.106FJBRE073433@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 3efe9b3e77c3 - main - Fix a couple of typos and formatting issues MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3efe9b3e77c3943fc791d305f4f6043b05ff1eeb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 15:19:12 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3efe9b3e77c3943fc791d305f4f6043b05ff1eeb commit 3efe9b3e77c3943fc791d305f4f6043b05ff1eeb Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-01-06 15:19:15 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-01-06 15:19:15 +0000 Fix a couple of typos and formatting issues --- stand/defaults/loader.conf.5 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index 2adfbacc3a62..21ee86c83c65 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd Januar 6, 2020 +.Dd January 6, 2020 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -193,7 +193,7 @@ special value which aborts the bootstrap process, use of this setting should be avoided. .El .Pp -.Em WARNING: +.Em WARNING : developers should never use these suffixes for any kernel environment variables (tunables) or conflicts will result. .Sh DEFAULT SETTINGS @@ -242,12 +242,16 @@ Set font size for framebuffer mode. Default font size is selected based on screen resolution, to achieve terminal dimensions 80x24. .It Va screen.textmode -Value "0" will trigger BIOS loader to switch to use VESA BIOS Extension (VBE) +Value +.Dq 0 +will trigger BIOS loader to switch to use VESA BIOS Extension (VBE) frame buffer mode for console. The same effect can be achieved by setting .Va vbe_max_resolution . .Pp -Value "1" will force BIOS loader to use VGA text mode. +Value +.Dq 1 +will force BIOS loader to use VGA text mode. .Pp If .Va vbe_max_resolution @@ -377,7 +381,7 @@ It is not available in the default Forth-based loader. .Sh FILES .Bl -tag -width /boot/defaults/loader.conf -compact .It Pa /boot/defaults/loader.conf -default settings -- do not change this file. +default settings \(em do not change this file. .It Pa /boot/loader.conf user defined settings. .It Pa /boot/loader.conf.local @@ -403,7 +407,7 @@ The stops reading .Nm when it encounters a syntax error, so any options which are vital for -booting a particular system (i.e.\& +booting a particular system (i.e., .Dq Va hw.ata.ata_dma Ns "=0" ) should precede any experimental additions to .Nm . From owner-dev-commits-src-all@freebsd.org Wed Jan 6 15:29:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 425BF4D4706; Wed, 6 Jan 2021 15:29:35 +0000 (UTC) (envelope-from gbe@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 4D9tZl1RJpz4S8q; Wed, 6 Jan 2021 15:29:35 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p200300d5d72fc8e88d2762c8763f258e.dip0.t-ipconnect.de [IPv6:2003:d5:d72f:c8e8:8d27:62c8:763f:258e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id 9775EB451; Wed, 6 Jan 2021 15:29:34 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Wed, 6 Jan 2021 16:29:32 +0100 From: Gordon Bergling To: Baptiste Daroussin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support Message-ID: References: <202101051302.105D24lW041218@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202101051302.105D24lW041218@gitrepo.freebsd.org> X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 4:20PM up 2 days, 18:25, 4 users, load averages: 0.31, 0.29, 0.25 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 15:29:35 -0000 On Tue, Jan 05, 2021 at 01:02:04PM +0000, Baptiste Daroussin wrote: > The branch main has been updated by bapt: > > URL: https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba0441562aa07 > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > Author: Baptiste Daroussin > AuthorDate: 2021-01-04 16:29:40 +0000 > Commit: Baptiste Daroussin > CommitDate: 2021-01-05 13:01:32 +0000 > > ncurses: only keep the version with widechar support > > Only keep the widechar version of ncurses as libncursesw.so.9 > > Keep the old name to avoid breaking the ABI compatibility (the non > widechar version libncurses.so.9 is not binary compatible with > libncursesw.so.9) since all ports and base are already only linking > against the widechar version we can simply remove libncurses.so.9 > > Since the .9 version only lived in the dev branch and never ended in a > release, it is simply removed and not added to any binary compat > package. > > Add symlinks to keep build time compatibility for anyone linking against > -lncurses > --- > Makefile.inc1 | 5 +-- > Makefile.libcompat | 4 +- > ObsoleteFiles.inc | 2 + > lib/ncurses/Makefile | 6 +-- > lib/ncurses/config.mk | 11 +----- > lib/ncurses/form/Makefile | 18 ++++++--- > lib/ncurses/formw/Makefile | 5 --- > lib/ncurses/formw/Makefile.depend | 17 --------- > lib/ncurses/menu/Makefile | 18 ++++++--- > lib/ncurses/menuw/Makefile | 5 --- > lib/ncurses/menuw/Makefile.depend | 17 --------- > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++-------------------- > lib/ncurses/ncursesw/Makefile | 7 ---- > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > lib/ncurses/panel/Makefile | 23 ++++++++---- > lib/ncurses/panelw/Makefile | 5 --- > lib/ncurses/panelw/Makefile.depend | 17 --------- > share/mk/src.libnames.mk | 16 ++------ > tools/bsdbox/Makefile.base | 2 +- > tools/tools/ath/athratestats/Makefile | 2 +- > 20 files changed, 87 insertions(+), 180 deletions(-) [...] This also breaks the build on arm64. I had NO_CLEAN=yes applied, but this error is generated after a 'make clean cleandepend'. The src.conf is the following, WITH_MALLOC_PRODUCTION=1 WITH_EXTRA_TCP_STACKS=1 WITH_BEARSSL=1 WITH_PIE=1 WITH_RETPOLINE=1 Is there anything else I can do? ------------------------------------------------------------------------------- ===> cddl/lib/libnvpair (obj,all,install) In file included from /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/widechar/lib_add_wch.c:37: /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:2062:40: error: a parameter list without types is only allowed in a function definition extern NCURSES_EXPORT(int) _nc_to_char(wint_t); ^ /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:2063:23: error: unknown type name 'wint_t' extern NCURSES_EXPORT(wint_t) _nc_to_widechar(int); ^ /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:2322:61: error: unknown type name 'mbstate_t'; did you mean '__ mbstate_t'? extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *); ^~~~~~~~~ __mbstate_t /tank/nfs_public/tiny/obj/tank/nfs_public/tiny/src/arm64.aarch64/tmp/usr/include/sys/_types.h:124:3: note: '__mbstate_t' declar ed here } __mbstate_t; ^ /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/widechar/lib_add_wch.c:46:34: error: excess elements in struct initializer [- Werror,-Wexcess-initializers] static const cchar_t blankchar = NewChar(BLANK_TEXT); ^~~~~~~~~~~~~~~~~~~ /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:1537:21: note: expanded from macro 'NewChar' #define NewChar(ch) NewChar2(ChCharOf(ch), ChAttrOf(ch)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:1536:43: note: expanded from macro 'NewChar2' #define NewChar2(c,a) { a, { c, NulChar } NulColor } ^~~~~~~~ /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:1523:20: note: expanded from macro 'NulColor' #define NulColor , 0 ^ /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/widechar/lib_add_wch.c:66:16: error: no member named 'ext_color' in 'cchar_t' int pair = GetPair(ch); ^~~~~~~~~~~ /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:479:42: note: expanded from macro 'GetPair' #define GetPair(value) GetPair2((value).ext_color, AttrOf(value)) ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ ------------------------------------------------------------------------------- --Gordon From owner-dev-commits-src-all@freebsd.org Wed Jan 6 15:45:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F04FF4D47E5; Wed, 6 Jan 2021 15:45:48 +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 4D9txS6L1dz4TDj; Wed, 6 Jan 2021 15:45:48 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (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 C7695B6AF; Wed, 6 Jan 2021 15:45:48 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f182.google.com with SMTP id 143so2743675qke.10; Wed, 06 Jan 2021 07:45:48 -0800 (PST) X-Gm-Message-State: AOAM532Tzc7XSi9uEQTZz05/CRTjGXX/xdBvlKJxclf/15gwbKHRcBQ+ ysCFB8ULjFyygof9ru72FhVUFMJOvtf2cN21nQY= X-Google-Smtp-Source: ABdhPJw005AlOOEX0bU+Au8zbJki7B1ivxhpAXVM0y3KLnlhltxd9L/sPFyb0v5ao0TlbdtgAVGREXhMydHpCrBTfIo= X-Received: by 2002:a05:620a:14a:: with SMTP id e10mr4704953qkn.103.1609947948494; Wed, 06 Jan 2021 07:45:48 -0800 (PST) MIME-Version: 1.0 References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> <20210106055051.51e28498@hermann.fritz.box> <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> <20210106102002.5af4db05@hermann.fritz.box> <202101061430.106EU2Og058101@slippy.cwsent.com> In-Reply-To: <202101061430.106EU2Og058101@slippy.cwsent.com> From: Kyle Evans Date: Wed, 6 Jan 2021 09:45:34 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel To: Cy Schubert Cc: Kyle Evans , Kristof Provost , "Hartmann, O." , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 15:45:49 -0000 On Wed, Jan 6, 2021 at 8:30 AM Cy Schubert wrote: > In message om> > , Kyle Evans writes: > > On Wed, Jan 6, 2021, 03:22 Kristof Provost wrote: > > > > > On 6 Jan 2021, at 10:20, Hartmann, O. wrote: > > > > > > > > amd64. > > > > kernel config is custom, no debug, IPFW, MAC. pf is not used, we use > > > IPFW. > > > Please share your kernel config as well. > > > > > > Best regards, > > > Kristof > > > > > I note that the original report says buildkernel, but the log exercpt is > > from buildworld. Looks like pf_ruleset.c kept the name, so this needs a > > dependency cleanup rule in tools/build to build the right one on > > WITHOUT_CLEAN builds. > > > > Yes, this is the problem. > This should do, I think: diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh index 8b249ccf55f..7d078f52c84 100755 --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -56,3 +56,6 @@ if [ -e "$OBJTOP"/rescue/rescue/rescue.c ] && \ echo "Removing old rescue(8) tree" rm -rf "$OBJTOP"/rescue/rescue fi + +# 20210105 fda7daf06301 pfctl gained its own version of pf_ruleset.c +clean_dep sbin/pfctl pf_ruleset c From owner-dev-commits-src-all@freebsd.org Wed Jan 6 16:12:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9D5F64D5771; Wed, 6 Jan 2021 16:12:03 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (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 4D9vWl1BM5z4WG4; Wed, 6 Jan 2021 16:12:02 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id xBPikXIXp34axxBPkkYj9e; Wed, 06 Jan 2021 09:12:01 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5ff5e151 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=Pej5ICdeRofg9T6lYGQA:9 a=CjuIK1q_8ugA:10 a=UJ0tAi3fqDAA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 5742A13EF; Wed, 6 Jan 2021 08:11:56 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 106GBuf8085541; Wed, 6 Jan 2021 08:11:56 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101061611.106GBuf8085541@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: Kyle Evans cc: Cy Schubert , Kristof Provost , "Hartmann, O." , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel In-reply-to: References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> <20210106055051.51e28498@hermann.fritz.box> <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> <20210106102002.5af4db05@hermann.fritz.box> <202101061430.106EU2Og058101@slippy.cwsent.com> Comments: In-reply-to Kyle Evans message dated "Wed, 06 Jan 2021 09:45:34 -0600." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 06 Jan 2021 08:11:56 -0800 X-CMAE-Envelope: MS4xfKJ0VACZmN3YZ2yj8eEj//l+cA3+cBZ96Rb2Y8RkxQWGvIPopEyV49ET0C1uIZgGxhVteayuBs4TRq/UrW4tDCRceZphAJWEpZ5SK4wQ3JSNSO3tWg/7 +pdwFRsqm+bGXslAaXHZl7ojfezGDPKK+OvBhxeoqcUTgXfSzmwHh17NoFcl7lKxchhJAatoOtFlk5/jfqQM3q+25RvZu+qvE7MdnKvS9QzLOeVlCMdhP1ro E2PSnhL7ja3+9z3LNCbgL7bQFrlPQSlYeU3Ww34JU8J1vz1lvwYlVlt6y5kucd5anVtDnOCak6tV5oMRgkESQFK27hiQbZ1reZSBk3fyEOHy8eOghbyzRLNm VhmEpro4u0jFeq9rey8D0JISoF0EOwzvQB/iq0v6EQSMRREunuc= X-Rspamd-Queue-Id: 4D9vWl1BM5z4WG4 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 16:12:03 -0000 In message , Kyle Evans writes: > On Wed, Jan 6, 2021 at 8:30 AM Cy Schubert wrote: > > In message c > > om> > > , Kyle Evans writes: > > > On Wed, Jan 6, 2021, 03:22 Kristof Provost wrote: > > > > > > > On 6 Jan 2021, at 10:20, Hartmann, O. wrote: > > > > > > > > > > amd64. > > > > > kernel config is custom, no debug, IPFW, MAC. pf is not used, we use > > > > IPFW. > > > > Please share your kernel config as well. > > > > > > > > Best regards, > > > > Kristof > > > > > > > I note that the original report says buildkernel, but the log exercpt is > > > from buildworld. Looks like pf_ruleset.c kept the name, so this needs a > > > dependency cleanup rule in tools/build to build the right one on > > > WITHOUT_CLEAN builds. > > > > > > > Yes, this is the problem. > > > > This should do, I think: > > diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh > index 8b249ccf55f..7d078f52c84 100755 > --- a/tools/build/depend-cleanup.sh > +++ b/tools/build/depend-cleanup.sh > @@ -56,3 +56,6 @@ if [ -e "$OBJTOP"/rescue/rescue/rescue.c ] && \ > echo "Removing old rescue(8) tree" > rm -rf "$OBJTOP"/rescue/rescue > fi > + > +# 20210105 fda7daf06301 pfctl gained its own version of pf_ruleset.c > +clean_dep sbin/pfctl pf_ruleset c We should add ncurses (for 821aa63a09402935da0a73abf20ba0441562aa07) here as well. -- 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-dev-commits-src-all@freebsd.org Wed Jan 6 16:27:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1F19A4D651F; Wed, 6 Jan 2021 16:27:29 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D9vsX5NsSz4XCk; Wed, 6 Jan 2021 16:27:28 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1609950446; bh=QBbHDd4orku5bSmEzeKKjzWzM/oSC5WubKo/LB2Wirc=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=R6h67dKiZrx4m3knH0kDwjezwBpCGIV82k4iYYY4k4QXIlvMUWZSxJ5qwp5wv0OuP H7RmOFE4LWSdSJmKNNkOz/vpKZHALwAEe+PT14CU0gSa3Jo8+2XFO7tcPdO48hDfZZ iGzh61L/RKuKeSxuaBZeveBxNQStpSA0JpRRmitE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([78.54.32.108]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mlf4S-1kFZMa0pik-00ihuY; Wed, 06 Jan 2021 17:27:26 +0100 Date: Wed, 6 Jan 2021 17:27:18 +0100 From: "Hartmann, O." To: Kyle Evans Cc: Kristof Provost , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel Message-ID: <20210106172718.4765d11c@hermann.fritz.box> In-Reply-To: References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> <20210106055051.51e28498@hermann.fritz.box> <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> <20210106102002.5af4db05@hermann.fritz.box> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/MGhWy4L977V/gae8e9.GsoS"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Provags-ID: V03:K1:lldDpJOJEJF90jsmGyBpcPeuzmkWR3kXj76f8uUuVIGiJD0vM/J Lb5CpztuUONV96rp2g/bCOAXuKfxFMBGq4kuP28eUs1GgK1pWQWb1jTOZW2fOaaTZzDXq9B jOxP0uJfXBAhrpzhAlFRezTDlHe/N/KmpgT0J32iTyIMX8ojqnCSz+/5MoRl8H9YWLWjtba 7ZwNktIcuKfkEX6ZfWRjw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:SM42qgZUyt4=:NoUpbJw7fdqVx37I43CKvv n3q5QXayabCDjge6n/v6BBob8MHom7DyO0j9GWoQhsRLZsdb1AlWhMeyJ7MLM65zIljOFqWEW 48Cd7TPfvgKf2cQK0srjUu0pznD70R1Q6eqABOcbuUyaQXDD7hxvmbwfA3NlIDdwAWJIu82+K h6OS8g6SCYYExMH6Bw2mPtbZlQwEe+C8P3H/7dROoT31GZTFl5GTp7zDTIS+tw5TkUz5ACh+y zk2zDU8v1v67eX5+T1k9WPFU92931C+1UsktY7V2bT6+vHEwnGGjhEAcN5KW65nOujM4QAav0 Avm2SPsX26c3bWyMYJvAHDhQg5IF1bhDdMpwfLoW7lFpwCbELOM29bIYrjoWfc5bhr0T8NMDw uy7s46jkOZbiapBMD72Dpf2prNR6uBiSRhIlLK6RRD4SW3X2pFJ2/KGNHOlzTF9tiVOEFnTob aki6M0jNAJvMCLczqxrPj/sEMHNLTt2mL8B6UVLBRkt7Ddx4fTI/MjqQS+dk6UwlGYrMtAHdQ F849jBAfkuX3V/EEJdx/WkG+n9LfKYgrxQaCB/Rz4M3PS29tXJ1kUS+A5A1APo9/I7Y5TatLo fU3vajnQLDd1YYBS2bbW0pCvB8fpHcbbCpHVfDw86QTyIYjGYnPht+zWveoUmUrEC5cpp/mhU uondVc19SMLtcdnjLXyxliROACGYrjGnj8geAzx//7el7jh36EWH7uxMo5O504zqtg+EqNt7X 3FuAf28vGBTb4RiKQ6RehP+uIHDuzIv1fHfwJMetNNq072ZMv1sa+CUT3Ap0L/1+2ch/5U6G4 aO0CyQOGRo3EPyK7Z1LFK9QlUR3pQrKFpXvHBHostT/bcjEA1alJuWdZdPmRsbnw8A80B+NYx J+Chc+BHjjVT2y2pNaVOKi3WZUAK75DQBOcyIccMs= X-Rspamd-Queue-Id: 4D9vsX5NsSz4XCk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 16:27:29 -0000 --Sig_/MGhWy4L977V/gae8e9.GsoS Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 6 Jan 2021 06:58:40 -0600 Kyle Evans wrote: > I note that the original report says buildkernel, but the log exercpt is > from buildworld. Looks like pf_ruleset.c kept the name, so this needs a > dependency cleanup rule in tools/build to build the right one on > WITHOUT_CLEAN builds. >=20 > On Wed, Jan 6, 2021, 03:22 Kristof Provost wrote: >=20 > > On 6 Jan 2021, at 10:20, Hartmann, O. wrote: =20 > > > > > > amd64. > > > kernel config is custom, no debug, IPFW, MAC. pf is not used, we use = =20 > > IPFW. > > Please share your kernel config as well. > > > > Best regards, > > Kristof Sorry, you're correct, it is buildworld that fails. oh --Sig_/MGhWy4L977V/gae8e9.GsoS Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCX/Xk5gAKCRA4N1ZZPba5 RycNAP0bedr8PQXSzcPImX8cxKzMrJ5rwXBMP3PsTCw6J6t+HAD+Ox1ao9OaR6tz OuEIkM0E/RGs5HwrgNACTf0zBoO3lQ8= =pTWX -----END PGP SIGNATURE----- --Sig_/MGhWy4L977V/gae8e9.GsoS-- From owner-dev-commits-src-all@freebsd.org Wed Jan 6 16:58:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B167E4D6AEF; Wed, 6 Jan 2021 16:58:10 +0000 (UTC) (envelope-from kp@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 4D9wXy4fb8z4Z15; Wed, 6 Jan 2021 16:58:10 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 7A947BEE9; Wed, 6 Jan 2021 16:58:10 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 91CA111351; Wed, 6 Jan 2021 17:58:08 +0100 (CET) From: "Kristof Provost" To: "Kyle Evans" Cc: "Cy Schubert" , "Hartmann, O." , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel Date: Wed, 06 Jan 2021 17:58:06 +0100 X-Mailer: MailMate (1.13.2r5673) Message-ID: <0FF4FD8F-8E07-4CBE-B370-A7D8B722C892@FreeBSD.org> In-Reply-To: References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> <20210106055051.51e28498@hermann.fritz.box> <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> <20210106102002.5af4db05@hermann.fritz.box> <202101061430.106EU2Og058101@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 16:58:10 -0000 On 6 Jan 2021, at 16:45, Kyle Evans wrote: > On Wed, Jan 6, 2021 at 8:30 AM Cy Schubert > wrote: >> In message >> > om> >> , Kyle Evans writes: >>> On Wed, Jan 6, 2021, 03:22 Kristof Provost wrote: >>> >>>> On 6 Jan 2021, at 10:20, Hartmann, O. wrote: >>>>> >>>>> amd64. >>>>> kernel config is custom, no debug, IPFW, MAC. pf is not used, we >>>>> use >>>> IPFW. >>>> Please share your kernel config as well. >>>> >>>> Best regards, >>>> Kristof >>>> >>> I note that the original report says buildkernel, but the log >>> exercpt is >>> from buildworld. Looks like pf_ruleset.c kept the name, so this >>> needs a >>> dependency cleanup rule in tools/build to build the right one on >>> WITHOUT_CLEAN builds. >>> >> >> Yes, this is the problem. >> > > This should do, I think: > > diff --git a/tools/build/depend-cleanup.sh > b/tools/build/depend-cleanup.sh > index 8b249ccf55f..7d078f52c84 100755 > --- a/tools/build/depend-cleanup.sh > +++ b/tools/build/depend-cleanup.sh > @@ -56,3 +56,6 @@ if [ -e "$OBJTOP"/rescue/rescue/rescue.c ] && \ > echo "Removing old rescue(8) tree" > rm -rf "$OBJTOP"/rescue/rescue > fi > + > +# 20210105 fda7daf06301 pfctl gained its own version of > pf_ruleset.c > +clean_dep sbin/pfctl pf_ruleset c That doesn’t appear to be working here. Possibly because clean_dep only removes if there’s a .pico file, and the dependency file is .depend.pf_ruleset.o Bes regards, Kristof From owner-dev-commits-src-all@freebsd.org Wed Jan 6 17:03:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9B9E04D703A; Wed, 6 Jan 2021 17:03:07 +0000 (UTC) (envelope-from brd@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 4D9wfg3swKz4ZSj; Wed, 6 Jan 2021 17:03:07 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com [66.111.4.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: brd/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 71232BDA4; Wed, 6 Jan 2021 17:03:07 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 3019827C0054; Wed, 6 Jan 2021 12:03:07 -0500 (EST) Received: from imap2 ([10.202.2.52]) by compute4.internal (MEProxy); Wed, 06 Jan 2021 12:03:07 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdegtddgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsehttd ertderreejnecuhfhrohhmpedfuehrrgguucffrghvihhsfdcuoegsrhgusefhrhgvvgeu ufffrdhorhhgqeenucggtffrrghtthgvrhhnpeevhfdvueejledthfehvdduhfdvhfetie evtedtueelkedugfelleffgfegtdfhveenucffohhmrghinhepfhhrvggvsghsugdrohhr ghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsrh grugdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqjedtjeeifedvfedvqddu kedtieelieekkedqsghrugeppefhrhgvvgeuufffrdhorhhgsehsohdugehkrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id A1B13E00A6; Wed, 6 Jan 2021 12:03:04 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.1-61-gb52c239-fm-20201210.001-gb52c2396 Mime-Version: 1.0 Message-Id: In-Reply-To: <202101060736.1067aB81077326@gitrepo.freebsd.org> References: <202101060736.1067aB81077326@gitrepo.freebsd.org> Date: Wed, 06 Jan 2021 10:02:45 -0700 From: "Brad Davis" To: "Mateusz Guzik" , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: =?UTF-8?Q?Re:_git:_deabdc686874_-_main_-_cache:_stop_pre-checking_seqc_w?= =?UTF-8?Q?hen_starting_the_lookup?= Content-Type: text/plain X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 17:03:07 -0000 On Wed, Jan 6, 2021, at 12:36 AM, Mateusz Guzik wrote: > The branch main has been updated by mjg: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=deabdc686874411bd32775c3bdd04c04d9eff3e5 > > commit deabdc686874411bd32775c3bdd04c04d9eff3e5 > Author: Mateusz Guzik > AuthorDate: 2021-01-06 06:12:58 +0000 > Commit: Mateusz Guzik > CommitDate: 2021-01-06 07:28:07 +0000 > > cache: stop pre-checking seqc when starting the lookup > > Tested by: pho > --- > sys/kern/vfs_cache.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c > index 710c499d6bb5..138a55f94dbd 100644 > --- a/sys/kern/vfs_cache.c > +++ b/sys/kern/vfs_cache.c > @@ -5032,7 +5032,7 @@ cache_fplookup_skip_slashes(struct cache_fpl *fpl) > ndp->ni_next = cnp->cn_nameptr; > > /* > - * Retry the lookup, similar to dot lookups. > + * See cache_fplookup_dot. > */ > fpl->tvp = fpl->dvp; > fpl->tvp_seqc = fpl->dvp_seqc; > @@ -5139,11 +5139,14 @@ cache_fplookup_impl(struct vnode *dvp, struct > cache_fpl *fpl) > > cache_fpl_checkpoint(fpl, &fpl->snd); > > + /* > + * The vnode is hand is almost always stable, skip checking for it. "The vnode in hand" maybe? Regards, Brad Davis From owner-dev-commits-src-all@freebsd.org Wed Jan 6 17:24:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 21ACA4D7BFA; Wed, 6 Jan 2021 17:24:45 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (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 4D9x7b47Dxz4bnP; Wed, 6 Jan 2021 17:24:43 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id xCY4k8X7NktFkxCY5kuDQy; Wed, 06 Jan 2021 10:24:42 -0700 X-Authority-Analysis: v=2.4 cv=NYRYa0P4 c=1 sm=1 tr=0 ts=5ff5f25a a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=HHGDD-5mAAAA:8 a=B-X5g-zTAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=mWDPWY4-FaEoZ_HGz28A:9 a=CjuIK1q_8ugA:10 a=5JClSVac4pN9U82U9_TY:22 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 A4678D3; Wed, 6 Jan 2021 09:24:39 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 106HOdv0002673; Wed, 6 Jan 2021 09:24:39 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101061724.106HOdv0002673@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: Toomas Soome cc: Peter Jeremy , Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console In-reply-to: <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> Comments: In-reply-to Toomas Soome message dated "Wed, 06 Jan 2021 14:50:38 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 06 Jan 2021 09:24:39 -0800 X-CMAE-Envelope: MS4xfBm1PPcT1Xh1juRnKxffZiFU8zZ2q7A/8Ywkf3dTEbzs6cHvZnN0E1CxH3wrwodD+ZXhjeUjqT3T6MO9NY8Upn0Vn5Rf7hP/hd5WXO8EqsEoZtW1P+o6 c/exvkhyllFzQmAlpxhpOdNeBJupt527SCm9Go1WTxL4Od1uRuWwDGHBhOFWaDcu4uInEg81K4oImIYZwgS+MFbU9KtZPbZHjFeIO/lD5o3PHHlz1irdi6rk aAqiHaTtMkXQ4Y5xtynmh7jl6lpkKl+k+Gyv9HmBRWMBUsXEhGpo4vUxUk7vCk5OBakFKgtwSTMbI2ybaCqbiLefht4OoNyWhj+aTn/b+faHCoFEBL453oxc nxpSSMsoF3rKr5JjM/5U7K5JjuhPFQ== X-Rspamd-Queue-Id: 4D9x7b47Dxz4bnP 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.139) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-1.70 / 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)[6]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[me.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.139:from]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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]; RWL_MAILSPIKE_VERYGOOD(0.00)[64.59.136.139:from]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 17:24:45 -0000 In message <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com>, Toomas Soome writes: > > > > On 6. Jan 2021, at 12:33, Peter Jeremy wrote: > > > > On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote: > >> The branch main has been updated by tsoome: > >> > >> URL: https://cgit.FreeBSD.org/src/commit/?id=3630506b9daec9167a89bc4525638 > ea45a00769e > > > > Note that this commit adds a hard build dependency on vtfontcvt(8) > > but that tool is depends on the WITH_VT build option. I suspect > > that stand/fonts should be likewise dependent on WITH_VT > > > > -- > > Peter Jeremy > > > Thanks for pointing this out. We actually need to build vtfontcvt uncondition > ally, in addition to font files, we also need it to generate C code for built > in font (used when there are no /boot/fonts). Is this why my consoles are blank during boot? My laptop is blank during boot until X starts. My three machines downstairs don't run X and remain blank. There is no way to enable the display. -- 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-dev-commits-src-all@freebsd.org Wed Jan 6 17:32:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 02C364D804B; Wed, 6 Jan 2021 17:32:39 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from mail.macktronics.com (coco.macktronics.com [209.181.253.65]) (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 4D9xJj6JRXz4cBZ; Wed, 6 Jan 2021 17:32:37 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from olive.macktronics.com (unknown [209.181.253.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.macktronics.com (Postfix) with ESMTPS id 056D6183E; Wed, 6 Jan 2021 11:31:51 -0600 (CST) Date: Wed, 6 Jan 2021 11:31:51 -0600 (CST) From: Dan Mack X-X-Sender: mack@localhost.local To: Cy Schubert cc: Toomas Soome , Peter Jeremy , Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console In-Reply-To: <202101061724.106HOdv0002673@slippy.cwsent.com> Message-ID: References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> <202101061724.106HOdv0002673@slippy.cwsent.com> User-Agent: Alpine 2.20 (GSO 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 4D9xJj6JRXz4cBZ X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=macktronics.com; spf=pass (mx1.freebsd.org: domain of mack@macktronics.com designates 209.181.253.65 as permitted sender) smtp.mailfrom=mack@macktronics.com X-Spamd-Result: default: False [-3.80 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.181.253.64/29]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.181.253.65:from]; SPAMHAUS_ZRD(0.00)[209.181.253.65:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[macktronics.com,none]; RCPT_COUNT_SEVEN(0.00)[7]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:209, ipnet:209.181.252.0/23, country:US]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; FREEMAIL_CC(0.00)[me.com,rulingia.com,freebsd.org] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 17:32:39 -0000 On Wed, 6 Jan 2021, Cy Schubert wrote: > In message <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com>, Toomas Soome > writes: >> >> >>> On 6. Jan 2021, at 12:33, Peter Jeremy wrote: >>> >>> On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote: >>>> The branch main has been updated by tsoome: >>>> >>>> URL: https://cgit.FreeBSD.org/src/commit/?id=3630506b9daec9167a89bc4525638 >> ea45a00769e >>> >>> Note that this commit adds a hard build dependency on vtfontcvt(8) >>> but that tool is depends on the WITH_VT build option. I suspect >>> that stand/fonts should be likewise dependent on WITH_VT >>> >>> -- >>> Peter Jeremy >> >> >> Thanks for pointing this out. We actually need to build vtfontcvt uncondition >> ally, in addition to font files, we also need it to generate C code for built >> in font (used when there are no /boot/fonts). > > Is this why my consoles are blank during boot? My laptop is blank during > boot until X starts. My three machines downstairs don't run X and remain > blank. There is no way to enable the display. > I noticed this as well. My test machine's HDMI connected console running broken for a sec :-) I'm running FreeBSD 13.0-CURRENT (GENERIC) #6 main-c255603-g225afb6cad9: Tue Jan 5 11:20:42 CST 2021 and still experiencing the issue. Dan From owner-dev-commits-src-all@freebsd.org Wed Jan 6 17:38:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2557E4D83A7; Wed, 6 Jan 2021 17:38:41 +0000 (UTC) (envelope-from kp@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 4D9xRj0Tpkz4cdp; Wed, 6 Jan 2021 17:38:41 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id C2B64C8DB; Wed, 6 Jan 2021 17:38:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 258AB11984; Wed, 6 Jan 2021 18:38:39 +0100 (CET) From: "Kristof Provost" To: "Kyle Evans" Cc: "Cy Schubert" , "Hartmann, O." , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel Date: Wed, 06 Jan 2021 18:38:38 +0100 X-Mailer: MailMate (1.13.2r5673) Message-ID: <56DF787E-3BE8-473E-8B35-50DC594B682A@FreeBSD.org> In-Reply-To: <0FF4FD8F-8E07-4CBE-B370-A7D8B722C892@FreeBSD.org> References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> <20210106055051.51e28498@hermann.fritz.box> <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> <20210106102002.5af4db05@hermann.fritz.box> <202101061430.106EU2Og058101@slippy.cwsent.com> <0FF4FD8F-8E07-4CBE-B370-A7D8B722C892@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 17:38:41 -0000 On 6 Jan 2021, at 17:58, Kristof Provost wrote: > On 6 Jan 2021, at 16:45, Kyle Evans wrote: >> On Wed, Jan 6, 2021 at 8:30 AM Cy Schubert >> wrote: >>> In message >>> >> om> >>> , Kyle Evans writes: >>>> On Wed, Jan 6, 2021, 03:22 Kristof Provost wrote: >>>> >>>>> On 6 Jan 2021, at 10:20, Hartmann, O. wrote: >>>>>> >>>>>> amd64. >>>>>> kernel config is custom, no debug, IPFW, MAC. pf is not used, we >>>>>> use >>>>> IPFW. >>>>> Please share your kernel config as well. >>>>> >>>>> Best regards, >>>>> Kristof >>>>> >>>> I note that the original report says buildkernel, but the log >>>> exercpt is >>>> from buildworld. Looks like pf_ruleset.c kept the name, so this >>>> needs a >>>> dependency cleanup rule in tools/build to build the right one on >>>> WITHOUT_CLEAN builds. >>>> >>> >>> Yes, this is the problem. >>> >> >> This should do, I think: >> >> diff --git a/tools/build/depend-cleanup.sh >> b/tools/build/depend-cleanup.sh >> index 8b249ccf55f..7d078f52c84 100755 >> --- a/tools/build/depend-cleanup.sh >> +++ b/tools/build/depend-cleanup.sh >> @@ -56,3 +56,6 @@ if [ -e "$OBJTOP"/rescue/rescue/rescue.c ] && \ >> echo "Removing old rescue(8) tree" >> rm -rf "$OBJTOP"/rescue/rescue >> fi >> + >> +# 20210105 fda7daf06301 pfctl gained its own version of >> pf_ruleset.c >> +clean_dep sbin/pfctl pf_ruleset c > > That doesn’t appear to be working here. > Possibly because clean_dep only removes if there’s a .pico file, and > the dependency file is .depend.pf_ruleset.o > I think clean_dep is intended for kernel use. This seems to work for me: diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh index 8b249ccf55fa..0b3ff9bcc635 100755 --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -56,3 +56,11 @@ if [ -e "$OBJTOP"/rescue/rescue/rescue.c ] && \ echo "Removing old rescue(8) tree" rm -rf "$OBJTOP"/rescue/rescue fi + +# 20210105 fda7daf06301 pfctl gained its own version of pf_ruleset.c +if [ -e "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o ] && \ + egrep -qw "sys/netpfil/pf/pf_ruleset.c" \ + "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o; then + echo "Removing old pf_ruleset dependecy file" + rm -rf "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o +fi Best regards, Kristof From owner-dev-commits-src-all@freebsd.org Wed Jan 6 17:42:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 284474D83CB; Wed, 6 Jan 2021 17:42:44 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from mail.macktronics.com (coco.macktronics.com [209.181.253.65]) (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 4D9xXM2vsgz4cwj; Wed, 6 Jan 2021 17:42:43 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from olive.macktronics.com (unknown [209.181.253.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.macktronics.com (Postfix) with ESMTPS id 4027F1841; Wed, 6 Jan 2021 11:42:03 -0600 (CST) Date: Wed, 6 Jan 2021 11:42:03 -0600 (CST) From: Dan Mack X-X-Sender: mack@localhost.local To: Cy Schubert cc: Toomas Soome , Peter Jeremy , Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console In-Reply-To: Message-ID: References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> <202101061724.106HOdv0002673@slippy.cwsent.com> User-Agent: Alpine 2.20 (GSO 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 4D9xXM2vsgz4cwj X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=macktronics.com; spf=pass (mx1.freebsd.org: domain of mack@macktronics.com designates 209.181.253.65 as permitted sender) smtp.mailfrom=mack@macktronics.com X-Spamd-Result: default: False [-3.80 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.181.253.65:from]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.181.253.64/29:c]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; SPAMHAUS_ZRD(0.00)[209.181.253.65:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[macktronics.com,none]; RCPT_COUNT_SEVEN(0.00)[7]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:209, ipnet:209.181.252.0/23, country:US]; FREEMAIL_CC(0.00)[me.com,rulingia.com,freebsd.org]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 17:42:44 -0000 On Wed, 6 Jan 2021, Dan Mack wrote: > On Wed, 6 Jan 2021, Cy Schubert wrote: > >> In message <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com>, Toomas Soome >> writes: >>> >>> >>>> On 6. Jan 2021, at 12:33, Peter Jeremy wrote: >>>> >>>> On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote: >>>>> The branch main has been updated by tsoome: >>>>> >>>>> URL: >>>>> https://cgit.FreeBSD.org/src/commit/?id=3630506b9daec9167a89bc4525638 >>> ea45a00769e >>>> >>>> Note that this commit adds a hard build dependency on vtfontcvt(8) >>>> but that tool is depends on the WITH_VT build option. I suspect >>>> that stand/fonts should be likewise dependent on WITH_VT >>>> >>>> -- >>>> Peter Jeremy >>> >>> >>> Thanks for pointing this out. We actually need to build vtfontcvt >>> uncondition >>> ally, in addition to font files, we also need it to generate C code for >>> built >>> in font (used when there are no /boot/fonts). >> >> Is this why my consoles are blank during boot? My laptop is blank during >> boot until X starts. My three machines downstairs don't run X and remain >> blank. There is no way to enable the display. >> Sorry my reply got garbled ... My console is an hdmi connected monitor. The display works until FreeBSD boots and then it's just blank. Something is broke; I am doing full buildworld / buildkernel (GENERIC builds) from the tip of main. Dan > I noticed this as well. My test machine's HDMI connected console running > broken for a sec :-) > > I'm running FreeBSD 13.0-CURRENT (GENERIC) #6 main-c255603-g225afb6cad9: Tue > Jan 5 11:20:42 CST 2021 > > and still experiencing the issue. > > Dan > > > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to > "dev-commits-src-all-unsubscribe@freebsd.org" > From owner-dev-commits-src-all@freebsd.org Wed Jan 6 17:56:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D71AD4D8C36; Wed, 6 Jan 2021 17:56:39 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (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 4D9xrR3GG0z4dwt; Wed, 6 Jan 2021 17:56:39 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id xD2xkXuVT34axxD2ykZ87q; Wed, 06 Jan 2021 10:56:37 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5ff5f9d5 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=HHGDD-5mAAAA:8 a=B-X5g-zTAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=6BkZrkxgWxTBOmZWg5EA:9 a=CjuIK1q_8ugA:10 a=5JClSVac4pN9U82U9_TY:22 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 06A80204; Wed, 6 Jan 2021 09:56:34 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 106HuYq9002766; Wed, 6 Jan 2021 09:56:34 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101061756.106HuYq9002766@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: Dan Mack cc: Cy Schubert , Toomas Soome , Peter Jeremy , Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console In-reply-to: References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> <202101061724.106HOdv0002673@slippy.cwsent.com> Comments: In-reply-to Dan Mack message dated "Wed, 06 Jan 2021 11:42:03 -0600." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 06 Jan 2021 09:56:34 -0800 X-CMAE-Envelope: MS4xfE8uoC/d/OL3hdLJuiqfEpKRM1lWnMLr39lqsZUXWa6HI8NsjOkF7vunhkDYKK6SsgUjLWAl+JVNY01sPgQXO3+OyUQS7i6pxvI1lwaf9bhyPTFpCxx2 /jRBdoXZNDypAA21bIEJBSmX8R525jEj8beS/UVRJOpzPz7e4jYi6W6+y2TeIK5WEnPLuSYXNVhKl1zXrBsuh+tVEYCF3AXsEoa3wj0QRWWB/TK+f06nQc6g NukBU4TmjHpB83S2WZa4Riwpa+xZi0Lw3szUvY+Px4YVfFQ8jCWWn9qK+bwEk/9amJfIX45TPxv7aE8I3DD7e9u/9cvDq5R4XE7myZ+TOza33wCCw5DFiyga 5Z2nnVegZILN3qJXG6GwAf/1qX9X2aWyPCdnnWQeTM0dAGKpaqKEnk46zt/zSEPOgKq2R1mf X-Rspamd-Queue-Id: 4D9xrR3GG0z4dwt X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 17:56:39 -0000 In message , Dan Mack writ es: > On Wed, 6 Jan 2021, Dan Mack wrote: > > > On Wed, 6 Jan 2021, Cy Schubert wrote: > > > >> In message <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com>, Toomas Soome > >> writes: > >>> > >>> > >>>> On 6. Jan 2021, at 12:33, Peter Jeremy wrote: > >>>> > >>>> On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote: > >>>>> The branch main has been updated by tsoome: > >>>>> > >>>>> URL: > >>>>> https://cgit.FreeBSD.org/src/commit/?id=3630506b9daec9167a89bc4525638 > >>> ea45a00769e > >>>> > >>>> Note that this commit adds a hard build dependency on vtfontcvt(8) > >>>> but that tool is depends on the WITH_VT build option. I suspect > >>>> that stand/fonts should be likewise dependent on WITH_VT > >>>> > >>>> -- > >>>> Peter Jeremy > >>> > >>> > >>> Thanks for pointing this out. We actually need to build vtfontcvt > >>> uncondition > >>> ally, in addition to font files, we also need it to generate C code for > >>> built > >>> in font (used when there are no /boot/fonts). > >> > >> Is this why my consoles are blank during boot? My laptop is blank during > >> boot until X starts. My three machines downstairs don't run X and remain > >> blank. There is no way to enable the display. > >> > > > Sorry my reply got garbled ... My console is an hdmi connected monitor. > The display works until FreeBSD boots and then it's just blank. Something > is broke; I am doing full buildworld / buildkernel (GENERIC builds) from > the tip of main. All four machines here exhibit the same problem. Some are VGA connected, others HDMI. Each has a different video card. The three downstairs are servers, no X, using the video cards in text mode. The laptop has an HD3000, uses X, X works but boot messages, like the three downstairs are black holes. I suspect it's some commit from Jan 5 as messages did display then. This morning, nothing. The puzzling thing is that the commits between Jan 5 and now look innocuous. -- 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-dev-commits-src-all@freebsd.org Wed Jan 6 18:01:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ABF354D8FA6; Wed, 6 Jan 2021 18:01:17 +0000 (UTC) (envelope-from git@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 4D9xxn4XVXz4fN6; Wed, 6 Jan 2021 18:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CC6C22DAF; Wed, 6 Jan 2021 18:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106I1HDS088425; Wed, 6 Jan 2021 18:01:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106I1HKY088424; Wed, 6 Jan 2021 18:01:17 GMT (envelope-from git) Date: Wed, 6 Jan 2021 18:01:17 GMT Message-Id: <202101061801.106I1HKY088424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando Apesteguía Subject: git: cfaa2958dc44 - main - gstat(8): Document interactive keyboard commands MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cfaa2958dc44c20f56a19fe490ee4d7c02f50bef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 18:01:17 -0000 The branch main has been updated by fernape (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=cfaa2958dc44c20f56a19fe490ee4d7c02f50bef commit cfaa2958dc44c20f56a19fe490ee4d7c02f50bef Author: Fernando Apesteguía AuthorDate: 2020-12-29 21:07:11 +0000 Commit: Fernando Apesteguía CommitDate: 2021-01-06 17:55:03 +0000 gstat(8): Document interactive keyboard commands gstat(8) allows for <, >, c, f, F and q while in interactive mode. PR: 251313 Submitted by: bojan_petrovic@fastmail.fm Approved by: manpages (0mp@) Differential Revision: https://reviews.freebsd.org/D27815 --- usr.sbin/gstat/gstat.8 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/usr.sbin/gstat/gstat.8 b/usr.sbin/gstat/gstat.8 index 4d22a60bb571..1ed36e7857af 100644 --- a/usr.sbin/gstat/gstat.8 +++ b/usr.sbin/gstat/gstat.8 @@ -97,6 +97,28 @@ seconds, milliseconds, or microseconds, respectively. .It Fl p Only display physical providers (those with rank of 1). .El +.Sh INTERACTIVE COMMANDS +These commands are currently recognized if +.Nm +is not running in batch mode: +.Bl -tag -width indent +.It Ic < +Halve the update interval. +.It Ic > +Double the update interval. +.It Ic c +Toggle display of +.Xr geom 4 +consumers. +.It Ic f +Display only devices with the names matching regular expression filter +(prompt for filter). +.It Ic F +Remove device filter. +.It Ic q +Quit +.Nm . +.El .Sh EXIT STATUS .Ex -std .Sh SEE ALSO From owner-dev-commits-src-all@freebsd.org Wed Jan 6 18:04:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EE1024D92EA; Wed, 6 Jan 2021 18:04:26 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from mail.macktronics.com (coco.macktronics.com [209.181.253.65]) (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 4D9y1Q2hNyz4fxV; Wed, 6 Jan 2021 18:04:26 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from olive.macktronics.com (unknown [209.181.253.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.macktronics.com (Postfix) with ESMTPS id AF84E1847; Wed, 6 Jan 2021 12:03:45 -0600 (CST) Date: Wed, 6 Jan 2021 12:03:45 -0600 (CST) From: Dan Mack X-X-Sender: mack@localhost.local To: Cy Schubert cc: Toomas Soome , Peter Jeremy , Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console In-Reply-To: <202101061756.106HuYq9002766@slippy.cwsent.com> Message-ID: References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> <202101061724.106HOdv0002673@slippy.cwsent.com> <202101061756.106HuYq9002766@slippy.cwsent.com> User-Agent: Alpine 2.20 (GSO 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 4D9y1Q2hNyz4fxV X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=macktronics.com; spf=pass (mx1.freebsd.org: domain of mack@macktronics.com designates 209.181.253.65 as permitted sender) smtp.mailfrom=mack@macktronics.com X-Spamd-Result: default: False [-3.80 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.181.253.65:from]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.181.253.64/29:c]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; SPAMHAUS_ZRD(0.00)[209.181.253.65:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[macktronics.com,none]; RCPT_COUNT_SEVEN(0.00)[7]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:209, ipnet:209.181.252.0/23, country:US]; FREEMAIL_CC(0.00)[me.com,rulingia.com,freebsd.org]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 18:04:27 -0000 On Wed, 6 Jan 2021, Cy Schubert wrote: > In message , Dan Mack > writ > es: >> On Wed, 6 Jan 2021, Dan Mack wrote: >> >>> On Wed, 6 Jan 2021, Cy Schubert wrote: >>> >>>> In message <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com>, Toomas Soome >>>> writes: >>>>> >>>>> >>>>>> On 6. Jan 2021, at 12:33, Peter Jeremy wrote: >>>>>> >>>>>> On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote: >>>>>>> The branch main has been updated by tsoome: >>>>>>> >>>>>>> URL: >>>>>>> https://cgit.FreeBSD.org/src/commit/?id=3630506b9daec9167a89bc4525638 >>>>> ea45a00769e >>>>>> >>>>>> Note that this commit adds a hard build dependency on vtfontcvt(8) >>>>>> but that tool is depends on the WITH_VT build option. I suspect >>>>>> that stand/fonts should be likewise dependent on WITH_VT >>>>>> >>>>>> -- >>>>>> Peter Jeremy >>>>> >>>>> >>>>> Thanks for pointing this out. We actually need to build vtfontcvt >>>>> uncondition >>>>> ally, in addition to font files, we also need it to generate C code for >>>>> built >>>>> in font (used when there are no /boot/fonts). >>>> >>>> Is this why my consoles are blank during boot? My laptop is blank during >>>> boot until X starts. My three machines downstairs don't run X and remain >>>> blank. There is no way to enable the display. >>>> >> >> >> Sorry my reply got garbled ... My console is an hdmi connected monitor. >> The display works until FreeBSD boots and then it's just blank. Something >> is broke; I am doing full buildworld / buildkernel (GENERIC builds) from >> the tip of main. > > All four machines here exhibit the same problem. Some are VGA connected, others HDMI. Each has a different video card. The three downstairs are servers, no X, using the video cards in text mode. The laptop has an HD3000, uses X, X works but boot messages, like the three downstairs are black holes. > > I suspect it's some commit from Jan 5 as messages did display then. This morning, nothing. The puzzling thing is that the commits between Jan 5 and now look innocuous. I noticed that commit babda0952f8355a89b3241d5e8943c7da0fa4f6b has some more framebuffer related changes so I'm rebuilding world with the latest to see if anything changes. Dan From owner-dev-commits-src-all@freebsd.org Wed Jan 6 18:08:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4037D4D93CE; Wed, 6 Jan 2021 18:08:28 +0000 (UTC) (envelope-from git@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 4D9y640vBRz4gH7; Wed, 6 Jan 2021 18:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1194422EBB; Wed, 6 Jan 2021 18:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106I8Roj092775; Wed, 6 Jan 2021 18:08:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106I8ROF092774; Wed, 6 Jan 2021 18:08:27 GMT (envelope-from git) Date: Wed, 6 Jan 2021 18:08:27 GMT Message-Id: <202101061808.106I8ROF092774@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando Apesteguía Subject: git: 439862883f48 - main - gstat(8): Bump .Dd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 439862883f482fb12709968e0ca6df6c80f8d636 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 18:08:28 -0000 The branch main has been updated by fernape (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=439862883f482fb12709968e0ca6df6c80f8d636 commit 439862883f482fb12709968e0ca6df6c80f8d636 Author: Fernando Apesteguía AuthorDate: 2021-01-06 18:03:06 +0000 Commit: Fernando Apesteguía CommitDate: 2021-01-06 18:04:09 +0000 gstat(8): Bump .Dd Forgotten in cfaa2958dc44c20f56a19fe490ee4d7c02f50bef PR: 251313 Differential Revision: https://reviews.freebsd.org/D27815 --- usr.sbin/gstat/gstat.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/gstat/gstat.8 b/usr.sbin/gstat/gstat.8 index 1ed36e7857af..de1a2b21bc88 100644 --- a/usr.sbin/gstat/gstat.8 +++ b/usr.sbin/gstat/gstat.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 21, 2018 +.Dd January 1, 2021 .Dt GSTAT 8 .Os .Sh NAME From owner-dev-commits-src-all@freebsd.org Wed Jan 6 18:13:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5200E4D9738; Wed, 6 Jan 2021 18:13:37 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (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 4D9yCz6lMyz4hCV; Wed, 6 Jan 2021 18:13:35 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id xDJMkY1Ev34axxDJOkZDFC; Wed, 06 Jan 2021 11:13:34 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5ff5fdce a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=VxmjJ2MpAAAA:8 a=HHGDD-5mAAAA:8 a=B-X5g-zTAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=lypThI8O4zbTD1zGLn8A:9 a=CjuIK1q_8ugA:10 a=LAhnAAZQYXsA:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=5JClSVac4pN9U82U9_TY:22 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 D953122D; Wed, 6 Jan 2021 10:13:31 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 106IDU81002691; Wed, 6 Jan 2021 10:13:30 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101061813.106IDU81002691@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: Cy Schubert cc: Dan Mack , Toomas Soome , Peter Jeremy , Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console In-reply-to: <202101061756.106HuYq9002766@slippy.cwsent.com> References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> <202101061724.106HOdv0002673@slippy.cwsent.com> <202101061756.106HuYq9002766@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Wed, 06 Jan 2021 09:56:34 -0800." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 06 Jan 2021 10:13:30 -0800 X-CMAE-Envelope: MS4xfLHNvN5MBUr3yNZDG4XqXUC7F975Kd1etNwaMGqKAlkqH7CNYuMkToExEwV3xD7M0Qn0hGN4z5jAqmoYW2L+UAhh+FXkMo9/S4ZLVYZA4zt+J5B5YB4g LRvSU7lXr3cdmqxI7H0DE0tUgZbPeXUIlASYN4e5FmNM6SARHc6x+nnJr5tu6uem17iZ4SNOYeB+N5j/UicnFOoTK+GanKlm6D70PNGK9zvEBNzEmy3JL8jO U1br8kb42y9zqSqIu4I3U4lpwURvw55WXMcycKbXpFeG2jY/ppSORffCnEAKbmnaMXqv0L5JHIfJNsQTBC3cjzGoK3UaXzJ0DMQW45H3+C43LIJwD+HIGeuQ Wbyves4/mz8HBZppxpgHXqymssbketWwazc6GIOa4CiOGe+M003pjKQaog/HTorTAf3AnbIu X-Rspamd-Queue-Id: 4D9yCz6lMyz4hCV 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.134.12) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-1.70 / 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)[]; RWL_MAILSPIKE_GOOD(0.00)[64.59.134.12:from]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_IN_DNSWL_LOW(-0.10)[64.59.134.12:from]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[64.59.134.12:from]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; AUTH_NA(1.00)[]; SPAMHAUS_ZRD(0.00)[64.59.134.12:from:127.0.2.255]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[70.67.229.168:received]; R_SPF_NA(0.00)[no SPF record]; FREEMAIL_CC(0.00)[macktronics.com,me.com,rulingia.com,freebsd.org]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 18:13:37 -0000 In message <202101061756.106HuYq9002766@slippy.cwsent.com>, Cy Schubert writes: > In message , Dan Mack > writ > es: > > On Wed, 6 Jan 2021, Dan Mack wrote: > > > > > On Wed, 6 Jan 2021, Cy Schubert wrote: > > > > > >> In message <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com>, Toomas Soome > > >> writes: > > >>> > > >>> > > >>>> On 6. Jan 2021, at 12:33, Peter Jeremy wrote: > > >>>> > > >>>> On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote > : > > >>>>> The branch main has been updated by tsoome: > > >>>>> > > >>>>> URL: > > >>>>> https://cgit.FreeBSD.org/src/commit/?id=3630506b9daec9167a89bc4525638 > > >>> ea45a00769e > > >>>> > > >>>> Note that this commit adds a hard build dependency on vtfontcvt(8) > > >>>> but that tool is depends on the WITH_VT build option. I suspect > > >>>> that stand/fonts should be likewise dependent on WITH_VT > > >>>> > > >>>> -- > > >>>> Peter Jeremy > > >>> > > >>> > > >>> Thanks for pointing this out. We actually need to build vtfontcvt > > >>> uncondition > > >>> ally, in addition to font files, we also need it to generate C code for > > > >>> built > > >>> in font (used when there are no /boot/fonts). > > >> > > >> Is this why my consoles are blank during boot? My laptop is blank during > > >> boot until X starts. My three machines downstairs don't run X and remain > > >> blank. There is no way to enable the display. > > >> > > > > > > Sorry my reply got garbled ... My console is an hdmi connected monitor. > > The display works until FreeBSD boots and then it's just blank. Something > > is broke; I am doing full buildworld / buildkernel (GENERIC builds) from > > the tip of main. > > All four machines here exhibit the same problem. Some are VGA connected, othe > rs HDMI. Each has a different video card. The three downstairs are servers, n > o X, using the video cards in text mode. The laptop has an HD3000, uses X, X > works but boot messages, like the three downstairs are black holes. > > I suspect it's some commit from Jan 5 as messages did display then. This morn > ing, nothing. The puzzling thing is that the commits between Jan 5 and now lo > ok innocuous. It's changed to screen.textmode. The font is hard on the eyes. -- 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-dev-commits-src-all@freebsd.org Wed Jan 6 18:14:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6F9594D9A1A; Wed, 6 Jan 2021 18:14:13 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (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 4D9yDh3D8cz4hZY; Wed, 6 Jan 2021 18:14:12 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id xDJxk8s68ktFkxDJykuS03; Wed, 06 Jan 2021 11:14:11 -0700 X-Authority-Analysis: v=2.4 cv=NYRYa0P4 c=1 sm=1 tr=0 ts=5ff5fdf3 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=VxmjJ2MpAAAA:8 a=HHGDD-5mAAAA:8 a=B-X5g-zTAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=fkyZSSSrcde08lj4jp0A:9 a=CjuIK1q_8ugA:10 a=f-eX8FMoNsAA:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=5JClSVac4pN9U82U9_TY:22 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 5D755236; Wed, 6 Jan 2021 10:14:09 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 106IE9Mr002703; Wed, 6 Jan 2021 10:14:09 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101061814.106IE9Mr002703@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: Cy Schubert cc: Toomas Soome , Peter Jeremy , Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console In-reply-to: <202101061724.106HOdv0002673@slippy.cwsent.com> References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> <202101061724.106HOdv0002673@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Wed, 06 Jan 2021 09:24:39 -0800." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 06 Jan 2021 10:14:09 -0800 X-CMAE-Envelope: MS4xfLH0fYkphJp7pebFIeYHDifYXzJV/y86VCDYgnEFbinFnufbhEGGg7Mh5vXPvO2yV5LIA53dHIzScJHUhcIORHOYCqdDLNOHBRyeYFZ7wGgYn+GctL5I CY+gcFAWYOyWoX3B8MNx8CBvj/cA696vPcFgplAvuvXPzDG1l6JVv2BhViavgKmh56PSdfsGXV3QYSNUU2LlYSYkaiHdOq/bt4tFqoYbusuuLnHJreRIA3rn ba4t87aikFWeY8iIGe5nAvRQYT4th8fl34Gj+RgrdONxjLAzA1Ed8Wz1N8UdO6M3VzcyZMjblv1Jxi3iEPZM8SPsTLQ9JH3CLpj1lp19fOVI7exddlqOVrhp zFNb8L7FqfsdKWLNTWAwrfpIKrToMA== X-Rspamd-Queue-Id: 4D9yDh3D8cz4hZY 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.139) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-1.70 / 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)[]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[7]; RECEIVED_SPAMHAUS_PBL(0.00)[70.67.229.168:received]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; AUTH_NA(1.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[64.59.136.139:from]; TO_MATCH_ENVRCPT_SOME(0.00)[]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_VERYGOOD(0.00)[64.59.136.139:from]; FREEMAIL_CC(0.00)[me.com,rulingia.com,freebsd.org]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 18:14:13 -0000 In message <202101061724.106HOdv0002673@slippy.cwsent.com>, Cy Schubert writes: > In message <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com>, Toomas Soome > writes: > > > > > > > On 6. Jan 2021, at 12:33, Peter Jeremy wrote: > > > > > > On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote: > > >> The branch main has been updated by tsoome: > > >> > > >> URL: https://cgit.FreeBSD.org/src/commit/?id=3630506b9daec9167a89bc45256 > 38 > > ea45a00769e > > > > > > Note that this commit adds a hard build dependency on vtfontcvt(8) > > > but that tool is depends on the WITH_VT build option. I suspect > > > that stand/fonts should be likewise dependent on WITH_VT > > > > > > -- > > > Peter Jeremy > > > > > > Thanks for pointing this out. We actually need to build vtfontcvt unconditi > on > > ally, in addition to font files, we also need it to generate C code for bui > lt > > in font (used when there are no /boot/fonts). > > Is this why my consoles are blank during boot? My laptop is blank during > boot until X starts. My three machines downstairs don't run X and remain > blank. There is no way to enable the display. This probably needs an UPDATING entry for the change to screen.textmode. -- 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-dev-commits-src-all@freebsd.org Wed Jan 6 19:35:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6701A4DB9C3; Wed, 6 Jan 2021 19:35:10 +0000 (UTC) (envelope-from flo@smeets.xyz) Received: from mail-out.smeets.xyz (mail-out.smeets.xyz [IPv6:2a01:4f8:10a:3543:ffff:0:25:11]) by mx1.freebsd.org (Postfix) with ESMTP id 4DB0260sWlz4nK3; Wed, 6 Jan 2021 19:35:09 +0000 (UTC) (envelope-from flo@smeets.xyz) Received: from mail.smeets.xyz (mail.smeets.xyz [IPv6:2a01:4f8:10a:3543::25:3]) by mail-out.smeets.xyz (Postfix) with ESMTP id EBF491C2F3; Wed, 6 Jan 2021 20:35:02 +0100 (CET) Received: from amavis.smeets.xyz (amavis.smeets.xyz [IPv6:2a01:4f8:10a:3543::aa:4]) by mail.smeets.xyz (Postfix) with ESMTP id E4FFEB0655; Wed, 6 Jan 2021 20:35:02 +0100 (CET) X-Virus-Scanned: amavisd-new at smeets.xyz Received: from mail.smeets.xyz ([IPv6:2a01:4f8:10a:3543::25:3]) by amavis.smeets.xyz (amavis.smeets.xyz [IPv6:2a01:4f8:10a:3543::aa:4]) (amavisd-new, port 10025) with ESMTP id jgEcOb7NlVL0; Wed, 6 Jan 2021 20:35:02 +0100 (CET) Received: from nibbler.home.lan (p2003000631ae245361da993fdf258291.dip0.t-ipconnect.de [IPv6:2003:6:31ae:2453:61da:993f:df25:8291]) (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) (Client did not present a certificate) by mail.smeets.xyz (Postfix) with ESMTPSA id 6C808B06FF; Wed, 6 Jan 2021 20:35:00 +0100 (CET) Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel To: Kristof Provost , Kyle Evans Cc: Cy Schubert , "Hartmann, O." , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> <20210106055051.51e28498@hermann.fritz.box> <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> <20210106102002.5af4db05@hermann.fritz.box> <202101061430.106EU2Og058101@slippy.cwsent.com> <0FF4FD8F-8E07-4CBE-B370-A7D8B722C892@FreeBSD.org> <56DF787E-3BE8-473E-8B35-50DC594B682A@FreeBSD.org> From: Florian Smeets Message-ID: <65d8ccf2-8852-c213-a7b1-c12d5742a3b7@smeets.xyz> Date: Wed, 6 Jan 2021 20:34:59 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <56DF787E-3BE8-473E-8B35-50DC594B682A@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="algA4P4ldKajvFrGnr91UIR6z0103Ve0w" X-Rspamd-Queue-Id: 4DB0260sWlz4nK3 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 19:35:10 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --algA4P4ldKajvFrGnr91UIR6z0103Ve0w Content-Type: multipart/mixed; boundary="Gkwdnw31itBexB3mOeKaEmvcQ10GcCibX"; protected-headers="v1" From: Florian Smeets To: Kristof Provost , Kyle Evans Cc: Cy Schubert , "Hartmann, O." , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Message-ID: <65d8ccf2-8852-c213-a7b1-c12d5742a3b7@smeets.xyz> Subject: Re: git: fda7daf06301 - main - pfctl: Stop sharing pf_ruleset.c with the kernel References: <202101052237.105MbsPa081440@gitrepo.freebsd.org> <20210106055051.51e28498@hermann.fritz.box> <1D693FF6-3D56-40C0-A058-5EFF0E3058FD@FreeBSD.org> <20210106102002.5af4db05@hermann.fritz.box> <202101061430.106EU2Og058101@slippy.cwsent.com> <0FF4FD8F-8E07-4CBE-B370-A7D8B722C892@FreeBSD.org> <56DF787E-3BE8-473E-8B35-50DC594B682A@FreeBSD.org> In-Reply-To: <56DF787E-3BE8-473E-8B35-50DC594B682A@FreeBSD.org> --Gkwdnw31itBexB3mOeKaEmvcQ10GcCibX Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 06.01.21 18:38, Kristof Provost wrote: > I think clean_dep is intended for kernel use. This seems to work for me= : >=20 > =C2=A0=C2=A0=C2=A0=C2=A0diff --git a/tools/build/depend-cleanup.sh > b/tools/build/depend-cleanup.sh > =C2=A0=C2=A0=C2=A0=C2=A0index 8b249ccf55fa..0b3ff9bcc635 100755 > =C2=A0=C2=A0=C2=A0=C2=A0--- a/tools/build/depend-cleanup.sh > =C2=A0=C2=A0=C2=A0=C2=A0+++ b/tools/build/depend-cleanup.sh > =C2=A0=C2=A0=C2=A0=C2=A0@@ -56,3 +56,11 @@ if [ -e "$OBJTOP"/rescue/res= cue/rescue.c ] && \ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 echo= "Removing old rescue(8) tree" > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rm -= rf "$OBJTOP"/rescue/rescue > =C2=A0=C2=A0=C2=A0=C2=A0 fi > =C2=A0=C2=A0=C2=A0=C2=A0+ > =C2=A0=C2=A0=C2=A0=C2=A0+# 20210105=C2=A0 fda7daf06301=C2=A0=C2=A0 pfct= l gained its own version of > pf_ruleset.c > =C2=A0=C2=A0=C2=A0=C2=A0+if [ -e "$OBJTOP"/sbin/pfctl/.depend.pf_rulese= t.o ] && \ > =C2=A0=C2=A0=C2=A0=C2=A0+=C2=A0=C2=A0=C2=A0 egrep -qw "sys/netpfil/pf/p= f_ruleset.c" \ > =C2=A0=C2=A0=C2=A0=C2=A0+=C2=A0=C2=A0=C2=A0 "$OBJTOP"/sbin/pfctl/.depen= d.pf_ruleset.o; then > =C2=A0=C2=A0=C2=A0=C2=A0+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 echo "Rem= oving old pf_ruleset dependecy file" > =C2=A0=C2=A0=C2=A0=C2=A0+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rm -rf "$= OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o > =C2=A0=C2=A0=C2=A0=C2=A0+fi >=20 Yeah, that works for me, on a system where it failed with the previously mentioned error message. Thansk, Florian --Gkwdnw31itBexB3mOeKaEmvcQ10GcCibX-- --algA4P4ldKajvFrGnr91UIR6z0103Ve0w Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEE7LNouHkIv7aRTXJp71uk3NWp88AFAl/2EOMFAwAAAAAACgkQ71uk3NWp88A1 HBAAoJvOuFN3JZpX83A1KiG/mSA6E9dbqNGuUkwpEyTjSTc7YJC8qzgSDbCF1XFvFoDf1Lo1iYBW UVfJU2bbKaALmO9dwr+G3ye1vTYXCetTUfMckIBH9oMKzYvfIGus5PrG6IT79Rh6v4aSHoNZzIGs dDJjDNm2Q2AxIM9J7jGAwkjFuIgFvl6IRP/UbdGGKXzrAv9UPvEnSaSM6QMmQdvTIaF4lF3jTZVX dqEKoPympsiCqec6fuMRVP6306U42S58iJImI8PAPy+aNJtQ3jOfKF8a0iY+8MZSsaDFeqjFo6A/ tI3ih2kvChQZMPaigq2ZiSoUKz2lyPj+s4JxKcgR0aIzD3BbyNEauILYDtgZHe7joMXM8Rn7tXFw earfJdEli5lNHsFpvkuHzZGRHVDkEYoiiRXQHw5K7eTg4LTUJsHcNj5NV7/en1WOCv14AvJ+vDiO 4zjr3tJQgNAy8jTpLx8Eepjhpn2Ov6cRVL/zGvMfODiwI96P42uavwrjGhWdnZB3ppC641Y0LID1 NHQuveE48FY7vJiHN5uzp/2vKR0MYrqJwe2DFzwr4wrq96/6vUmcDFqJqf1va8vRbfZc1dwCmJ13 jAovt3YBO8pjldqmw+8wagkGexF65t7ecYgb4hnhbIhQyzQbM389N925+2uu0fWaLf6dLJkk8vZU Vw8= =CIyy -----END PGP SIGNATURE----- --algA4P4ldKajvFrGnr91UIR6z0103Ve0w-- From owner-dev-commits-src-all@freebsd.org Wed Jan 6 19:42:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DAC4B4DBD2E; Wed, 6 Jan 2021 19:42:08 +0000 (UTC) (envelope-from git@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 4DB0B85vn6z4nXg; Wed, 6 Jan 2021 19:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B45262458D; Wed, 6 Jan 2021 19:42:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106Jg8Sm021150; Wed, 6 Jan 2021 19:42:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106Jg8vu021149; Wed, 6 Jan 2021 19:42:08 GMT (envelope-from git) Date: Wed, 6 Jan 2021 19:42:08 GMT Message-Id: <202101061942.106Jg8vu021149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: b1ea63e2e3c9 - main - bectl(8): sync man page and help text MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1ea63e2e3c92d1346af067f5cf609e3e062f8b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 19:42:08 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=b1ea63e2e3c92d1346af067f5cf609e3e062f8b9 commit b1ea63e2e3c92d1346af067f5cf609e3e062f8b9 Author: Robert Wing AuthorDate: 2021-01-06 19:38:25 +0000 Commit: Robert Wing CommitDate: 2021-01-06 19:38:25 +0000 bectl(8): sync man page and help text Sync man page with behavior of bectl(8). Sync help text with man page. PR: 246697 Reported by: olgeni Submitted by: olgeni (with changes) Reviewed by: kevans, olgeni Approved by: kevans (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27482 --- sbin/bectl/bectl.8 | 11 +++++------ sbin/bectl/bectl.c | 9 ++++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/sbin/bectl/bectl.8 b/sbin/bectl/bectl.8 index 0638a0c10ecb..4b7868e093eb 100644 --- a/sbin/bectl/bectl.8 +++ b/sbin/bectl/bectl.8 @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 25, 2020 +.Dd January 6, 2021 .Dt BECTL 8 .Os .Sh NAME @@ -71,8 +71,7 @@ .Ar newBeName .Nm .Brq Cm ujail | unjail -.Brq Ar jailId | jailName -.Ar beName +.Brq Ar jailId | jailName | beName .Nm .Brq Cm umount | unmount .Op Fl f @@ -256,7 +255,7 @@ generated by All default parameters may be overwritten. .It Xo .Cm list -.Op Fl DHas +.Op Fl aDHs .Oo Bro Fl c Ar property | Fl C Ar property Brc Oc .Xc .Pp @@ -321,8 +320,8 @@ Rename the given to the given .Ar newBeName . The boot environment will not be unmounted in order for this rename to occur. -.It Cm ujail Bro Ar jailId | jailName Brc Ar beName -.It Cm unjail Bro Ar jailId | jailName Brc Ar beName +.It Cm ujail Brq Ar jailId | jailName | beName +.It Cm unjail Brq Ar jailId | jailName | beName Destroy the jail created from the given boot environment. .It Xo .Cm umount diff --git a/sbin/bectl/bectl.c b/sbin/bectl/bectl.c index ec6c55a57dd9..d4573393130d 100644 --- a/sbin/bectl/bectl.c +++ b/sbin/bectl/bectl.c @@ -81,13 +81,12 @@ usage(bool explicit) "\tbectl destroy [-Fo] {beName | beName@snapshot}\n" "\tbectl export sourceBe\n" "\tbectl import targetBe\n" - "\tbectl jail {-b | -U} [{-o key=value | -u key}]... " - "{jailID | jailName}\n" - "\t bootenv [utility [argument ...]]\n" - "\tbectl list [-DHas] [{-c property | -C property}]\n" + "\tbectl jail [-bU] [{-o key=value | -u key}]... beName\n" + "\t [utility [argument ...]]\n" + "\tbectl list [-aDHs] [{-c property | -C property}]\n" "\tbectl mount beName [mountpoint]\n" "\tbectl rename origBeName newBeName\n" - "\tbectl {ujail | unjail} {jailID | jailName} bootenv\n" + "\tbectl {ujail | unjail} {jailID | jailName | beName}\n" "\tbectl {umount | unmount} [-f] beName\n"); return (explicit ? 0 : EX_USAGE); From owner-dev-commits-src-all@freebsd.org Wed Jan 6 20:38:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 470C54DE5B6; Wed, 6 Jan 2021 20:38:14 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "vtr.rulingia.com", Issuer "R3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DB1Qr6ZVCz3G9K; Wed, 6 Jan 2021 20:38:12 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp239-208.static.internode.on.net [59.167.239.208]) by vtr.rulingia.com (8.15.2/8.15.2) with ESMTPS id 106Kc10L023209 (version=TLSv1.3 cipher=AEAD-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Jan 2021 07:38:07 +1100 (AEDT) (envelope-from peter@rulingia.com) DKIM-Filter: OpenDKIM Filter v2.10.3 vtr.rulingia.com 106Kc10L023209 X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.16.1/8.16.1) with ESMTPS id 106Kbtdx044613 (version=TLSv1.3 cipher=AEAD-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 7 Jan 2021 07:37:55 +1100 (AEDT) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.16.1/8.16.1/Submit) id 106Kbt4q044612; Thu, 7 Jan 2021 07:37:55 +1100 (AEDT) (envelope-from peter) Date: Thu, 7 Jan 2021 07:37:55 +1100 From: Peter Jeremy To: Toomas Soome Cc: Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console Message-ID: References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pO/8cUiEPj9JiOun" Content-Disposition: inline In-Reply-To: <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp X-Rspamd-Queue-Id: 4DB1Qr6ZVCz3G9K X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.10 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[rulingia.com:s=default]; FREEFALL_USER(0.00)[peter]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[2001:19f0:5801:ebe:5400:1ff:fe53:30fd:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[rulingia.com:+]; DMARC_POLICY_ALLOW(-0.50)[rulingia.com,quarantine]; NEURAL_SPAM_LONG(1.00)[1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; SIGNED_PGP(-2.00)[]; FREEMAIL_TO(0.00)[me.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:19f0:5801:ebe:5400:1ff:fe53:30fd:from]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5800::/38, country:US]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 20:38:14 -0000 --pO/8cUiEPj9JiOun Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2021-Jan-06 14:50:38 +0200, Toomas Soome wrote: > > >> On 6. Jan 2021, at 12:33, Peter Jeremy wrote: >>=20 >> On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote: >>> The branch main has been updated by tsoome: >>>=20 >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3D3630506b9daec9167a89bc45= 25638ea45a00769e >>=20 >> Note that this commit adds a hard build dependency on vtfontcvt(8) >> but that tool is depends on the WITH_VT build option. I suspect >> that stand/fonts should be likewise dependent on WITH_VT >>=20 >> --=20 >> Peter Jeremy > > >Thanks for pointing this out. We actually need to build vtfontcvt uncondit= ionally, in addition to font files, we also need it to generate C code for = built in font (used when there are no /boot/fonts). That seems to assume that fonts are needed at all - I found this bug on a Cloud instance that uses a serial console and has no real or simulated graphical display "hardware". --=20 Peter Jeremy --pO/8cUiEPj9JiOun Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAl/2H51fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi CzT+fA/+NOqi/axq02ypfFlclvxAChWKDPmt77/gEeto9rSGCMrUpzshAv84JT8u vtYefrOVhZewev5FNdnN/focGt1sex6/PVFQcIHFyyvJsy/XiI1JhuPTBzrUnLxh lNnE4O37vlPsxVEAtapdtKD6nzLKfdBTnqodGgbBWbbRKV2ujDBJ4yEDMJ059wVy 54iRW6PuJIidMsPEJhD7IvlP8B8+dr6vQwwMwcpRzxfOkyIKPEl44Ldm9tw/d0ap vFgUmIjwfUSsTFCkii+hNXlOaf1wsXE3QUtqD9yi0SfguWL6rvTOzVNPYcOT7GEz Q7ViK4ZsutGxBm1Z9/LswtMxivPFhkJq0dW923SNmc0upW0K07y2Q5xzKCrgSSyI w8uiAagcYkzIdZvXswGsLqcQUsHDmEFo/v7pbD8fM/c1vc/Mez/vMAeaBFFKhDB3 pnVX6o/nIKuLdEaezoACQ5UiGvX8UU/1qQ+yN9ON70xs2f9sMo9jqvL1Pj+nzm8E e4sfO1t9EOQF1uYx/HuPCoF6mTelN637Axi+pRB1XhJSrffHgpns2ArQo0Mk1IVl qe1VOa8rw95RCVUCp60Zp3wkrBiB4HqUBjRPeLbuDUisSoU2NTHPXRYjov3wGY6O uP2CJAG+/hEtglE9nP3lFyCEiTYOdpiiQkyXrVIti/dP9wpKybs= =Q/9/ -----END PGP SIGNATURE----- --pO/8cUiEPj9JiOun-- From owner-dev-commits-src-all@freebsd.org Wed Jan 6 20:44:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EF8634DEE0F; Wed, 6 Jan 2021 20:44:24 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from mail.macktronics.com (coco.macktronics.com [209.181.253.65]) (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 4DB1Yz6RxBz3H3k; Wed, 6 Jan 2021 20:44:23 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from olive.macktronics.com (unknown [209.181.253.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.macktronics.com (Postfix) with ESMTPS id 67D6B1873; Wed, 6 Jan 2021 14:43:43 -0600 (CST) Date: Wed, 6 Jan 2021 14:43:43 -0600 (CST) From: Dan Mack X-X-Sender: mack@localhost.local To: Peter Jeremy cc: Toomas Soome , Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console In-Reply-To: Message-ID: References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> User-Agent: Alpine 2.20 (GSO 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 4DB1Yz6RxBz3H3k X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=macktronics.com; spf=pass (mx1.freebsd.org: domain of mack@macktronics.com designates 209.181.253.65 as permitted sender) smtp.mailfrom=mack@macktronics.com X-Spamd-Result: default: False [-1.80 / 15.00]; RCVD_TLS_ALL(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.181.253.65:from]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.181.253.64/29]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; RCPT_COUNT_FIVE(0.00)[6]; SPAMHAUS_ZRD(0.00)[209.181.253.65:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.997]; DMARC_POLICY_ALLOW(-0.50)[macktronics.com,none]; NEURAL_SPAM_LONG(1.00)[1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:209, ipnet:209.181.252.0/23, country:US]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; FREEMAIL_CC(0.00)[me.com,freebsd.org] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 20:44:25 -0000 I just builtworld/kernel: FreeBSD nvserve 13.0-CURRENT FreeBSD 13.0-CURRENT #7 main-c255633-g3efe9b3e77c: Wed Jan 6 14:23:16 CST 2021 root@nvserve:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 from source ... VGA console is still completly broken/in-operative. Dan On Thu, 7 Jan 2021, Peter Jeremy via dev-commits-src-all wrote: > On 2021-Jan-06 14:50:38 +0200, Toomas Soome wrote: >> >> >>> On 6. Jan 2021, at 12:33, Peter Jeremy wrote: >>> >>> On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote: >>>> The branch main has been updated by tsoome: >>>> >>>> URL: https://cgit.FreeBSD.org/src/commit/?id=3630506b9daec9167a89bc4525638ea45a00769e >>> >>> Note that this commit adds a hard build dependency on vtfontcvt(8) >>> but that tool is depends on the WITH_VT build option. I suspect >>> that stand/fonts should be likewise dependent on WITH_VT >>> >>> -- >>> Peter Jeremy >> >> >> Thanks for pointing this out. We actually need to build vtfontcvt unconditionally, in addition to font files, we also need it to generate C code for built in font (used when there are no /boot/fonts). > > That seems to assume that fonts are needed at all - I found this bug on > a Cloud instance that uses a serial console and has no real or simulated > graphical display "hardware". > > -- > Peter Jeremy > From owner-dev-commits-src-all@freebsd.org Wed Jan 6 21:07:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 94C874DF52C; Wed, 6 Jan 2021 21:07:40 +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 4DB24r1Nc0z3Hlx; Wed, 6 Jan 2021 21:07:39 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id xG1kkVDYjbYg3xG1pkjSfi; Wed, 06 Jan 2021 14:07:38 -0700 X-Authority-Analysis: v=2.4 cv=Q4RsX66a c=1 sm=1 tr=0 ts=5ff6269a a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=HHGDD-5mAAAA:8 a=B-X5g-zTAAAA:8 a=t0Az4YPiXhTzx4vVslQA:9 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=LK5xJRSDVpKd5WXXoEvA:22 a=5JClSVac4pN9U82U9_TY:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 8DEAA4A2; Wed, 6 Jan 2021 13:07:30 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 106L7SaJ002944; Wed, 6 Jan 2021 13:07:28 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101062107.106L7SaJ002944@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: Dan Mack cc: Peter Jeremy , Toomas Soome , Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console In-reply-to: References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> Comments: In-reply-to Dan Mack message dated "Wed, 06 Jan 2021 14:43:43 -0600." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 06 Jan 2021 13:07:28 -0800 X-CMAE-Envelope: MS4xfGW7Btv1j/DOwXHVyFO41Hne7QWkgFc92x5HGzF0g3OwxdJTSWvli/E1/xfEGfQEJDgJdSorUn+u84ZEG1TQOFyKbNQFrYxk0rThmNAbwwLYW+ltLTab SR89lqzt068VBLihEAmK2GpOtlG9559/IxFdk4nnXnbIk6L1e+hWGNuEipKpDg7U7uVZlpJToZhYicVL59rZTv28jizbM8nZhxrbrxDm/NpZtiVz55RXvQWO v/rHTv6lX3KjKFnTRmf0wEiyKUceMrWYcrbVfYiOo3F+xtMhOWBknxJXDStAZF9Gj/C1B5i8DMBKABIv9x9krSbgrnLbBP5TNRFTMOWrPuc90jEU4JznMYC1 a+wuy2/I0Mkhs2W+bX3c4r+pL8m4fyZV6lq8J+KY72eE2UzjPS8jbAKRg+OZkgQBKclq4jED X-Rspamd-Queue-Id: 4DB24r1Nc0z3Hlx X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 21:07:40 -0000 Add screen.textmode=1 to /boot/loader.conf. You'll get text and depending on your card the font may or may not be acceptable. -- 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. In message , Dan Mack writ es: > I just builtworld/kernel: > > FreeBSD nvserve 13.0-CURRENT FreeBSD 13.0-CURRENT #7 > main-c255633-g3efe9b3e77c: Wed Jan 6 14:23:16 CST 2021 > root@nvserve:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 > > from source ... > > VGA console is still completly broken/in-operative. > > Dan > > On Thu, 7 Jan 2021, Peter Jeremy via dev-commits-src-all wrote: > > > On 2021-Jan-06 14:50:38 +0200, Toomas Soome wrote: > >> > >> > >>> On 6. Jan 2021, at 12:33, Peter Jeremy wrote: > >>> > >>> On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote: > >>>> The branch main has been updated by tsoome: > >>>> > >>>> URL: https://cgit.FreeBSD.org/src/commit/?id=3630506b9daec9167a89bc45256 > 38ea45a00769e > >>> > >>> Note that this commit adds a hard build dependency on vtfontcvt(8) > >>> but that tool is depends on the WITH_VT build option. I suspect > >>> that stand/fonts should be likewise dependent on WITH_VT > >>> > >>> -- > >>> Peter Jeremy > >> > >> > >> Thanks for pointing this out. We actually need to build vtfontcvt uncondit > ionally, in addition to font files, we also need it to generate C code for bu > ilt in font (used when there are no /boot/fonts). > > > > That seems to assume that fonts are needed at all - I found this bug on > > a Cloud instance that uses a serial console and has no real or simulated > > graphical display "hardware". > > > > -- > > Peter Jeremy > > > From owner-dev-commits-src-all@freebsd.org Wed Jan 6 21:35:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DCC164DFCD6 for ; Wed, 6 Jan 2021 21:35:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) (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 4DB2jT06tPz3KNp for ; Wed, 6 Jan 2021 21:35:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf33.google.com with SMTP id d11so1918559qvo.11 for ; Wed, 06 Jan 2021 13:35:56 -0800 (PST) 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=pWsXVezn0vkjSQnzw+6g64mkyRXuQT340ZJpcD9y5yA=; b=qb1UPN1DgcoEyAYRczcCy//YfG/3XqQpDaVeozdOn1FpVP/8rBZZ4Ufpup+RmyWmyO SkpCjWT1uWLknt74FlX0kWox6qL+k4KaZ7NwqLv9HwAmAUBqWYK9q11DZJikHLKk3Y4s jGtIcGr62bke7BxSXzX1CrIGmqSGk97acA6lzioqPpBEw47VE+SgxXSzObVnXYijbLfB p5AcksH2V8ErNdJKTHyHCta8qyvW27/yveg92IJuDcKOcEib5Z3aTLLvQhdq7tzPT5uG ZqAxJdqOWHwq4geRdPrThmbEm3I4HbRbx+GJQWc88BH50HQBW5WsV4ZsqscMKemQl/zq GwyA== 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=pWsXVezn0vkjSQnzw+6g64mkyRXuQT340ZJpcD9y5yA=; b=Qj5NRBxKLtWYGuezIWqoLA75znphfnqI1/yjSg5KwtAsMj0VD/t/ZQad/9QV9vVby0 bTbdOVnkjEWBDNg31lVjn+3kCWnQBjDB0nMrGQdk7cJ7FyMsy+F6tf9k0TFCXmz1rO+n hA3EV4zQrFr8WEl2lk4E5/IyQoGQAf+8pZi0UTxQus8WsZl1L/qrCnnibyCrb6VLyVgN RdVAVG1X9Ab7Na3V05PG3twYLpqpJaCHp8pCNxCkZhdJ4mCSOuSfQ6FDwmWmOfSOewxB kmMB2Z8dssetRqUnaoiI4YN7ERMOTUViR0RxVEhFkA4VCvDzYZjiilqN6q+qZWUb5EOo 8q/A== X-Gm-Message-State: AOAM531CZRYedQdZfVRqvtHstw7kDEYai3H2CKDKdTsIQXCXushlR8ws taTFW8iB0XrcHz0A/w8ESD4pfRB6+cfeB8uMLmGH4w== X-Google-Smtp-Source: ABdhPJxLAjBkdrPNdwANvOEaXsQrv3ArryOuQ1Hno4zRBEfqL2+GgAkibWBi/Uqjj0ceEvGSNMvNkpDW4u06DudyDag= X-Received: by 2002:a0c:f14c:: with SMTP id y12mr5977793qvl.23.1609968956006; Wed, 06 Jan 2021 13:35:56 -0800 (PST) MIME-Version: 1.0 References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> In-Reply-To: <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> From: Warner Losh Date: Wed, 6 Jan 2021 14:35:44 -0700 Message-ID: Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console To: Toomas Soome Cc: Peter Jeremy , Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4DB2jT06tPz3KNp X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=qb1UPN1D; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::f33) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[6]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::f33:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_SPAM_LONG(1.00)[1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::f33:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; R_SPF_NA(0.00)[no SPF record]; FREEMAIL_TO(0.00)[me.com]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::f33:from]; 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)[dev-commits-src-all]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 21:35:57 -0000 On Wed, Jan 6, 2021, 5:51 AM Toomas Soome wrote: > > > > On 6. Jan 2021, at 12:33, Peter Jeremy wrote: > > > > On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote: > >> The branch main has been updated by tsoome: > >> > >> URL: > https://cgit.FreeBSD.org/src/commit/?id=3630506b9daec9167a89bc4525638ea45a00769e > > > > Note that this commit adds a hard build dependency on vtfontcvt(8) > > but that tool is depends on the WITH_VT build option. I suspect > > that stand/fonts should be likewise dependent on WITH_VT > > > > -- > > Peter Jeremy > > > Thanks for pointing this out. We actually need to build vtfontcvt > unconditionally, in addition to font files, we also need it to generate C > code for built in font (used when there are no /boot/fonts). > Is there some way to build without any of this stuff *at*all*? Warner thanks, > toomas From owner-dev-commits-src-all@freebsd.org Wed Jan 6 21:38:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4FC4D4DFE4E; Wed, 6 Jan 2021 21:38:04 +0000 (UTC) (envelope-from git@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 4DB2lw1qs7z3Kq7; Wed, 6 Jan 2021 21:38:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 317CE25A2D; Wed, 6 Jan 2021 21:38:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106Lc4wU065271; Wed, 6 Jan 2021 21:38:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106Lc4kh065270; Wed, 6 Jan 2021 21:38:04 GMT (envelope-from git) Date: Wed, 6 Jan 2021 21:38:04 GMT Message-Id: <202101062138.106Lc4kh065270@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: ca71c7e3bb0a - main - arm64: QorIQ: gpio: return BUS_PROBE_DEFAULT MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca71c7e3bb0a1589a3100a2f7a90d463ae7694c8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 21:38:04 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=ca71c7e3bb0a1589a3100a2f7a90d463ae7694c8 commit ca71c7e3bb0a1589a3100a2f7a90d463ae7694c8 Author: Marcin Wojtas AuthorDate: 2021-01-06 14:18:53 +0000 Commit: Marcin Wojtas CommitDate: 2021-01-06 21:37:38 +0000 arm64: QorIQ: gpio: return BUS_PROBE_DEFAULT There is no reason this driver can't return default probe value. Submitted by: Artur Rojek Reviewed by: emaste, mmel Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D26869 --- sys/arm64/qoriq/ls1046_gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/qoriq/ls1046_gpio.c b/sys/arm64/qoriq/ls1046_gpio.c index 89b98c55663b..4992d059a0ee 100644 --- a/sys/arm64/qoriq/ls1046_gpio.c +++ b/sys/arm64/qoriq/ls1046_gpio.c @@ -239,7 +239,7 @@ qoriq_gpio_probe(device_t dev) device_set_desc(dev, "Integrated GPIO Controller"); - return (0); + return (BUS_PROBE_DEFAULT); } static int From owner-dev-commits-src-all@freebsd.org Wed Jan 6 21:38:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7383E4DFEBF; Wed, 6 Jan 2021 21:38:04 +0000 (UTC) (envelope-from git@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 4DB2lw2st1z3KhF; Wed, 6 Jan 2021 21:38:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5458D25B25; Wed, 6 Jan 2021 21:38:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106Lc4S3065305; Wed, 6 Jan 2021 21:38:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106Lc4eY065304; Wed, 6 Jan 2021 21:38:04 GMT (envelope-from git) Date: Wed, 6 Jan 2021 21:38:04 GMT Message-Id: <202101062138.106Lc4eY065304@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: c76c36f95c3c - main - arm64: QorIQ: gpio: Style cleanups MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c76c36f95c3c680064970b655f896afa46df98c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 21:38:04 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=c76c36f95c3c680064970b655f896afa46df98c6 commit c76c36f95c3c680064970b655f896afa46df98c6 Author: Marcin Wojtas AuthorDate: 2021-01-06 14:10:42 +0000 Commit: Marcin Wojtas CommitDate: 2021-01-06 21:37:13 +0000 arm64: QorIQ: gpio: Style cleanups Make the code more conformant to style(9) and improve the general readability. This patch does not alter the driver logic. Submitted by: Artur Rojek Reviewed by: mmel Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D26867 --- sys/arm64/qoriq/ls1046_gpio.c | 122 ++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 71 deletions(-) diff --git a/sys/arm64/qoriq/ls1046_gpio.c b/sys/arm64/qoriq/ls1046_gpio.c index 7e72a2c9f5ed..19695e36564e 100644 --- a/sys/arm64/qoriq/ls1046_gpio.c +++ b/sys/arm64/qoriq/ls1046_gpio.c @@ -80,7 +80,7 @@ struct gpio_softc { /* prototypes */ /* helpers */ -static int qoriq_make_gpio_res(device_t, struct gpio_res*); +static bool qoriq_make_gpio_res(device_t, struct gpio_res*); static uint32_t qoriq_gpio_reg_read(device_t, uint32_t); static void qoriq_gpio_reg_write(device_t, uint32_t, uint32_t); static void qoriq_gpio_reg_set(device_t, uint32_t, uint32_t); @@ -144,18 +144,14 @@ MODULE_VERSION(gpio, 1); /* * helpers */ -static int +static bool qoriq_make_gpio_res(device_t dev, struct gpio_res *out) { out->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &out->mem_rid, RF_ACTIVE | RF_SHAREABLE); - if(out->mem_res == NULL) { - return (1); - } else { - return (0); - } + return (out->mem_res == NULL); } static uint32_t @@ -166,6 +162,7 @@ qoriq_gpio_reg_read(device_t dev, uint32_t reg) QORIQ_GPIO_ASSERT_LOCKED(sc); result = bus_read_4(sc->res.mem_res, reg); + return be32toh(result); } @@ -178,8 +175,8 @@ qoriq_gpio_reg_write(device_t dev, uint32_t reg, uint32_t val) val = htobe32(val); bus_write_4(sc->res.mem_res, reg, val); - bus_barrier(sc->res.mem_res, reg, 4, BUS_SPACE_BARRIER_READ - | BUS_SPACE_BARRIER_WRITE); + bus_barrier(sc->res.mem_res, reg, 4, BUS_SPACE_BARRIER_READ | + BUS_SPACE_BARRIER_WRITE); } static void @@ -209,11 +206,10 @@ qoriq_gpio_out_en(device_t dev, uint32_t pin, uint8_t enable) if (pin >= PIN_COUNT) return; - if (enable) { + if (enable != 0) qoriq_gpio_reg_set(dev, DIRECTION, pin); - } else { + else qoriq_gpio_reg_clear(dev, DIRECTION, pin); - } } static void @@ -223,11 +219,10 @@ qoriq_gpio_value_set(device_t dev, uint32_t pin, uint8_t val) if (pin >= PIN_COUNT) return; - if (val) { + if (val != 0) qoriq_gpio_reg_set(dev, DATA, pin); - } else { + else qoriq_gpio_reg_clear(dev, DATA, pin); - } } static uint32_t @@ -239,22 +234,21 @@ qoriq_gpio_value_get(device_t dev, uint32_t pin) return (0); reg_val = qoriq_gpio_reg_read(dev, DATA); - return ((reg_val & GPIO(pin)) == 0 ? 0 : 1); + + return ((reg_val & GPIO(pin)) != 0); } static void qoriq_gpio_open_drain_set(device_t dev, uint32_t pin, uint8_t val) { - if (pin >= PIN_COUNT) { + if (pin >= PIN_COUNT) return; - } - if (val) { + if (val != 0) qoriq_gpio_reg_set(dev, OPEN_DRAIN, pin); - } else { + else qoriq_gpio_reg_clear(dev, OPEN_DRAIN, pin); - } } static int @@ -263,18 +257,16 @@ qoriq_gpio_configure(device_t dev, uint32_t pin, uint32_t flags) struct gpio_softc *sc = device_get_softc(dev); uint32_t newflags; - if (pin >= PIN_COUNT) { + if (pin >= PIN_COUNT) return (EINVAL); - } /* * Pin cannot function as input and output at the same time. * The same applies to open-drain and push-pull functionality. */ - if (((flags & GPIO_PIN_INPUT) && (flags & GPIO_PIN_OUTPUT)) - || ((flags & GPIO_PIN_OPENDRAIN) && (flags & GPIO_PIN_PUSHPULL))) { + if (((flags & GPIO_PIN_INPUT) && (flags & GPIO_PIN_OUTPUT)) || + ((flags & GPIO_PIN_OPENDRAIN) && (flags & GPIO_PIN_PUSHPULL))) return (EINVAL); - } QORIQ_GPIO_ASSERT_LOCKED(sc); @@ -306,15 +298,14 @@ static int qoriq_gpio_probe(device_t dev) { - if (!ofw_bus_status_okay(dev)) { + if (!ofw_bus_status_okay(dev)) return (ENXIO); - } - if (!ofw_bus_is_compatible(dev, "fsl,qoriq-gpio")) { + if (!ofw_bus_is_compatible(dev, "fsl,qoriq-gpio")) return (ENXIO); - } device_set_desc(dev, "Integrated GPIO Controller"); + return (0); } @@ -324,20 +315,17 @@ qoriq_gpio_attach(device_t dev) struct gpio_softc *sc = device_get_softc(dev); int i; - if(qoriq_make_gpio_res(dev, &sc->res) != 0) { + if (qoriq_make_gpio_res(dev, &sc->res)) return (ENXIO); - } - for(i = 0; i < PIN_COUNT; i++) { + for (i = 0; i < PIN_COUNT; i++) sc->setup[i].gp_caps = DEFAULT_CAPS; - } sc->dev = dev; sc->busdev = gpiobus_attach_bus(dev); - if(sc->busdev == NULL) { + if (sc->busdev == NULL) return (ENXIO); - } return (0); } @@ -354,11 +342,11 @@ static int qoriq_gpio_pin_max(device_t dev, int *maxpin) { - if(maxpin == NULL) { + if (maxpin == NULL) return (EINVAL); - } *maxpin = PIN_COUNT - 1; + return (0); } @@ -366,9 +354,8 @@ static int qoriq_gpio_pin_getname(device_t dev, uint32_t pin, char *name) { - if(name == NULL || pin >= PIN_COUNT) { + if (name == NULL || pin >= PIN_COUNT) return (EINVAL); - } snprintf(name, GPIOMAXNAME, "pin %d", pin); @@ -380,9 +367,8 @@ qoriq_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *pflags) { struct gpio_softc *sc = device_get_softc(dev); - if (pflags == NULL || pin >= PIN_COUNT) { + if (pflags == NULL || pin >= PIN_COUNT) return (EINVAL); - } QORIQ_GPIO_LOCK(sc); *pflags = sc->setup[pin].gp_flags; @@ -402,6 +388,7 @@ qoriq_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) /* Check for unwanted flags. */ QORIQ_GPIO_LOCK(sc); + if ((flags & sc->setup[pin].gp_caps) != flags) { QORIQ_GPIO_UNLOCK(sc); return (EINVAL); @@ -410,6 +397,7 @@ qoriq_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) ret = qoriq_gpio_configure(dev, pin, flags); QORIQ_GPIO_UNLOCK(sc); + return (ret); } @@ -418,9 +406,8 @@ qoriq_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) { struct gpio_softc *sc = device_get_softc(dev); - if (caps == NULL || pin >= PIN_COUNT) { + if (caps == NULL || pin >= PIN_COUNT) return (EINVAL); - } QORIQ_GPIO_LOCK(sc); *caps = sc->setup[pin].gp_caps; @@ -434,13 +421,13 @@ qoriq_gpio_pin_get(device_t dev, uint32_t pin, uint32_t *value) { struct gpio_softc *sc = device_get_softc(dev); - if (value == NULL || pin >= PIN_COUNT) { + if (value == NULL || pin >= PIN_COUNT) return (EINVAL); - } QORIQ_GPIO_LOCK(sc); *value = qoriq_gpio_value_get(dev, pin); QORIQ_GPIO_UNLOCK(sc); + return (0); } @@ -449,13 +436,13 @@ qoriq_gpio_pin_set(device_t dev, uint32_t pin, uint32_t value) { struct gpio_softc *sc = device_get_softc(dev); - if (pin >= PIN_COUNT) { + if (pin >= PIN_COUNT) return (EINVAL); - } QORIQ_GPIO_LOCK(sc); qoriq_gpio_value_set(dev, pin, value); QORIQ_GPIO_UNLOCK(sc); + return (0); } @@ -465,18 +452,13 @@ qoriq_gpio_pin_toggle(device_t dev, uint32_t pin) struct gpio_softc *sc; uint32_t value; - if (pin >= PIN_COUNT) { + if (pin >= PIN_COUNT) return (EINVAL); - } sc = device_get_softc(dev); QORIQ_GPIO_LOCK(sc); - value = qoriq_gpio_reg_read(dev, DATA); - if (value & (1 << pin)) - value &= ~(1 << pin); - else - value |= (1 << pin); + value = qoriq_gpio_reg_read(dev, DATA) ^ (1 << pin); qoriq_gpio_reg_write(dev, DATA, value); QORIQ_GPIO_UNLOCK(sc); @@ -497,12 +479,13 @@ qoriq_gpio_map_gpios(device_t bus, phandle_t dev, phandle_t gparent, int gcells, err = qoriq_gpio_configure(bus, gpios[0], gpios[1]); QORIQ_GPIO_UNLOCK(sc); - if(err == 0) { - *pin = gpios[0]; - *flags = gpios[1]; - } + if (err != 0) + return (err); - return (err); + *pin = gpios[0]; + *flags = gpios[1]; + + return (0); } static int @@ -542,9 +525,7 @@ qoriq_gpio_pin_config_32(device_t dev, uint32_t first_pin, uint32_t num_pins, sc = device_get_softc(dev); - dir = 0; - odr = 0; - mask = 0; + dir = odr = mask = 0; for (i = 0; i < num_pins; i++) { newflags[i] = 0; @@ -568,17 +549,16 @@ qoriq_gpio_pin_config_32(device_t dev, uint32_t first_pin, uint32_t num_pins, } QORIQ_GPIO_LOCK(sc); - reg = qoriq_gpio_reg_read(dev, DIRECTION); - reg &= ~mask; - reg |= dir; + + reg = (qoriq_gpio_reg_read(dev, DIRECTION) & ~mask) | dir; qoriq_gpio_reg_write(dev, DIRECTION, reg); - reg = qoriq_gpio_reg_read(dev, OPEN_DRAIN); - reg &= ~mask; - reg |= odr; + + reg = (qoriq_gpio_reg_read(dev, OPEN_DRAIN) & ~mask) | odr; qoriq_gpio_reg_write(dev, OPEN_DRAIN, reg); - for (i = 0; i < num_pins; i++) { + + for (i = 0; i < num_pins; i++) sc->setup[i].gp_flags = newflags[i]; - } + QORIQ_GPIO_UNLOCK(sc); return (0); From owner-dev-commits-src-all@freebsd.org Wed Jan 6 21:38:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 633CE4DFD5E; Wed, 6 Jan 2021 21:38:04 +0000 (UTC) (envelope-from git@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 4DB2lw2Q5Wz3KsG; Wed, 6 Jan 2021 21:38:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4200E25A2E; Wed, 6 Jan 2021 21:38:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106Lc4e6065288; Wed, 6 Jan 2021 21:38:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106Lc4gE065287; Wed, 6 Jan 2021 21:38:04 GMT (envelope-from git) Date: Wed, 6 Jan 2021 21:38:04 GMT Message-Id: <202101062138.106Lc4gE065287@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 39c24889b022 - main - arm64: QorIQ: gpio: Cleanup qoriq_gpio_* helpers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 39c24889b0222dc7e734445ee765a7d22abbd543 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 21:38:04 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=39c24889b0222dc7e734445ee765a7d22abbd543 commit 39c24889b0222dc7e734445ee765a7d22abbd543 Author: Marcin Wojtas AuthorDate: 2021-01-06 14:15:55 +0000 Commit: Marcin Wojtas CommitDate: 2021-01-06 21:37:21 +0000 arm64: QorIQ: gpio: Cleanup qoriq_gpio_* helpers Replace various hw reg bit set/clear helpers with a universal `qoriq_gpio_set` function. Submitted by: Artur Rojek Reviewed by: mmel Obtained from: Semihalf Sponsored by: Alstom Group Differential Revision: https://reviews.freebsd.org/D26868 --- sys/arm64/qoriq/ls1046_gpio.c | 91 ++++++------------------------------------- 1 file changed, 12 insertions(+), 79 deletions(-) diff --git a/sys/arm64/qoriq/ls1046_gpio.c b/sys/arm64/qoriq/ls1046_gpio.c index 19695e36564e..89b98c55663b 100644 --- a/sys/arm64/qoriq/ls1046_gpio.c +++ b/sys/arm64/qoriq/ls1046_gpio.c @@ -83,12 +83,7 @@ struct gpio_softc { static bool qoriq_make_gpio_res(device_t, struct gpio_res*); static uint32_t qoriq_gpio_reg_read(device_t, uint32_t); static void qoriq_gpio_reg_write(device_t, uint32_t, uint32_t); -static void qoriq_gpio_reg_set(device_t, uint32_t, uint32_t); -static void qoriq_gpio_reg_clear(device_t, uint32_t, uint32_t); -static void qoriq_gpio_out_en(device_t, uint32_t, uint8_t); -static void qoriq_gpio_value_set(device_t, uint32_t, uint8_t); -static uint32_t qoriq_gpio_value_get(device_t, uint32_t); -static void qoriq_gpio_open_drain_set(device_t, uint32_t, uint8_t); +static void qoriq_gpio_set(device_t, uint32_t, uint32_t, uint32_t); static int qoriq_gpio_configure(device_t, uint32_t, uint32_t); /* GPIO API */ @@ -180,75 +175,13 @@ qoriq_gpio_reg_write(device_t dev, uint32_t reg, uint32_t val) } static void -qoriq_gpio_reg_set(device_t dev, uint32_t reg, uint32_t pin) +qoriq_gpio_set(device_t dev, uint32_t reg, uint32_t pin, uint32_t set) { - uint32_t reg_val; + uint32_t val; - reg_val = qoriq_gpio_reg_read(dev, reg); - reg_val |= GPIO(pin); - qoriq_gpio_reg_write(dev, reg, reg_val); -} - -static void -qoriq_gpio_reg_clear(device_t dev, uint32_t reg, uint32_t pin) -{ - uint32_t reg_val; - - reg_val = qoriq_gpio_reg_read(dev, reg); - reg_val &= ~(GPIO(pin)); - qoriq_gpio_reg_write(dev, reg, reg_val); -} - -static void -qoriq_gpio_out_en(device_t dev, uint32_t pin, uint8_t enable) -{ - - if (pin >= PIN_COUNT) - return; - - if (enable != 0) - qoriq_gpio_reg_set(dev, DIRECTION, pin); - else - qoriq_gpio_reg_clear(dev, DIRECTION, pin); -} - -static void -qoriq_gpio_value_set(device_t dev, uint32_t pin, uint8_t val) -{ - - if (pin >= PIN_COUNT) - return; - - if (val != 0) - qoriq_gpio_reg_set(dev, DATA, pin); - else - qoriq_gpio_reg_clear(dev, DATA, pin); -} - -static uint32_t -qoriq_gpio_value_get(device_t dev, uint32_t pin) -{ - uint32_t reg_val; - - if (pin >= PIN_COUNT) - return (0); - - reg_val = qoriq_gpio_reg_read(dev, DATA); - - return ((reg_val & GPIO(pin)) != 0); -} - -static void -qoriq_gpio_open_drain_set(device_t dev, uint32_t pin, uint8_t val) -{ - - if (pin >= PIN_COUNT) - return; - - if (val != 0) - qoriq_gpio_reg_set(dev, OPEN_DRAIN, pin); - else - qoriq_gpio_reg_clear(dev, OPEN_DRAIN, pin); + set = set != 0; + val = (qoriq_gpio_reg_read(dev, reg) & ~(1U << pin)) | (set << pin); + qoriq_gpio_reg_write(dev, reg, val); } static int @@ -272,19 +205,19 @@ qoriq_gpio_configure(device_t dev, uint32_t pin, uint32_t flags) if (flags & GPIO_PIN_INPUT) { newflags = GPIO_PIN_INPUT; - qoriq_gpio_out_en(dev, pin, 0); + qoriq_gpio_set(dev, DIRECTION, pin, 0); } if (flags & GPIO_PIN_OUTPUT) { newflags = GPIO_PIN_OUTPUT; - qoriq_gpio_out_en(dev, pin, 1); + qoriq_gpio_set(dev, DIRECTION, pin, 1); if (flags & GPIO_PIN_OPENDRAIN) { newflags |= GPIO_PIN_OPENDRAIN; - qoriq_gpio_open_drain_set(dev, pin, 1); + qoriq_gpio_set(dev, OPEN_DRAIN, pin, 1); } else { newflags |= GPIO_PIN_PUSHPULL; - qoriq_gpio_open_drain_set(dev, pin, 0); + qoriq_gpio_set(dev, OPEN_DRAIN, pin, 0); } } @@ -425,7 +358,7 @@ qoriq_gpio_pin_get(device_t dev, uint32_t pin, uint32_t *value) return (EINVAL); QORIQ_GPIO_LOCK(sc); - *value = qoriq_gpio_value_get(dev, pin); + *value = (qoriq_gpio_reg_read(dev, DATA) & GPIO(pin)) != 0; QORIQ_GPIO_UNLOCK(sc); return (0); @@ -440,7 +373,7 @@ qoriq_gpio_pin_set(device_t dev, uint32_t pin, uint32_t value) return (EINVAL); QORIQ_GPIO_LOCK(sc); - qoriq_gpio_value_set(dev, pin, value); + qoriq_gpio_set(dev, DATA, pin, value); QORIQ_GPIO_UNLOCK(sc); return (0); From owner-dev-commits-src-all@freebsd.org Wed Jan 6 21:50:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3B5C74E0144; Wed, 6 Jan 2021 21:50:09 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from mail.macktronics.com (coco.macktronics.com [209.181.253.65]) (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 4DB31r4SnKz3M2n; Wed, 6 Jan 2021 21:50:08 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from olive.macktronics.com (unknown [209.181.253.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.macktronics.com (Postfix) with ESMTPS id BF4801889; Wed, 6 Jan 2021 15:49:27 -0600 (CST) Date: Wed, 6 Jan 2021 15:49:27 -0600 (CST) From: Dan Mack X-X-Sender: mack@localhost.local To: Cy Schubert cc: Peter Jeremy , Toomas Soome , Toomas Soome , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console In-Reply-To: <202101062107.106L7SaJ002944@slippy.cwsent.com> Message-ID: References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> <202101062107.106L7SaJ002944@slippy.cwsent.com> User-Agent: Alpine 2.20 (GSO 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 4DB31r4SnKz3M2n X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=macktronics.com; spf=pass (mx1.freebsd.org: domain of mack@macktronics.com designates 209.181.253.65 as permitted sender) smtp.mailfrom=mack@macktronics.com X-Spamd-Result: default: False [-1.80 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.181.253.65:from]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.181.253.64/29:c]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; SPAMHAUS_ZRD(0.00)[209.181.253.65:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.998]; DMARC_POLICY_ALLOW(-0.50)[macktronics.com,none]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_SPAM_LONG(1.00)[1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:209, ipnet:209.181.252.0/23, country:US]; FREEMAIL_CC(0.00)[rulingia.com,me.com,freebsd.org]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 21:50:09 -0000 Ack ... that worked for me. Back in business. Dan On Wed, 6 Jan 2021, Cy Schubert wrote: > Add screen.textmode=1 to /boot/loader.conf. You'll get text and depending > on your card the font may or may not be acceptable. > > > -- > 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. > > > > In message , Dan Mack > writ > es: >> I just builtworld/kernel: >> >> FreeBSD nvserve 13.0-CURRENT FreeBSD 13.0-CURRENT #7 >> main-c255633-g3efe9b3e77c: Wed Jan 6 14:23:16 CST 2021 >> root@nvserve:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 >> >> from source ... >> >> VGA console is still completly broken/in-operative. >> >> Dan >> >> On Thu, 7 Jan 2021, Peter Jeremy via dev-commits-src-all wrote: >> >>> On 2021-Jan-06 14:50:38 +0200, Toomas Soome wrote: >>>> >>>> >>>>> On 6. Jan 2021, at 12:33, Peter Jeremy wrote: >>>>> >>>>> On 2021-Jan-02 20:09:25 +0000, Toomas Soome wrote: >>>>>> The branch main has been updated by tsoome: >>>>>> >>>>>> URL: https://cgit.FreeBSD.org/src/commit/?id=3630506b9daec9167a89bc45256 >> 38ea45a00769e >>>>> >>>>> Note that this commit adds a hard build dependency on vtfontcvt(8) >>>>> but that tool is depends on the WITH_VT build option. I suspect >>>>> that stand/fonts should be likewise dependent on WITH_VT >>>>> >>>>> -- >>>>> Peter Jeremy >>>> >>>> >>>> Thanks for pointing this out. We actually need to build vtfontcvt uncondit >> ionally, in addition to font files, we also need it to generate C code for bu >> ilt in font (used when there are no /boot/fonts). >>> >>> That seems to assume that fonts are needed at all - I found this bug on >>> a Cloud instance that uses a serial console and has no real or simulated >>> graphical display "hardware". >>> >>> -- >>> Peter Jeremy >>> >> > > > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebsd.org" > From owner-dev-commits-src-all@freebsd.org Wed Jan 6 22:08:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 54F064E08EE; Wed, 6 Jan 2021 22:08:11 +0000 (UTC) (envelope-from git@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 4DB3Qg21gBz3N08; Wed, 6 Jan 2021 22:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 386CE25C4F; Wed, 6 Jan 2021 22:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106M8Bma004130; Wed, 6 Jan 2021 22:08:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106M8B9W004129; Wed, 6 Jan 2021 22:08:11 GMT (envelope-from git) Date: Wed, 6 Jan 2021 22:08:11 GMT Message-Id: <202101062208.106M8B9W004129@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c38e59ce1b0a - main - pfctl: Fix NOCLEAN build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c38e59ce1b0a6c030a942d0814d581dbd7f67e3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 22:08:11 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c38e59ce1b0a6c030a942d0814d581dbd7f67e3c commit c38e59ce1b0a6c030a942d0814d581dbd7f67e3c Author: Kristof Provost AuthorDate: 2021-01-06 21:07:25 +0000 Commit: Kristof Provost CommitDate: 2021-01-06 21:07:46 +0000 pfctl: Fix NOCLEAN build We've created a new pf_ruleset.c file for pfctl and no longer use the kernel vrsion, but the build system doesn't handle this dependency change correctly. Delete the dependency file if it contains the kernel version of the file. MFC after: 2 weeks --- tools/build/depend-cleanup.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh index 8b249ccf55fa..0b3ff9bcc635 100755 --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -56,3 +56,11 @@ if [ -e "$OBJTOP"/rescue/rescue/rescue.c ] && \ echo "Removing old rescue(8) tree" rm -rf "$OBJTOP"/rescue/rescue fi + +# 20210105 fda7daf06301 pfctl gained its own version of pf_ruleset.c +if [ -e "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o ] && \ + egrep -qw "sys/netpfil/pf/pf_ruleset.c" \ + "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o; then + echo "Removing old pf_ruleset dependecy file" + rm -rf "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o +fi From owner-dev-commits-src-all@freebsd.org Wed Jan 6 22:20:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8A9DB4E10ED for ; Wed, 6 Jan 2021 22:20:13 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-zteg10021301.me.com (pv50p00im-zteg10021301.me.com [17.58.6.46]) (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 4DB3hY2j0gz3NkH for ; Wed, 6 Jan 2021 22:20:13 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-zteg10021301.me.com (Postfix) with ESMTPSA id 1EFD3CC01A0; Wed, 6 Jan 2021 22:20:04 +0000 (UTC) From: Toomas Soome Message-Id: Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: git: 3630506b9dae - main - loader: implement framebuffer console Date: Thu, 7 Jan 2021 00:20:02 +0200 In-Reply-To: Cc: Peter Jeremy , Toomas Soome , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org To: Warner Losh References: <202101022009.102K9PRl075016@gitrepo.freebsd.org> <51035B54-FF30-41EE-BC4A-3D4E0ABD1B13@me.com> X-Mailer: Apple Mail (2.3654.40.0.2.32) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2021-01-06_12:2021-01-06, 2021-01-06 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=946 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2006250000 definitions=main-2101060125 X-Rspamd-Queue-Id: 4DB3hY2j0gz3NkH X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 22:20:13 -0000 > On 6. Jan 2021, at 23:35, Warner Losh wrote: >=20 >=20 >=20 > On Wed, Jan 6, 2021, 5:51 AM Toomas Soome > wrote: >=20 >=20 > > On 6. Jan 2021, at 12:33, Peter Jeremy > wrote: > >=20 > > On 2021-Jan-02 20:09:25 +0000, Toomas Soome = wrote: > >> The branch main has been updated by tsoome: > >>=20 > >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D3630506b9daec9167a89bc4525638ea4= 5a00769e = > >=20 > > Note that this commit adds a hard build dependency on vtfontcvt(8) > > but that tool is depends on the WITH_VT build option. I suspect > > that stand/fonts should be likewise dependent on WITH_VT > >=20 > > --=20 > > Peter Jeremy >=20 >=20 > Thanks for pointing this out. We actually need to build vtfontcvt = unconditionally, in addition to font files, we also need it to generate = C code for built in font (used when there are no /boot/fonts). >=20 > Is there some way to build without any of this stuff *at*all*? >=20 > Warner Not at this time, no. rgds, toomas From owner-dev-commits-src-all@freebsd.org Wed Jan 6 23:46:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2E72B4E4F0E; Wed, 6 Jan 2021 23:46:44 +0000 (UTC) (envelope-from git@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 4DB5cN0rwxz3l12; Wed, 6 Jan 2021 23:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 103ED26DF4; Wed, 6 Jan 2021 23:46:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 106Nkibn032270; Wed, 6 Jan 2021 23:46:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 106NkhDh032269; Wed, 6 Jan 2021 23:46:43 GMT (envelope-from git) Date: Wed, 6 Jan 2021 23:46:43 GMT Message-Id: <202101062346.106NkhDh032269@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: f2b794e1e90c - main - cache: unengrish the comment in previous commit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2b794e1e90c1163e21d69dbc63101df8276eaa6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 23:46:44 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f2b794e1e90c1163e21d69dbc63101df8276eaa6 commit f2b794e1e90c1163e21d69dbc63101df8276eaa6 Author: Mateusz Guzik AuthorDate: 2021-01-06 23:44:05 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-06 23:46:05 +0000 cache: unengrish the comment in previous commit Reported by: rpokala, brd --- sys/kern/vfs_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 138a55f94dbd..43c44aa60afc 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5140,7 +5140,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) cache_fpl_checkpoint(fpl, &fpl->snd); /* - * The vnode is hand is almost always stable, skip checking for it. + * The vnode at hand is almost always stable, skip checking for it. * Worst case this postpones the check towards the end of the iteration * of the main loop. */ From owner-dev-commits-src-all@freebsd.org Thu Jan 7 00:30:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A23BD4E5ECF; Thu, 7 Jan 2021 00:30:58 +0000 (UTC) (envelope-from git@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 4DB6bQ3z3hz3p69; Thu, 7 Jan 2021 00:30:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B2F727A4B; Thu, 7 Jan 2021 00:30:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1070UwQn091658; Thu, 7 Jan 2021 00:30:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1070Uwpe091657; Thu, 7 Jan 2021 00:30:58 GMT (envelope-from git) Date: Thu, 7 Jan 2021 00:30:58 GMT Message-Id: <202101070030.1070Uwpe091657@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: c8a7a3ffe120 - main - Fix bug in expanding lost+found direct blocks. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8a7a3ffe120d0d44a39e69466c088d5862e6f5c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 00:30:58 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=c8a7a3ffe120d0d44a39e69466c088d5862e6f5c commit c8a7a3ffe120d0d44a39e69466c088d5862e6f5c Author: Kirk McKusick AuthorDate: 2021-01-07 00:31:33 +0000 Commit: Kirk McKusick CommitDate: 2021-01-07 00:35:01 +0000 Fix bug in expanding lost+found direct blocks. Reported by: Peter Holm Sponsored by: Netflix --- sbin/fsck_ffs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index 044a7b0f13a9..a86d65a9f183 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -657,7 +657,7 @@ expanddir(union dinode *dp, char *name) * If last block is a fragment, expand it to a full size block. */ lastlbnsize = sblksize(&sblock, filesize, lastlbn); - if (lastlbnsize < sblock.fs_bsize) { + if (lastlbnsize > 0 && lastlbnsize < sblock.fs_bsize) { oldblk = DIP(dp, di_db[lastlbn]); bp = getdirblk(oldblk, lastlbnsize); if (bp->b_errs) From owner-dev-commits-src-all@freebsd.org Thu Jan 7 01:30:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 327F44E71EB; Thu, 7 Jan 2021 01:30:45 +0000 (UTC) (envelope-from git@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 4DB7wP10k3z3sGW; Thu, 7 Jan 2021 01:30:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1597855E; Thu, 7 Jan 2021 01:30:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1071UjQH069256; Thu, 7 Jan 2021 01:30:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1071UjS5069255; Thu, 7 Jan 2021 01:30:45 GMT (envelope-from git) Date: Thu, 7 Jan 2021 01:30:45 GMT Message-Id: <202101070130.1071UjS5069255@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Neel Chauhan Subject: git: 710dd05c0efc - main - Add my name/handle/mentor to committers-ports.dot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 710dd05c0efc36fceac8e95a2457b57cc1b4c4e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 01:30:45 -0000 The branch main has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=710dd05c0efc36fceac8e95a2457b57cc1b4c4e2 commit 710dd05c0efc36fceac8e95a2457b57cc1b4c4e2 Author: Neel Chauhan AuthorDate: 2021-01-07 01:30:21 +0000 Commit: Neel Chauhan CommitDate: 2021-01-07 01:30:21 +0000 Add my name/handle/mentor to committers-ports.dot --- share/misc/committers-ports.dot | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/misc/committers-ports.dot b/share/misc/committers-ports.dot index d132703e258a..5bb8be40d4e7 100644 --- a/share/misc/committers-ports.dot +++ b/share/misc/committers-ports.dot @@ -203,6 +203,7 @@ mm [label="Martin Matuska\nmm@FreeBSD.org\n2007/04/04"] mmokhi [label="Mahdi Mokhtari\nmmokhi@FreeBSD.org\n2017/02/09"] mnag [label="Marcus Alves Grando\nmnag@FreeBSD.org\n2005/09/15"] mva [label="Marcus von Appen\nmva@FreeBSD.org\n2009/02/16"] +nc [label="Neel Chauhan\nnc@FreeBSD.org\n2021/01/02"] nemysis [label="Rusmir Dusko\nnemysis@FreeBSD.org\n2013/07/31"] nemoliu [label="Tong Liu\nnemoliu@FreeBSD.org\n2007/04/25"] netchild [label="Alexander Leidinger\nnetchild@FreeBSD.org\n2002/03/19"] @@ -297,6 +298,8 @@ znerd [label="Ernst de Haan\nznerd@FreeBSD.org\n2001/11/15"] # Group together all the mentees for a particular mentor. # Keep the list sorted by mentor login. +0mp -> nc + adamw -> ahze adamw -> jylefort adamw -> ler From owner-dev-commits-src-all@freebsd.org Thu Jan 7 07:06:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3EFD64C5260; Thu, 7 Jan 2021 07:06:38 +0000 (UTC) (envelope-from git@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 4DBHMy1L48z4cLt; Thu, 7 Jan 2021 07:06:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20E904EB4; Thu, 7 Jan 2021 07:06:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10776c4I000540; Thu, 7 Jan 2021 07:06:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10776cN5000539; Thu, 7 Jan 2021 07:06:38 GMT (envelope-from git) Date: Thu, 7 Jan 2021 07:06:38 GMT Message-Id: <202101070706.10776cN5000539@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 163f4f15733f - main - netmap: bridge: fix NS_MOREFRAG support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 163f4f15733f82584a967538cf2340bf1b6a245f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 07:06:38 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=163f4f15733f82584a967538cf2340bf1b6a245f commit 163f4f15733f82584a967538cf2340bf1b6a245f Author: Vincenzo Maffione AuthorDate: 2021-01-07 07:00:43 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-07 07:05:57 +0000 netmap: bridge: fix NS_MOREFRAG support Support for NS_MOREFRAG is broken, as NS_MOREFRAG is copied from the TX slot to the RX slot rather than the other way around. Also, the NS_MOREFRAG must be copied also in case of packet copy (no zerocopy). Reported by: rajesh1.kumar_amd.com MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D27980 --- tools/tools/netmap/bridge.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/tools/netmap/bridge.c b/tools/tools/netmap/bridge.c index af8c2847130a..77d235bf6e08 100644 --- a/tools/tools/netmap/bridge.c +++ b/tools/tools/netmap/bridge.c @@ -86,13 +86,12 @@ rings_move(struct netmap_ring *rxring, struct netmap_ring *txring, struct netmap_slot *rs = &rxring->slot[j]; struct netmap_slot *ts = &txring->slot[k]; - /* swap packets */ if (ts->buf_idx < 2 || rs->buf_idx < 2) { RD(2, "wrong index rxr[%d] = %d -> txr[%d] = %d", j, rs->buf_idx, k, ts->buf_idx); sleep(2); } - /* copy the packet length. */ + /* Copy the packet length. */ if (rs->len > rxring->nr_buf_size) { RD(2, "%s: invalid len %u, rxr[%d] -> txr[%d]", msg, rs->len, j, k); @@ -109,13 +108,16 @@ rings_move(struct netmap_ring *rxring, struct netmap_ring *txring, /* report the buffer change. */ ts->flags |= NS_BUF_CHANGED; rs->flags |= NS_BUF_CHANGED; - /* copy the NS_MOREFRAG */ - rs->flags = (rs->flags & ~NS_MOREFRAG) | (ts->flags & NS_MOREFRAG); } else { char *rxbuf = NETMAP_BUF(rxring, rs->buf_idx); char *txbuf = NETMAP_BUF(txring, ts->buf_idx); nm_pkt_copy(rxbuf, txbuf, ts->len); } + /* + * Copy the NS_MOREFRAG from rs to ts, leaving any + * other flags unchanged. + */ + ts->flags = (ts->flags & ~NS_MOREFRAG) | (rs->flags & NS_MOREFRAG); j = nm_ring_next(rxring, j); k = nm_ring_next(txring, k); } @@ -190,7 +192,7 @@ usage(void) int main(int argc, char **argv) { - char msg_a2b[128], msg_b2a[128]; + char msg_a2b[256], msg_b2a[256]; struct pollfd pollfd[2]; u_int burst = 1024, wait_link = 4; struct nmport_d *pa = NULL, *pb = NULL; From owner-dev-commits-src-all@freebsd.org Thu Jan 7 07:28:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1AD144C52D4; Thu, 7 Jan 2021 07:28:47 +0000 (UTC) (envelope-from gbe@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 4DBHsW049Gz4d66; Thu, 7 Jan 2021 07:28:47 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p200300d5d72fc8e88d2762c8763f258e.dip0.t-ipconnect.de [IPv6:2003:d5:d72f:c8e8:8d27:62c8:763f:258e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id 68FE3224E2; Thu, 7 Jan 2021 07:28:46 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Thu, 7 Jan 2021 08:28:45 +0100 From: Gordon Bergling To: Gordon Bergling Cc: Baptiste Daroussin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support Message-ID: References: <202101051302.105D24lW041218@gitrepo.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 12.2-STABLE amd64 X-Host-Uptime: 8:26AM up 3 days, 10:30, 4 users, load averages: 0.24, 0.29, 0.27 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 07:28:47 -0000 On Wed, Jan 06, 2021 at 04:29:32PM +0100, Gordon Bergling wrote: > On Tue, Jan 05, 2021 at 01:02:04PM +0000, Baptiste Daroussin wrote: > > The branch main has been updated by bapt: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba0441562aa07 > > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > Author: Baptiste Daroussin > > AuthorDate: 2021-01-04 16:29:40 +0000 > > Commit: Baptiste Daroussin > > CommitDate: 2021-01-05 13:01:32 +0000 > > > > ncurses: only keep the version with widechar support > > > > Only keep the widechar version of ncurses as libncursesw.so.9 > > > > Keep the old name to avoid breaking the ABI compatibility (the non > > widechar version libncurses.so.9 is not binary compatible with > > libncursesw.so.9) since all ports and base are already only linking > > against the widechar version we can simply remove libncurses.so.9 > > > > Since the .9 version only lived in the dev branch and never ended in a > > release, it is simply removed and not added to any binary compat > > package. > > > > Add symlinks to keep build time compatibility for anyone linking against > > -lncurses > > --- > > Makefile.inc1 | 5 +-- > > Makefile.libcompat | 4 +- > > ObsoleteFiles.inc | 2 + > > lib/ncurses/Makefile | 6 +-- > > lib/ncurses/config.mk | 11 +----- > > lib/ncurses/form/Makefile | 18 ++++++--- > > lib/ncurses/formw/Makefile | 5 --- > > lib/ncurses/formw/Makefile.depend | 17 --------- > > lib/ncurses/menu/Makefile | 18 ++++++--- > > lib/ncurses/menuw/Makefile | 5 --- > > lib/ncurses/menuw/Makefile.depend | 17 --------- > > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++-------------------- > > lib/ncurses/ncursesw/Makefile | 7 ---- > > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > > lib/ncurses/panel/Makefile | 23 ++++++++---- > > lib/ncurses/panelw/Makefile | 5 --- > > lib/ncurses/panelw/Makefile.depend | 17 --------- > > share/mk/src.libnames.mk | 16 ++------ > > tools/bsdbox/Makefile.base | 2 +- > > tools/tools/ath/athratestats/Makefile | 2 +- > > 20 files changed, 87 insertions(+), 180 deletions(-) > [...] > > This also breaks the build on arm64. I had NO_CLEAN=yes applied, but this error > is generated after a 'make clean cleandepend'. The src.conf is the following, > > WITH_MALLOC_PRODUCTION=1 > WITH_EXTRA_TCP_STACKS=1 > WITH_BEARSSL=1 > WITH_PIE=1 > WITH_RETPOLINE=1 > > Is there anything else I can do? > > ------------------------------------------------------------------------------- > ===> cddl/lib/libnvpair (obj,all,install) > In file included from /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/widechar/lib_add_wch.c:37: > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:2062:40: error: a parameter list without types is only allowed > in a function definition > extern NCURSES_EXPORT(int) _nc_to_char(wint_t); > ^ > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:2063:23: error: unknown type name 'wint_t' > extern NCURSES_EXPORT(wint_t) _nc_to_widechar(int); > ^ > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:2322:61: error: unknown type name 'mbstate_t'; did you mean '__ > mbstate_t'? > extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *); > ^~~~~~~~~ > __mbstate_t > /tank/nfs_public/tiny/obj/tank/nfs_public/tiny/src/arm64.aarch64/tmp/usr/include/sys/_types.h:124:3: note: '__mbstate_t' declar > ed here > } __mbstate_t; > ^ > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/widechar/lib_add_wch.c:46:34: error: excess elements in struct initializer [- > Werror,-Wexcess-initializers] > static const cchar_t blankchar = NewChar(BLANK_TEXT); > ^~~~~~~~~~~~~~~~~~~ > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:1537:21: note: expanded from macro 'NewChar' > #define NewChar(ch) NewChar2(ChCharOf(ch), ChAttrOf(ch)) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:1536:43: note: expanded from macro 'NewChar2' > #define NewChar2(c,a) { a, { c, NulChar } NulColor } > ^~~~~~~~ > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:1523:20: note: expanded from macro 'NulColor' > #define NulColor , 0 > ^ > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/widechar/lib_add_wch.c:66:16: error: no member named 'ext_color' in 'cchar_t' > int pair = GetPair(ch); > ^~~~~~~~~~~ > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:479:42: note: expanded from macro 'GetPair' > #define GetPair(value) GetPair2((value).ext_color, AttrOf(value)) > ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ > ------------------------------------------------------------------------------- If someone is facing the same problem, this could fixed by deleting the whole content of the obj-directory. --Gordon From owner-dev-commits-src-all@freebsd.org Thu Jan 7 07:50:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A41E84C5E4A; Thu, 7 Jan 2021 07:50:04 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "vtr.rulingia.com", Issuer "R3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DBJL34SDMz4f9x; Thu, 7 Jan 2021 07:50:03 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp239-208.static.internode.on.net [59.167.239.208]) by vtr.rulingia.com (8.15.2/8.15.2) with ESMTPS id 1077nqWR026260 (version=TLSv1.3 cipher=AEAD-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 7 Jan 2021 18:49:57 +1100 (AEDT) (envelope-from peter@rulingia.com) DKIM-Filter: OpenDKIM Filter v2.10.3 vtr.rulingia.com 1077nqWR026260 X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.16.1/8.16.1) with ESMTPS id 1077nlW7067117 (version=TLSv1.3 cipher=AEAD-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 7 Jan 2021 18:49:47 +1100 (AEDT) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.16.1/8.16.1/Submit) id 1077nlts067116; Thu, 7 Jan 2021 18:49:47 +1100 (AEDT) (envelope-from peter) Date: Thu, 7 Jan 2021 18:49:47 +1100 From: Peter Jeremy To: Kyle Evans Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: ac5f382a9d0a - main - stand: properly declare subdir deps or .WAIT, do parallel build Message-ID: References: <202012311717.0BVHHp4G092948@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ifS/kDSaI/DDY3Wf" Content-Disposition: inline In-Reply-To: <202012311717.0BVHHp4G092948@gitrepo.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp X-Rspamd-Queue-Id: 4DBJL34SDMz4f9x X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.10 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[rulingia.com:s=default]; FREEFALL_USER(0.00)[peter]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; R_SPF_ALLOW(-0.20)[+mx]; SPAMHAUS_ZRD(0.00)[2001:19f0:5801:ebe:5400:1ff:fe53:30fd:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[rulingia.com:+]; DMARC_POLICY_ALLOW(-0.50)[rulingia.com,quarantine]; NEURAL_SPAM_LONG(1.00)[1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:19f0:5801:ebe:5400:1ff:fe53:30fd:from]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5800::/38, country:US]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 07:50:04 -0000 --ifS/kDSaI/DDY3Wf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-Dec-31 17:17:51 +0000, Kyle Evans wrote: >The branch main has been updated by kevans: > >URL: https://cgit.FreeBSD.org/src/commit/?id=3Dac5f382a9d0a26685b92b49abb8= 45d3b30ea5f91 > >commit ac5f382a9d0a26685b92b49abb845d3b30ea5f91 >Author: Kyle Evans >AuthorDate: 2020-12-31 17:15:45 +0000 >Commit: Kyle Evans >CommitDate: 2020-12-31 17:15:45 +0000 This commit adds fdt as a hard dependency for efi but leaves fdt as optionally built based on WITH_FDT. As a result, adding WITHOUT_FDT=3Dyes causes the build to fail: make[3]: don't know how to make all_subdir_stand/fdt. Stop Either MK_FDT needs to be forced on by MK_EFI or the dependency needs to be made conditional. --=20 Peter Jeremy --ifS/kDSaI/DDY3Wf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAl/2vRZfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi CzR+jg/+Pgz66MN1yC8bh0h0zqI3xhQQLSUq2kJIIKKomYxzd3g07yHVBYFzkp4v ej7vz0m5HxrGLPw+lrIhT28BYVZ7qv7XYPviJpAHB/bemDd9pJk4qYexW95XmQZB w4C5YJ/+Mo4Vzf1VgV24IICZTkEGMrup4G8iJpm0JqoA5H7pIv8rloFIzsuicFvx KgjbvKfC2djIEmQZS0rgPqmL5AO6lr5aJZ6yIcio/IQJ5aaGxcEkHEvBlIxi5JxN cdW1I5NVTAj3q7ZvUNV6FVZ14lbbdQspjyrTI0XGdl4a3MK6uvr5j1zFaPAuMcc/ xzu3/PPBUYuR/M1j/O5KCjlnMKUtdesnImkrDwgH70A3FUX9Ac1C5Xno+w1IDEcD bJDVB/W0+14mVgcOA71fiwBSBIXn43sFFNda87tdfVHQsEy0VH5LZ7qqRZradMAR dklXXrBlQ+51q2Rdm7LY3S7kQT1vuj4HSb2w9xrFIsnNPA2O9aRtXjO19uithmv6 eCtHuWgWfBNFBTo1ZXPjbtyDh1mZKZmNMzpjLMayB0+fJlpqpg6DI+LaFPLwzGgO 4LZgW81EMRbX6C0sUIj72NW65j1IikuEMOUbCwTG8sQb/DyWS/0r5b/FVWSgCCPk wecDbi4Jb1mgMPzqZIsEWSuCYT9mXPPSKewe/n4U3yEZtclZ3KQ= =ECqp -----END PGP SIGNATURE----- --ifS/kDSaI/DDY3Wf-- From owner-dev-commits-src-all@freebsd.org Thu Jan 7 08:43:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CAA964C868A; Thu, 7 Jan 2021 08:43:57 +0000 (UTC) (envelope-from bapt@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 4DBKXF5Nhbz4jFT; Thu, 7 Jan 2021 08:43:57 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from ivaldir.etoilebsd.net (etoilebsd.net [178.32.217.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id 7FB5A2323B; Thu, 7 Jan 2021 08:43:57 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by ivaldir.etoilebsd.net (Postfix, from userid 1001) id 57525EBD24; Thu, 7 Jan 2021 09:43:25 +0100 (CET) Date: Thu, 7 Jan 2021 09:43:25 +0100 From: Baptiste Daroussin To: Gordon Bergling Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support Message-ID: <20210107084325.mbwynkmgadspbtlf@ivaldir.net> References: <202101051302.105D24lW041218@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="44yvuvcsowe3zlep" Content-Disposition: inline In-Reply-To: X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 08:43:57 -0000 --44yvuvcsowe3zlep Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 07, 2021 at 08:28:45AM +0100, Gordon Bergling wrote: > On Wed, Jan 06, 2021 at 04:29:32PM +0100, Gordon Bergling wrote: > > On Tue, Jan 05, 2021 at 01:02:04PM +0000, Baptiste Daroussin wrote: > > > The branch main has been updated by bapt: > > >=20 > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D821aa63a09402935da0a73= abf20ba0441562aa07 > > >=20 > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > > Author: Baptiste Daroussin > > > AuthorDate: 2021-01-04 16:29:40 +0000 > > > Commit: Baptiste Daroussin > > > CommitDate: 2021-01-05 13:01:32 +0000 > > >=20 > > > ncurses: only keep the version with widechar support > > > =20 > > > Only keep the widechar version of ncurses as libncursesw.so.9 > > > =20 > > > Keep the old name to avoid breaking the ABI compatibility (the non > > > widechar version libncurses.so.9 is not binary compatible with > > > libncursesw.so.9) since all ports and base are already only linki= ng > > > against the widechar version we can simply remove libncurses.so.9 > > > =20 > > > Since the .9 version only lived in the dev branch and never ended= in a > > > release, it is simply removed and not added to any binary compat > > > package. > > > =20 > > > Add symlinks to keep build time compatibility for anyone linking = against > > > -lncurses > > > --- > > > Makefile.inc1 | 5 +-- > > > Makefile.libcompat | 4 +- > > > ObsoleteFiles.inc | 2 + > > > lib/ncurses/Makefile | 6 +-- > > > lib/ncurses/config.mk | 11 +----- > > > lib/ncurses/form/Makefile | 18 ++++++--- > > > lib/ncurses/formw/Makefile | 5 --- > > > lib/ncurses/formw/Makefile.depend | 17 --------- > > > lib/ncurses/menu/Makefile | 18 ++++++--- > > > lib/ncurses/menuw/Makefile | 5 --- > > > lib/ncurses/menuw/Makefile.depend | 17 --------- > > > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++----------= ---------- > > > lib/ncurses/ncursesw/Makefile | 7 ---- > > > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > > > lib/ncurses/panel/Makefile | 23 ++++++++---- > > > lib/ncurses/panelw/Makefile | 5 --- > > > lib/ncurses/panelw/Makefile.depend | 17 --------- > > > share/mk/src.libnames.mk | 16 ++------ > > > tools/bsdbox/Makefile.base | 2 +- > > > tools/tools/ath/athratestats/Makefile | 2 +- > > > 20 files changed, 87 insertions(+), 180 deletions(-) > > [...] > >=20 > > This also breaks the build on arm64. I had NO_CLEAN=3Dyes applied, but = this error > > is generated after a 'make clean cleandepend'. The src.conf is the foll= owing, > >=20 > > WITH_MALLOC_PRODUCTION=3D1 > > WITH_EXTRA_TCP_STACKS=3D1 > > WITH_BEARSSL=3D1 > > WITH_PIE=3D1 > > WITH_RETPOLINE=3D1 > >=20 > > Is there anything else I can do? > >=20 > > -----------------------------------------------------------------------= -------- > > =3D=3D=3D> cddl/lib/libnvpair (obj,all,install) > > In file included from /tank/nfs_public/tiny/src/contrib/ncurses/ncurses= /widechar/lib_add_wch.c:37: > > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:2062:40= : error: a parameter list without types is only allowed > > in a function definition > > extern NCURSES_EXPORT(int) _nc_to_char(wint_t); > > ^ > > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:2063:23= : error: unknown type name 'wint_t' > > extern NCURSES_EXPORT(wint_t) _nc_to_widechar(int); > > ^ > > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:2322:61= : error: unknown type name 'mbstate_t'; did you mean '__ > > mbstate_t'? > > extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *= ); > > ^~~~~~~~~ > > __mbstate_t > > /tank/nfs_public/tiny/obj/tank/nfs_public/tiny/src/arm64.aarch64/tmp/us= r/include/sys/_types.h:124:3: note: '__mbstate_t' declar > > ed here > > } __mbstate_t; > > ^ > > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/widechar/lib_add_wch.= c:46:34: error: excess elements in struct initializer [- > > Werror,-Wexcess-initializers] > > static const cchar_t blankchar =3D NewChar(BLANK_TEXT); > > ^~~~~~~~~~~~~~~~~~~ > > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:1537:21= : note: expanded from macro 'NewChar' > > #define NewChar(ch) NewChar2(ChCharOf(ch), ChAttrOf(ch)) > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:1536:43= : note: expanded from macro 'NewChar2' > > #define NewChar2(c,a) { a, { c, NulChar } NulColor } > > ^~~~~~~~ > > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:1523:20= : note: expanded from macro 'NulColor' > > #define NulColor , 0 > > ^ > > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/widechar/lib_add_wch.= c:66:16: error: no member named 'ext_color' in 'cchar_t' > > int pair =3D GetPair(ch); > > ^~~~~~~~~~~ > > /tank/nfs_public/tiny/src/contrib/ncurses/ncurses/curses.priv.h:479:42:= note: expanded from macro 'GetPair' > > #define GetPair(value) GetPair2((value).ext_color, AttrOf(valu= e)) > > ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~= ~~~ > > -----------------------------------------------------------------------= -------- >=20 > If someone is facing the same problem, this could fixed by deleting the w= hole content of the obj-directory. >=20 > --Gordon Yes I was about to reply, I still don't get what file is left over that res= ults into this issue so I can add it to the make clean hackery we have :( Best regards, Bapt --44yvuvcsowe3zlep Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAl/2yagACgkQY4mL3PG3 PloTHxAAmT12zOq+Xjmo4R22tlR9PgbH3meoEr4TQj6sYS9/51PW/eOwyMUt8p9Y 9znN/A+hyqE3COpLB4JIcNS+niFGA5icaFqGmUmHTmadT4ME7qs6WujTQ9GplDrZ kAu3HoWZz/UTSEaPSNELKgIlwWz7HdhWYkB7nXqlq6+sNKCfVRNNk7pB75EU0Wb2 yO6pq5fe18sxZ5i6DZZaKLOAMXiwrEiidduqXkCooSjCs9Q60DExaEhHWcZtOpEW nLVuwd+suDRVXNUa6A4gra0QS893ZTd/PnQjKhSEiyOf7oLV8T6bwxLCAPF6cTUk aTylo7hGaivnb86LkYoEcdVZWBmMyuxc4XyMPol/1L4k4bM5p54IEe6+Q2hiyDSt DndyxFGAcNYUcZlJk4i+bI2SYaftoIikBOEWBfcx/y2aU2ZF1ptp7VisF9tWAfQq HfOfQxT4uU3nxAS6dulilatcOJMRAEV0a2dFJ12Of9aYmeqNT63fCxNMoqnEc9Vw tQwsLl2URxzKzZPAJCmXzL/aeoUf0E7MaGznJZcvMMtdAHqCsxj4qwpenvsDHJdd nyPuy7PuK54rkjfvQP9ybh+rhaVtJYA4HWKNc4/QsuinRzZZRjVlQ07bIYfi3bnn QcDUR2OQs4QjyQdIFItifpm/dT74qWw8LvqUMsgJ5KU0FlC75D0= =z7JR -----END PGP SIGNATURE----- --44yvuvcsowe3zlep-- From owner-dev-commits-src-all@freebsd.org Thu Jan 7 09:24:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B714B4C9C10; Thu, 7 Jan 2021 09:24:14 +0000 (UTC) (envelope-from git@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 4DBLQk4hsyz4m7j; Thu, 7 Jan 2021 09:24:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9027A66E7; Thu, 7 Jan 2021 09:24:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1079OEYL081850; Thu, 7 Jan 2021 09:24:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1079OE4g081849; Thu, 7 Jan 2021 09:24:14 GMT (envelope-from git) Date: Thu, 7 Jan 2021 09:24:14 GMT Message-Id: <202101070924.1079OE4g081849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 74bd20769706 - main - Reference newfs_msdos(8) from the newfs(8) manual MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 74bd20769706041108a573601cf0b61c755bdc56 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 09:24:14 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=74bd20769706041108a573601cf0b61c755bdc56 commit 74bd20769706041108a573601cf0b61c755bdc56 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-01-07 09:22:20 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-01-07 09:24:07 +0000 Reference newfs_msdos(8) from the newfs(8) manual PR: 252484 Reported by: Graham Perrin MFC after: 3 days --- sbin/newfs/newfs.8 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8 index 9565929664c5..0cc1d7ce12cf 100644 --- a/sbin/newfs/newfs.8 +++ b/sbin/newfs/newfs.8 @@ -28,7 +28,7 @@ .\" @(#)newfs.8 8.6 (Berkeley) 5/3/95 .\" $FreeBSD$ .\" -.Dd January 29, 2019 +.Dd January 7, 2021 .Dt NEWFS 8 .Os .Sh NAME @@ -320,6 +320,7 @@ on file systems that contain many small files. .Xr gvinum 8 , .Xr makefs 8 , .Xr mount 8 , +.Xr newfs_msdos 8 , .Xr tunefs 8 .Rs .%A M. McKusick From owner-dev-commits-src-all@freebsd.org Thu Jan 7 11:05:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1E0AF4CCE1B; Thu, 7 Jan 2021 11:05:56 +0000 (UTC) (envelope-from git@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 4DBNh36XGzz4tVK; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C89017ACE; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107B5t3X011344; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107B5tDM011343; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 11:05:55 GMT Message-Id: <202101071105.107B5tDM011343@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 7b0d3a3ccf8d - main - include: Use printf(1) instead of shell loops for header symlinks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7b0d3a3ccf8d2ea3b7c8338bdf4aa588222f6adc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 11:05:56 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7b0d3a3ccf8d2ea3b7c8338bdf4aa588222f6adc commit 7b0d3a3ccf8d2ea3b7c8338bdf4aa588222f6adc Author: Alex Richardson AuthorDate: 2021-01-06 17:46:36 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 09:26:22 +0000 include: Use printf(1) instead of shell loops for header symlinks Using a shell for loop means we have to spawn a separate install(1) process for each header that is symlinked. This patch uses printf(1) to generate an argument list that has been prefixed with the correct number of ../ and then uses a single install(1) invocation. This reduces the number of execve() calls during make includes from 2442 (with D27622) to 1382. Running `make symlinks` in include/ now spawns 214 processes instead of 1276 without this patch. Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D27723 --- include/Makefile | 149 +++++++++++++++++++------------------------------------ 1 file changed, 52 insertions(+), 97 deletions(-) diff --git a/include/Makefile b/include/Makefile index 1cdd8350bc7d..d374ce739cf4 100644 --- a/include/Makefile +++ b/include/Makefile @@ -320,124 +320,79 @@ copies: .PHONY .META symlinks: .PHONY .META @${ECHO} "Setting up symlinks to kernel source tree..." .for i in ${LDIRS} - cd ${SRCTOP}/sys/$i; \ - for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ - done + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i .endfor .for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec} - cd ${SRCTOP}/sys/$i; \ - for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ - done + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i .endfor - cd ${SRCTOP}/sys/dev/acpica; \ - for h in acpiio.h acpi_hpet.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/acpica/$$h \ - ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ - done - cd ${SRCTOP}/sys/dev/agp; \ - for h in agpreg.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/$$h \ - ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ - done - cd ${SRCTOP}/sys/dev/evdev; \ - for h in input.h input-event-codes.h uinput.h; do \ - ln -fs ../../../../sys/dev/evdev/$$h \ - ${SDESTDIR}${INCLUDEDIR}/dev/evdev; \ - done - cd ${SRCTOP}/sys/dev/hyperv/include; \ - for h in hyperv.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/$$h \ - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ - done - cd ${SRCTOP}/sys/dev/hyperv/utilities; \ - for h in hv_snapshot.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/$$h \ - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ - done - cd ${SRCTOP}/sys/dev/pci; \ - for h in pcireg.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/$$h \ - ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ - done - cd ${SRCTOP}/sys/dev/veriexec; \ - for h in veriexec_ioctl.h; do \ - ln -fs ../../../../sys/dev/veriexec/$$h \ - ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; \ - done + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \ + ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ + ${SDESTDIR}${INCLUDEDIR}/dev/evdev; + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; .for i in ${LSUBSUBDIRS} - cd ${SRCTOP}/sys/$i; \ - for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../../sys/$i/$$h ${SDESTDIR}${INCLUDEDIR}/$i; \ - done + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i .endfor .if ${MK_IPFILTER} != "no" - cd ${SRCTOP}/sys/contrib/ipfilter/netinet; \ - for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/contrib/ipfilter/netinet/$$h \ - ${SDESTDIR}${INCLUDEDIR}/netinet; \ - done + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/contrib/ipfilter/netinet/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/netinet; .endif .if ${MK_PF} != "no" - cd ${SRCTOP}/sys/netpfil/pf; \ - for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/netpfil/pf/$$h \ - ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; \ - done + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; .endif - cd ${SRCTOP}/sys/crypto; \ - for h in rijndael/rijndael.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/$$h \ - ${SDESTDIR}${INCLUDEDIR}/crypto; \ - done - cd ${SRCTOP}/sys/opencrypto; \ - for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/opencrypto/$$h \ - ${SDESTDIR}${INCLUDEDIR}/crypto; \ - done - cd ${SRCTOP}/sys/${MACHINE}/include; \ - for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/${MACHINE}/include/$$h \ - ${SDESTDIR}${INCLUDEDIR}/machine; \ - done + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ + ${SDESTDIR}${INCLUDEDIR}/crypto; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/opencrypto/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/crypto; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/machine; .if exists(${SRCTOP}/sys/${MACHINE}/include/pc) - cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ - for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/${MACHINE}/include/pc/$$h \ - ${SDESTDIR}${INCLUDEDIR}/machine/pc; \ - done + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/machine/pc; .endif .for _MARCH in ${_MARCHS} .if exists(${SRCTOP}/sys/${_MARCH}/include) ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ - cd ${SRCTOP}/sys/${_MARCH}/include; \ - for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/${_MARCH}/include/$$h \ - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ - done + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; .if exists(${SRCTOP}/sys/${_MARCH}/include/pc) ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ - cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ - for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/${_MARCH}/include/pc/$$h \ - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ - done + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; .endif .endif .endfor - cd ${SRCTOP}/sys/fs/cd9660; \ - for h in *.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/fs/cd9660/$$h \ - ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ - done - cd ${SRCTOP}/sys/rpc; \ - for h in rpcsec_tls.h types.h; do \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/rpc/$$h \ - ${SDESTDIR}${INCLUDEDIR}/rpc; \ - done + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \ + ${SDESTDIR}${INCLUDEDIR}/rpc; + cd ${SRCTOP}/sys/rpc; .if ${MK_CDDL} != "no" ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ ../../../sys/contrib/openenzfs/include/sys/nvpair.h \ From owner-dev-commits-src-all@freebsd.org Thu Jan 7 11:05:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8F4944CCDA0; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@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 4DBNh33jKKz4tQ0; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F9137EDE; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107B5tP0011255; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107B5tUX011254; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 11:05:55 GMT Message-Id: <202101071105.107B5tUX011254@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 7fa2f2a62f04 - main - Rename NO_WERROR -> MK_WERROR=no MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7fa2f2a62f04f095e1e27ad55aa22a8f59b1df8f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 11:05:55 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7fa2f2a62f04f095e1e27ad55aa22a8f59b1df8f commit 7fa2f2a62f04f095e1e27ad55aa22a8f59b1df8f Author: Alex Richardson AuthorDate: 2021-01-06 17:55:06 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 09:31:03 +0000 Rename NO_WERROR -> MK_WERROR=no As suggested in D27598. This also supports MK_WERROR.clang=no and MK_WERROR.gcc=no to support the existing NO_WERROR. uses. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D27601 --- Makefile | 2 +- Makefile.inc1 | 10 +++++----- Makefile.libcompat | 2 +- lib/googletest/tests/gmock/Makefile | 2 +- lib/googletest/tests/gmock_main/Makefile | 2 +- lib/googletest/tests/gtest/Makefile | 2 +- lib/googletest/tests/gtest_main/Makefile | 2 +- lib/libalias/libalias/Makefile | 2 +- lib/libc/tests/ssp/Makefile | 2 +- lib/libcompiler_rt/Makefile | 2 +- lib/libgcc_s/Makefile | 2 +- share/man/man5/style.Makefile.5 | 2 +- share/man/man7/build.7 | 2 +- share/mk/bsd.README | 2 +- share/mk/bsd.lib.mk | 4 +++- share/mk/bsd.opts.mk | 6 ++++-- share/mk/bsd.prog.mk | 4 +++- share/mk/bsd.progs.mk | 2 +- share/mk/bsd.sys.mk | 8 ++++---- targets/pseudo/bootstrap-tools/Makefile | 2 +- tools/build/options/WITHOUT_WERROR | 4 ++++ usr.bin/drill/Makefile | 2 +- usr.bin/kdump/Makefile | 2 -- usr.bin/truss/Makefile | 1 - usr.sbin/unbound/Makefile.inc | 2 +- 25 files changed, 40 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index 90549cadba08..1a1739acb0fe 100644 --- a/Makefile +++ b/Makefile @@ -459,7 +459,7 @@ MMAKE= ${MMAKEENV} ${MAKE} \ OBJROOT='$${OBJTOP}/' \ MAKEOBJDIRPREFIX= \ MAN= -DNO_SHARED \ - -DNO_CPU_CFLAGS -DNO_WERROR \ + -DNO_CPU_CFLAGS MK_WERROR=no \ -DNO_SUBDIR \ DESTDIR= PROGNAME=${MYMAKE:T} diff --git a/Makefile.inc1 b/Makefile.inc1 index 4bb8ef282f4a..c4e656c79ceb 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -731,7 +731,7 @@ BSARGS= DESTDIR= \ SSP_CFLAGS= \ MK_HTML=no NO_LINT=yes MK_MAN=no MK_MAN_UTILS=yes \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ - -DNO_CPU_CFLAGS -DNO_WERROR MK_CTF=no \ + -DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no \ MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no \ MK_INCLUDES=yes @@ -752,7 +752,7 @@ TMAKE= \ BWPHASE=${.TARGET:C,^_,,} \ SSP_CFLAGS= \ -DNO_LINT \ - -DNO_CPU_CFLAGS -DNO_WERROR MK_CTF=no \ + -DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no \ MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no @@ -780,7 +780,7 @@ KTMAKE= \ SSP_CFLAGS= \ MK_HTML=no -DNO_LINT MK_MAN=no \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ - -DNO_CPU_CFLAGS MK_RETPOLINE=no -DNO_WERROR MK_CTF=no + -DNO_CPU_CFLAGS MK_RETPOLINE=no MK_WERROR=no MK_CTF=no # world stage WMAKEENV= ${CROSSENV} \ @@ -2748,7 +2748,7 @@ NXBMAKEARGS+= \ MK_SENDMAIL=no \ MK_SVNLITE=no \ MK_TESTS=no \ - -DNO_WERROR \ + MK_WERROR=no \ MK_ZFS=no .if make(native-xtools*) && \ @@ -3367,7 +3367,7 @@ XDEV_CPUTYPE?=${TARGET_CPUTYPE} NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \ MK_MAN=no MK_NLS=no MK_PROFILE=no \ - MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no -DNO_WERROR \ + MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WERROR=no \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ CPUTYPE=${XDEV_CPUTYPE} diff --git a/Makefile.libcompat b/Makefile.libcompat index 8b5b31e99387..ec4402586558 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -104,7 +104,7 @@ build${libcompat}: .PHONY OBJROOT='$${OBJTOP}/' \ MAKEOBJDIRPREFIX= \ DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS \ - MK_CTF=no MK_RETPOLINE=no -DNO_WERROR \ + MK_CTF=no MK_RETPOLINE=no MK_WERROR=no \ ${_t} .endfor .endfor diff --git a/lib/googletest/tests/gmock/Makefile b/lib/googletest/tests/gmock/Makefile index 0e311abfe3e1..0f31e87018de 100644 --- a/lib/googletest/tests/gmock/Makefile +++ b/lib/googletest/tests/gmock/Makefile @@ -9,6 +9,6 @@ GTESTS+= gmock_stress_test LIBADD+= pthread gtest gmock # The next release will resolve a number of build warnings issues. -NO_WERROR= +MK_WERROR= no .include diff --git a/lib/googletest/tests/gmock_main/Makefile b/lib/googletest/tests/gmock_main/Makefile index 444c9ae3cb5d..a44d893b96f0 100644 --- a/lib/googletest/tests/gmock_main/Makefile +++ b/lib/googletest/tests/gmock_main/Makefile @@ -32,6 +32,6 @@ SRCS.gmock_link_test= \ LIBADD= gmock_main gmock gtest # The next release will resolve a number of build warnings issues. -NO_WERROR= +MK_WERROR= no .include diff --git a/lib/googletest/tests/gtest/Makefile b/lib/googletest/tests/gtest/Makefile index 9ab69ede2d6e..07b43884dedd 100644 --- a/lib/googletest/tests/gtest/Makefile +++ b/lib/googletest/tests/gtest/Makefile @@ -41,6 +41,6 @@ LIBADD+= gtest LIBADD.gtest_stress_test+= pthread # The next release will resolve a number of build warnings issues. -NO_WERROR= +MK_WERROR= no .include diff --git a/lib/googletest/tests/gtest_main/Makefile b/lib/googletest/tests/gtest_main/Makefile index 8d2e9e68d5e1..0d4175735b1c 100644 --- a/lib/googletest/tests/gtest_main/Makefile +++ b/lib/googletest/tests/gtest_main/Makefile @@ -39,6 +39,6 @@ LIBADD.googletest-port-test+= pthread LIBADD.gtest_unittest+= pthread # The next release will resolve a number of build warnings issues. -NO_WERROR= +MK_WERROR= no .include diff --git a/lib/libalias/libalias/Makefile b/lib/libalias/libalias/Makefile index eba0e3098017..17d4c2458abf 100644 --- a/lib/libalias/libalias/Makefile +++ b/lib/libalias/libalias/Makefile @@ -10,6 +10,6 @@ SHLIB_MAJOR= 7 MAN= libalias.3 SRCS= alias.c alias_db.c alias_proxy.c alias_util.c alias_mod.c INCS= alias.h -NO_WERROR= +MK_WERROR= no .include diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile index c6b625a91d7b..655130ab309d 100644 --- a/lib/libc/tests/ssp/Makefile +++ b/lib/libc/tests/ssp/Makefile @@ -2,7 +2,7 @@ .include -NO_WERROR= +MK_WERROR= no WARNS?= 2 CFLAGS.h_raw+= -fstack-protector-all -Wstack-protector diff --git a/lib/libcompiler_rt/Makefile b/lib/libcompiler_rt/Makefile index 0f42dd516c51..a2325221d0b1 100644 --- a/lib/libcompiler_rt/Makefile +++ b/lib/libcompiler_rt/Makefile @@ -15,7 +15,7 @@ CFLAGS+= -I${SRCTOP}/contrib/libcxxrt # gcc has incompatible internal declarations for __divtc3 and __multc3, but has # no option to silence its warning, so make warnings non-fatal. -NO_WERROR.gcc= +MK_WERROR.gcc= no .include "Makefile.inc" diff --git a/lib/libgcc_s/Makefile b/lib/libgcc_s/Makefile index f245069aee40..84477ee00818 100644 --- a/lib/libgcc_s/Makefile +++ b/lib/libgcc_s/Makefile @@ -26,7 +26,7 @@ SYMBOL_MAPS+= ${.CURDIR}/SymbolDefault.map # gcc has incompatible internal declarations for __divtc3 and __multc3, but has # no option to silence its warning, so make warnings non-fatal. -NO_WERROR.gcc= +MK_WERROR.gcc= no LIBCSRCDIR= ${SRCTOP}/lib/libc LIBMSRCDIR= ${SRCTOP}/lib/msun/src diff --git a/share/man/man5/style.Makefile.5 b/share/man/man5/style.Makefile.5 index 6bd1b7738c98..67991869ff57 100644 --- a/share/man/man5/style.Makefile.5 +++ b/share/man/man5/style.Makefile.5 @@ -156,7 +156,7 @@ is spelled so that it may be overridden on the command line or in .Xr make.conf 5 . .It -.Dq Li "NO_WERROR= yes" +.Dq Li "MK_WERROR=no" should not be used, it defeats the purpose of .Va WARNS . diff --git a/share/man/man7/build.7 b/share/man/man7/build.7 index aa45d846fd87..72a1dc3078d1 100644 --- a/share/man/man7/build.7 +++ b/share/man/man7/build.7 @@ -492,7 +492,7 @@ and not via or .Pa /etc/src.conf or the command line. -.It Va NO_WERROR +.It Va WITHOUT_WERROR If defined, compiler warnings will not cause the build to halt, even if the makefile says otherwise. .It Va WITH_CTF diff --git a/share/mk/bsd.README b/share/mk/bsd.README index e50772151d06..9eb91c1bce3c 100644 --- a/share/mk/bsd.README +++ b/share/mk/bsd.README @@ -417,7 +417,7 @@ PROGS_CXX PROG and PROG_CXX in one Makefile. To define - LINKS - MAN - MLINKS - - NO_WERROR + - MK_WERROR=no - PROGNAME - SRCS - STRIP diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 3d429a6b5b8a..9a31c72255f7 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -47,7 +47,9 @@ CFLAGS+= ${CRUNCH_CFLAGS} .if ${MK_ASSERT_DEBUG} == "no" CFLAGS+= -DNDEBUG -NO_WERROR= +# XXX: shouldn't we ensure that !asserts marks potentially unused variables as +# __unused instead of disabling -Werror globally? +MK_WERROR= no .endif .if defined(DEBUG_FLAGS) diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index d0e7f1cb00ba..88c73cc6bfe4 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -65,7 +65,8 @@ __DEFAULT_YES_OPTIONS = \ SSP \ TESTS \ TOOLCHAIN \ - WARNS + WARNS \ + WERROR __DEFAULT_NO_OPTIONS = \ BIND_NOW \ @@ -103,7 +104,8 @@ __DEFAULT_DEPENDENT_OPTIONS = \ INSTALLLIB \ MAN \ PROFILE \ - WARNS + WARNS \ + WERROR .if defined(NO_${var}) .error "NO_${var} is defined, but deprecated. Please use MK_${var}=no instead." MK_${var}:=no diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 401915b3f525..5e7aaaeb37f8 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -15,7 +15,9 @@ CFLAGS+=${COPTS} .if ${MK_ASSERT_DEBUG} == "no" CFLAGS+= -DNDEBUG -NO_WERROR= +# XXX: shouldn't we ensure that !asserts marks potentially unused variables as +# __unused instead of disabling -Werror globally? +MK_WERROR= no .endif .if defined(DEBUG_FLAGS) diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk index d56626805a44..54266a335177 100644 --- a/share/mk/bsd.progs.mk +++ b/share/mk/bsd.progs.mk @@ -23,7 +23,7 @@ PROGS += ${PROGS_CXX} .if defined(PROG) # just one of many PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE CSTD CXXSTD DPSRCS MAN \ - NO_SHARED NO_WERROR PROGNAME SRCS STRIP WARNS + NO_SHARED MK_WERROR PROGNAME SRCS STRIP WARNS PROG_VARS += CFLAGS CXXFLAGS DEBUG_FLAGS DPADD INTERNALPROG LDADD LIBADD \ LINKS LDFLAGS MLINKS ${PROG_OVERRIDE_VARS} .for v in ${PROG_VARS:O:u} diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 0d6fcf05f683..497283fc95da 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -41,9 +41,9 @@ WARNS= ${DEFAULTWARNS} .if defined(WARNS) .if ${WARNS} >= 1 CWARNFLAGS+= -Wsystem-headers -.if !defined(NO_WERROR) && !defined(NO_WERROR.${COMPILER_TYPE}) +.if ${MK_WERROR} != "no" && ${MK_WERROR.${COMPILER_TYPE}:Uyes} != "no" CWARNFLAGS+= -Werror -.endif # !NO_WERROR && !NO_WERROR.${COMPILER_TYPE} +.endif # ${MK_WERROR} != "no" && ${MK_WERROR.${COMPILER_TYPE}:Uyes} != "no" .endif # WARNS >= 1 .if ${WARNS} >= 2 CWARNFLAGS+= -Wall -Wno-format-y2k @@ -120,9 +120,9 @@ CWARNFLAGS+= -Wformat=2 -Wno-format-extra-args .if ${WARNS} <= 3 CWARNFLAGS.clang+= -Wno-format-nonliteral .endif # WARNS <= 3 -.if !defined(NO_WERROR) && !defined(NO_WERROR.${COMPILER_TYPE}) +.if ${MK_WERROR} != "no" && ${MK_WERROR.${COMPILER_TYPE}:Uyes} != "no" CWARNFLAGS+= -Werror -.endif # !NO_WERROR && !NO_WERROR.${COMPILER_TYPE} +.endif # ${MK_WERROR} != "no" && ${MK_WERROR.${COMPILER_TYPE}:Uyes} != "no" .endif # WFORMAT > 0 .endif # WFORMAT .if defined(NO_WFORMAT) || defined(NO_WFORMAT.${COMPILER_TYPE}) diff --git a/targets/pseudo/bootstrap-tools/Makefile b/targets/pseudo/bootstrap-tools/Makefile index d370538c361d..0023f763af83 100644 --- a/targets/pseudo/bootstrap-tools/Makefile +++ b/targets/pseudo/bootstrap-tools/Makefile @@ -42,7 +42,7 @@ BSARGS= DESTDIR= \ SSP_CFLAGS= \ MK_HTML=no NO_LINT=yes MK_MAN=no \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ - -DNO_CPU_CFLAGS -DNO_WERROR MK_CTF=no \ + -DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no \ MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_TESTS=no \ MK_INCLUDES=yes diff --git a/tools/build/options/WITHOUT_WERROR b/tools/build/options/WITHOUT_WERROR new file mode 100644 index 000000000000..84a4c6b06967 --- /dev/null +++ b/tools/build/options/WITHOUT_WERROR @@ -0,0 +1,4 @@ +.\" $FreeBSD$ +Set this to not treat compiler warnings as errors. +Useful as a temporary workaround when working on fixing compiler warnings. +When set, warnings are still printed in the build log but do not fail the build. diff --git a/usr.bin/drill/Makefile b/usr.bin/drill/Makefile index 8cf0e682e36f..096699c7602f 100644 --- a/usr.bin/drill/Makefile +++ b/usr.bin/drill/Makefile @@ -9,7 +9,7 @@ PROG= drill SRCS= drill.c drill_util.c error.c root.c work.c \ chasetrace.c dnssec.c securetrace.c CFLAGS+= -I${LDNSDIR} -NO_WERROR= true +MK_WERROR= no MAN= drill.1 LIBADD= ldns crypto diff --git a/usr.bin/kdump/Makefile b/usr.bin/kdump/Makefile index e1b9d4fd68a2..e826ac2d6dbf 100644 --- a/usr.bin/kdump/Makefile +++ b/usr.bin/kdump/Makefile @@ -17,6 +17,4 @@ LIBADD+= cap_pwd CFLAGS+=-DWITH_CASPER .endif -#NO_WERROR?= YES - .include diff --git a/usr.bin/truss/Makefile b/usr.bin/truss/Makefile index b29befdf9c37..e6b83a5591fe 100644 --- a/usr.bin/truss/Makefile +++ b/usr.bin/truss/Makefile @@ -1,6 +1,5 @@ # $FreeBSD$ -#NO_WERROR= PROG= truss SRCS= main.c setup.c syscalls.c diff --git a/usr.sbin/unbound/Makefile.inc b/usr.sbin/unbound/Makefile.inc index cdb1faf5a14f..7cdeaa592d2a 100644 --- a/usr.sbin/unbound/Makefile.inc +++ b/usr.sbin/unbound/Makefile.inc @@ -1,6 +1,6 @@ # $FreeBSD$ -NO_WERROR= true +MK_WERROR= no NO_WTHREAD_SAFETY= true PACKAGE= unbound From owner-dev-commits-src-all@freebsd.org Thu Jan 7 11:05:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7DE5C4CCC3E; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@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 4DBNh339wcz4tcX; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B98C7EDD; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107B5t0Q011238; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107B5tp1011237; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 11:05:55 GMT Message-Id: <202101071105.107B5tp1011237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: d037edf82071 - main - tools/build/make.py: Fix macOS build after a920b9817 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d037edf82071d8efb5a58d8d1a923cdfea2e0a7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 11:05:55 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d037edf82071d8efb5a58d8d1a923cdfea2e0a7c commit d037edf82071d8efb5a58d8d1a923cdfea2e0a7c Author: Alex Richardson AuthorDate: 2020-12-22 16:14:32 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 10:55:21 +0000 tools/build/make.py: Fix macOS build after a920b9817 If we set STRIPBIN, we also have to set XSTRIPBIN since we otherwise use the host /usr/bin/strip during buildworld. However, this does not work on macOS since /usr/bin/strip doesn't handle ELF binaries. --- tools/build/make.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/tools/build/make.py b/tools/build/make.py index d06686f8be63..146d4a7b6d47 100755 --- a/tools/build/make.py +++ b/tools/build/make.py @@ -207,8 +207,8 @@ if __name__ == "__main__": parsed_args.host_bindir) # Using the default value for LD is fine (but not for XLD!) - use_cross_gcc = parsed_args.cross_compiler_type == "gcc" # On non-FreeBSD we need to explicitly pass XCC/XLD/X_COMPILER_TYPE + use_cross_gcc = parsed_args.cross_compiler_type == "gcc" check_required_make_env_var("XCC", "gcc" if use_cross_gcc else "clang", parsed_args.cross_bindir) check_required_make_env_var("XCXX", @@ -219,9 +219,26 @@ if __name__ == "__main__": parsed_args.cross_bindir) check_required_make_env_var("XLD", "ld" if use_cross_gcc else "ld.lld", parsed_args.cross_bindir) - check_required_make_env_var("STRIPBIN", - "strip" if use_cross_gcc else "llvm-strip", - parsed_args.cross_bindir) + + # We also need to set STRIPBIN if there is no working strip binary + # in $PATH. + if not shutil.which("strip"): + if sys.platform.startswith("darwin"): + # On macOS systems we have to use /usr/bin/strip. + sys.exit("Cannot find required tool 'strip'. Please install the" + " host compiler and command line tools.") + if parsed_args.host_compiler_type == "clang": + strip_binary = "llvm-strip" + else: + strip_binary = "strip" + check_required_make_env_var("STRIPBIN", strip_binary, + parsed_args.cross_bindir) + if os.getenv("STRIPBIN") or "STRIPBIN" in new_env_vars: + # If we are setting STRIPBIN, we have to set XSTRIPBIN to the + # default if it is not set otherwise already. + if not os.getenv("XSTRIPBIN") and not is_make_var_set("XSTRIPBIN"): + # Use the bootstrapped elftoolchain strip: + new_env_vars["XSTRIPBIN"] = "strip" bmake_binary = bootstrap_bmake(source_root, objdir_prefix) # at -j1 cleandir+obj is unbearably slow. AUTO_OBJ helps a lot From owner-dev-commits-src-all@freebsd.org Thu Jan 7 11:05:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6B6C04CCB66; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@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 4DBNh32YJBz4tX0; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AB027EDC; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107B5t0r011221; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107B5tvT011220; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 11:05:55 GMT Message-Id: <202101071105.107B5tvT011220@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: b500c184b656 - main - Drop some unncessary stale code from Makefile.boot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b500c184b6569ff2443bd9d0e3697fafdb2e47ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 11:05:55 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=b500c184b6569ff2443bd9d0e3697fafdb2e47ac commit b500c184b6569ff2443bd9d0e3697fafdb2e47ac Author: Alex Richardson AuthorDate: 2020-12-16 16:57:09 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 10:55:21 +0000 Drop some unncessary stale code from Makefile.boot No longer required after 0e1e341b486cdf4769195ba1e5b3cb32e7387873. --- tools/build/mk/Makefile.boot | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tools/build/mk/Makefile.boot b/tools/build/mk/Makefile.boot index 4adc04b0ea9a..38df8135e53b 100644 --- a/tools/build/mk/Makefile.boot +++ b/tools/build/mk/Makefile.boot @@ -14,15 +14,6 @@ AR:= /usr/bin/ar RANLIB:= /usr/bin/ranlib NM:= /usr/bin/nm -# Don't use lorder and tsort since lorder is not installed by default on most -# Linux systems and the FreeBSD lorder does not work on Linux. For the bootstrap -# tools the order of the .o files should not matter since we only care about -# a few individual files (and might soon require linking with lld anyway) -LORDER:=echo -TSORT:=cat -# When using cat as tsort we can't pass -q: -TSORTFLAGS:= - # Avoid stale dependecy warnings: LIBC:= LIBZ:= From owner-dev-commits-src-all@freebsd.org Thu Jan 7 11:05:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 76FCE4CCCCE; Thu, 7 Jan 2021 11:05:56 +0000 (UTC) (envelope-from git@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 4DBNh415R7z4tMP; Thu, 7 Jan 2021 11:05:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 154427F04; Thu, 7 Jan 2021 11:05:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107B5tlv011378; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107B5ttc011377; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 11:05:55 GMT Message-Id: <202101071105.107B5ttc011377@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: fe41c64b5772 - main - Fix -Wpointer-sign warnings in makefs and mkimg MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fe41c64b577251fd1df89aa6c722a877b88b402b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 11:05:56 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=fe41c64b577251fd1df89aa6c722a877b88b402b commit fe41c64b577251fd1df89aa6c722a877b88b402b Author: Alex Richardson AuthorDate: 2021-01-06 17:05:29 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 09:26:21 +0000 Fix -Wpointer-sign warnings in makefs and mkimg Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D27175 --- usr.bin/mkimg/mkimg.c | 2 +- usr.sbin/makefs/cd9660.h | 8 +- usr.sbin/makefs/cd9660/cd9660_debug.c | 137 +++++++++++++--------------------- usr.sbin/makefs/cd9660/cd9660_write.c | 2 +- usr.sbin/makefs/ffs/ffs_subr.c | 2 +- usr.sbin/makefs/ffs/mkfs.c | 3 +- usr.sbin/makefs/makefs.h | 2 +- 7 files changed, 62 insertions(+), 94 deletions(-) diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c index c5a85aa7c33d..d870f3a8f0c3 100644 --- a/usr.bin/mkimg/mkimg.c +++ b/usr.bin/mkimg/mkimg.c @@ -438,7 +438,7 @@ mkimg(void) FILE *fp; struct part *part; lba_t block, blkoffset; - off_t bytesize, byteoffset; + uint64_t bytesize, byteoffset; char *size, *offset; bool abs_offset; int error, fd; diff --git a/usr.sbin/makefs/cd9660.h b/usr.sbin/makefs/cd9660.h index 05f42c97231e..5f6525d3e94f 100644 --- a/usr.sbin/makefs/cd9660.h +++ b/usr.sbin/makefs/cd9660.h @@ -221,7 +221,7 @@ typedef struct _path_table_entry u_char extended_attribute_length[ISODCL (2, 2)]; u_char first_sector[ISODCL (3, 6)]; u_char parent_number[ISODCL (7, 8)]; - u_char name[ISO_FILENAME_MAXLENGTH_WITH_PADDING]; + char name[ISO_FILENAME_MAXLENGTH_WITH_PADDING]; } path_table_entry; typedef struct _volume_descriptor @@ -347,9 +347,9 @@ void debug_print_volume_descriptor_information(iso9660_disk *); void debug_dump_to_xml_ptentry(path_table_entry *,int, int); void debug_dump_to_xml_path_table(FILE *, off_t, int, int); void debug_dump_to_xml(FILE *); -int debug_get_encoded_number(unsigned char *, int); -void debug_dump_integer(const char *, char *,int); -void debug_dump_string(const char *,unsigned char *,int); +int debug_get_encoded_number(const unsigned char *, int); +void debug_dump_integer(const char *, const unsigned char *, int); +void debug_dump_string(const char *, const unsigned char *, int); void debug_dump_directory_record_9_1(unsigned char *); void debug_dump_to_xml_volume_descriptor(unsigned char *,int); diff --git a/usr.sbin/makefs/cd9660/cd9660_debug.c b/usr.sbin/makefs/cd9660/cd9660_debug.c index bcf58a35fa37..b1e07fb85f0f 100644 --- a/usr.sbin/makefs/cd9660/cd9660_debug.c +++ b/usr.sbin/makefs/cd9660/cd9660_debug.c @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); #include "iso9660_rrip.h" static void debug_print_susp_attrs(cd9660node *, int); -static void debug_dump_to_xml_padded_hex_output(const char *, unsigned char *, +static void debug_dump_to_xml_padded_hex_output(const char *, const char *, int); static inline void @@ -265,8 +265,8 @@ debug_dump_to_xml(FILE *fd) } static void -debug_dump_to_xml_padded_hex_output(const char *element, unsigned char *buf, - int len) +debug_dump_to_xml_padded_hex_output(const char *element, const char *buf, + int len) { int i; int t; @@ -288,7 +288,7 @@ debug_dump_to_xml_padded_hex_output(const char *element, unsigned char *buf, } int -debug_get_encoded_number(unsigned char* buf, int mode) +debug_get_encoded_number(const unsigned char* buf, int mode) { #if !HAVE_NBTOOL_CONFIG_H switch (mode) { @@ -298,7 +298,7 @@ debug_get_encoded_number(unsigned char* buf, int mode) /* 712: Single signed byte */ case 712: - return isonum_712((signed char *)buf); + return isonum_712(buf); /* 721: 16 bit LE */ case 721: @@ -329,14 +329,14 @@ debug_get_encoded_number(unsigned char* buf, int mode) } void -debug_dump_integer(const char *element, char* buf, int mode) +debug_dump_integer(const char *element, const unsigned char* buf, int mode) { - printf("<%s>%i\n", element, - debug_get_encoded_number((unsigned char *)buf, mode), element); + printf("<%s>%i\n", element, debug_get_encoded_number(buf, mode), + element); } void -debug_dump_string(const char *element __unused, unsigned char *buf __unused, int len __unused) +debug_dump_string(const char *element __unused, const unsigned char *buf __unused, int len __unused) { } @@ -344,30 +344,20 @@ debug_dump_string(const char *element __unused, unsigned char *buf __unused, int void debug_dump_directory_record_9_1(unsigned char* buf) { + struct iso_directory_record *rec = (struct iso_directory_record *)buf; printf("\n"); - debug_dump_integer("length", - ((struct iso_directory_record*) buf)->length, 711); - debug_dump_integer("ext_attr_length", - ((struct iso_directory_record*) buf)->ext_attr_length,711); - debug_dump_integer("extent", - (char *)((struct iso_directory_record*) buf)->extent, 733); - debug_dump_integer("size", - (char *)((struct iso_directory_record*) buf)->size, 733); - debug_dump_integer("flags", - ((struct iso_directory_record*) buf)->flags, 711); - debug_dump_integer("file_unit_size", - ((struct iso_directory_record*) buf)->file_unit_size,711); - debug_dump_integer("interleave", - ((struct iso_directory_record*) buf)->interleave, 711); + debug_dump_integer("length", rec->length, 711); + debug_dump_integer("ext_attr_length", rec->ext_attr_length, 711); + debug_dump_integer("extent", rec->extent, 733); + debug_dump_integer("size", rec->size, 733); + debug_dump_integer("flags", rec->flags, 711); + debug_dump_integer("file_unit_size", rec->file_unit_size, 711); + debug_dump_integer("interleave", rec->interleave, 711); debug_dump_integer("volume_sequence_number", - ((struct iso_directory_record*) buf)->volume_sequence_number, - 723); - debug_dump_integer("name_len", - ((struct iso_directory_record*) buf)->name_len, 711); - debug_dump_to_xml_padded_hex_output("name", - (u_char *)((struct iso_directory_record*) buf)->name, - debug_get_encoded_number((u_char *) - ((struct iso_directory_record*) buf)->length, 711)); + rec->volume_sequence_number, 723); + debug_dump_integer("name_len", rec->name_len, 711); + debug_dump_to_xml_padded_hex_output("name", rec->name, + debug_get_encoded_number(rec->length, 711)); printf("\n"); } @@ -375,6 +365,9 @@ debug_dump_directory_record_9_1(unsigned char* buf) void debug_dump_to_xml_volume_descriptor(unsigned char* buf, int sector) { + struct iso_primary_descriptor *desc = + (struct iso_primary_descriptor *)buf; + printf("\n", sector); printf(""); switch(buf[0]) { @@ -402,86 +395,60 @@ debug_dump_to_xml_volume_descriptor(unsigned char* buf, int sector) printf("\n"); switch(buf[0]) { case 1: - debug_dump_integer("type", - ((struct iso_primary_descriptor*)buf)->type, 711); - debug_dump_to_xml_padded_hex_output("id", - (u_char *)((struct iso_primary_descriptor*) buf)->id, - ISODCL ( 2, 6)); - debug_dump_integer("version", - ((struct iso_primary_descriptor*)buf)->version, - 711); + debug_dump_integer("type", desc->type, 711); + debug_dump_to_xml_padded_hex_output("id", desc->id, + ISODCL(2, 6)); + debug_dump_integer("version", (u_char *)desc->version, 711); debug_dump_to_xml_padded_hex_output("system_id", - (u_char *)((struct iso_primary_descriptor*)buf)->system_id, - ISODCL(9,40)); + desc->system_id, ISODCL(9, 40)); debug_dump_to_xml_padded_hex_output("volume_id", - (u_char *)((struct iso_primary_descriptor*)buf)->volume_id, - ISODCL(41,72)); + desc->volume_id, ISODCL(41, 72)); debug_dump_integer("volume_space_size", - ((struct iso_primary_descriptor*)buf)->volume_space_size, - 733); + (u_char *)desc->volume_space_size, 733); debug_dump_integer("volume_set_size", - ((struct iso_primary_descriptor*)buf)->volume_set_size, - 733); + (u_char *)desc->volume_set_size, 733); debug_dump_integer("volume_sequence_number", - ((struct iso_primary_descriptor*)buf)->volume_sequence_number, - 723); + (u_char *)desc->volume_sequence_number, 723); debug_dump_integer("logical_block_size", - ((struct iso_primary_descriptor*)buf)->logical_block_size, - 723); + (u_char *)desc->logical_block_size, 723); debug_dump_integer("path_table_size", - ((struct iso_primary_descriptor*)buf)->path_table_size, - 733); + (u_char *)desc->path_table_size, 733); debug_dump_integer("type_l_path_table", - ((struct iso_primary_descriptor*)buf)->type_l_path_table, - 731); + (u_char *)desc->type_l_path_table, 731); debug_dump_integer("opt_type_l_path_table", - ((struct iso_primary_descriptor*)buf)->opt_type_l_path_table, - 731); + (u_char *)desc->opt_type_l_path_table, 731); debug_dump_integer("type_m_path_table", - ((struct iso_primary_descriptor*)buf)->type_m_path_table, - 732); + (u_char *)desc->type_m_path_table, 732); debug_dump_integer("opt_type_m_path_table", - ((struct iso_primary_descriptor*)buf)->opt_type_m_path_table,732); + (u_char *)desc->opt_type_m_path_table, 732); debug_dump_directory_record_9_1( - (u_char *)((struct iso_primary_descriptor*)buf)->root_directory_record); + (u_char *)desc->root_directory_record); debug_dump_to_xml_padded_hex_output("volume_set_id", - (u_char *)((struct iso_primary_descriptor*) buf)->volume_set_id, - ISODCL (191, 318)); + desc->volume_set_id, ISODCL(191, 318)); debug_dump_to_xml_padded_hex_output("publisher_id", - (u_char *)((struct iso_primary_descriptor*) buf)->publisher_id, - ISODCL (319, 446)); + desc->publisher_id, ISODCL(319, 446)); debug_dump_to_xml_padded_hex_output("preparer_id", - (u_char *)((struct iso_primary_descriptor*) buf)->preparer_id, - ISODCL (447, 574)); + desc->preparer_id, ISODCL(447, 574)); debug_dump_to_xml_padded_hex_output("application_id", - (u_char *)((struct iso_primary_descriptor*) buf)->application_id, - ISODCL (575, 702)); + desc->application_id, ISODCL(575, 702)); debug_dump_to_xml_padded_hex_output("copyright_file_id", - (u_char *)((struct iso_primary_descriptor*) buf)->copyright_file_id, - ISODCL (703, 739)); + desc->copyright_file_id, ISODCL(703, 739)); debug_dump_to_xml_padded_hex_output("abstract_file_id", - (u_char *)((struct iso_primary_descriptor*) buf)->abstract_file_id, - ISODCL (740, 776)); + desc->abstract_file_id, ISODCL(740, 776)); debug_dump_to_xml_padded_hex_output("bibliographic_file_id", - (u_char *)((struct iso_primary_descriptor*) buf)->bibliographic_file_id, - ISODCL (777, 813)); + desc->bibliographic_file_id, ISODCL(777, 813)); debug_dump_to_xml_padded_hex_output("creation_date", - (u_char *)((struct iso_primary_descriptor*) buf)->creation_date, - ISODCL (814, 830)); + desc->creation_date, ISODCL(814, 830)); debug_dump_to_xml_padded_hex_output("modification_date", - (u_char *)((struct iso_primary_descriptor*) buf)->modification_date, - ISODCL (831, 847)); + desc->modification_date, ISODCL(831, 847)); debug_dump_to_xml_padded_hex_output("expiration_date", - (u_char *)((struct iso_primary_descriptor*) buf)->expiration_date, - ISODCL (848, 864)); + desc->expiration_date, ISODCL(848, 864)); debug_dump_to_xml_padded_hex_output("effective_date", - (u_char *)((struct iso_primary_descriptor*) buf)->effective_date, - ISODCL (865, 881)); + desc->effective_date, ISODCL(865, 881)); debug_dump_to_xml_padded_hex_output("file_structure_version", - (u_char *)((struct iso_primary_descriptor*) buf)->file_structure_version, - ISODCL(882,882)); + desc->file_structure_version, ISODCL(882, 882)); break; } printf("\n"); diff --git a/usr.sbin/makefs/cd9660/cd9660_write.c b/usr.sbin/makefs/cd9660/cd9660_write.c index 8d4df08275db..3d50fcd6b232 100644 --- a/usr.sbin/makefs/cd9660/cd9660_write.c +++ b/usr.sbin/makefs/cd9660/cd9660_write.c @@ -64,7 +64,7 @@ cd9660_write_image(iso9660_disk *diskStructure, const char* image) { FILE *fd; int status; - char buf[CD9660_SECTOR_SIZE]; + unsigned char buf[CD9660_SECTOR_SIZE]; if ((fd = fopen(image, "w+")) == NULL) { err(EXIT_FAILURE, "%s: Can't open `%s' for writing", __func__, diff --git a/usr.sbin/makefs/ffs/ffs_subr.c b/usr.sbin/makefs/ffs/ffs_subr.c index 97b4dcb05dc1..53e5b97ada48 100644 --- a/usr.sbin/makefs/ffs/ffs_subr.c +++ b/usr.sbin/makefs/ffs/ffs_subr.c @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); * of some frags. */ void -ffs_fragacct_swap(struct fs *fs, int fragmap, int32_t fraglist[], int cnt, int needswap) +ffs_fragacct_swap(struct fs *fs, int fragmap, uint32_t fraglist[], int cnt, int needswap) { int inblk; int field, subfield; diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c index e885d23613bb..ff3c1d594b4e 100644 --- a/usr.sbin/makefs/ffs/mkfs.c +++ b/usr.sbin/makefs/ffs/mkfs.c @@ -143,7 +143,8 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) bbsize = BBSIZE; sbsize = SBLOCKSIZE; - strlcpy(sblock.fs_volname, ffs_opts->label, sizeof(sblock.fs_volname)); + strlcpy((char *)sblock.fs_volname, ffs_opts->label, + sizeof(sblock.fs_volname)); if (Oflag == 0) { sblock.fs_old_inodefmt = FS_42INODEFMT; diff --git a/usr.sbin/makefs/makefs.h b/usr.sbin/makefs/makefs.h index 25f41731fe57..68dc0362dd21 100644 --- a/usr.sbin/makefs/makefs.h +++ b/usr.sbin/makefs/makefs.h @@ -299,7 +299,7 @@ extern struct stat stampst; ((int32_t *)((uintptr_t)(cgp) + ufs_rw32((cgp)->cg_clustersumoff, ns))) struct fs; -void ffs_fragacct_swap(struct fs *, int, int32_t [], int, int); +void ffs_fragacct_swap(struct fs *, int, uint32_t [], int, int); fsinode *link_check(fsinode *); From owner-dev-commits-src-all@freebsd.org Thu Jan 7 11:05:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A0FFC4CCC3F; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@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 4DBNh348smz4tQ1; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8193B7EDF; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107B5t5B011272; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107B5tZM011271; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 11:05:55 GMT Message-Id: <202101071105.107B5tZM011271@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 94ffff68c8e8 - main - Stop passing MK_WARNS=no for bootstrap tools MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 94ffff68c8e84d4983e3d803575cfdb3e5782515 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 11:05:55 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=94ffff68c8e84d4983e3d803575cfdb3e5782515 commit 94ffff68c8e84d4983e3d803575cfdb3e5782515 Author: Alex Richardson AuthorDate: 2021-01-06 17:52:02 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 09:31:03 +0000 Stop passing MK_WARNS=no for bootstrap tools I got annoyed by the number of warnings that the CheriBSD build was emitting. It turns out that we are emitting lots of warnings during bootstrap because bootstrap tools are built with the default compiler flags and ignore the warnings flags that are set in bsd.sys.mk. Looking at git blame, it appears that MK_WARNS=no has been passed since rS112869, replacing the -DNO_WERROR option that was added in rS87775. This commit changes MK_WARNS=no back to -DNO_WERROR. We need to pass -DNO_WERROR, since the system compiler might have new warnings that we don't know about yet, and we shouldn't fail the build in that case. Reviewed By: imp, brooks Differential Revision: https://reviews.freebsd.org/D27598 --- Makefile.inc1 | 10 +++++----- Makefile.libcompat | 2 +- targets/pseudo/bootstrap-tools/Makefile | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 4527c22208c5..4bb8ef282f4a 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -731,7 +731,7 @@ BSARGS= DESTDIR= \ SSP_CFLAGS= \ MK_HTML=no NO_LINT=yes MK_MAN=no MK_MAN_UTILS=yes \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ - -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ + -DNO_CPU_CFLAGS -DNO_WERROR MK_CTF=no \ MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no \ MK_INCLUDES=yes @@ -752,7 +752,7 @@ TMAKE= \ BWPHASE=${.TARGET:C,^_,,} \ SSP_CFLAGS= \ -DNO_LINT \ - -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ + -DNO_CPU_CFLAGS -DNO_WERROR MK_CTF=no \ MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no @@ -780,7 +780,7 @@ KTMAKE= \ SSP_CFLAGS= \ MK_HTML=no -DNO_LINT MK_MAN=no \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ - -DNO_CPU_CFLAGS MK_RETPOLINE=no MK_WARNS=no MK_CTF=no + -DNO_CPU_CFLAGS MK_RETPOLINE=no -DNO_WERROR MK_CTF=no # world stage WMAKEENV= ${CROSSENV} \ @@ -2748,7 +2748,7 @@ NXBMAKEARGS+= \ MK_SENDMAIL=no \ MK_SVNLITE=no \ MK_TESTS=no \ - MK_WARNS=no \ + -DNO_WERROR \ MK_ZFS=no .if make(native-xtools*) && \ @@ -3367,7 +3367,7 @@ XDEV_CPUTYPE?=${TARGET_CPUTYPE} NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \ MK_MAN=no MK_NLS=no MK_PROFILE=no \ - MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \ + MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no -DNO_WERROR \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ CPUTYPE=${XDEV_CPUTYPE} diff --git a/Makefile.libcompat b/Makefile.libcompat index 85859a960d81..8b5b31e99387 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -104,7 +104,7 @@ build${libcompat}: .PHONY OBJROOT='$${OBJTOP}/' \ MAKEOBJDIRPREFIX= \ DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS \ - MK_CTF=no MK_RETPOLINE=no MK_WARNS=no \ + MK_CTF=no MK_RETPOLINE=no -DNO_WERROR \ ${_t} .endfor .endfor diff --git a/targets/pseudo/bootstrap-tools/Makefile b/targets/pseudo/bootstrap-tools/Makefile index 88b89a5c9d10..d370538c361d 100644 --- a/targets/pseudo/bootstrap-tools/Makefile +++ b/targets/pseudo/bootstrap-tools/Makefile @@ -42,7 +42,7 @@ BSARGS= DESTDIR= \ SSP_CFLAGS= \ MK_HTML=no NO_LINT=yes MK_MAN=no \ -DNO_PIC MK_PROFILE=no -DNO_SHARED \ - -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ + -DNO_CPU_CFLAGS -DNO_WERROR MK_CTF=no \ MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no \ MK_LLDB=no MK_TESTS=no \ MK_INCLUDES=yes From owner-dev-commits-src-all@freebsd.org Thu Jan 7 11:05:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BEE4F4CCDA2; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@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 4DBNh34yshz4tVJ; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D6E97D71; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107B5tnE011291; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107B5tWR011290; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 11:05:55 GMT Message-Id: <202101071105.107B5tWR011290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 7467c537a50e - main - Fix warnings during bootstrap phase on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7467c537a50e558588e369a1409f50684ddefb25 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 11:05:55 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7467c537a50e558588e369a1409f50684ddefb25 commit 7467c537a50e558588e369a1409f50684ddefb25 Author: Alex Richardson AuthorDate: 2020-12-14 16:14:04 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 09:31:03 +0000 Fix warnings during bootstrap phase on macOS --- tools/build/cross-build/include/mac/string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build/cross-build/include/mac/string.h b/tools/build/cross-build/include/mac/string.h index 5e7823a5f291..3f9ec4935a37 100644 --- a/tools/build/cross-build/include/mac/string.h +++ b/tools/build/cross-build/include/mac/string.h @@ -51,7 +51,7 @@ strchrnul(const char *p, int ch) c = ch; for (;; ++p) { if (*p == c || *p == '\0') - return ((char *)p); + return (__DECONST(char *, p)); } /* NOTREACHED */ } From owner-dev-commits-src-all@freebsd.org Thu Jan 7 11:05:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C862D4CCB77; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@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 4DBNh35Hm8z4tQ2; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6E8C7F81; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107B5tEw011308; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107B5tPe011307; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 11:05:55 GMT Message-Id: <202101071105.107B5tPe011307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 4e64fb9f4901 - main - Fix warnings during bootstrap on Linux systems MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e64fb9f4901e99ce02f13d45f370e75d53075a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 11:05:56 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=4e64fb9f4901e99ce02f13d45f370e75d53075a6 commit 4e64fb9f4901e99ce02f13d45f370e75d53075a6 Author: Alex Richardson AuthorDate: 2020-12-14 10:52:15 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 09:30:50 +0000 Fix warnings during bootstrap on Linux systems Most warnings are currently off for the boostrap phase, but once D27598 lands they will be enabled again. --- tools/build/Makefile | 2 ++ tools/build/cross-build/capsicum_stubs.c | 7 +++-- tools/build/cross-build/fake_sysctl.c | 6 ++-- .../{include/linux/sys/sysctl.h => fflags.c} | 34 +++++++++++++++++----- tools/build/cross-build/include/common/grp.h | 2 +- tools/build/cross-build/include/common/pwd.h | 2 +- tools/build/cross-build/include/common/sys/cdefs.h | 24 --------------- tools/build/cross-build/include/common/sys/param.h | 26 +++++++++++++++++ tools/build/cross-build/include/common/unistd.h | 2 +- tools/build/cross-build/include/linux/limits.h | 4 --- tools/build/cross-build/include/linux/unistd.h | 22 ++------------ tools/build/mk/Makefile.boot | 7 ++++- 12 files changed, 74 insertions(+), 64 deletions(-) diff --git a/tools/build/Makefile b/tools/build/Makefile index ee9d9692df3b..28257a2ea2e5 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -174,6 +174,8 @@ CFLAGS.closefrom.c+= -DSTDC_HEADERS -DHAVE_SYS_DIR_H -DHAVE_DIRENT_H \ -DHAVE_DIRFD -DHAVE_SYSCONF # Provide warnc/errc/getprogname/setprograme SRCS+= err.c progname.c +# Stub implementations of fflagstostr/strtofflags +SRCS+= fflags.c .endif # Provide the same arc4random implementation on Linux/macOS CFLAGS.arc4random.c+= -I${SRCTOP}/sys/crypto/chacha20 -D__isthreaded=1 diff --git a/tools/build/cross-build/capsicum_stubs.c b/tools/build/cross-build/capsicum_stubs.c index b042796c069f..227ef3496b09 100644 --- a/tools/build/cross-build/capsicum_stubs.c +++ b/tools/build/cross-build/capsicum_stubs.c @@ -42,19 +42,20 @@ __FBSDID("$FreeBSD$"); #include int -cap_ioctls_limit(int fd, const cap_ioctl_t *cmds, size_t ncmds) +cap_ioctls_limit(int fd __unused, const cap_ioctl_t *cmds __unused, + size_t ncmds __unused) { return 0; /* Just pretend that it succeeded */ } int -cap_fcntls_limit(int fd, uint32_t fcntlrights) +cap_fcntls_limit(int fd __unused, uint32_t fcntlrights __unused) { return 0; /* Just pretend that it succeeded */ } int -cap_rights_limit(int fd, const cap_rights_t *rights) +cap_rights_limit(int fd __unused, const cap_rights_t *rights __unused) { return 0; /* Just pretend that it succeeded */ } diff --git a/tools/build/cross-build/fake_sysctl.c b/tools/build/cross-build/fake_sysctl.c index 7b9524e1626b..289fb83652f6 100644 --- a/tools/build/cross-build/fake_sysctl.c +++ b/tools/build/cross-build/fake_sysctl.c @@ -37,13 +37,15 @@ #include __FBSDID("$FreeBSD$"); +#include + #include #include #include int -__freebsd_sysctlbyname( - const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen) +__freebsd_sysctlbyname(const char *name, void *oldp, size_t *oldlenp, + const void *newp, size_t newlen) { if (strcmp(name, "kern.vm_guest") == 0) { if (!oldp || !oldlenp) diff --git a/tools/build/cross-build/include/linux/sys/sysctl.h b/tools/build/cross-build/fflags.c similarity index 76% rename from tools/build/cross-build/include/linux/sys/sysctl.h rename to tools/build/cross-build/fflags.c index d24a85b4a266..f1d23c3637b6 100644 --- a/tools/build/cross-build/include/linux/sys/sysctl.h +++ b/tools/build/cross-build/fflags.c @@ -12,6 +12,9 @@ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * + * 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: @@ -32,11 +35,28 @@ * 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 once -/* The Linux sysctl struct has a member called __unused */ -#undef __unused -#include_next -#define __unused __attribute__((unused)) + +#include +#include + +char * +fflagstostr(u_long flags __unused) +{ + return strdup(""); +} + +int +strtofflags(char **stringp __unused, u_long *setp, u_long *clrp) +{ + /* On linux just ignore the file flags for now */ + /* + * XXX: this will prevent makefs from setting noschg on libc, etc. + * so we should really find a way to support flags in disk images. + */ + if (setp) + *setp = 0; + if (clrp) + *clrp = 0; + return (0); /* success */ +} diff --git a/tools/build/cross-build/include/common/grp.h b/tools/build/cross-build/include/common/grp.h index add44b9f8695..08a8bc540569 100644 --- a/tools/build/cross-build/include/common/grp.h +++ b/tools/build/cross-build/include/common/grp.h @@ -53,7 +53,7 @@ const char *group_from_gid(gid_t gid, int noname); #ifdef __linux__ static inline int -setgroupent(int stayopen) +setgroupent(int stayopen __unused) { setgrent(); return (1); diff --git a/tools/build/cross-build/include/common/pwd.h b/tools/build/cross-build/include/common/pwd.h index 243da3a1332f..e167fe47701f 100644 --- a/tools/build/cross-build/include/common/pwd.h +++ b/tools/build/cross-build/include/common/pwd.h @@ -52,7 +52,7 @@ const char *user_from_uid(uid_t uid, int noname); #ifdef __linux__ static inline int -setpassent(int stayopen) +setpassent(int stayopen __unused) { setpwent(); return (1); diff --git a/tools/build/cross-build/include/common/sys/cdefs.h b/tools/build/cross-build/include/common/sys/cdefs.h index c86369ab778a..c129542b6180 100644 --- a/tools/build/cross-build/include/common/sys/cdefs.h +++ b/tools/build/cross-build/include/common/sys/cdefs.h @@ -59,15 +59,6 @@ #define __IDSTRING(name, string) #endif -#ifndef rounddown -#define rounddown(x, y) (((x) / (y)) * (y)) -#define rounddown2(x, y) ((x) & (~((y)-1))) /* if y is power of two */ -#define roundup(x, y) ((((x) + ((y)-1)) / (y)) * (y)) /* to any y */ -#define roundup2(x, y) \ - (((x) + ((y)-1)) & (~((y)-1))) /* if y is powers of two */ -#define powerof2(x) ((((x)-1) & (x)) == 0) -#endif - #ifndef __pure #define __pure __attribute__((__pure__)) #endif @@ -145,12 +136,6 @@ #define __malloc_like __attribute__((__malloc__)) #endif -#ifndef nitems -// https://stackoverflow.com/questions/1598773/is-there-a-standard-function-in-c-that-would-return-the-length-of-an-array/1598827#1598827 -#define nitems(x) \ - ((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x]))))) -#endif - #ifndef __min_size #if !defined(__cplusplus) #define __min_size(x) static(x) @@ -181,15 +166,6 @@ #define __printf0__ __printf__ #endif -/* - * These should probably be in sys/types.h but mtree expects them to exist - * without including - */ -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned int u_int; -typedef unsigned long u_long; - /* On MacOS __CONCAT is defined as x ## y, which won't expand macros */ #undef __CONCAT #define __CONCAT1(x, y) x##y diff --git a/tools/build/cross-build/include/common/sys/param.h b/tools/build/cross-build/include/common/sys/param.h index a197fe3ea9ff..f672b1067d46 100644 --- a/tools/build/cross-build/include/common/sys/param.h +++ b/tools/build/cross-build/include/common/sys/param.h @@ -12,6 +12,9 @@ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * + * 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: @@ -63,3 +66,26 @@ #ifndef __PAST_END #define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset]) #endif + +#ifndef nitems +// https://stackoverflow.com/questions/1598773/is-there-a-standard-function-in-c-that-would-return-the-length-of-an-array/1598827#1598827 +#define nitems(x) \ + ((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x]))))) +#endif + +#ifndef rounddown +#define rounddown(x, y) (((x) / (y)) * (y)) +#endif +#ifndef rounddown2 +#define rounddown2(x, y) ((x) & (~((y)-1))) /* if y is power of two */ +#endif +#ifndef roundup +#define roundup(x, y) ((((x) + ((y)-1)) / (y)) * (y)) /* to any y */ +#endif +#ifndef roundup2 +#define roundup2(x, y) \ + (((x) + ((y)-1)) & (~((y)-1))) /* if y is powers of two */ +#endif +#ifndef powerof2 +#define powerof2(x) ((((x)-1) & (x)) == 0) +#endif diff --git a/tools/build/cross-build/include/common/unistd.h b/tools/build/cross-build/include/common/unistd.h index f438b8936105..593dd700f140 100644 --- a/tools/build/cross-build/include/common/unistd.h +++ b/tools/build/cross-build/include/common/unistd.h @@ -40,7 +40,7 @@ #include static inline int -check_utility_compat(const char *utility) +check_utility_compat(const char *utility __unused) { /* * The check_utility_compat() function returns zero if utility should diff --git a/tools/build/cross-build/include/linux/limits.h b/tools/build/cross-build/include/linux/limits.h index 98523fe0d7a3..833b49b49348 100644 --- a/tools/build/cross-build/include/linux/limits.h +++ b/tools/build/cross-build/include/linux/limits.h @@ -39,10 +39,6 @@ #include_next #endif -#ifdef __STRICT_ANSI__ -#warning __STRICT_ANSI__ defined -#endif - #if __has_include() #include #endif diff --git a/tools/build/cross-build/include/linux/unistd.h b/tools/build/cross-build/include/linux/unistd.h index 0a6b6296a9de..9d1bd1bf4025 100644 --- a/tools/build/cross-build/include/linux/unistd.h +++ b/tools/build/cross-build/include/linux/unistd.h @@ -62,26 +62,8 @@ issetugid(void) } #endif -static inline char * -fflagstostr(u_long flags) -{ - return strdup(""); -} - -static inline int -strtofflags(char **stringp, u_long *setp, u_long *clrp) -{ - /* On linux just ignore the file flags for now */ - /* - * XXXAR: this will prevent makefs from setting noschg on libc, etc - * so we should really build the version from libc - */ - if (setp) - *setp = 0; - if (clrp) - *clrp = 0; - return (0); /* success */ -} +char *fflagstostr(unsigned long flags); +int strtofflags(char **stringp, u_long *setp, u_long *clrp); /* * getentropy() was added in glibc 2.25. Declare it for !glibc and older diff --git a/tools/build/mk/Makefile.boot b/tools/build/mk/Makefile.boot index ada14e6112f4..4adc04b0ea9a 100644 --- a/tools/build/mk/Makefile.boot +++ b/tools/build/mk/Makefile.boot @@ -45,6 +45,11 @@ CFLAGS+= -Werror=implicit-function-declaration -Werror=implicit-int \ -Werror=return-type -Wundef CFLAGS+= -DHAVE_NBTOOL_CONFIG_H=1 CFLAGS+= -I${SRCTOP}/tools/build/cross-build/include/common +# This is needed for code that compiles for pre-C11 C standards +CWARNFLAGS+= -Wno-typedef-redefinition +# bsd.sys.mk explicitly turns on -Wsystem-headers, but that's extremely +# noisy when building on Linux. +CWARNFLAGS+= -Wno-system-headers # b64_pton and b64_ntop is in libresolv on MacOS and Linux: # TODO: only needed for uuencode and uudecode @@ -52,7 +57,7 @@ LDADD+=-lresolv .if ${.MAKE.OS} == "Linux" CFLAGS+= -I${SRCTOP}/tools/build/cross-build/include/linux -CFLAGS+= -std=gnu99 -D_GNU_SOURCE=1 +CFLAGS+= -D_GNU_SOURCE=1 # Needed for sem_init, etc. on Linux (used by usr.bin/sort) LDADD+= -pthread From owner-dev-commits-src-all@freebsd.org Thu Jan 7 11:05:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 31CF54CCE1C; Thu, 7 Jan 2021 11:05:56 +0000 (UTC) (envelope-from git@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 4DBNh362jDz4tZ6; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B99037F82; Thu, 7 Jan 2021 11:05:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107B5tI1011326; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107B5tDG011325; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 11:05:55 GMT Message-Id: <202101071105.107B5tDG011325@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: ed8455806e88 - main - Fix all warnings emitted in `make kernel-toolchain` MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ed8455806e88deeb7151b9bb23ad5026a36d252d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 11:05:56 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=ed8455806e88deeb7151b9bb23ad5026a36d252d commit ed8455806e88deeb7151b9bb23ad5026a36d252d Author: Alex Richardson AuthorDate: 2021-01-06 17:51:03 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 09:26:22 +0000 Fix all warnings emitted in `make kernel-toolchain` With this change and D27598 make kernel-toolchain no longer emits any warnings for me. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D27599 --- bin/cat/cat.c | 6 +++++- tools/build/Makefile | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/cat/cat.c b/bin/cat/cat.c index 7668673f5e89..40d91b243bd4 100644 --- a/bin/cat/cat.c +++ b/bin/cat/cat.c @@ -74,7 +74,9 @@ static const char *filename; static void usage(void) __dead2; static void scanfiles(char *argv[], int cooked); +#ifndef BOOTSTRAP_CAT static void cook_cat(FILE *); +#endif static void raw_cat(int); #ifndef NO_UDOM_SUPPORT @@ -178,11 +180,13 @@ usage(void) } static void -scanfiles(char *argv[], int cooked) +scanfiles(char *argv[], int cooked __unused) { int fd, i; char *path; +#ifndef BOOTSTRAP_CAT FILE *fp; +#endif i = 0; fd = -1; diff --git a/tools/build/Makefile b/tools/build/Makefile index 01a29ad730af..ee9d9692df3b 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -105,9 +105,6 @@ INCS+= libcasper.h # not match. RPCINCS+= ${SRCTOP}/sys/rpc/types.h -.if ${.MAKE.OS} != "FreeBSD" -.PATH: ${.CURDIR}/cross-build - INCS+= ${SRCTOP}/include/mpool.h INCS+= ${SRCTOP}/include/ndbm.h INCS+= ${SRCTOP}/include/err.h @@ -143,6 +140,9 @@ INCS+= ${SRCTOP}/include/nlist.h SYSINCS+= ${SRCTOP}/sys/sys/imgact_aout.h SYSINCS+= ${SRCTOP}/sys/sys/nlist_aout.h + +.if ${.MAKE.OS} != "FreeBSD" +.PATH: ${.CURDIR}/cross-build # dbopen() behaves differently on Linux and FreeBSD so we ensure that we # bootstrap the FreeBSD db code. The cross-build headers #define dbopen() to # __freebsd_dbopen() so that we don't ever use the host version From owner-dev-commits-src-all@freebsd.org Thu Jan 7 11:05:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6DDAC4CCDAE; Thu, 7 Jan 2021 11:05:56 +0000 (UTC) (envelope-from git@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 4DBNh40mD1z4tVP; Thu, 7 Jan 2021 11:05:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04F1F7F83; Thu, 7 Jan 2021 11:05:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107B5tcd011361; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107B5tcv011360; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 11:05:55 GMT Message-Id: <202101071105.107B5tcv011360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 0cace0bb0ae0 - main - Add mkimg to the list of bootstrap tools MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0cace0bb0ae0158d8a770a88570fa93d47ffc980 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 11:05:56 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=0cace0bb0ae0158d8a770a88570fa93d47ffc980 commit 0cace0bb0ae0158d8a770a88570fa93d47ffc980 Author: Alex Richardson AuthorDate: 2021-01-06 17:08:52 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 09:26:21 +0000 Add mkimg to the list of bootstrap tools Having this as part of the bootstrap tools is useful to build disk images to boot in QEMU (especially when building on a Linux/macOS host where mkimg is not available). We have been bootstrapping mkimg in CheriBSD for a long time (using LOCAL_XTOOL_DIRS) but I believe this is also useful upstream. Reviewed By: emaste, brooks Differential Revision: https://reviews.freebsd.org/D27602 --- Makefile.inc1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index 1bf174419da0..4527c22208c5 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2287,6 +2287,14 @@ _bootstrap_tools_links+=kbdcontrol .endif .endif +# 1300102: VHDX support +.if ${BOOTSTRAPPING} < 1201520 || \ + (${BOOTSTRAPPING} > 1300000 && ${BOOTSTRAPPING} < 1300102) +_mkimg= usr.bin/mkimg +.else +_bootstrap_tools_links+=mkimg +.endif + _yacc= usr.bin/yacc .if ${MK_BSNMP} != "no" @@ -2462,6 +2470,7 @@ bootstrap-tools: ${_bt}-links .PHONY ${_flua} \ ${_crunchide} \ ${_crunchgen} \ + ${_mkimg} \ ${_nmtree} \ ${_vtfontcvt} \ ${_localedef} \ From owner-dev-commits-src-all@freebsd.org Thu Jan 7 11:05:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8AA684CCBF9; Thu, 7 Jan 2021 11:05:56 +0000 (UTC) (envelope-from git@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 4DBNh41JH5z4tcZ; Thu, 7 Jan 2021 11:05:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1976B7EE0; Thu, 7 Jan 2021 11:05:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107B5tSN011395; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107B5tYA011394; Thu, 7 Jan 2021 11:05:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 11:05:55 GMT Message-Id: <202101071105.107B5tYA011394@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 1f6612b444e3 - main - Install dtrace.h and dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f6612b444e3fc54697a4ef3167efdddff6944ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 11:05:57 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=1f6612b444e3fc54697a4ef3167efdddff6944ea commit 1f6612b444e3fc54697a4ef3167efdddff6944ea Author: Alex Richardson AuthorDate: 2021-01-06 15:39:10 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 09:26:21 +0000 Install dtrace.h and dependencies This makes the minimum amount of changes to allow inclusion of dtrace.h without all the solaris compatibility headers. Installing dtrace.h allows compiling consumers of libdtrace (e.g. https://github.com/tmetsch/python-dtrace) without requiring a copy of the source tree. For python-dtrace I worked around this in https://github.com/tmetsch/python-dtrace/commit/58019c9a12022203a9ffda286dd8b41f1a5ace42 but being able to build the library without installed sources would be extremely useful. Reviewed By: gnn Differential Revision: https://reviews.freebsd.org/D27884 --- cddl/lib/libdtrace/Makefile | 7 +++++++ sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile index d0184185ff74..efd73751e2c0 100644 --- a/cddl/lib/libdtrace/Makefile +++ b/cddl/lib/libdtrace/Makefile @@ -64,6 +64,13 @@ FILES= ${DSRCS} FILESDIR= /usr/lib/dtrace FILESMODE= ${NOBINMODE} +INCSGROUPS= INCS SYSINCS +SYSINCSDIR= ${INCLUDEDIR}/sys +INCS+= ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h +SYSINCS+= ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h +SYSINCS+= ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h +SYSINCS+= ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/ctf.h + WARNS?= 1 CFLAGS+= -DIN_BASE diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h index b9ee9095d17d..31c5983270ca 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h +++ b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h @@ -49,10 +49,20 @@ extern "C" { #ifndef _ASM -#include +#include +#include #ifdef _KERNEL #include #endif +#if !defined(IN_BASE) && !defined(_KERNEL) +/* Compatibility types to allow including the CTF API */ +typedef unsigned int zoneid_t; +typedef unsigned char uchar_t; +typedef unsigned short ushort_t; +typedef unsigned int uint_t; +typedef unsigned long ulong_t; +typedef int processorid_t; +#else #include #include #include @@ -63,9 +73,9 @@ extern "C" { #include #include #include +#endif typedef int model_t; #include -#include /* * DTrace Universal Constants and Typedefs From owner-dev-commits-src-all@freebsd.org Thu Jan 7 13:34:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AB4CB4D0CDF; Thu, 7 Jan 2021 13:34:43 +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 4DBRzl4HCTz53qK; Thu, 7 Jan 2021 13:34:43 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (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 8157625B08; Thu, 7 Jan 2021 13:34:43 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f51.google.com with SMTP id s6so2724211qvn.6; Thu, 07 Jan 2021 05:34:43 -0800 (PST) X-Gm-Message-State: AOAM530XXZUiSU2YfIkb6M6JCPUzQ22NwuIEFusuRcYMio8TXlffhVIM wbfaWVkpMUm82PrzcvKNqt81PAMc1BKUzpwaLMo= X-Google-Smtp-Source: ABdhPJyF8lbjE9Qtxgle2DVrfq1rHbW2i+BjEg3UiTHG5HH2LQtXALqvnNncdq/P5+tbHxMyWUt60azHzFogE6AFHLI= X-Received: by 2002:a05:6214:6af:: with SMTP id s15mr8435562qvz.34.1610026483182; Thu, 07 Jan 2021 05:34:43 -0800 (PST) MIME-Version: 1.0 References: <202012311717.0BVHHp4G092948@gitrepo.freebsd.org> In-Reply-To: From: Kyle Evans Date: Thu, 7 Jan 2021 07:34:30 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: ac5f382a9d0a - main - stand: properly declare subdir deps or .WAIT, do parallel build To: Peter Jeremy Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 13:34:43 -0000 On Thu, Jan 7, 2021 at 1:50 AM Peter Jeremy wrote: > > On 2020-Dec-31 17:17:51 +0000, Kyle Evans wrote: > >The branch main has been updated by kevans: > > > >URL: https://cgit.FreeBSD.org/src/commit/?id=ac5f382a9d0a26685b92b49abb845d3b30ea5f91 > > > >commit ac5f382a9d0a26685b92b49abb845d3b30ea5f91 > >Author: Kyle Evans > >AuthorDate: 2020-12-31 17:15:45 +0000 > >Commit: Kyle Evans > >CommitDate: 2020-12-31 17:15:45 +0000 > > This commit adds fdt as a hard dependency for efi but leaves fdt as > optionally built based on WITH_FDT. As a result, adding WITHOUT_FDT=yes > causes the build to fail: > make[3]: don't know how to make all_subdir_stand/fdt. Stop > > Either MK_FDT needs to be forced on by MK_EFI or the dependency needs to > be made conditional. > Ah, yes, sorry- will fix. It looks like that should be the only other conditional dep that I missed here. The latter option is what we opt for here- Thanks, Kyle Evans From owner-dev-commits-src-all@freebsd.org Thu Jan 7 13:54:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 03E634D194A; Thu, 7 Jan 2021 13:54:01 +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 4DBSQ06hYdz553Q; Thu, 7 Jan 2021 13:54:00 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (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 D401325A1F; Thu, 7 Jan 2021 13:54:00 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f173.google.com with SMTP id a6so4239877qtw.6; Thu, 07 Jan 2021 05:54:00 -0800 (PST) X-Gm-Message-State: AOAM533JbhRqoMHzLUdoi/Jxm+I3g5dDN7MKg8fCmn0yXVKCEHj0U+gw 0UHvtfRzhr0hfNmAqYQfVfUdFRF9YAMdinulbgc= X-Google-Smtp-Source: ABdhPJzNMF6KJBuIScGrhcdtj9SuXwz9hyaZoCskfndvd/RK155QE93JXhTzQEYsk68f34et1Vmlr/CocaWLUvBBJvQ= X-Received: by 2002:ac8:4e87:: with SMTP id 7mr8473153qtp.310.1610027640091; Thu, 07 Jan 2021 05:54:00 -0800 (PST) MIME-Version: 1.0 References: <202101051302.105D24lW041218@gitrepo.freebsd.org> In-Reply-To: <202101051302.105D24lW041218@gitrepo.freebsd.org> From: Kyle Evans Date: Thu, 7 Jan 2021 07:53:47 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support To: Baptiste Daroussin Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 13:54:01 -0000 On Tue, Jan 5, 2021 at 7:02 AM Baptiste Daroussin wrote: > > The branch main has been updated by bapt: > > URL: https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba0441562aa07 > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > Author: Baptiste Daroussin > AuthorDate: 2021-01-04 16:29:40 +0000 > Commit: Baptiste Daroussin > CommitDate: 2021-01-05 13:01:32 +0000 > > ncurses: only keep the version with widechar support > > Only keep the widechar version of ncurses as libncursesw.so.9 > > Keep the old name to avoid breaking the ABI compatibility (the non > widechar version libncurses.so.9 is not binary compatible with > libncursesw.so.9) since all ports and base are already only linking > against the widechar version we can simply remove libncurses.so.9 > > Since the .9 version only lived in the dev branch and never ended in a > release, it is simply removed and not added to any binary compat > package. > > Add symlinks to keep build time compatibility for anyone linking against > -lncurses > --- > Makefile.inc1 | 5 +-- > Makefile.libcompat | 4 +- > ObsoleteFiles.inc | 2 + > lib/ncurses/Makefile | 6 +-- > lib/ncurses/config.mk | 11 +----- > lib/ncurses/form/Makefile | 18 ++++++--- > lib/ncurses/formw/Makefile | 5 --- > lib/ncurses/formw/Makefile.depend | 17 --------- > lib/ncurses/menu/Makefile | 18 ++++++--- > lib/ncurses/menuw/Makefile | 5 --- > lib/ncurses/menuw/Makefile.depend | 17 --------- > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++-------------------- > lib/ncurses/ncursesw/Makefile | 7 ---- > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > lib/ncurses/panel/Makefile | 23 ++++++++---- > lib/ncurses/panelw/Makefile | 5 --- > lib/ncurses/panelw/Makefile.depend | 17 --------- > share/mk/src.libnames.mk | 16 ++------ > tools/bsdbox/Makefile.base | 2 +- > tools/tools/ath/athratestats/Makefile | 2 +- > 20 files changed, 87 insertions(+), 180 deletions(-) > > diff --git a/Makefile.inc1 b/Makefile.inc1 > index fecdc1bdca71..a19fde9195cf 100644 > --- a/Makefile.inc1 > +++ b/Makefile.inc1 > @@ -2524,7 +2524,6 @@ _bt_clean= ${CLEANDIR} > ${LOCAL_TOOL_DIRS} \ > ${_jevents} \ > lib/ncurses/ncurses \ > - lib/ncurses/ncursesw \ > ${_rescue} \ > ${_share} \ > usr.bin/awk \ > @@ -2870,7 +2869,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ > lib/libzstd \ > ${_lib_casper} \ > - lib/ncurses/ncurses lib/ncurses/ncursesw \ > + lib/ncurses/ncurses \ > lib/libopie lib/libpam/libpam ${_lib_libthr} \ > ${_lib_libradius} lib/libsbuf lib/libtacplus \ > lib/libgeom \ > @@ -2891,7 +2890,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > .if ${MK_DIALOG} != "no" > _prebuild_libs+= gnu/lib/libdialog > -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L > +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncurses__L > .endif > > .if ${MK_GOOGLETEST} != "no" > diff --git a/Makefile.libcompat b/Makefile.libcompat > index 3f23a33aa19b..85859a960d81 100644 > --- a/Makefile.libcompat > +++ b/Makefile.libcompat > @@ -45,7 +45,7 @@ _LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib > > _LC_INCDIRS= \ > include \ > - lib/ncurses/ncursesw \ > + lib/ncurses/ncurses \ > ${_LC_LIBDIRS.yes} > > .if ${MK_FILE} != "no" > @@ -94,7 +94,7 @@ build${libcompat}: .PHONY > DIRPRFX=${_dir}/ ${_t} > .endfor > .endfor > -.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevents} > +.for _dir in lib/ncurses/ncurses lib/ncurses/ncurses ${_libmagic} ${_jevents} > .for _t in ${_obj} build-tools > ${_+_}cd ${.CURDIR}/${_dir}; \ > WORLDTMP=${WORLDTMP} \ The second occurence of lib/ncurses/ncurses should probably just go away? > diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk > index d15be8601136..f199c5829b65 100644 > --- a/lib/ncurses/config.mk > +++ b/lib/ncurses/config.mk > @@ -4,20 +4,11 @@ > > NCURSES_DIR= ${SRCTOP}/contrib/ncurses > > -.if defined(ENABLE_WIDEC) > -LIB_SUFFIX= w > CFLAGS+= -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC > -NCURSES_CFG_H= ${.CURDIR:H}/ncurses/ncurses_cfg.h > -.else > -LIB_SUFFIX= > NCURSES_CFG_H= ${.CURDIR}/ncurses_cfg.h > -.endif > > CFLAGS+= -I. > -.if exists(${.OBJDIR:H}/ncurses${LIB_SUFFIX}) > -CFLAGS+= -I${.OBJDIR:H}/ncurses${LIB_SUFFIX} > -.endif > -CFLAGS+= -I${.CURDIR:H}/ncurses${LIB_SUFFIX} > +CFLAGS+= -I${.CURDIR:H}/ncurses > > # for ${NCURSES_CFG_H} > CFLAGS+= -I${.CURDIR:H}/ncurses Based on this we should really just nuke the entire ncurses dir for older WITHOUT_CLEAN builds, because any objects in this objdir will have been built without -DENABLE_WIDEC. Maybe just key it off of an ncursesw directory existing in the objdir hierarchy and nuke it all in depend-cleanup. Thanks, Kyle Evans From owner-dev-commits-src-all@freebsd.org Thu Jan 7 13:59:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 32AE14D17F4; Thu, 7 Jan 2021 13:59:14 +0000 (UTC) (envelope-from bapt@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 4DBSX20yvjz54y6; Thu, 7 Jan 2021 13:59:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from ivaldir.etoilebsd.net (etoilebsd.net [178.32.217.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id DC47D25AE9; Thu, 7 Jan 2021 13:59:13 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by ivaldir.etoilebsd.net (Postfix, from userid 1001) id 1BB64EBF73; Thu, 7 Jan 2021 14:58:42 +0100 (CET) Date: Thu, 7 Jan 2021 14:58:42 +0100 From: Baptiste Daroussin To: Kyle Evans Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support Message-ID: <20210107135842.lji6ydbajmzxqiuq@ivaldir.net> References: <202101051302.105D24lW041218@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cqvldhvjompcmxf2" Content-Disposition: inline In-Reply-To: X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 13:59:14 -0000 --cqvldhvjompcmxf2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 07, 2021 at 07:53:47AM -0600, Kyle Evans wrote: > On Tue, Jan 5, 2021 at 7:02 AM Baptiste Daroussin wrot= e: > > > > The branch main has been updated by bapt: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D821aa63a09402935da0a73ab= f20ba0441562aa07 > > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > Author: Baptiste Daroussin > > AuthorDate: 2021-01-04 16:29:40 +0000 > > Commit: Baptiste Daroussin > > CommitDate: 2021-01-05 13:01:32 +0000 > > > > ncurses: only keep the version with widechar support > > > > Only keep the widechar version of ncurses as libncursesw.so.9 > > > > Keep the old name to avoid breaking the ABI compatibility (the non > > widechar version libncurses.so.9 is not binary compatible with > > libncursesw.so.9) since all ports and base are already only linking > > against the widechar version we can simply remove libncurses.so.9 > > > > Since the .9 version only lived in the dev branch and never ended i= n a > > release, it is simply removed and not added to any binary compat > > package. > > > > Add symlinks to keep build time compatibility for anyone linking ag= ainst > > -lncurses > > --- > > Makefile.inc1 | 5 +-- > > Makefile.libcompat | 4 +- > > ObsoleteFiles.inc | 2 + > > lib/ncurses/Makefile | 6 +-- > > lib/ncurses/config.mk | 11 +----- > > lib/ncurses/form/Makefile | 18 ++++++--- > > lib/ncurses/formw/Makefile | 5 --- > > lib/ncurses/formw/Makefile.depend | 17 --------- > > lib/ncurses/menu/Makefile | 18 ++++++--- > > lib/ncurses/menuw/Makefile | 5 --- > > lib/ncurses/menuw/Makefile.depend | 17 --------- > > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++------------= -------- > > lib/ncurses/ncursesw/Makefile | 7 ---- > > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > > lib/ncurses/panel/Makefile | 23 ++++++++---- > > lib/ncurses/panelw/Makefile | 5 --- > > lib/ncurses/panelw/Makefile.depend | 17 --------- > > share/mk/src.libnames.mk | 16 ++------ > > tools/bsdbox/Makefile.base | 2 +- > > tools/tools/ath/athratestats/Makefile | 2 +- > > 20 files changed, 87 insertions(+), 180 deletions(-) > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > index fecdc1bdca71..a19fde9195cf 100644 > > --- a/Makefile.inc1 > > +++ b/Makefile.inc1 > > @@ -2524,7 +2524,6 @@ _bt_clean=3D ${CLEANDIR} > > ${LOCAL_TOOL_DIRS} \ > > ${_jevents} \ > > lib/ncurses/ncurses \ > > - lib/ncurses/ncursesw \ > > ${_rescue} \ > > ${_share} \ > > usr.bin/awk \ > > @@ -2870,7 +2869,7 @@ _prebuild_libs=3D ${_kerberos5_lib_libasn1} \ > > lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libn= v \ > > lib/libzstd \ > > ${_lib_casper} \ > > - lib/ncurses/ncurses lib/ncurses/ncursesw \ > > + lib/ncurses/ncurses \ > > lib/libopie lib/libpam/libpam ${_lib_libthr} \ > > ${_lib_libradius} lib/libsbuf lib/libtacplus \ > > lib/libgeom \ > > @@ -2891,7 +2890,7 @@ _prebuild_libs=3D ${_kerberos5_lib_libasn1} \ > > > > .if ${MK_DIALOG} !=3D "no" > > _prebuild_libs+=3D gnu/lib/libdialog > > -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L > > +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncurses__L > > .endif > > > > .if ${MK_GOOGLETEST} !=3D "no" > > diff --git a/Makefile.libcompat b/Makefile.libcompat > > index 3f23a33aa19b..85859a960d81 100644 > > --- a/Makefile.libcompat > > +++ b/Makefile.libcompat > > @@ -45,7 +45,7 @@ _LC_LIBDIRS.${MK_KERBEROS:tl}+=3D kerberos5/lib > > > > _LC_INCDIRS=3D \ > > include \ > > - lib/ncurses/ncursesw \ > > + lib/ncurses/ncurses \ > > ${_LC_LIBDIRS.yes} > > > > .if ${MK_FILE} !=3D "no" > > @@ -94,7 +94,7 @@ build${libcompat}: .PHONY > > DIRPRFX=3D${_dir}/ ${_t} > > .endfor > > .endfor > > -.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_= jevents} > > +.for _dir in lib/ncurses/ncurses lib/ncurses/ncurses ${_libmagic} ${_j= events} > > .for _t in ${_obj} build-tools > > ${_+_}cd ${.CURDIR}/${_dir}; \ > > WORLDTMP=3D${WORLDTMP} \ >=20 > The second occurence of lib/ncurses/ncurses should probably just go away? >=20 > > diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk > > index d15be8601136..f199c5829b65 100644 > > --- a/lib/ncurses/config.mk > > +++ b/lib/ncurses/config.mk > > @@ -4,20 +4,11 @@ > > > > NCURSES_DIR=3D ${SRCTOP}/contrib/ncurses > > > > -.if defined(ENABLE_WIDEC) > > -LIB_SUFFIX=3D w > > CFLAGS+=3D -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC > > -NCURSES_CFG_H=3D ${.CURDIR:H}/ncurses/ncurses_cfg.h > > -.else > > -LIB_SUFFIX=3D > > NCURSES_CFG_H=3D ${.CURDIR}/ncurses_cfg.h > > -.endif > > > > CFLAGS+=3D -I. > > -.if exists(${.OBJDIR:H}/ncurses${LIB_SUFFIX}) > > -CFLAGS+=3D -I${.OBJDIR:H}/ncurses${LIB_SUFFIX} > > -.endif > > -CFLAGS+=3D -I${.CURDIR:H}/ncurses${LIB_SUFFIX} > > +CFLAGS+=3D -I${.CURDIR:H}/ncurses > > > > # for ${NCURSES_CFG_H} > > CFLAGS+=3D -I${.CURDIR:H}/ncurses >=20 > Based on this we should really just nuke the entire ncurses dir for > older WITHOUT_CLEAN builds, because any objects in this objdir will > have been built without -DENABLE_WIDEC. Maybe just key it off of an > ncursesw directory existing in the objdir hierarchy and nuke it all in > depend-cleanup. >=20 Yes to everything you said ;) Best regards, Bapt --cqvldhvjompcmxf2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAl/3E48ACgkQY4mL3PG3 PlouBRAA2STgN5MtK60g6hoVhMXJO41yJarEwowR3cc8pgCv/1hFMoh2L6h2fDn/ oq+lGSaC2VEmHq6xOfny22TFDA1+nhZmfPu1BTxqmoBCp8+cPhQaQRtbCrsg8lRF /AEStb0TDez84YMMSMbDb9VQfnOxc6hwKs6ra31R79QJJAAgVC/RSGFtf6sDv5ax u2IVuXrLNR9fomDhVajhjN4EQMS45U53hF6wQ6d1lFosOcBIHOzGkU5mdjHcagOs SF/H60g7P+VdG9zZC4krbg/WU9aFwt3czLl+9S3uEnHX/IobAzTfSN0pY5qrHyvP fdMNTOFeukX9vuQq+OwiWBhpRWlq3xDSX7jPkhbQxiUxJRW64oZhGD6ro3IrNltU f45Bf17/HmQAp3nW8YuVyRyfnWKUb8y1I4u9S1r9ZJ1bi524MI7YbAx7SGt/5Wqp hZ58WNS/6VGSpQwnhpP8dhrrJHcM+mcglN/baNx4YbZQlReCM1LtMoK4YFAB57zy mtVK96HCpnINsL/0MMVqVPwDqx+JL0DyAtvyMReSarKAo9x+tlNSj3yR6i1mJIiw BokgNL/9Z3cNSt9uTp+rSWKgqnucNYpEPlX458e9u1e+CU6bN8/o/q190FfhPhcz 3l1BOatUTcxO0fJoQwudq3ZQPeXyzKrswqE98K8jYljImg5jpeQ= =wACi -----END PGP SIGNATURE----- --cqvldhvjompcmxf2-- From owner-dev-commits-src-all@freebsd.org Thu Jan 7 14:01:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E5FFE4D1DA7; Thu, 7 Jan 2021 14:01:24 +0000 (UTC) (envelope-from git@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 4DBSZX69jRz55Tn; Thu, 7 Jan 2021 14:01:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6F2B1241E; Thu, 7 Jan 2021 14:01:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107E1OUU039428; Thu, 7 Jan 2021 14:01:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107E1OXJ039427; Thu, 7 Jan 2021 14:01:24 GMT (envelope-from git) Date: Thu, 7 Jan 2021 14:01:24 GMT Message-Id: <202101071401.107E1OXJ039427@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: d146f831801f - main - prepare-commit-msg: Avoid warning on macOS and shellcheck fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d146f831801f226802e3e1d55bec2cfbea9dc577 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 14:01:25 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d146f831801f226802e3e1d55bec2cfbea9dc577 commit d146f831801f226802e3e1d55bec2cfbea9dc577 Author: Alex Richardson AuthorDate: 2021-01-07 14:00:32 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 14:00:32 +0000 prepare-commit-msg: Avoid warning on macOS and shellcheck fixes The macOS /bin/sh complains about using return outside of functions. Replace `return 0` with `exit 0` to fix this. While editing this files I've also fixed all the shellcheck warnings that were displayed by my IDE. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D28016 --- tools/tools/git/hooks/prepare-commit-msg | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/tools/git/hooks/prepare-commit-msg b/tools/tools/git/hooks/prepare-commit-msg index e453b73cc45d..51b92a10724d 100755 --- a/tools/tools/git/hooks/prepare-commit-msg +++ b/tools/tools/git/hooks/prepare-commit-msg @@ -13,13 +13,13 @@ commit|message) # It appears git invokes this script for interactive rebase but does # not remove commented lines, so just exit if we're not called with the # default (comment-containing) template. - egrep -q '^#' "$1" || return 0 + grep -E -q '^#' "$1" || exit 0 ;; template) - return 0 + exit 0 ;; merge) - return 0 + exit 0 ;; esac @@ -58,7 +58,7 @@ $(awk '1;/^#$/{exit}' $1) # # "Pull Request" and "Differential Revision" require the *full* GitHub or # Phabricator URL. -$(awk '/^#$/,EOF' $1) +$(awk '/^#$/,EOF' "$1") EOF -mv $outfile $1 +mv "$outfile" "$1" From owner-dev-commits-src-all@freebsd.org Thu Jan 7 14:15:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 968F54D2562; Thu, 7 Jan 2021 14:15:15 +0000 (UTC) (envelope-from git@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 4DBStW3sGvz56fY; Thu, 7 Jan 2021 14:15:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 77C571284D; Thu, 7 Jan 2021 14:15:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107EFFVN055943; Thu, 7 Jan 2021 14:15:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107EFF44055942; Thu, 7 Jan 2021 14:15:15 GMT (envelope-from git) Date: Thu, 7 Jan 2021 14:15:15 GMT Message-Id: <202101071415.107EFF44055942@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 8537f16249c4 - main - libcompat: remove redundant path for ncurses MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8537f16249c4ed8e575386472d624dbd423cf093 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 14:15:15 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=8537f16249c4ed8e575386472d624dbd423cf093 commit 8537f16249c4ed8e575386472d624dbd423cf093 Author: Baptiste Daroussin AuthorDate: 2021-01-07 14:14:52 +0000 Commit: Baptiste Daroussin CommitDate: 2021-01-07 14:14:52 +0000 libcompat: remove redundant path for ncurses Reported by: kevans --- Makefile.libcompat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.libcompat b/Makefile.libcompat index ec4402586558..e4d9cd94e835 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -94,7 +94,7 @@ build${libcompat}: .PHONY DIRPRFX=${_dir}/ ${_t} .endfor .endfor -.for _dir in lib/ncurses/ncurses lib/ncurses/ncurses ${_libmagic} ${_jevents} +.for _dir in lib/ncurses/ncurses ${_libmagic} ${_jevents} .for _t in ${_obj} build-tools ${_+_}cd ${.CURDIR}/${_dir}; \ WORLDTMP=${WORLDTMP} \ From owner-dev-commits-src-all@freebsd.org Thu Jan 7 14:28:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 96CE24D2C9D; Thu, 7 Jan 2021 14:28:30 +0000 (UTC) (envelope-from git@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 4DBT9p3qcFz57LZ; Thu, 7 Jan 2021 14:28:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 760A11234C; Thu, 7 Jan 2021 14:28:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107ESUTK069164; Thu, 7 Jan 2021 14:28:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107ESU2p069163; Thu, 7 Jan 2021 14:28:30 GMT (envelope-from git) Date: Thu, 7 Jan 2021 14:28:30 GMT Message-Id: <202101071428.107ESU2p069163@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 0199cbf641db - main - Fix a typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0199cbf641db5f28d258153014fa8a657ae98ea6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 14:28:30 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0199cbf641db5f28d258153014fa8a657ae98ea6 commit 0199cbf641db5f28d258153014fa8a657ae98ea6 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-01-07 14:28:29 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-01-07 14:28:29 +0000 Fix a typo MFC after: 3 days --- usr.sbin/certctl/certctl.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/certctl/certctl.8 b/usr.sbin/certctl/certctl.8 index 49da109c5e71..8ca2cd37dee5 100644 --- a/usr.sbin/certctl/certctl.8 +++ b/usr.sbin/certctl/certctl.8 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 30, 2020 +.Dd January 7, 2021 .Dt CERTCTL 8 .Os .Sh NAME @@ -65,7 +65,7 @@ Specify the path of the METALOG file (default: $DESTDIR/METALOG). .It Fl n No-Op mode, do not actually perform any actions. .It Fl v -be verbose, print details about actions before performing them. +Be verbose, print details about actions before performing them. .It Fl U Unprivileged mode, do not change the ownership of created links. Do record the ownership in the METALOG file. From owner-dev-commits-src-all@freebsd.org Thu Jan 7 14:37:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CFB894D300D; Thu, 7 Jan 2021 14:37:35 +0000 (UTC) (envelope-from git@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 4DBTNH5W32z57fW; Thu, 7 Jan 2021 14:37:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFFC51235F; Thu, 7 Jan 2021 14:37:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107EbZld082424; Thu, 7 Jan 2021 14:37:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107EbZ5W082423; Thu, 7 Jan 2021 14:37:35 GMT (envelope-from git) Date: Thu, 7 Jan 2021 14:37:35 GMT Message-Id: <202101071437.107EbZ5W082423@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: c834f30a0c16 - main - Add new PCI ID for XHCI(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c834f30a0c16d1ea79f3e1695b486aa81a8ede38 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 14:37:35 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c834f30a0c16d1ea79f3e1695b486aa81a8ede38 commit c834f30a0c16d1ea79f3e1695b486aa81a8ede38 Author: Hans Petter Selasky AuthorDate: 2021-01-07 14:27:24 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-07 14:35:35 +0000 Add new PCI ID for XHCI(4). Submitted by: Dmitry Luhtionov MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/usb/controller/xhci_pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c index 869f6a0aae2b..615d16ee3740 100644 --- a/sys/dev/usb/controller/xhci_pci.c +++ b/sys/dev/usb/controller/xhci_pci.c @@ -130,6 +130,8 @@ xhci_pci_match(device_t self) return ("Intel Panther Point USB 3.0 controller"); case 0x22b58086: return ("Intel Braswell USB 3.0 controller"); + case 0x31a88086: + return ("Intel Gemini Lake USB 3.0 controller"); case 0x5aa88086: return ("Intel Apollo Lake USB 3.0 controller"); case 0x8c318086: From owner-dev-commits-src-all@freebsd.org Thu Jan 7 14:38:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 084B54D2F9F; Thu, 7 Jan 2021 14:38:05 +0000 (UTC) (envelope-from git@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 4DBTNr6srpz57tw; Thu, 7 Jan 2021 14:38:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE9A312360; Thu, 7 Jan 2021 14:38:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107Ec4iI082597; Thu, 7 Jan 2021 14:38:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107Ec43X082596; Thu, 7 Jan 2021 14:38:04 GMT (envelope-from git) Date: Thu, 7 Jan 2021 14:38:04 GMT Message-Id: <202101071438.107Ec43X082596@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: ea0efc370416 - main - Add support for PL2303HXN to uplcom(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ea0efc37041640686fbfb226e80ee60e58cb17f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 14:38:05 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ea0efc37041640686fbfb226e80ee60e58cb17f1 commit ea0efc37041640686fbfb226e80ee60e58cb17f1 Author: Hans Petter Selasky AuthorDate: 2021-01-07 14:34:26 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-07 14:35:35 +0000 Add support for PL2303HXN to uplcom(4). Code changes in this commit were obtained from straight from OpenBSD's uplcom.c with almost no modification, the list of chip names and USB IDs was obtained from Linux. Differential Revision: https://reviews.freebsd.org/D27952 Submitted by: tomli_tomli.me (Yifeng Li) MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- share/man/man4/uplcom.4 | 4 +- sys/dev/usb/serial/uplcom.c | 94 +++++++++++++++++++++++++++++++++++++++------ sys/dev/usb/usbdevs | 6 +++ 3 files changed, 92 insertions(+), 12 deletions(-) diff --git a/share/man/man4/uplcom.4 b/share/man/man4/uplcom.4 index 0da1255ecfd6..85822d7d0dc6 100644 --- a/share/man/man4/uplcom.4 +++ b/share/man/man4/uplcom.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 24, 2018 +.Dd January 7, 2021 .Dt UPLCOM 4 .Os .Sh NAME @@ -134,6 +134,8 @@ PLANEX USB-RS232 URS-03 .It Prolific Generic USB-Serial Adapters .It +Prolific Generic USB-Serial Adapters (HXN) +.It Prolific Pharos USB-Serial Adapter .It Prolific USB-Serial Controller D diff --git a/sys/dev/usb/serial/uplcom.c b/sys/dev/usb/serial/uplcom.c index 013b837ef52f..9efac9ff6b7c 100644 --- a/sys/dev/usb/serial/uplcom.c +++ b/sys/dev/usb/serial/uplcom.c @@ -132,8 +132,13 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RWTUN, #define UPLCOM_BULK_BUF_SIZE 1024 /* bytes */ #define UPLCOM_SET_REQUEST 0x01 +#define UPLCOM_SET_REQUEST_PL2303HXN 0x80 #define UPLCOM_SET_CRTSCTS 0x41 #define UPLCOM_SET_CRTSCTS_PL2303X 0x61 +#define UPLCOM_SET_CRTSCTS_PL2303HXN 0xFA +#define UPLCOM_CLEAR_CRTSCTS_PL2303HXN 0xFF +#define UPLCOM_CRTSCTS_REG_PL2303HXN 0x0A +#define UPLCOM_STATUS_REG_PL2303HX 0x8080 #define RSAQ_STATUS_CTS 0x80 #define RSAQ_STATUS_OVERRUN_ERROR 0x40 #define RSAQ_STATUS_PARITY_ERROR 0x20 @@ -146,6 +151,7 @@ SYSCTL_INT(_hw_usb_uplcom, OID_AUTO, debug, CTLFLAG_RWTUN, #define TYPE_PL2303 0 #define TYPE_PL2303HX 1 #define TYPE_PL2303HXD 2 +#define TYPE_PL2303HXN 3 #define UPLCOM_STATE_INDEX 8 @@ -289,6 +295,12 @@ static const STRUCT_USB_HOST_ID uplcom_devs[] = { UPLCOM_DEV(PROLIFIC, MOTOROLA), /* Motorola cable */ UPLCOM_DEV(PROLIFIC, PHAROS), /* Prolific Pharos */ UPLCOM_DEV(PROLIFIC, PL2303), /* Generic adapter */ + UPLCOM_DEV(PROLIFIC, PL2303GC), /* Generic adapter (PL2303HXN, type GC) */ + UPLCOM_DEV(PROLIFIC, PL2303GB), /* Generic adapter (PL2303HXN, type GB) */ + UPLCOM_DEV(PROLIFIC, PL2303GT), /* Generic adapter (PL2303HXN, type GT) */ + UPLCOM_DEV(PROLIFIC, PL2303GL), /* Generic adapter (PL2303HXN, type GL) */ + UPLCOM_DEV(PROLIFIC, PL2303GE), /* Generic adapter (PL2303HXN, type GE) */ + UPLCOM_DEV(PROLIFIC, PL2303GS), /* Generic adapter (PL2303HXN, type GS) */ UPLCOM_DEV(PROLIFIC, RSAQ2), /* I/O DATA USB-RSAQ2 */ UPLCOM_DEV(PROLIFIC, RSAQ3), /* I/O DATA USB-RSAQ3 */ UPLCOM_DEV(PROLIFIC, UIC_MSR206), /* UIC MSR206 Card Reader */ @@ -368,6 +380,10 @@ uplcom_attach(device_t dev) struct usb_device_descriptor *dd; int error; + struct usb_device_request req; + usb_error_t err; + uint8_t buf[4]; + DPRINTFN(11, "\n"); device_set_usb_desc(dev); @@ -407,6 +423,25 @@ uplcom_attach(device_t dev) break; } + /* + * The new chip revision PL2303HXN is only compatible with the new + * UPLCOM_SET_REQUEST_PL2303HXN command. Issuing the old command + * UPLCOM_SET_REQUEST to the new chip raises an error. Thus, PL2303HX + * and PL2303HXN can be distinguished by issuing an old-style request + * (on a status register) to the new chip and checking the error. + */ + if (sc->sc_chiptype == TYPE_PL2303HX) { + req.bmRequestType = UT_READ_VENDOR_DEVICE; + req.bRequest = UPLCOM_SET_REQUEST; + USETW(req.wValue, UPLCOM_STATUS_REG_PL2303HX); + req.wIndex[0] = sc->sc_data_iface_no; + req.wIndex[1] = 0; + USETW(req.wLength, 1); + err = usbd_do_request(sc->sc_udev, NULL, &req, buf); + if (err) + sc->sc_chiptype = TYPE_PL2303HXN; + } + switch (sc->sc_chiptype) { case TYPE_PL2303: DPRINTF("chiptype: 2303\n"); @@ -414,6 +449,9 @@ uplcom_attach(device_t dev) case TYPE_PL2303HX: DPRINTF("chiptype: 2303HX/TA\n"); break; + case TYPE_PL2303HXN: + DPRINTF("chiptype: 2303HXN\n"); + break; case TYPE_PL2303HXD: DPRINTF("chiptype: 2303HXD/TB/RA/EA\n"); break; @@ -475,7 +513,8 @@ uplcom_attach(device_t dev) usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_WR]); usbd_xfer_set_stall(sc->sc_xfer[UPLCOM_BULK_DT_RD]); mtx_unlock(&sc->sc_mtx); - } else { + } else if (sc->sc_chiptype == TYPE_PL2303HX || + sc->sc_chiptype == TYPE_PL2303HXD) { /* reset upstream data pipes */ if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 8, 0, 0) || @@ -483,6 +522,12 @@ uplcom_attach(device_t dev) UPLCOM_SET_REQUEST, 9, 0, 0)) { goto detach; } + } else if (sc->sc_chiptype == TYPE_PL2303HXN) { + /* reset upstream data pipes */ + if (uplcom_pl2303_do(sc->sc_udev, UT_WRITE_VENDOR_DEVICE, + UPLCOM_SET_REQUEST_PL2303HXN, 0x07, 0x03, 0)) { + goto detach; + } } error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, @@ -546,6 +591,11 @@ uplcom_reset(struct uplcom_softc *sc, struct usb_device *udev) { struct usb_device_request req; + if (sc->sc_chiptype == TYPE_PL2303HXN) { + /* PL2303HXN doesn't need this reset sequence */ + return (0); + } + req.bmRequestType = UT_WRITE_VENDOR_DEVICE; req.bRequest = UPLCOM_SET_REQUEST; USETW(req.wValue, 0); @@ -583,6 +633,11 @@ uplcom_pl2303_init(struct usb_device *udev, uint8_t chiptype) { int err; + if (chiptype == TYPE_PL2303HXN) { + /* PL2303HXN doesn't need this initialization sequence */ + return (0); + } + if (uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) || uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404, 0, 0) || uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1) @@ -729,7 +784,7 @@ uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) * * The PL2303 can only set specific baud rates, up to 1228800 baud. * The PL2303HX can set any baud rate up to 6Mb. - * The PL2303HX rev. D can set any baud rate up to 12Mb. + * The PL2303HX rev. D and PL2303HXN can set any baud rate up to 12Mb. * */ @@ -737,6 +792,10 @@ uplcom_pre_param(struct ucom_softc *ucom, struct termios *t) if (t->c_ospeed & 0x80000000) return 0; switch (sc->sc_chiptype) { + case TYPE_PL2303HXN: + if (t->c_ospeed <= 12000000) + return (0); + break; case TYPE_PL2303HXD: if (t->c_ospeed <= 12000000) return (0); @@ -873,21 +932,34 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termios *t) DPRINTF("crtscts = on\n"); req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = UPLCOM_SET_REQUEST; - USETW(req.wValue, 0); - if (sc->sc_chiptype != TYPE_PL2303) - USETW(req.wIndex, UPLCOM_SET_CRTSCTS_PL2303X); - else - USETW(req.wIndex, UPLCOM_SET_CRTSCTS); + if (sc->sc_chiptype == TYPE_PL2303HXN) { + req.bRequest = UPLCOM_SET_REQUEST_PL2303HXN; + USETW(req.wValue, UPLCOM_CRTSCTS_REG_PL2303HXN); + USETW(req.wIndex, UPLCOM_SET_CRTSCTS_PL2303HXN); + } else { + req.bRequest = UPLCOM_SET_REQUEST; + USETW(req.wValue, 0); + if (sc->sc_chiptype != TYPE_PL2303) + USETW(req.wIndex, UPLCOM_SET_CRTSCTS_PL2303X); + else + USETW(req.wIndex, UPLCOM_SET_CRTSCTS); + } USETW(req.wLength, 0); ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, &req, NULL, 0, 1000); } else { req.bmRequestType = UT_WRITE_VENDOR_DEVICE; - req.bRequest = UPLCOM_SET_REQUEST; - USETW(req.wValue, 0); - USETW(req.wIndex, 0); + if (sc->sc_chiptype == TYPE_PL2303HXN) { + req.bRequest = UPLCOM_SET_REQUEST_PL2303HXN; + USETW(req.wValue, UPLCOM_CRTSCTS_REG_PL2303HXN); + USETW(req.wIndex, UPLCOM_CLEAR_CRTSCTS_PL2303HXN); + } + else { + req.bRequest = UPLCOM_SET_REQUEST; + USETW(req.wValue, 0); + USETW(req.wIndex, 0); + } USETW(req.wLength, 0); ucom_cfg_do_request(sc->sc_udev, &sc->sc_ucom, &req, NULL, 0, 1000); diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 8ea76d44ce14..ab1d1339d587 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -3795,6 +3795,12 @@ product PROLIFIC MICROMAX_610U 0x0612 Micromax 610U product PROLIFIC DCU11 0x1234 DCU-11 Phone Cable product PROLIFIC UIC_MSR206 0x206a UIC MSR206 Card Reader product PROLIFIC PL2303 0x2303 PL2303 Serial (ATEN/IOGEAR UC232A) +product PROLIFIC PL2303GC 0x23a3 PL2303HXN Serial, type GC +product PROLIFIC PL2303GB 0x23b3 PL2303HXN Serial, type GB +product PROLIFIC PL2303GT 0x23c3 PL2303HXN Serial, type GT +product PROLIFIC PL2303GL 0x23d3 PL2303HXN Serial, type GL +product PROLIFIC PL2303GE 0x23e3 PL2303HXN Serial, type GE +product PROLIFIC PL2303GS 0x23f3 PL2303HXN Serial, type GS product PROLIFIC PL2305 0x2305 Parallel printer product PROLIFIC ATAPI4 0x2307 ATAPI-4 Controller product PROLIFIC PL2501 0x2501 PL2501 Host-Host interface From owner-dev-commits-src-all@freebsd.org Thu Jan 7 15:02:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7D55C4D3538; Thu, 7 Jan 2021 15:02:10 +0000 (UTC) (envelope-from git@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 4DBTwf36c1z59Qj; Thu, 7 Jan 2021 15:02:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DA4713150; Thu, 7 Jan 2021 15:02:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107F2ASO020142; Thu, 7 Jan 2021 15:02:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107F2A2k020141; Thu, 7 Jan 2021 15:02:10 GMT (envelope-from git) Date: Thu, 7 Jan 2021 15:02:10 GMT Message-Id: <202101071502.107F2A2k020141@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: f45f9ef05103 - main - arm64 GENERIC: sort to match amd64, to ease comparison MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f45f9ef05103c5d8ffcd9c15b3f0b36af4839903 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 15:02:10 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f45f9ef05103c5d8ffcd9c15b3f0b36af4839903 commit f45f9ef05103c5d8ffcd9c15b3f0b36af4839903 Author: Ed Maste AuthorDate: 2021-01-06 17:45:52 +0000 Commit: Ed Maste CommitDate: 2021-01-07 15:01:48 +0000 arm64 GENERIC: sort to match amd64, to ease comparison No functional change - only moved lines, changed whitespace, and updated comments. Reviewed by: allanjude MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28001 --- sys/arm64/conf/GENERIC | 201 +++++++++++++++++++++++++------------------------ 1 file changed, 102 insertions(+), 99 deletions(-) diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index 9b9b44ef3261..f7f446c6c881 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -30,10 +30,10 @@ options PREEMPTION # Enable kernel thread preemption options VIMAGE # Subsystem virtualization, e.g. VNET options INET # InterNETworking options INET6 # IPv6 communications protocols -options ROUTE_MPATH # Multipath routing support options IPSEC_SUPPORT # Allow kldload of ipsec and tcpmd5 -options TCP_HHOOK # hhook(9) framework for TCP +options ROUTE_MPATH # Multipath routing support options TCP_OFFLOAD # TCP offload +options TCP_HHOOK # hhook(9) framework for TCP options TCP_RFC7413 # TCP Fast Open options SCTP_SUPPORT # Allow kldload of SCTP options FFS # Berkeley Fast Filesystem @@ -54,6 +54,7 @@ options PSEUDOFS # Pseudo-filesystem framework options TMPFS # Efficient memory filesystem options GEOM_RAID # Soft RAID functionality. options GEOM_LABEL # Provides labelization +options EFIRT # EFI Runtime Services support options COMPAT_FREEBSD32 # Compatible with FreeBSD/arm options COMPAT_FREEBSD11 # Compatible with FreeBSD11 options COMPAT_FREEBSD12 # Compatible with FreeBSD12 @@ -78,7 +79,6 @@ options VFP # Floating-point support options RACCT # Resource accounting framework options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default options RCTL # Resource limits -options SMP options INTRNG options LINUX_BOOT_ABI # Boot using booti command from U-Boot @@ -95,7 +95,6 @@ options WITNESS # Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones options ALT_BREAK_TO_DEBUGGER # Enter debugger on keyboard escape sequence -options USB_DEBUG # enable debug msgs options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default # Kernel Sanitizers @@ -112,6 +111,9 @@ options ZSTDIO # zstd-compressed kernel and user dumps options DEBUGNET # debugnet networking options NETDUMP # netdump(4) client support +# Make an SMP-capable kernel by default +options SMP # Symmetric MultiProcessor Kernel + # SoC support options SOC_ALLWINNER_A64 options SOC_ALLWINNER_H5 @@ -142,13 +144,6 @@ device al_udma # Universal DMA # Qualcomm Snapdragon drivers device qcom_gcc # Global Clock Controller -# VirtIO support -device virtio -device virtio_pci -device virtio_mmio -device virtio_blk -device vtnet - # CPU frequency control device cpufreq @@ -159,33 +154,6 @@ device al_pci # Annapurna Alpine PCI-E options PCI_HP # PCI-Express native HotPlug options PCI_IOV # PCI SR-IOV support -# PCI/PCI-X/PCIe Ethernet NICs that use iflib infrastructure -device iflib -device em # Intel PRO/1000 Gigabit Ethernet Family -device ix # Intel 10Gb Ethernet Family - -# Ethernet NICs -device mdio -device mii -device miibus # MII bus support -device awg # Allwinner EMAC Gigabit Ethernet -device axa # AMD Opteron A1100 integrated NIC -device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet -device neta # Marvell Armada 370/38x/XP/3700 NIC -device re # RealTek 8139C+/8169/8169S/8110S -device smc # SMSC LAN91C111 -device vnic # Cavium ThunderX NIC -device al_eth # Annapurna Alpine Ethernet NIC -device dwc_rk # Rockchip Designware -device dwc_socfpga # Altera SOCFPGA Ethernet MAC -device genet # Broadcom on RPi4 -device ffec # iMX FFEC - -# Etherswitch devices -device etherswitch # Enable etherswitch support -device miiproxy # Required for etherswitch -device e6000sw # Marvell mv88e6085 based switches - # Block devices device ahci device scbus @@ -200,58 +168,6 @@ device nvme # base NVMe driver options NVME_USE_NVD=0 # prefer the cam(4) based nda(4) driver device nvd # expose NVMe namespaces as disks, depends on nvme -# MMC/SD/SDIO Card slot support -device sdhci -device sdhci_xenon # Marvell Xenon SD/MMC controller -device aw_mmc # Allwinner SD/MMC controller -device mmc # mmc/sd bus -device mmcsd # mmc/sd flash cards -device dwmmc -device dwmmc_altera -device dwmmc_hisi -device rk_dwmmc -device rk_emmcphy - -# Serial (COM) ports -device uart # Generic UART driver -device uart_imx # iMX8 UART -device uart_msm # Qualcomm MSM UART driver -device uart_mu # RPI3 aux port -device uart_mvebu # Armada 3700 UART driver -device uart_ns8250 # ns8250-type UART driver -device uart_snps -device pl011 - -# USB support -options USB_HOST_ALIGN=64 # Align usb buffers to cache line size. -device aw_usbphy # Allwinner USB PHY -device rk_usb2phy # Rockchip USB2PHY -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) -device dwc3 # Synopsys DWC controller -device aw_dwc3 # Allwinner DWC3 controller -device rk_dwc3 # Rockchip DWC3 controller -device usb # USB Bus (required) -device ukbd # Keyboard -device umass # Disks/Mass storage - Requires scbus and da -device tegra210_xusb_fw # Tegra XUSB firmware - -# USB ethernet support -device muge -device smcphy -device smsc -device ure - -# Sound support -device sound -device a10_codec - # DMA controller device a31_dmac @@ -340,16 +256,53 @@ options EVDEV_SUPPORT # evdev support in legacy drivers device uinput # install /dev/uinput cdev device aw_cir +# Serial (COM) ports +device uart # Generic UART driver +device uart_imx # iMX8 UART +device uart_msm # Qualcomm MSM UART driver +device uart_mu # RPI3 aux port +device uart_mvebu # Armada 3700 UART driver +device uart_ns8250 # ns8250-type UART driver +device uart_snps +device pl011 + +# PCI/PCI-X/PCIe Ethernet NICs that use iflib infrastructure +device iflib +device em # Intel PRO/1000 Gigabit Ethernet Family +device ix # Intel 10Gb Ethernet Family + +# Ethernet NICs +device mdio +device mii +device miibus # MII bus support +device al_eth # Annapurna Alpine Ethernet NIC +device awg # Allwinner EMAC Gigabit Ethernet +device axa # AMD Opteron A1100 integrated NIC +device dwc_rk # Rockchip Designware +device dwc_socfpga # Altera SOCFPGA Ethernet MAC +device ffec # iMX FFEC +device genet # Broadcom on RPi4 +device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet +device neta # Marvell Armada 370/38x/XP/3700 NIC +device re # RealTek 8139C+/8169/8169S/8110S +device smc # SMSC LAN91C111 +device vnic # Cavium ThunderX NIC + +# Etherswitch devices +device etherswitch # Enable etherswitch support +device miiproxy # Required for etherswitch +device e6000sw # Marvell mv88e6085 based switches + + # Pseudo devices. -device crypto # core crypto support -device loop # Network loopback -device ether # Ethernet support -device vlan # 802.1Q VLAN support -device tuntap # Packet tunnel. -device md # Memory "disks" -device gif # IPv6 and IPv4 tunneling -device firmware # firmware assist module -options EFIRT # EFI Runtime Services +device crypto # core crypto support +device loop # Network loopback +device ether # Ethernet support +device vlan # 802.1Q VLAN support +device tuntap # Packet tunnel. +device md # Memory "disks" +device gif # IPv6 and IPv4 tunneling +device firmware # firmware assist module # EXT_RESOURCES pseudo devices options EXT_RESOURCES @@ -369,6 +322,56 @@ device rk_iodomain # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter +# USB support +options USB_DEBUG # enable debug msgs +options USB_HOST_ALIGN=64 # Align usb buffers to cache line size. +device aw_usbphy # Allwinner USB PHY +device rk_usb2phy # Rockchip USB2PHY +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) +device dwc3 # Synopsys DWC controller +device aw_dwc3 # Allwinner DWC3 controller +device rk_dwc3 # Rockchip DWC3 controller +device usb # USB Bus (required) +device ukbd # Keyboard +device umass # Disks/Mass storage - Requires scbus and da +device tegra210_xusb_fw # Tegra XUSB firmware + +# USB ethernet support +device muge +device smcphy +device smsc +device ure + +# Sound support +device sound +device a10_codec + +# MMC/SD/SDIO Card slot support +device sdhci +device sdhci_xenon # Marvell Xenon SD/MMC controller +device aw_mmc # Allwinner SD/MMC controller +device mmc # mmc/sd bus +device mmcsd # mmc/sd flash cards +device dwmmc +device dwmmc_altera +device dwmmc_hisi +device rk_dwmmc +device rk_emmcphy + +# VirtIO support +device virtio +device virtio_pci +device virtio_mmio +device virtio_blk +device vtnet + # Chip-specific errata options THUNDERX_PASS_1_1_ERRATA From owner-dev-commits-src-all@freebsd.org Thu Jan 7 15:24:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9DCB64D3C30 for ; Thu, 7 Jan 2021 15:24:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) (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 4DBVQ73rwzz3CZ0 for ; Thu, 7 Jan 2021 15:24:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72b.google.com with SMTP id d14so5644215qkc.13 for ; Thu, 07 Jan 2021 07:24:15 -0800 (PST) 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=1o1hoIJDBeMuM1JVaY93JMg7XKoBTrLcsaCIqR+8ymU=; b=umnUEAanxSgg4ZNmCO/ORa3aLURj6yBl67efBUEH/lvsPB4oB5QlhIDHxJ/A8C2jlI lfWigvtv48GCHrhO9aXCmFrFpZ2w/zwHU+YZso7lOBVxe0WL5NP/lvON7xK34V2ojhej 4L9xd1fR3WRGRFUndHsBWE+Z+/Mdkbu8GYtr8Sop9LB49IBRnYmG0fjLM4SJFH40XYfr NFdke1C0zVGvw0IfuJBnI5MD4heTpVZaTr5G4k7bjghMf8M2QJg0kVuxuCN/1EOxViJy k1OAojlfR9LS9a8rcoNBH7C0gLLWzTHuXCMGjDE3cbqPaX/q1FQzz7fAvVEde3mO9tn6 kjeA== 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=1o1hoIJDBeMuM1JVaY93JMg7XKoBTrLcsaCIqR+8ymU=; b=oClRdSleYnxDXIk11Ytio+FgeiN/7NLlk2YKblThWvj5ZtLCiSfQbOXJDEa7FmBauO ljvR28k5HU9RzJ/yi9tLe7Cuzf0WDj4JIXmkvzt17RGhmA26JPXtVUYK/3khBnx7XKKL n2uL1/ep/OLrMBzqv6GK5fz9RGvfU4xvKd4SBwe+betC/802OY5JF9E5qdn0e6hisRxv 4HuFR+MQ9chFB7T8ZxnR7P3Qr6n2GuctBTrIyzr0N2Sk7+UhGR1ee/QjEx50HYNVDmaI NjBG0skX4kYakreIU8iKeenEWOKeLzizq1IGLPP3OXgA0FyX4BtUae1ICU+aNEUY7Vw+ DFKA== X-Gm-Message-State: AOAM533KMzkk6GlOSLmQd3qJG1K1ZiPQ/lrwLiZ+m4pMcjipw1Utlc08 4fYvPqEWsoubTSm4r6u4eT4+N7M4t7iP9qf4pWuHJg== X-Google-Smtp-Source: ABdhPJz34h3upQWrTh/vgGzhVgWeW0ljD7Lt4Ka+DbHQM/MARBXt+t+0w8MfpVi0ItdrcWdxkr3tVrJIZYB/rs08rRU= X-Received: by 2002:ae9:ebd5:: with SMTP id b204mr9296724qkg.195.1610033054456; Thu, 07 Jan 2021 07:24:14 -0800 (PST) MIME-Version: 1.0 References: <202012311717.0BVHHp4G092948@gitrepo.freebsd.org> In-Reply-To: From: Warner Losh Date: Thu, 7 Jan 2021 08:24:02 -0700 Message-ID: Subject: Re: git: ac5f382a9d0a - main - stand: properly declare subdir deps or .WAIT, do parallel build To: Kyle Evans Cc: Peter Jeremy , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4DBVQ73rwzz3CZ0 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 15:24:15 -0000 On Thu, Jan 7, 2021, 6:34 AM Kyle Evans wrote: > On Thu, Jan 7, 2021 at 1:50 AM Peter Jeremy wrote: > > > > On 2020-Dec-31 17:17:51 +0000, Kyle Evans wrote: > > >The branch main has been updated by kevans: > > > > > >URL: > https://cgit.FreeBSD.org/src/commit/?id=ac5f382a9d0a26685b92b49abb845d3b30ea5f91 > > > > > >commit ac5f382a9d0a26685b92b49abb845d3b30ea5f91 > > >Author: Kyle Evans > > >AuthorDate: 2020-12-31 17:15:45 +0000 > > >Commit: Kyle Evans > > >CommitDate: 2020-12-31 17:15:45 +0000 > > > > This commit adds fdt as a hard dependency for efi but leaves fdt as > > optionally built based on WITH_FDT. As a result, adding WITHOUT_FDT=yes > > causes the build to fail: > > make[3]: don't know how to make all_subdir_stand/fdt. Stop > > > > Either MK_FDT needs to be forced on by MK_EFI or the dependency needs to > > be made conditional. > > > > Ah, yes, sorry- will fix. It looks like that should be the only other > conditional dep that I missed here. The latter option is what we opt > for here- > We should add the missing items in our test matrix for tools/boot/universe.sh Warner Thanks, > > Kyle Evans > From owner-dev-commits-src-all@freebsd.org Thu Jan 7 16:18:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B5A7C4D51ED; Thu, 7 Jan 2021 16:18:02 +0000 (UTC) (envelope-from git@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 4DBWcB4rjsz3GWm; Thu, 7 Jan 2021 16:18:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 949F713FF9; Thu, 7 Jan 2021 16:18:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107GI2dI011179; Thu, 7 Jan 2021 16:18:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107GI2ld011178; Thu, 7 Jan 2021 16:18:02 GMT (envelope-from git) Date: Thu, 7 Jan 2021 16:18:02 GMT Message-Id: <202101071618.107GI2ld011178@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: f309bd633bfc - main - src.conf.5: regenerate after MK_WERROR change MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f309bd633bfcaea0d1b0428290d90dba96c2c02a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 16:18:02 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=f309bd633bfcaea0d1b0428290d90dba96c2c02a commit f309bd633bfcaea0d1b0428290d90dba96c2c02a Author: Alex Richardson AuthorDate: 2021-01-07 16:15:58 +0000 Commit: Alex Richardson CommitDate: 2021-01-07 16:15:58 +0000 src.conf.5: regenerate after MK_WERROR change This was missed in 7fa2f2a62f04f095e1e27ad55aa22a8f59b1df8f. --- share/man/man5/src.conf.5 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 0461a76c94b5..fa44fac74a51 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd December 25, 2020 +.Dd January 7, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1691,6 +1691,10 @@ Set this to not add warning flags to the compiler invocations. Useful as a temporary workaround when code enters the tree which triggers warnings in environments that differ from the original developer. +.It Va WITHOUT_WERROR +Set this to not treat compiler warnings as errors. +Useful as a temporary workaround when working on fixing compiler warnings. +When set, warnings are still printed in the build log but do not fail the build. .It Va WITHOUT_WIRELESS Set to not build programs used for 802.11 wireless networks; especially .Xr wpa_supplicant 8 From owner-dev-commits-src-all@freebsd.org Thu Jan 7 16:52:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 815944D5BE0; Thu, 7 Jan 2021 16:52:19 +0000 (UTC) (envelope-from git@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 4DBXMl2zJlz3JyF; Thu, 7 Jan 2021 16:52:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59725145C3; Thu, 7 Jan 2021 16:52:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107GqJhT059442; Thu, 7 Jan 2021 16:52:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107GqJ76059441; Thu, 7 Jan 2021 16:52:19 GMT (envelope-from git) Date: Thu, 7 Jan 2021 16:52:19 GMT Message-Id: <202101071652.107GqJ76059441@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Neel Chauhan Subject: git: 4d64c7243d26 - main - Fix the bug in committers-ports.dot with my mentor. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d64c7243d266091aa41379f7b5fb8532ae16d5d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 16:52:19 -0000 The branch main has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4d64c7243d266091aa41379f7b5fb8532ae16d5d commit 4d64c7243d266091aa41379f7b5fb8532ae16d5d Author: Neel Chauhan AuthorDate: 2021-01-07 15:52:11 +0000 Commit: Neel Chauhan CommitDate: 2021-01-07 16:51:25 +0000 Fix the bug in committers-ports.dot with my mentor. Reviewed by: 0mp Approved by: 0mp (mentor) Differential Revision: https://reviews.freebsd.org/D28022 --- share/misc/committers-ports.dot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/misc/committers-ports.dot b/share/misc/committers-ports.dot index 5bb8be40d4e7..aba3225de23c 100644 --- a/share/misc/committers-ports.dot +++ b/share/misc/committers-ports.dot @@ -298,7 +298,7 @@ znerd [label="Ernst de Haan\nznerd@FreeBSD.org\n2001/11/15"] # Group together all the mentees for a particular mentor. # Keep the list sorted by mentor login. -0mp -> nc +"0mp" -> nc adamw -> ahze adamw -> jylefort From owner-dev-commits-src-all@freebsd.org Thu Jan 7 17:46:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2D7234D715F; Thu, 7 Jan 2021 17:46:56 +0000 (UTC) (envelope-from git@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 4DBYZm0p00z3MG9; Thu, 7 Jan 2021 17:46:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EB7B15311; Thu, 7 Jan 2021 17:46:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107Hkts4027209; Thu, 7 Jan 2021 17:46:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107Hkt7s027208; Thu, 7 Jan 2021 17:46:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 17:46:55 GMT Message-Id: <202101071746.107Hkt7s027208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: a2fc8ade1057 - main - isci: use maxphys rather than 128KB to size s/g list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2fc8ade10577cd35a6000fdb6e7dd7c570852d6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 17:46:56 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=a2fc8ade10577cd35a6000fdb6e7dd7c570852d6 commit a2fc8ade10577cd35a6000fdb6e7dd7c570852d6 Author: Andrew Gallatin AuthorDate: 2021-01-07 17:45:46 +0000 Commit: Andrew Gallatin CommitDate: 2021-01-07 17:45:46 +0000 isci: use maxphys rather than 128KB to size s/g list In the conversion into a tunable, we converted the size of the s/g list used by the driver to be based off of a hardcoded size of 128k rather than maxphys, this caused performance problems for us. Revert this to use the maxphys tunable. Note that this constant is used to size dynamically allocated things, and not static data structs, so this is safe. Reviewed By: imp, kib, mav Tested By:i dhw Differential Revision: https://reviews.freebsd.org/D28023 Sponsored by: Netflix --- sys/dev/isci/scil/sci_controller_constants.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/isci/scil/sci_controller_constants.h b/sys/dev/isci/scil/sci_controller_constants.h index 40f6b983601d..47712c531986 100644 --- a/sys/dev/isci/scil/sci_controller_constants.h +++ b/sys/dev/isci/scil/sci_controller_constants.h @@ -157,7 +157,7 @@ extern "C" { * posted to hardware always contain pairs of elements (with second * element set to zeroes if not needed). */ -#define __MAXPHYS_ELEMENTS ((128 * 1024 / PAGE_SIZE) + 1) +#define __MAXPHYS_ELEMENTS ((maxphys / PAGE_SIZE) + 1) #define SCI_MAX_SCATTER_GATHER_ELEMENTS ((__MAXPHYS_ELEMENTS + 1) & ~0x1) #endif From owner-dev-commits-src-all@freebsd.org Thu Jan 7 18:16:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 65B0E4D7D50; Thu, 7 Jan 2021 18:16: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 4DBZF809qFz3P1T; Thu, 7 Jan 2021 18:16:43 +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 107IGYQk070524 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 7 Jan 2021 20:16:37 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 107IGYQk070524 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 107IGXkd070523; Thu, 7 Jan 2021 20:16:33 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 7 Jan 2021 20:16:33 +0200 From: Konstantin Belousov To: Mateusz Piotrowski <0mp@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 74bd20769706 - main - Reference newfs_msdos(8) from the newfs(8) manual Message-ID: References: <202101070924.1079OE4g081849@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202101070924.1079OE4g081849@gitrepo.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: 4DBZF809qFz3P1T X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 18:16:44 -0000 On Thu, Jan 07, 2021 at 09:24:14AM +0000, Mateusz Piotrowski wrote: > The branch main has been updated by 0mp (doc, ports committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=74bd20769706041108a573601cf0b61c755bdc56 > > commit 74bd20769706041108a573601cf0b61c755bdc56 > Author: Mateusz Piotrowski <0mp@FreeBSD.org> > AuthorDate: 2021-01-07 09:22:20 +0000 > Commit: Mateusz Piotrowski <0mp@FreeBSD.org> > CommitDate: 2021-01-07 09:24:07 +0000 > > Reference newfs_msdos(8) from the newfs(8) manual Why ? newfs is not the interface to create arbitrary kind of filesystem, it is just UFS writer. From owner-dev-commits-src-all@freebsd.org Thu Jan 7 18:20:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B08EB4D7CFB; Thu, 7 Jan 2021 18:20:44 +0000 (UTC) (envelope-from git@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 4DBZKm4ZGcz3PJy; Thu, 7 Jan 2021 18:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E68F15635; Thu, 7 Jan 2021 18:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107IKijS073841; Thu, 7 Jan 2021 18:20:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107IKiQL073840; Thu, 7 Jan 2021 18:20:44 GMT (envelope-from git) Date: Thu, 7 Jan 2021 18:20:44 GMT Message-Id: <202101071820.107IKiQL073840@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: ceaf1713927d - stable/12 - o In iflib_txq_drain(): - Remove desc_used, which is only ever written to. - Remove a dead store to reclaimed. - Don't recycle avail. - Sort variables according to style(9). These changes will make a subsequent commit easier to read. o In iflib_tx_credits_update(), don't bother checking whether the ift_txd_credits_update method pointer is NULL; _iflib_pre_assert() asserts upfront that this method has been assigned and functions like iflib_{fast_intr_rxtx,netmap_timer_adjust,txq_can_drain}() and _task_fn_tx() were already unconditionally relying on the method being callable. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ceaf1713927d99da35cb3e75f879a4706b9f53a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 18:20:44 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=ceaf1713927d99da35cb3e75f879a4706b9f53a2 commit ceaf1713927d99da35cb3e75f879a4706b9f53a2 Author: Marius Strobl AuthorDate: 2019-06-26 15:28:21 +0000 Commit: Alexander Motin CommitDate: 2021-01-07 18:17:41 +0000 o In iflib_txq_drain(): - Remove desc_used, which is only ever written to. - Remove a dead store to reclaimed. - Don't recycle avail. - Sort variables according to style(9). These changes will make a subsequent commit easier to read. o In iflib_tx_credits_update(), don't bother checking whether the ift_txd_credits_update method pointer is NULL; _iflib_pre_assert() asserts upfront that this method has been assigned and functions like iflib_{fast_intr_rxtx,netmap_timer_adjust,txq_can_drain}() and _task_fn_tx() were already unconditionally relying on the method being callable. (cherry picked from commit c2c5d1e7874dd2928bc5e85912e59541741f74a3) --- sys/net/iflib.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index eddfb9bc8f9b..3e115e992e4a 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -3664,10 +3664,10 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) iflib_txq_t txq = r->cookie; if_ctx_t ctx = txq->ift_ctx; if_t ifp = ctx->ifc_ifp; - struct mbuf **mp, *m; - int i, count, consumed, pkt_sent, bytes_sent, mcast_sent, avail; - int reclaimed, err, in_use_prev, desc_used; - bool do_prefetch, ring, rang; + struct mbuf *m, **mp; + int avail, bytes_sent, consumed, count, err, i, in_use_prev; + int mcast_sent, pkt_sent, reclaimed, txq_avail; + bool do_prefetch, rang, ring; if (__predict_false(!(if_getdrvflags(ifp) & IFF_DRV_RUNNING) || !LINK_ACTIVE(ctx))) { @@ -3705,16 +3705,15 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) avail, ctx->ifc_flags, TXQ_AVAIL(txq)); #endif do_prefetch = (ctx->ifc_flags & IFC_PREFETCH); - avail = TXQ_AVAIL(txq); + txq_avail = TXQ_AVAIL(txq); err = 0; - for (desc_used = i = 0; i < count && avail > MAX_TX_DESC(ctx) + 2; i++) { + for (i = 0; i < count && txq_avail > MAX_TX_DESC(ctx) + 2; i++) { int rem = do_prefetch ? count - i : 0; mp = _ring_peek_one(r, cidx, i, rem); MPASS(mp != NULL && *mp != NULL); if (__predict_false(*mp == (struct mbuf *)txq)) { consumed++; - reclaimed++; continue; } in_use_prev = txq->ift_in_use; @@ -3733,10 +3732,9 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) DBG_COUNTER_INC(tx_sent); bytes_sent += m->m_pkthdr.len; mcast_sent += !!(m->m_flags & M_MCAST); - avail = TXQ_AVAIL(txq); + txq_avail = TXQ_AVAIL(txq); txq->ift_db_pending += (txq->ift_in_use - in_use_prev); - desc_used += (txq->ift_in_use - in_use_prev); ETHER_BPF_MTAP(ifp, m); if (__predict_false(!(ifp->if_drv_flags & IFF_DRV_RUNNING))) break; @@ -6269,9 +6267,6 @@ iflib_tx_credits_update(if_ctx_t ctx, iflib_txq_t txq) int credits_pre = txq->ift_cidx_processed; #endif - if (ctx->isc_txd_credits_update == NULL) - return (0); - bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map, BUS_DMASYNC_POSTREAD); if ((credits = ctx->isc_txd_credits_update(ctx->ifc_softc, txq->ift_id, true)) == 0) From owner-dev-commits-src-all@freebsd.org Thu Jan 7 18:20:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BF50C4D79F7; Thu, 7 Jan 2021 18:20:44 +0000 (UTC) (envelope-from git@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 4DBZKm53BMz3Nws; Thu, 7 Jan 2021 18:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F8B51553E; Thu, 7 Jan 2021 18:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107IKigs073859; Thu, 7 Jan 2021 18:20:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107IKiNS073857; Thu, 7 Jan 2021 18:20:44 GMT (envelope-from git) Date: Thu, 7 Jan 2021 18:20:44 GMT Message-Id: <202101071820.107IKiNS073857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 6bebabe0943e - stable/12 - V_ip6_forwarding and V_ipforwarding have been defined in ip6_var.h / ip_var.h since at least 2008, so make use of those definitions here. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6bebabe0943e0774dbf8e9ef7c052200272323a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 18:20:44 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=6bebabe0943e0774dbf8e9ef7c052200272323a5 commit 6bebabe0943e0774dbf8e9ef7c052200272323a5 Author: Marko Zec AuthorDate: 2019-06-19 08:49:24 +0000 Commit: Alexander Motin CommitDate: 2021-01-07 17:42:46 +0000 V_ip6_forwarding and V_ipforwarding have been defined in ip6_var.h / ip_var.h since at least 2008, so make use of those definitions here. (cherry picked from commit 188adcb7e471a228398a6d879c65ca5e65333c1c) --- sys/net/iflib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 4b5e73ce08e0..eddfb9bc8f9b 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -2767,10 +2767,10 @@ iflib_get_ip_forwarding(struct lro_ctrl *lc, bool *v4, bool *v6) { CURVNET_SET(lc->ifp->if_vnet); #if defined(INET6) - *v6 = VNET(ip6_forwarding); + *v6 = V_ip6_forwarding; #endif #if defined(INET) - *v4 = VNET(ipforwarding); + *v4 = V_ipforwarding; #endif CURVNET_RESTORE(); } From owner-dev-commits-src-all@freebsd.org Thu Jan 7 18:20:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CFEB84D7CFF; Thu, 7 Jan 2021 18:20:44 +0000 (UTC) (envelope-from git@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 4DBZKm5Xwzz3PH1; Thu, 7 Jan 2021 18:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B14581553F; Thu, 7 Jan 2021 18:20:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107IKiXj073877; Thu, 7 Jan 2021 18:20:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107IKi6N073876; Thu, 7 Jan 2021 18:20:44 GMT (envelope-from git) Date: Thu, 7 Jan 2021 18:20:44 GMT Message-Id: <202101071820.107IKi6N073876@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 896ccd678d18 - stable/12 - Evaluating htons() at compile time is more efficient than doing ntohs() at runtime. This change removes a dependency on a barrel shifter pass before branch resolution, while reducing the instruction stream size by 9 bytes on amd64. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 896ccd678d1837f7c39b4c0a617a081f2c168443 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 18:20:44 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=896ccd678d1837f7c39b4c0a617a081f2c168443 commit 896ccd678d1837f7c39b4c0a617a081f2c168443 Author: Marko Zec AuthorDate: 2019-06-19 08:39:19 +0000 Commit: Alexander Motin CommitDate: 2021-01-07 17:41:12 +0000 Evaluating htons() at compile time is more efficient than doing ntohs() at runtime. This change removes a dependency on a barrel shifter pass before branch resolution, while reducing the instruction stream size by 9 bytes on amd64. (cherry picked from commit 6aee0bfa85685017dbc5050ce36793f7dcd80f82) --- sys/net/iflib.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 24f23a338411..4b5e73ce08e0 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -2784,18 +2784,16 @@ static bool iflib_check_lro_possible(struct mbuf *m, bool v4_forwarding, bool v6_forwarding) { struct ether_header *eh; - uint16_t eh_type; eh = mtod(m, struct ether_header *); - eh_type = ntohs(eh->ether_type); - switch (eh_type) { + switch (eh->ether_type) { #if defined(INET6) - case ETHERTYPE_IPV6: - return !v6_forwarding; + case htons(ETHERTYPE_IPV6): + return (!v6_forwarding); #endif #if defined (INET) - case ETHERTYPE_IP: - return !v4_forwarding; + case htons(ETHERTYPE_IP): + return (!v4_forwarding); #endif } From owner-dev-commits-src-all@freebsd.org Thu Jan 7 18:52:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 183E34D8ADC; Thu, 7 Jan 2021 18:52:36 +0000 (UTC) (envelope-from git@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 4DBb2X02rWz3R8m; Thu, 7 Jan 2021 18:52:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E882216289; Thu, 7 Jan 2021 18:52:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107IqZLr017018; Thu, 7 Jan 2021 18:52:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107IqZ9F017017; Thu, 7 Jan 2021 18:52:35 GMT (envelope-from git) Date: Thu, 7 Jan 2021 18:52:35 GMT Message-Id: <202101071852.107IqZ9F017017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 1790f5e654ff - main - loader: do not update palette in text mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1790f5e654ff20e61d8d83f16773dc0ef3f7da01 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 18:52:36 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=1790f5e654ff20e61d8d83f16773dc0ef3f7da01 commit 1790f5e654ff20e61d8d83f16773dc0ef3f7da01 Author: Toomas Soome AuthorDate: 2021-01-07 07:07:59 +0000 Commit: Toomas Soome CommitDate: 2021-01-07 15:07:53 +0000 loader: do not update palette in text mode Apparently palette update while in text mode, will cause some adapters to end up with blank display. --- stand/i386/libi386/vidconsole.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/i386/libi386/vidconsole.c b/stand/i386/libi386/vidconsole.c index a965c1d2e4f2..47150b3dd09f 100644 --- a/stand/i386/libi386/vidconsole.c +++ b/stand/i386/libi386/vidconsole.c @@ -936,7 +936,7 @@ cons_update_mode(bool use_gfx_mode) gfx_state.tg_fb.fb_mask_green >> goff, goff, gfx_state.tg_fb.fb_mask_blue >> boff, boff); - if (gfx_state.tg_ctype == CT_INDEXED) + if (gfx_state.tg_ctype == CT_INDEXED && !use_gfx_mode) vidc_load_palette(); teken_set_winsize(&gfx_state.tg_teken, &gfx_state.tg_tp); From owner-dev-commits-src-all@freebsd.org Thu Jan 7 19:36:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 499EE4D94F5; Thu, 7 Jan 2021 19:36:21 +0000 (UTC) (envelope-from git@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 4DBc111bn2z3kDD; Thu, 7 Jan 2021 19:36:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2551E16560; Thu, 7 Jan 2021 19:36:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107JaLq0069217; Thu, 7 Jan 2021 19:36:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107JaL8B069216; Thu, 7 Jan 2021 19:36:21 GMT (envelope-from git) Date: Thu, 7 Jan 2021 19:36:21 GMT Message-Id: <202101071936.107JaL8B069216@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 4979620ece98 - main - armv8crypto: add AES-XTS support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4979620ece984ffb10c27c2db7d0e253eb84b2ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 19:36:21 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=4979620ece984ffb10c27c2db7d0e253eb84b2ba commit 4979620ece984ffb10c27c2db7d0e253eb84b2ba Author: Mitchell Horne AuthorDate: 2021-01-07 19:30:40 +0000 Commit: Mitchell Horne CommitDate: 2021-01-07 19:35:20 +0000 armv8crypto: add AES-XTS support A straightforward(ish) port from aesni(4). This implementation does not perform loop unrolling on the input blocks, so this is left as a future performance improvement. Submitted by: Greg V Looks good: jhb, jmg Tested by: mhorne Differential Revision: https://reviews.freebsd.org/D21017 --- sys/crypto/armv8/armv8_crypto.c | 51 +++++++++++++++----- sys/crypto/armv8/armv8_crypto.h | 6 +++ sys/crypto/armv8/armv8_crypto_wrap.c | 92 ++++++++++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+), 11 deletions(-) diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c index 43dafd7b365c..90d096b53b1a 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -114,7 +114,7 @@ armv8_crypto_probe(device_t dev) break; } - device_set_desc_copy(dev, "AES-CBC"); + device_set_desc_copy(dev, "AES-CBC,AES-XTS"); /* TODO: Check more fields as we support more features */ @@ -204,6 +204,17 @@ armv8_crypto_probesession(device_t dev, return (EINVAL); } break; + case CRYPTO_AES_XTS: + if (csp->csp_ivlen != AES_XTS_IV_LEN) + return (EINVAL); + switch (csp->csp_cipher_klen * 8) { + case 256: + case 512: + break; + default: + return (EINVAL); + } + break; default: return (EINVAL); } @@ -211,16 +222,19 @@ armv8_crypto_probesession(device_t dev, default: return (EINVAL); } - return (CRYPTODEV_PROBE_ACCEL_SOFTWARE); + return (CRYPTODEV_PROBE_ACCEL_SOFTWARE); } static void armv8_crypto_cipher_setup(struct armv8_crypto_session *ses, - const struct crypto_session_params *csp) + const struct crypto_session_params *csp, const uint8_t *key, int keylen) { int i; - switch (csp->csp_cipher_klen * 8) { + if (csp->csp_cipher_alg == CRYPTO_AES_XTS) + keylen /= 2; + + switch (keylen * 8) { case 128: ses->rounds = AES128_ROUNDS; break; @@ -231,16 +245,19 @@ armv8_crypto_cipher_setup(struct armv8_crypto_session *ses, ses->rounds = AES256_ROUNDS; break; default: - panic("invalid CBC key length"); + panic("invalid AES key length"); } - rijndaelKeySetupEnc(ses->enc_schedule, csp->csp_cipher_key, - csp->csp_cipher_klen * 8); - rijndaelKeySetupDec(ses->dec_schedule, csp->csp_cipher_key, - csp->csp_cipher_klen * 8); + rijndaelKeySetupEnc(ses->enc_schedule, key, keylen * 8); + rijndaelKeySetupDec(ses->dec_schedule, key, keylen * 8); + if (csp->csp_cipher_alg == CRYPTO_AES_XTS) + rijndaelKeySetupEnc(ses->xts_schedule, key + keylen, keylen * 8); + for (i = 0; i < nitems(ses->enc_schedule); i++) { ses->enc_schedule[i] = bswap32(ses->enc_schedule[i]); ses->dec_schedule[i] = bswap32(ses->dec_schedule[i]); + if (csp->csp_cipher_alg == CRYPTO_AES_XTS) + ses->xts_schedule[i] = bswap32(ses->xts_schedule[i]); } } @@ -259,7 +276,8 @@ armv8_crypto_newsession(device_t dev, crypto_session_t cses, } ses = crypto_get_driver_session(cses); - armv8_crypto_cipher_setup(ses, csp); + armv8_crypto_cipher_setup(ses, csp, csp->csp_cipher_key, + csp->csp_cipher_klen); rw_wunlock(&sc->lock); return (0); } @@ -333,7 +351,8 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, } if (crp->crp_cipher_key != NULL) { - panic("armv8: new cipher key"); + armv8_crypto_cipher_setup(ses, csp, crp->crp_cipher_key, + csp->csp_cipher_klen); } crypto_read_iv(crp, iv); @@ -348,6 +367,16 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, armv8_aes_decrypt_cbc(ses->rounds, ses->dec_schedule, crp->crp_payload_length, buf, iv); break; + case CRYPTO_AES_XTS: + if (encflag) + armv8_aes_encrypt_xts(ses->rounds, ses->enc_schedule, + ses->xts_schedule, crp->crp_payload_length, buf, + buf, iv); + else + armv8_aes_decrypt_xts(ses->rounds, ses->dec_schedule, + ses->xts_schedule, crp->crp_payload_length, buf, + buf, iv); + break; } if (allocated) diff --git a/sys/crypto/armv8/armv8_crypto.h b/sys/crypto/armv8/armv8_crypto.h index 01d31f7cec78..2d0be163b072 100644 --- a/sys/crypto/armv8/armv8_crypto.h +++ b/sys/crypto/armv8/armv8_crypto.h @@ -40,6 +40,7 @@ struct armv8_crypto_session { uint32_t enc_schedule[AES_SCHED_LEN/4]; uint32_t dec_schedule[AES_SCHED_LEN/4]; + uint32_t xts_schedule[AES_SCHED_LEN/4]; int algo; int rounds; }; @@ -49,4 +50,9 @@ void armv8_aes_encrypt_cbc(int, const void *, size_t, const uint8_t *, void armv8_aes_decrypt_cbc(int, const void *, size_t, uint8_t *, const uint8_t[static AES_BLOCK_LEN]); +void armv8_aes_encrypt_xts(int, const void *, const void *, size_t, + const uint8_t *, uint8_t *, const uint8_t[AES_BLOCK_LEN]); +void armv8_aes_decrypt_xts(int, const void *, const void *, size_t, + const uint8_t *, uint8_t *, const uint8_t[AES_BLOCK_LEN]); + #endif /* _ARMV8_CRYPTO_H_ */ diff --git a/sys/crypto/armv8/armv8_crypto_wrap.c b/sys/crypto/armv8/armv8_crypto_wrap.c index 643b2be2cb12..83af3fad40ef 100644 --- a/sys/crypto/armv8/armv8_crypto_wrap.c +++ b/sys/crypto/armv8/armv8_crypto_wrap.c @@ -126,3 +126,95 @@ armv8_aes_decrypt_cbc(int rounds, const void *key_schedule, size_t len, buf += AES_BLOCK_LEN; } } + +#define AES_XTS_BLOCKSIZE 16 +#define AES_XTS_IVSIZE 8 +#define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ + +static inline int32x4_t +xts_crank_lfsr(int32x4_t inp) +{ + const int32x4_t alphamask = {AES_XTS_ALPHA, 1, 1, 1}; + int32x4_t xtweak, ret; + + /* set up xor mask */ + xtweak = vextq_s32(inp, inp, 3); + xtweak = vshrq_n_s32(xtweak, 31); + xtweak &= alphamask; + + /* next term */ + ret = vshlq_n_s32(inp, 1); + ret ^= xtweak; + + return ret; +} + +static void +armv8_aes_crypt_xts_block(int rounds, const uint8x16_t *key_schedule, + uint8x16_t *tweak, const uint8_t *from, uint8_t *to, int do_encrypt) +{ + uint8x16_t block; + + block = vld1q_u8(from) ^ *tweak; + + if (do_encrypt) + block = armv8_aes_enc(rounds - 1, key_schedule, block); + else + block = armv8_aes_dec(rounds - 1, key_schedule, block); + + vst1q_u8(to, block ^ *tweak); + + *tweak = vreinterpretq_u8_s32(xts_crank_lfsr(vreinterpretq_s32_u8(*tweak))); +} + +static void +armv8_aes_crypt_xts(int rounds, const uint8x16_t *data_schedule, + const uint8x16_t *tweak_schedule, size_t len, const uint8_t *from, + uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN], int do_encrypt) +{ + uint8x16_t tweakreg; + uint8_t tweak[AES_XTS_BLOCKSIZE] __aligned(16); + size_t i, cnt; + + /* + * Prepare tweak as E_k2(IV). IV is specified as LE representation + * of a 64-bit block number which we allow to be passed in directly. + */ +#if BYTE_ORDER == LITTLE_ENDIAN + bcopy(iv, tweak, AES_XTS_IVSIZE); + /* Last 64 bits of IV are always zero. */ + bzero(tweak + AES_XTS_IVSIZE, AES_XTS_IVSIZE); +#else +#error Only LITTLE_ENDIAN architectures are supported. +#endif + tweakreg = vld1q_u8(tweak); + tweakreg = armv8_aes_enc(rounds - 1, tweak_schedule, tweakreg); + + cnt = len / AES_XTS_BLOCKSIZE; + for (i = 0; i < cnt; i++) { + armv8_aes_crypt_xts_block(rounds, data_schedule, &tweakreg, + from, to, do_encrypt); + from += AES_XTS_BLOCKSIZE; + to += AES_XTS_BLOCKSIZE; + } +} + +void +armv8_aes_encrypt_xts(int rounds, const void *data_schedule, + const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, + const uint8_t iv[static AES_BLOCK_LEN]) +{ + + armv8_aes_crypt_xts(rounds, data_schedule, tweak_schedule, len, from, to, + iv, 1); +} + +void +armv8_aes_decrypt_xts(int rounds, const void *data_schedule, + const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, + const uint8_t iv[static AES_BLOCK_LEN]) +{ + + armv8_aes_crypt_xts(rounds, data_schedule, tweak_schedule, len, from, to, + iv, 0); +} From owner-dev-commits-src-all@freebsd.org Thu Jan 7 19:38:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 55B1C4D9AFB; Thu, 7 Jan 2021 19:38:26 +0000 (UTC) (envelope-from git@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 4DBc3Q1vf4z3kN4; Thu, 7 Jan 2021 19:38:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 346D0165EB; Thu, 7 Jan 2021 19:38:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107JcQN6069619; Thu, 7 Jan 2021 19:38:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107JcQ8m069618; Thu, 7 Jan 2021 19:38:26 GMT (envelope-from git) Date: Thu, 7 Jan 2021 19:38:26 GMT Message-Id: <202101071938.107JcQ8m069618@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: d68cf57b7f22 - main - Refactor rt_addrmsg() and rt_routemsg(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d68cf57b7f22a38a2b276bff039432d1aa2022f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 19:38:26 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=d68cf57b7f22a38a2b276bff039432d1aa2022f8 commit d68cf57b7f22a38a2b276bff039432d1aa2022f8 Author: Alexander V. Chernikov AuthorDate: 2021-01-07 19:13:52 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-01-07 19:38:19 +0000 Refactor rt_addrmsg() and rt_routemsg(). Summary: * Refactor rt_addrmsg(): make V_rt_add_addr_allfibs decision locally. * Fix rt_routemsg() and multipath by accepting nexthop instead of interface pointer. * Refactor rtsock_routemsg(): avoid accessing rtentry fields directly. * Simplify in_addprefix() by moving prefix search to a separate function. Reviewers: #network Subscribers: imp, ae, bz Differential Revision: https://reviews.freebsd.org/D28011 --- sys/net/route.c | 17 ++++++++++------- sys/net/route.h | 6 +----- sys/net/route/route_ctl.c | 15 ++++++++++++--- sys/net/route/route_ctl.h | 1 + sys/net/route/route_var.h | 7 +++++++ sys/net/rtsock.c | 16 +++++++++------- sys/netinet/in.c | 46 +++++++++++++++++++++++++--------------------- sys/netinet6/in6.c | 2 +- sys/netinet6/nd6_rtr.c | 18 ++++++++++++------ 9 files changed, 78 insertions(+), 50 deletions(-) diff --git a/sys/net/route.c b/sys/net/route.c index 2f4ae40e83aa..b3383f90789b 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -710,10 +710,13 @@ rt_addrmsg(int cmd, struct ifaddr *ifa, int fibnum) KASSERT(cmd == RTM_ADD || cmd == RTM_DELETE, ("unexpected cmd %d", cmd)); - KASSERT(fibnum == RT_ALL_FIBS || (fibnum >= 0 && fibnum < rt_numfibs), + KASSERT((fibnum >= 0 && fibnum < rt_numfibs), ("%s: fib out of range 0 <=%d<%d", __func__, fibnum, rt_numfibs)); EVENTHANDLER_DIRECT_INVOKE(rt_addrmsg, ifa, cmd); + + if (V_rt_add_addr_allfibs) + fibnum = RT_ALL_FIBS; return (rtsock_addrmsg(cmd, ifa, fibnum)); } @@ -721,13 +724,13 @@ rt_addrmsg(int cmd, struct ifaddr *ifa, int fibnum) * Announce kernel-originated route addition/removal to rtsock based on @rt data. * cmd: RTM_ cmd * @rt: valid rtentry - * @ifp: target route interface + * @nh: nhop object to announce * @fibnum: fib id or RT_ALL_FIBS * * Returns 0 on success. */ int -rt_routemsg(int cmd, struct rtentry *rt, struct ifnet *ifp, int rti_addrs, +rt_routemsg(int cmd, struct rtentry *rt, struct nhop_object *nh, int fibnum) { @@ -739,7 +742,7 @@ rt_routemsg(int cmd, struct rtentry *rt, struct ifnet *ifp, int rti_addrs, KASSERT(rt_key(rt) != NULL, (":%s: rt_key must be supplied", __func__)); - return (rtsock_routemsg(cmd, rt, ifp, 0, fibnum)); + return (rtsock_routemsg(cmd, rt, nh, fibnum)); } /* @@ -775,16 +778,16 @@ rt_newaddrmsg_fib(int cmd, struct ifaddr *ifa, struct rtentry *rt, int fibnum) KASSERT(cmd == RTM_ADD || cmd == RTM_DELETE, ("unexpected cmd %u", cmd)); - KASSERT(fibnum == RT_ALL_FIBS || (fibnum >= 0 && fibnum < rt_numfibs), + KASSERT((fibnum >= 0 && fibnum < rt_numfibs), ("%s: fib out of range 0 <=%d<%d", __func__, fibnum, rt_numfibs)); if (cmd == RTM_ADD) { rt_addrmsg(cmd, ifa, fibnum); if (rt != NULL) - rt_routemsg(cmd, rt, ifa->ifa_ifp, 0, fibnum); + rt_routemsg(cmd, rt, nhop_select(rt->rt_nhop, 0), fibnum); } else { if (rt != NULL) - rt_routemsg(cmd, rt, ifa->ifa_ifp, 0, fibnum); + rt_routemsg(cmd, rt, nhop_select(rt->rt_nhop, 0), fibnum); rt_addrmsg(cmd, ifa, fibnum); } } diff --git a/sys/net/route.h b/sys/net/route.h index e9f5b8b9d7f6..96a8e78ecb3a 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -417,7 +417,7 @@ void rt_missmsg(int, struct rt_addrinfo *, int, int); void rt_missmsg_fib(int, struct rt_addrinfo *, int, int, int); void rt_newaddrmsg_fib(int, struct ifaddr *, struct rtentry *, int); int rt_addrmsg(int, struct ifaddr *, int); -int rt_routemsg(int, struct rtentry *, struct ifnet *ifp, int, int); +int rt_routemsg(int, struct rtentry *, struct nhop_object *, int); int rt_routemsg_info(int, struct rt_addrinfo *, int); void rt_newmaddrmsg(int, struct ifmultiaddr *); void rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *); @@ -425,10 +425,6 @@ struct rib_head *rt_table_init(int, int, u_int); void rt_table_destroy(struct rib_head *); u_int rt_tables_get_gen(uint32_t table, sa_family_t family); -int rtsock_addrmsg(int, struct ifaddr *, int); -int rtsock_routemsg(int, struct rtentry *, struct ifnet *ifp, int, int); -int rtsock_routemsg_info(int, struct rt_addrinfo *, int); - struct sockaddr *rtsock_fix_netmask(const struct sockaddr *dst, const struct sockaddr *smask, struct sockaddr_storage *dmask); diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index c0fc3b5f1888..230d23845c64 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -244,6 +244,16 @@ rt_is_host(const struct rtentry *rt) return (rt->rte_flags & RTF_HOST); } +sa_family_t +rt_get_family(const struct rtentry *rt) +{ + const struct sockaddr *dst; + + dst = (const struct sockaddr *)rt_key_const(rt); + + return (dst->sa_family); +} + /* * Returns pointer to nexthop or nexthop group * associated with @rt @@ -1322,11 +1332,10 @@ rib_walk_del(u_int fibnum, int family, rib_filter_f_t *filter_f, void *arg, bool nhg = (struct nhgrp_object *)nh; wn = nhgrp_get_nhops(nhg, &num_nhops); for (int i = 0; i < num_nhops; i++) - rt_routemsg(RTM_DELETE, rt, - wn[i].nh->nh_ifp, 0, fibnum); + rt_routemsg(RTM_DELETE, rt, wn[i].nh, fibnum); } else #endif - rt_routemsg(RTM_DELETE, rt, nh->nh_ifp, 0, fibnum); + rt_routemsg(RTM_DELETE, rt, nh, fibnum); } rtfree(rt); } diff --git a/sys/net/route/route_ctl.h b/sys/net/route/route_ctl.h index da0520fd89f5..c52c6b96e126 100644 --- a/sys/net/route/route_ctl.h +++ b/sys/net/route/route_ctl.h @@ -100,6 +100,7 @@ const struct rtentry *rib_lookup_lpm(uint32_t fibnum, int family, /* rtentry accessors */ bool rt_is_host(const struct rtentry *rt); +sa_family_t rt_get_family(const struct rtentry *); struct nhop_object *rt_get_raw_nhop(const struct rtentry *rt); #ifdef INET struct in_addr; diff --git a/sys/net/route/route_var.h b/sys/net/route/route_var.h index fe299f90714d..427c286a5090 100644 --- a/sys/net/route/route_var.h +++ b/sys/net/route/route_var.h @@ -306,6 +306,13 @@ void nhgrp_ref_object(struct nhgrp_object *nhg); uint32_t nhgrp_get_idx(const struct nhgrp_object *nhg); void nhgrp_free(struct nhgrp_object *nhg); +/* rtsock */ +int rtsock_routemsg(int cmd, struct rtentry *rt, struct nhop_object *nh, + int fibnum); +int rtsock_routemsg_info(int cmd, struct rt_addrinfo *info, int fibnum); +int rtsock_addrmsg(int cmd, struct ifaddr *ifa, int fibnum); + + /* lookup_framework.c */ void fib_grow_rtables(uint32_t new_num_tables); int fib_select_algo_initial(struct rib_head *rh); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 88ae0c0868c8..ba1182d55439 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1591,23 +1591,25 @@ rtsock_addrmsg(int cmd, struct ifaddr *ifa, int fibnum) * Returns 0 on success. */ int -rtsock_routemsg(int cmd, struct rtentry *rt, struct ifnet *ifp, int rti_addrs, +rtsock_routemsg(int cmd, struct rtentry *rt, struct nhop_object *nh, int fibnum) { - struct sockaddr_storage ss; + union sockaddr_union dst, mask; struct rt_addrinfo info; - struct nhop_object *nh; if (V_route_cb.any_count == 0) return (0); - nh = rt->rt_nhop; + int family = rt_get_family(rt); + init_sockaddrs_family(family, &dst.sa, &mask.sa); + export_rtaddrs(rt, &dst.sa, &mask.sa); + bzero((caddr_t)&info, sizeof(info)); - info.rti_info[RTAX_DST] = rt_key(rt); - info.rti_info[RTAX_NETMASK] = rtsock_fix_netmask(rt_key(rt), rt_mask(rt), &ss); + info.rti_info[RTAX_DST] = &dst.sa; + info.rti_info[RTAX_NETMASK] = &mask.sa; info.rti_info[RTAX_GATEWAY] = &nh->gw_sa; info.rti_flags = rt->rte_flags | nhop_get_rtflags(nh); - info.rti_ifp = ifp; + info.rti_ifp = nh->nh_ifp; return (rtsock_routemsg_info(cmd, &info, fibnum)); } diff --git a/sys/netinet/in.c b/sys/netinet/in.c index dd2286195c41..cf6541dca879 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -714,15 +714,15 @@ in_gifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) ? RTF_HOST : 0) /* - * Check if we have a route for the given prefix already or add one accordingly. + * Check if we have a route for the given prefix already. */ -int -in_addprefix(struct in_ifaddr *target, int flags) +static bool +in_hasrtprefix(struct in_ifaddr *target, int flags) { struct rm_priotracker in_ifa_tracker; struct in_ifaddr *ia; struct in_addr prefix, mask, p, m; - int error; + bool result = false; if ((flags & RTF_HOST) != 0) { prefix = target->ia_dstaddr.sin_addr; @@ -758,22 +758,30 @@ in_addprefix(struct in_ifaddr *target, int flags) * interface address, we are done here. */ if (ia->ia_flags & IFA_ROUTE) { - if (V_nosameprefix) { - IN_IFADDR_RUNLOCK(&in_ifa_tracker); - return (EEXIST); - } else { - int fibnum; - - fibnum = V_rt_add_addr_allfibs ? RT_ALL_FIBS : - target->ia_ifp->if_fib; - rt_addrmsg(RTM_ADD, &target->ia_ifa, fibnum); - IN_IFADDR_RUNLOCK(&in_ifa_tracker); - return (0); - } + result = true; + break; } } IN_IFADDR_RUNLOCK(&in_ifa_tracker); + return (result); +} + +int +in_addprefix(struct in_ifaddr *target, int flags) +{ + int error; + + if (in_hasrtprefix(target, flags)) { + if (V_nosameprefix) + return (EEXIST); + else { + rt_addrmsg(RTM_ADD, &target->ia_ifa, + target->ia_ifp->if_fib); + return (0); + } + } + /* * No-one seem to have this prefix route, so we try to insert it. */ @@ -869,11 +877,7 @@ in_scrubprefix(struct in_ifaddr *target, u_int flags) } if ((target->ia_flags & IFA_ROUTE) == 0) { - int fibnum; - - fibnum = V_rt_add_addr_allfibs ? RT_ALL_FIBS : - target->ia_ifp->if_fib; - rt_addrmsg(RTM_DELETE, &target->ia_ifa, fibnum); + rt_addrmsg(RTM_DELETE, &target->ia_ifa, target->ia_ifp->if_fib); /* * Removing address from !IFF_UP interface or diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index a86bdf5a1876..7c572e7b833b 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -186,7 +186,7 @@ in6_newaddrmsg(struct in6_ifaddr *ia, int cmd) if (cmd != RTM_DELETE) info.rti_ifp = V_loif; - fibnum = V_rt_add_addr_allfibs ? RT_ALL_FIBS : ia62ifa(ia)->ifa_ifp->if_fib; + fibnum = ia62ifa(ia)->ifa_ifp->if_fib; if (cmd == RTM_ADD) { rt_addrmsg(cmd, &ia->ia_ifa, fibnum); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 41c9e0251d59..c6317b1ea263 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -698,8 +698,10 @@ defrouter_addreq(struct nd_defrouter *new) NET_EPOCH_ASSERT(); error = rib_action(fibnum, RTM_ADD, &info, &rc); - if (rc.rc_rt != NULL) - rt_routemsg(RTM_ADD, rc.rc_rt, new->ifp, 0, fibnum); + if (rc.rc_rt != NULL) { + struct nhop_object *nh = nhop_select(rc.rc_nh_new, 0); + rt_routemsg(RTM_ADD, rc.rc_rt, nh, fibnum); + } if (error == 0) new->installed = 1; } @@ -736,8 +738,10 @@ defrouter_delreq(struct nd_defrouter *dr) NET_EPOCH_ENTER(et); rib_action(fibnum, RTM_DELETE, &info, &rc); - if (rc.rc_rt != NULL) - rt_routemsg(RTM_DELETE, rc.rc_rt, dr->ifp, 0, fibnum); + if (rc.rc_rt != NULL) { + struct nhop_object *nh = nhop_select(rc.rc_nh_old, 0); + rt_routemsg(RTM_DELETE, rc.rc_rt, nh, fibnum); + } NET_EPOCH_EXIT(et); dr->installed = 0; @@ -2077,7 +2081,8 @@ nd6_prefix_onlink_rtrequest(struct nd_prefix *pr, struct ifaddr *ifa) } pr->ndpr_stateflags |= NDPRF_ONLINK; - rt_routemsg(RTM_ADD, rc.rc_rt, pr->ndpr_ifp, 0, fibnum); + struct nhop_object *nh = nhop_select(rc.rc_nh_new, 0); + rt_routemsg(RTM_ADD, rc.rc_rt, nh, fibnum); } /* Return the last error we got. */ @@ -2224,7 +2229,8 @@ nd6_prefix_offlink(struct nd_prefix *pr) } /* report route deletion to the routing socket. */ - rt_routemsg(RTM_DELETE, rc.rc_rt, ifp, 0, fibnum); + struct nhop_object *nh = nhop_select(rc.rc_nh_old, 0); + rt_routemsg(RTM_DELETE, rc.rc_rt, nh, fibnum); } NET_EPOCH_EXIT(et); error = a_failure; From owner-dev-commits-src-all@freebsd.org Thu Jan 7 19:47:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5DA094DA1F4; Thu, 7 Jan 2021 19:47:37 +0000 (UTC) (envelope-from git@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 4DBcG129M4z3lMv; Thu, 7 Jan 2021 19:47:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D40A16AA2; Thu, 7 Jan 2021 19:47:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107JlbSZ082259; Thu, 7 Jan 2021 19:47:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107JlbQ4082258; Thu, 7 Jan 2021 19:47:37 GMT (envelope-from git) Date: Thu, 7 Jan 2021 19:47:37 GMT Message-Id: <202101071947.107JlbQ4082258@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 40d0971bbe5d - main - arm64: enable build of the ipmi module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40d0971bbe5dbb591bb923d0fbea67fab6f38d30 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 19:47:37 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=40d0971bbe5dbb591bb923d0fbea67fab6f38d30 commit 40d0971bbe5dbb591bb923d0fbea67fab6f38d30 Author: Mitchell Horne AuthorDate: 2021-01-06 20:27:40 +0000 Commit: Mitchell Horne CommitDate: 2021-01-07 19:45:25 +0000 arm64: enable build of the ipmi module Only ACPI attachment is supported for now, some others depend on the presence of smbios(4) support, which we lack on arm64. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28009 --- sys/conf/files.arm64 | 4 ++++ sys/modules/Makefile | 2 +- sys/modules/ipmi/Makefile | 16 ++++++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index f421304b1903..4bb454fd4e2a 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -361,6 +361,10 @@ dev/iicbus/twsi/a10_twsi.c optional twsi fdt dev/iicbus/twsi/twsi.c optional twsi fdt dev/iommu/busdma_iommu.c optional iommu dev/iommu/iommu_gas.c optional iommu +dev/ipmi/ipmi.c optional ipmi +dev/ipmi/ipmi_acpi.c optional ipmi acpi +dev/ipmi/ipmi_kcs.c optional ipmi +dev/ipmi/ipmi_smic.c optional ipmi dev/mbox/mbox_if.m optional soc_brcm_bcm2837 dev/mmc/host/dwmmc.c optional dwmmc fdt dev/mmc/host/dwmmc_altera.c optional dwmmc dwmmc_altera fdt diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 2a294aa68462..49b9960596e9 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -505,6 +505,7 @@ _ibcore= ibcore _ipoib= ipoib _iser= iser .endif +_ipmi= ipmi _mlx4= mlx4 _mlx5= mlx5 .if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \ @@ -682,7 +683,6 @@ _ichwd= ichwd _ida= ida _iir= iir _intelspi= intelspi -_ipmi= ipmi _ips= ips _isci= isci _ipw= ipw diff --git a/sys/modules/ipmi/Makefile b/sys/modules/ipmi/Makefile index 4539dfda3b28..733ac6f30222 100644 --- a/sys/modules/ipmi/Makefile +++ b/sys/modules/ipmi/Makefile @@ -7,11 +7,19 @@ KMOD= ipmi SRCS= ipmi.c SRCS+= bus_if.h device_if.h -.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" -SRCS+= ipmi_kcs.c ipmi_smic.c ipmi_smbios.c ipmi_ssif.c -SRCS+= ipmi_acpi.c ipmi_isa.c ipmi_pci.c ipmi_smbus.c + +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "aarch64" +SRCS+= ipmi_kcs.c ipmi_smic.c +SRCS+= ipmi_acpi.c SRCS+= opt_acpi.h -SRCS+= acpi_if.h isa_if.h pci_if.h smbus_if.h +SRCS+= acpi_if.h +.endif + +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +SRCS+= ipmi_smbios.c ipmi_ssif.c +SRCS+= ipmi_isa.c ipmi_pci.c ipmi_smbus.c +SRCS+= isa_if.h pci_if.h smbus_if.h SUBDIR+= ipmi_linux From owner-dev-commits-src-all@freebsd.org Thu Jan 7 20:16:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7B91A4DA8E4; Thu, 7 Jan 2021 20:16:26 +0000 (UTC) (envelope-from git@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 4DBcvG36SYz3mjq; Thu, 7 Jan 2021 20:16:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 595931722F; Thu, 7 Jan 2021 20:16:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107KGQMP021006; Thu, 7 Jan 2021 20:16:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107KGQrr021005; Thu, 7 Jan 2021 20:16:26 GMT (envelope-from git) Date: Thu, 7 Jan 2021 20:16:26 GMT Message-Id: <202101072016.107KGQrr021005@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: 79eca6520e0a - main - Fix date MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 79eca6520e0a516a2c217d8c9faedb58ad5db204 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 20:16:26 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=79eca6520e0a516a2c217d8c9faedb58ad5db204 commit 79eca6520e0a516a2c217d8c9faedb58ad5db204 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-01-07 20:15:26 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-01-07 20:15:26 +0000 Fix date It's 2021 already. Reported by: delphij --- stand/defaults/loader.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5 index 21ee86c83c65..76ec32ef6bec 100644 --- a/stand/defaults/loader.conf.5 +++ b/stand/defaults/loader.conf.5 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd January 6, 2020 +.Dd January 6, 2021 .Dt LOADER.CONF 5 .Os .Sh NAME From owner-dev-commits-src-all@freebsd.org Thu Jan 7 21:42:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 44DC44DC998; Thu, 7 Jan 2021 21:42:18 +0000 (UTC) (envelope-from git@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 4DBfpL1X9Dz3rxL; Thu, 7 Jan 2021 21:42:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2782F17DE8; Thu, 7 Jan 2021 21:42:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107LgIds033420; Thu, 7 Jan 2021 21:42:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107LgIRl033419; Thu, 7 Jan 2021 21:42:18 GMT (envelope-from git) Date: Thu, 7 Jan 2021 21:42:18 GMT Message-Id: <202101072142.107LgIRl033419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Chuck Silvers Subject: git: 11403bdeb415 - main - vfs: fix rangelock range in vn_rdwr() for IO_APPEND MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 11403bdeb4158531af36bc7c51cbbba27deb69b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 21:42:18 -0000 The branch main has been updated by chs: URL: https://cgit.FreeBSD.org/src/commit/?id=11403bdeb4158531af36bc7c51cbbba27deb69b1 commit 11403bdeb4158531af36bc7c51cbbba27deb69b1 Author: Chuck Silvers AuthorDate: 2021-01-06 20:04:25 +0000 Commit: Chuck Silvers CommitDate: 2021-01-07 21:37:35 +0000 vfs: fix rangelock range in vn_rdwr() for IO_APPEND vn_rdwr() must lock the entire file range for IO_APPEND just like vn_io_fault() does for O_APPEND. Reviewed by: kib, imp, mckusick Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28008 --- sys/kern/vfs_vnops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index f69115047eba..2ca2cf124c23 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -584,6 +584,8 @@ vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base, int len, off_t offset, if (rw == UIO_READ) { rl_cookie = vn_rangelock_rlock(vp, offset, offset + len); + } else if ((ioflg & IO_APPEND) != 0) { + rl_cookie = vn_rangelock_wlock(vp, 0, OFF_MAX); } else { rl_cookie = vn_rangelock_wlock(vp, offset, offset + len); From owner-dev-commits-src-all@freebsd.org Thu Jan 7 22:08:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B40214DD1CF; Thu, 7 Jan 2021 22:08:47 +0000 (UTC) (envelope-from git@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 4DBgNv4h4wz3tcv; Thu, 7 Jan 2021 22:08:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F30D18720; Thu, 7 Jan 2021 22:08:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107M8l14063704; Thu, 7 Jan 2021 22:08:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107M8llR063703; Thu, 7 Jan 2021 22:08:47 GMT (envelope-from git) Date: Thu, 7 Jan 2021 22:08:47 GMT Message-Id: <202101072208.107M8llR063703@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Matt Macy Subject: git: 81be655266fa - main - iflib: ensure that tx interrupts enabled and cleanups MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmacy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 81be655266fac2b333e25f386f32c9bcd17f523d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 22:08:47 -0000 The branch main has been updated by mmacy: URL: https://cgit.FreeBSD.org/src/commit/?id=81be655266fac2b333e25f386f32c9bcd17f523d commit 81be655266fac2b333e25f386f32c9bcd17f523d Author: Matt Macy AuthorDate: 2020-12-19 01:08:33 +0000 Commit: Matt Macy CommitDate: 2021-01-07 22:07:35 +0000 iflib: ensure that tx interrupts enabled and cleanups Doing a 'dd' over iscsi will reliably cause stalls. Tx cleaning _should_ reliably happen as data is sent. However, currently if the transmit queue fills it will wait until the iflib timer (hz/2) runs. This change causes the the tx taskq thread to be run if there are completed descriptors. While here: - make timer interrupt delay a sysctl - simplify txd_db_check handling - comment on INTR types Background on the change: Initially doorbell updates were minimized by only writing to the register on every fourth packet. If txq_drain would return without writing to the doorbell it scheduled a callout on the next tick to do the doorbell write to ensure that the write otherwise happened "soon". At that time a sysctl was added for users to avoid the potential added latency by simply writing to the doorbell register on every packet. This worked perfectly well for e1000 and ixgbe ... and appeared to work well on ixl. However, as it turned out there was a race to this approach that would lockup the ixl MAC. It was possible for a lower producer index to be written after a higher one. On e1000 and ixgbe this was harmless - on ixl it was fatal. My initial response was to add a lock around doorbell writes - fixing the problem but adding an unacceptable amount of lock contention. The next iteration was to use transmit interrupts to drive delayed doorbell writes. If there were no packets in the queue all doorbell writes would be immediate as the queue started to fill up we could delay doorbell writes further and further. At the start of drain if we've cleaned any packets we know we've moved the state machine along and we write the doorbell (an obvious missing optimization was to skip that doorbell write if db_pending is zero). This change required that tx interrupts be scheduled periodically as opposed to just when the hardware txq was full. However, that just leads to our next problem. Initially dedicated msix vectors were used for both tx and rx. However, it was often possible to use up all available vectors before we set up all the queues we wanted. By having rx and tx share a vector for a given queue we could halve the number of vectors used by a given configuration. The problem here is that with this change only e1000 passed the necessary value to have the fast interrupt drive tx when appropriate. Reported by: mav@ Tested by: mav@ Reviewed by: gallatin@ MFC after: 1 month Sponsored by: iXsystems Differential Revision: https://reviews.freebsd.org/D27683 --- sys/dev/axgbe/if_axgbe_pci.c | 2 +- sys/dev/bnxt/if_bnxt.c | 2 +- sys/dev/ice/if_ice_iflib.c | 2 +- sys/dev/ixgbe/if_ix.c | 2 +- sys/dev/ixgbe/if_ixv.c | 2 +- sys/dev/ixl/if_iavf.c | 2 +- sys/dev/ixl/if_ixl.c | 2 +- sys/dev/mgb/if_mgb.c | 2 +- sys/dev/vmware/vmxnet3/if_vmx.c | 2 +- sys/net/iflib.c | 94 +++++++++++++++++++++++++++-------------- sys/net/iflib.h | 17 ++++++++ 11 files changed, 88 insertions(+), 41 deletions(-) diff --git a/sys/dev/axgbe/if_axgbe_pci.c b/sys/dev/axgbe/if_axgbe_pci.c index 4c4883e1cb4f..7c4645792321 100644 --- a/sys/dev/axgbe/if_axgbe_pci.c +++ b/sys/dev/axgbe/if_axgbe_pci.c @@ -1922,7 +1922,7 @@ axgbe_if_msix_intr_assign(if_ctx_t ctx, int msix) channel = pdata->channel[i]; snprintf(buf, sizeof(buf), "rxq%d", i); - error = iflib_irq_alloc_generic(ctx, &irq, rid, IFLIB_INTR_RX, + error = iflib_irq_alloc_generic(ctx, &irq, rid, IFLIB_INTR_RXTX, axgbe_msix_que, channel, channel->queue_index, buf); if (error) { diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c index 724fd0469ef5..7811f4fdebf0 100644 --- a/sys/dev/bnxt/if_bnxt.c +++ b/sys/dev/bnxt/if_bnxt.c @@ -1534,7 +1534,7 @@ bnxt_msix_intr_assign(if_ctx_t ctx, int msix) for (i=0; iscctx->isc_nrxqsets; i++) { snprintf(irq_name, sizeof(irq_name), "rxq%d", i); rc = iflib_irq_alloc_generic(ctx, &softc->rx_cp_rings[i].irq, - softc->rx_cp_rings[i].ring.id + 1, IFLIB_INTR_RX, + softc->rx_cp_rings[i].ring.id + 1, IFLIB_INTR_RXTX, bnxt_handle_rx_cp, &softc->rx_cp_rings[i], i, irq_name); if (rc) { device_printf(iflib_get_dev(ctx), diff --git a/sys/dev/ice/if_ice_iflib.c b/sys/dev/ice/if_ice_iflib.c index dffdbc391f78..a3004b8f6c8d 100644 --- a/sys/dev/ice/if_ice_iflib.c +++ b/sys/dev/ice/if_ice_iflib.c @@ -1493,7 +1493,7 @@ ice_if_msix_intr_assign(if_ctx_t ctx, int msix) snprintf(irq_name, sizeof(irq_name), "rxq%d", i); err = iflib_irq_alloc_generic(ctx, &sc->irqvs[vector].irq, rid, - IFLIB_INTR_RX, ice_msix_que, + IFLIB_INTR_RXTX, ice_msix_que, rxq, rxq->me, irq_name); if (err) { device_printf(sc->dev, diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 783c50d5a3cc..7eb32077f8b0 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -2026,7 +2026,7 @@ ixgbe_if_msix_intr_assign(if_ctx_t ctx, int msix) snprintf(buf, sizeof(buf), "rxq%d", i); error = iflib_irq_alloc_generic(ctx, &rx_que->que_irq, rid, - IFLIB_INTR_RX, ixgbe_msix_que, rx_que, rx_que->rxr.me, buf); + IFLIB_INTR_RXTX, ixgbe_msix_que, rx_que, rx_que->rxr.me, buf); if (error) { device_printf(iflib_get_dev(ctx), diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 7b8c7f169a7e..6bd92d262558 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -1030,7 +1030,7 @@ ixv_if_msix_intr_assign(if_ctx_t ctx, int msix) snprintf(buf, sizeof(buf), "rxq%d", i); error = iflib_irq_alloc_generic(ctx, &rx_que->que_irq, rid, - IFLIB_INTR_RX, ixv_msix_que, rx_que, rx_que->rxr.me, buf); + IFLIB_INTR_RXTX, ixv_msix_que, rx_que, rx_que->rxr.me, buf); if (error) { device_printf(iflib_get_dev(ctx), diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c index d85cb8ac0541..2079e2d7306b 100644 --- a/sys/dev/ixl/if_iavf.c +++ b/sys/dev/ixl/if_iavf.c @@ -904,7 +904,7 @@ iavf_if_msix_intr_assign(if_ctx_t ctx, int msix) snprintf(buf, sizeof(buf), "rxq%d", i); err = iflib_irq_alloc_generic(ctx, &rx_que->que_irq, rid, - IFLIB_INTR_RX, iavf_msix_que, rx_que, rx_que->rxr.me, buf); + IFLIB_INTR_RXTX, iavf_msix_que, rx_que, rx_que->rxr.me, buf); /* XXX: Does the driver work as expected if there are fewer num_rx_queues than * what's expected in the iflib context? */ if (err) { diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 4d953c45ab91..50eb448a1154 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -1051,7 +1051,7 @@ ixl_if_msix_intr_assign(if_ctx_t ctx, int msix) snprintf(buf, sizeof(buf), "rxq%d", i); err = iflib_irq_alloc_generic(ctx, &rx_que->que_irq, rid, - IFLIB_INTR_RX, ixl_msix_que, rx_que, rx_que->rxr.me, buf); + IFLIB_INTR_RXTX, ixl_msix_que, rx_que, rx_que->rxr.me, buf); /* XXX: Does the driver work as expected if there are fewer num_rx_queues than * what's expected in the iflib context? */ if (err) { diff --git a/sys/dev/mgb/if_mgb.c b/sys/dev/mgb/if_mgb.c index ce4d43b8d34c..3f7a9d1a9dbb 100644 --- a/sys/dev/mgb/if_mgb.c +++ b/sys/dev/mgb/if_mgb.c @@ -855,7 +855,7 @@ mgb_msix_intr_assign(if_ctx_t ctx, int msix) vectorid++; snprintf(irq_name, sizeof(irq_name), "rxq%d", i); error = iflib_irq_alloc_generic(ctx, &sc->rx_irq, vectorid + 1, - IFLIB_INTR_RX, mgb_rxq_intr, sc, i, irq_name); + IFLIB_INTR_RXTX, mgb_rxq_intr, sc, i, irq_name); if (error) { device_printf(sc->dev, "Failed to register rxq %d interrupt handler\n", i); diff --git a/sys/dev/vmware/vmxnet3/if_vmx.c b/sys/dev/vmware/vmxnet3/if_vmx.c index c2ae55532ed0..340fe1a7dd80 100644 --- a/sys/dev/vmware/vmxnet3/if_vmx.c +++ b/sys/dev/vmware/vmxnet3/if_vmx.c @@ -480,7 +480,7 @@ vmxnet3_msix_intr_assign(if_ctx_t ctx, int msix) rxq = &sc->vmx_rxq[i]; error = iflib_irq_alloc_generic(ctx, &rxq->vxrxq_irq, i + 1, - IFLIB_INTR_RX, vmxnet3_rxq_intr, rxq, i, irq_name); + IFLIB_INTR_RXTX, vmxnet3_rxq_intr, rxq, i, irq_name); if (error) { device_printf(iflib_get_dev(ctx), "Failed to register rxq %d interrupt handler\n", i); diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 5db925fef05f..cc401a5db24d 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -585,6 +585,10 @@ SYSCTL_INT(_net_iflib, OID_AUTO, min_tx_latency, CTLFLAG_RW, static int iflib_no_tx_batch = 0; SYSCTL_INT(_net_iflib, OID_AUTO, no_tx_batch, CTLFLAG_RW, &iflib_no_tx_batch, 0, "minimize transmit latency at the possible expense of throughput"); +static int iflib_timer_default = 1000; +SYSCTL_INT(_net_iflib, OID_AUTO, timer_default, CTLFLAG_RW, + &iflib_timer_default, 0, "number of ticks between iflib_timer calls"); + #if IFLIB_DEBUG_COUNTERS @@ -2293,7 +2297,7 @@ iflib_timer(void *arg) ** can be done without the lock because its RO ** and the HUNG state will be static if set. */ - if (this_tick - txq->ift_last_timer_tick >= hz / 2) { + if (this_tick - txq->ift_last_timer_tick >= iflib_timer_default) { txq->ift_last_timer_tick = this_tick; IFDI_TIMER(ctx, txq->ift_id); if ((txq->ift_qstatus == IFLIB_QUEUE_HUNG) && @@ -2303,7 +2307,8 @@ iflib_timer(void *arg) if (txq->ift_qstatus != IFLIB_QUEUE_IDLE && ifmp_ring_is_stalled(txq->ift_br)) { - KASSERT(ctx->ifc_link_state == LINK_STATE_UP, ("queue can't be marked as hung if interface is down")); + KASSERT(ctx->ifc_link_state == LINK_STATE_UP, + ("queue can't be marked as hung if interface is down")); txq->ift_qstatus = IFLIB_QUEUE_HUNG; } txq->ift_cleaned_prev = txq->ift_cleaned; @@ -2314,7 +2319,8 @@ iflib_timer(void *arg) sctx->isc_pause_frames = 0; if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) - callout_reset_on(&txq->ift_timer, hz / 2, iflib_timer, txq, txq->ift_timer.c_cpu); + callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, + txq, txq->ift_timer.c_cpu); return; hung: @@ -2426,7 +2432,7 @@ done: IFDI_INTR_ENABLE(ctx); txq = ctx->ifc_txqs; for (i = 0; i < sctx->isc_ntxqsets; i++, txq++) - callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, + callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, txq, txq->ift_timer.c_cpu); } @@ -3001,26 +3007,37 @@ txq_max_rs_deferred(iflib_txq_t txq) /* XXX we should be setting this to something other than zero */ #define RECLAIM_THRESH(ctx) ((ctx)->ifc_sctx->isc_tx_reclaim_thresh) -#define MAX_TX_DESC(ctx) max((ctx)->ifc_softc_ctx.isc_tx_tso_segments_max, \ +#define MAX_TX_DESC(ctx) MAX((ctx)->ifc_softc_ctx.isc_tx_tso_segments_max, \ (ctx)->ifc_softc_ctx.isc_tx_nsegments) static inline bool -iflib_txd_db_check(if_ctx_t ctx, iflib_txq_t txq, int ring, qidx_t in_use) +iflib_txd_db_check(iflib_txq_t txq, int ring) { + if_ctx_t ctx = txq->ift_ctx; qidx_t dbval, max; - bool rang; - rang = false; - max = TXQ_MAX_DB_DEFERRED(txq, in_use); - if (ring || txq->ift_db_pending >= max) { + max = TXQ_MAX_DB_DEFERRED(txq, txq->ift_in_use); + + /* force || threshold exceeded || at the edge of the ring */ + if (ring || (txq->ift_db_pending >= max) || (TXQ_AVAIL(txq) <= MAX_TX_DESC(ctx) + 2)) { + + /* + * 'npending' is used if the card's doorbell is in terms of the number of descriptors + * pending flush (BRCM). 'pidx' is used in cases where the card's doorbeel uses the + * producer index explicitly (INTC). + */ dbval = txq->ift_npending ? txq->ift_npending : txq->ift_pidx; bus_dmamap_sync(txq->ift_ifdi->idi_tag, txq->ift_ifdi->idi_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); ctx->isc_txd_flush(ctx->ifc_softc, txq->ift_id, dbval); + + /* + * Absent bugs there are zero packets pending so reset pending counts to zero. + */ txq->ift_db_pending = txq->ift_npending = 0; - rang = true; + return (true); } - return (rang); + return (false); } #ifdef PKT_DEBUG @@ -3481,6 +3498,7 @@ defrag: MPASS(pi.ipi_new_pidx != pidx); MPASS(ndesc > 0); txq->ift_in_use += ndesc; + txq->ift_db_pending += ndesc; /* * We update the last software descriptor again here because there may @@ -3647,8 +3665,8 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) if_ctx_t ctx = txq->ift_ctx; if_t ifp = ctx->ifc_ifp; struct mbuf *m, **mp; - int avail, bytes_sent, consumed, count, err, i, in_use_prev; - int mcast_sent, pkt_sent, reclaimed, txq_avail; + int avail, bytes_sent, skipped, count, err, i; + int mcast_sent, pkt_sent, reclaimed; bool do_prefetch, rang, ring; if (__predict_false(!(if_getdrvflags(ifp) & IFF_DRV_RUNNING) || @@ -3657,9 +3675,13 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) return (0); } reclaimed = iflib_completed_tx_reclaim(txq, RECLAIM_THRESH(ctx)); - rang = iflib_txd_db_check(ctx, txq, reclaimed, txq->ift_in_use); + rang = iflib_txd_db_check(txq, reclaimed && txq->ift_db_pending); avail = IDXDIFF(pidx, cidx, r->size); + if (__predict_false(ctx->ifc_flags & IFC_QFLUSH)) { + /* + * The driver is unloading so we need to free all pending packets. + */ DBG_COUNTER_INC(txq_drain_flushing); for (i = 0; i < avail; i++) { if (__predict_true(r->items[(cidx + i) & (r->size-1)] != (void *)txq)) @@ -3677,9 +3699,13 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) DBG_COUNTER_INC(txq_drain_oactive); return (0); } + + /* + * If we've reclaimed any packets this queue cannot be hung. + */ if (reclaimed) txq->ift_qstatus = IFLIB_QUEUE_IDLE; - consumed = mcast_sent = bytes_sent = pkt_sent = 0; + skipped = mcast_sent = bytes_sent = pkt_sent = 0; count = MIN(avail, TX_BATCH_SIZE); #ifdef INVARIANTS if (iflib_verbose_debug) @@ -3687,54 +3713,57 @@ iflib_txq_drain(struct ifmp_ring *r, uint32_t cidx, uint32_t pidx) avail, ctx->ifc_flags, TXQ_AVAIL(txq)); #endif do_prefetch = (ctx->ifc_flags & IFC_PREFETCH); - txq_avail = TXQ_AVAIL(txq); err = 0; - for (i = 0; i < count && txq_avail > MAX_TX_DESC(ctx) + 2; i++) { + for (i = 0; i < count && TXQ_AVAIL(txq) >= MAX_TX_DESC(ctx) + 2; i++) { int rem = do_prefetch ? count - i : 0; mp = _ring_peek_one(r, cidx, i, rem); MPASS(mp != NULL && *mp != NULL); + + /* + * Completion interrupts will use the address of the txq + * as a sentinel to enqueue _something_ in order to acquire + * the lock on the mp_ring (there's no direct lock call). + * We obviously whave to check for these sentinel cases + * and skip them. + */ if (__predict_false(*mp == (struct mbuf *)txq)) { - consumed++; + skipped++; continue; } - in_use_prev = txq->ift_in_use; err = iflib_encap(txq, mp); if (__predict_false(err)) { /* no room - bail out */ if (err == ENOBUFS) break; - consumed++; + skipped++; /* we can't send this packet - skip it */ continue; } - consumed++; pkt_sent++; m = *mp; DBG_COUNTER_INC(tx_sent); bytes_sent += m->m_pkthdr.len; mcast_sent += !!(m->m_flags & M_MCAST); - txq_avail = TXQ_AVAIL(txq); - txq->ift_db_pending += (txq->ift_in_use - in_use_prev); - ETHER_BPF_MTAP(ifp, m); if (__predict_false(!(ifp->if_drv_flags & IFF_DRV_RUNNING))) break; - rang = iflib_txd_db_check(ctx, txq, false, in_use_prev); + ETHER_BPF_MTAP(ifp, m); + rang = iflib_txd_db_check(txq, false); } /* deliberate use of bitwise or to avoid gratuitous short-circuit */ - ring = rang ? false : (iflib_min_tx_latency | err) || (TXQ_AVAIL(txq) < MAX_TX_DESC(ctx)); - iflib_txd_db_check(ctx, txq, ring, txq->ift_in_use); + ring = rang ? false : (iflib_min_tx_latency | err); + iflib_txd_db_check(txq, ring); if_inc_counter(ifp, IFCOUNTER_OBYTES, bytes_sent); if_inc_counter(ifp, IFCOUNTER_OPACKETS, pkt_sent); if (mcast_sent) if_inc_counter(ifp, IFCOUNTER_OMCASTS, mcast_sent); #ifdef INVARIANTS if (iflib_verbose_debug) - printf("consumed=%d\n", consumed); + printf("consumed=%d\n", skipped + pkt_sent); #endif - return (consumed); + return (skipped + pkt_sent); } static uint32_t @@ -3907,7 +3936,7 @@ _task_fn_admin(void *context) } IFDI_UPDATE_ADMIN_STATUS(ctx); for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) { - callout_reset_on(&txq->ift_timer, hz / 2, iflib_timer, txq, + callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, txq, txq->ift_timer.c_cpu); } IFDI_LINK_INTR_ENABLE(ctx); @@ -5301,6 +5330,7 @@ iflib_device_iov_add_vf(device_t dev, uint16_t vfnum, const nvlist_t *params) static int iflib_module_init(void) { + iflib_timer_default = hz / 2; return (0); } @@ -6861,7 +6891,7 @@ iflib_debugnet_transmit(if_t ifp, struct mbuf *m) txq = &ctx->ifc_txqs[0]; error = iflib_encap(txq, &m); if (error == 0) - (void)iflib_txd_db_check(ctx, txq, true, txq->ift_in_use); + (void)iflib_txd_db_check(txq, true); return (error); } diff --git a/sys/net/iflib.h b/sys/net/iflib.h index eaf8ea33355d..a30740e67b6e 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -288,10 +288,27 @@ typedef struct iflib_dma_info { #define IFLIB_MAGIC 0xCAFEF00D typedef enum { + /* Interrupt or softirq handles only receive */ IFLIB_INTR_RX, + + /* Interrupt or softirq handles only transmit */ IFLIB_INTR_TX, + + /* + * Interrupt will check for both pending receive + * and available tx credits and dispatch a task + * for one or both depending on the disposition + * of the respective queues. + */ IFLIB_INTR_RXTX, + + /* + * Other interrupt - typically link status and + * or error conditions. + */ IFLIB_INTR_ADMIN, + + /* Softirq (task) for iov handling */ IFLIB_INTR_IOV, } iflib_intr_type_t; From owner-dev-commits-src-all@freebsd.org Thu Jan 7 22:26:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C0AEA4DD7F1; Thu, 7 Jan 2021 22:26:47 +0000 (UTC) (envelope-from git@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 4DBgng55m6z3vkD; Thu, 7 Jan 2021 22:26:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D7CF189E8; Thu, 7 Jan 2021 22:26:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107MQl00088939; Thu, 7 Jan 2021 22:26:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107MQlDR088938; Thu, 7 Jan 2021 22:26:47 GMT (envelope-from git) Date: Thu, 7 Jan 2021 22:26:47 GMT Message-Id: <202101072226.107MQlDR088938@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 0fcb03fbaca1 - main - pf: Copy kif flags to userspace MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0fcb03fbaca1307175edc96355c867471db309f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 22:26:47 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0fcb03fbaca1307175edc96355c867471db309f8 commit 0fcb03fbaca1307175edc96355c867471db309f8 Author: Kristof Provost AuthorDate: 2021-01-07 21:24:38 +0000 Commit: Kristof Provost CommitDate: 2021-01-07 21:26:05 +0000 pf: Copy kif flags to userspace This was overlooked in the pfi_kkif/pfi_kif splitup and as a result userspace could no longer tell which interfaces had the skip flag applied. MFC after: 2 weeks --- sys/netpfil/pf/pf_if.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 850a6dc1ca05..e941e3a79b91 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -829,6 +829,7 @@ pf_kkif_to_kif(const struct pfi_kkif *kkif, struct pfi_kif *kif) } } } + kif->pfik_flags = kkif->pfik_flags; kif->pfik_tzero = kkif->pfik_tzero; kif->pfik_rulerefs = kkif->pfik_rulerefs; } From owner-dev-commits-src-all@freebsd.org Thu Jan 7 22:28:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DE3C14DD370; Thu, 7 Jan 2021 22:28:21 +0000 (UTC) (envelope-from git@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 4DBgqT5tzkz3vhs; Thu, 7 Jan 2021 22:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBC6A188D1; Thu, 7 Jan 2021 22:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107MSL9h089283; Thu, 7 Jan 2021 22:28:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107MSLFg089282; Thu, 7 Jan 2021 22:28:21 GMT (envelope-from git) Date: Thu, 7 Jan 2021 22:28:21 GMT Message-Id: <202101072228.107MSLFg089282@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 27e90f70e09d - main - stand: remove bogus dependency from libsa32 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 27e90f70e09d9d003bdea09c41be64a7ec2ece9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 22:28:21 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=27e90f70e09d9d003bdea09c41be64a7ec2ece9a commit 27e90f70e09d9d003bdea09c41be64a7ec2ece9a Author: Kyle Evans AuthorDate: 2021-01-07 22:02:55 +0000 Commit: Kyle Evans CommitDate: 2021-01-07 22:28:21 +0000 stand: remove bogus dependency from libsa32 libsa32 is independent of libsa, they can build in parallel if needed. --- stand/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/stand/Makefile b/stand/Makefile index f08386424009..f11a77c9a499 100644 --- a/stand/Makefile +++ b/stand/Makefile @@ -73,8 +73,6 @@ SUBDIR_DEPEND_${_x}32+= libsa32 .endfor # Remaining dependencies -SUBDIR_DEPEND_libsa32+= libsa - SUBDIR_DEPEND_forth+= ficl SUBDIR_DEPEND_lua+= liblua From owner-dev-commits-src-all@freebsd.org Thu Jan 7 22:28:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EB3A14DD371; Thu, 7 Jan 2021 22:28:21 +0000 (UTC) (envelope-from git@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 4DBgqT6MYHz3vvf; Thu, 7 Jan 2021 22:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9529189E9; Thu, 7 Jan 2021 22:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107MSLw0089302; Thu, 7 Jan 2021 22:28:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107MSLCM089301; Thu, 7 Jan 2021 22:28:21 GMT (envelope-from git) Date: Thu, 7 Jan 2021 22:28:21 GMT Message-Id: <202101072228.107MSLCM089301@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: e41367e3ae12 - main - stand: avoid adding fdt SUBDIR_DEPEND if WITHOUT_FDT is set MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e41367e3ae1246c2b086f9f920a175108aa72380 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 22:28:22 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e41367e3ae1246c2b086f9f920a175108aa72380 commit e41367e3ae1246c2b086f9f920a175108aa72380 Author: Kyle Evans AuthorDate: 2021-01-07 21:59:38 +0000 Commit: Kyle Evans CommitDate: 2021-01-07 22:28:20 +0000 stand: avoid adding fdt SUBDIR_DEPEND if WITHOUT_FDT is set This unbreaks the efi build if WITHOUT_FDT is set. Reported by: peterj --- stand/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stand/Makefile b/stand/Makefile index 7b871d9164db..f08386424009 100644 --- a/stand/Makefile +++ b/stand/Makefile @@ -78,7 +78,9 @@ SUBDIR_DEPEND_libsa32+= libsa SUBDIR_DEPEND_forth+= ficl SUBDIR_DEPEND_lua+= liblua +.if ${MK_FDT} != "no" SUBDIR_DEPEND_efi+= fdt +.endif SUBDIR_PARALLEL= yes From owner-dev-commits-src-all@freebsd.org Thu Jan 7 22:37:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5A5554DDC3E; Thu, 7 Jan 2021 22:37:34 +0000 (UTC) (envelope-from git@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 4DBh2628FYz4Qng; Thu, 7 Jan 2021 22:37:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B6DE18DCF; Thu, 7 Jan 2021 22:37:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107MbYcB002772; Thu, 7 Jan 2021 22:37:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107MbYsM002771; Thu, 7 Jan 2021 22:37:34 GMT (envelope-from git) Date: Thu, 7 Jan 2021 22:37:34 GMT Message-Id: <202101072237.107MbYsM002771@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 3c5c39c7ad8f - main - du: tests: make H_flag tests more strict about output requirements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c5c39c7ad8f010cfa5fc0db43d15d1964b4cf16 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 22:37:34 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=3c5c39c7ad8f010cfa5fc0db43d15d1964b4cf16 commit 3c5c39c7ad8f010cfa5fc0db43d15d1964b4cf16 Author: Kyle Evans AuthorDate: 2021-01-05 21:49:46 +0000 Commit: Kyle Evans CommitDate: 2021-01-07 22:37:28 +0000 du: tests: make H_flag tests more strict about output requirements The current version of this test will effectively pass as long as one of the specified paths is in the output, and it could even be a subset of one of the paths. Strengthen up the test a little bit: * Specify beginning/end anchors for each path * Add egrep -v checks to make sure we don't have any *additional* paths * Ratchet down paths2 to exactly the two paths we expect to appear Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D27984 --- usr.bin/du/tests/du_test.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/usr.bin/du/tests/du_test.sh b/usr.bin/du/tests/du_test.sh index 4a8f11e83ff5..92a26deae02b 100755 --- a/usr.bin/du/tests/du_test.sh +++ b/usr.bin/du/tests/du_test.sh @@ -45,17 +45,25 @@ H_flag_head() H_flag_body() { local paths1='testdir/A/B testdir/A testdir/C testdir' - local paths2='testdir/A/B testdir/A testdir/C testdir' + local paths2='testdir/C/B testdir/C' local lineprefix="^[0-9]+$(printf "\t")" - local sep="\n${lineprefix}" + local sep="\$\n${lineprefix}" atf_check mkdir testdir atf_check -x "cd testdir && mkdir A && touch A/B && ln -s A C" atf_check -o save:du.out du -aAH testdir - atf_check egrep -q "${lineprefix}$(echo $paths1 | sed -e "s/ /$sep/g")" du.out + atf_check egrep -q "${lineprefix}$(echo $paths1 | sed -e "s/ /$sep/g")$" du.out + # Check that the output doesn't contain any lines (i.e. paths) that we + # did not expect it to contain from $paths1. + atf_check -s exit:1 egrep -vq "${lineprefix}$(echo $paths1 | sed -e "s/ /$sep/g")$" du.out + atf_check -o save:du_C.out du -aAH testdir/C - atf_check egrep -q "${lineprefix}$(echo $paths2 | sed -e "s/ /$sep/g")" du_C.out + atf_check egrep -q "${lineprefix}$(echo $paths2 | sed -e "s/ /$sep/g")$" du_C.out + + # Check that the output doesn't contain any lines (i.e. paths) that we + # did not expect it to contain from $paths2. + atf_check -s exit:1 egrep -vq "${lineprefix}$(echo $paths2 | sed -e "s/ /$sep/g")$" du_C.out } atf_test_case I_flag From owner-dev-commits-src-all@freebsd.org Thu Jan 7 22:37:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6D0CE4DDC3F; Thu, 7 Jan 2021 22:37:34 +0000 (UTC) (envelope-from git@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 4DBh262htLz3wBm; Thu, 7 Jan 2021 22:37:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AD4D18BC9; Thu, 7 Jan 2021 22:37:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107MbYVE002790; Thu, 7 Jan 2021 22:37:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107MbYaX002789; Thu, 7 Jan 2021 22:37:34 GMT (envelope-from git) Date: Thu, 7 Jan 2021 22:37:34 GMT Message-Id: <202101072237.107MbYaX002789@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 4832d2e8ae1d - main - du: tests: fix the H_flag test (primarily grep usage) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4832d2e8ae1df6f907ac00275764f8135722cb7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 22:37:34 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4832d2e8ae1df6f907ac00275764f8135722cb7e commit 4832d2e8ae1df6f907ac00275764f8135722cb7e Author: Kyle Evans AuthorDate: 2021-01-05 21:33:06 +0000 Commit: Kyle Evans CommitDate: 2021-01-07 22:36:31 +0000 du: tests: fix the H_flag test (primarily grep usage) This test attempts to use \t (tab intended) in a grep expression. With the former /usr/bin/grep (i.e. gnugrep), this was interpreted as a literal 't'. The expression would work anyways because the tr(1) usage would ultimately replace all of the spaces with a single newline, and they would match the paths whether they were correctly fromatted or not. Current /usr/bin/grep (i.e. bsdgrep) is less-tolerant of ordinary-escapes, a property of the underlying regex(3) engine, to make it easier to identify when stuff like this happens. In-fact, this expression broke after the switch happened. This revision does the bare basics to fix the usage by using a printf to get a literal tab character to insert into the expression. It also swaps out the manual insertion of the line prefix into the grep expression by pulling that part out of $sep and reusing it for the leading path. The secondary issue was the tr(1) usage, since tr would only replace the first character of string1 with the first character of string2. This has instead been replaced by a sed expression, which similary understands \n to be a newline on all supported versions of FreeBSD. Each path now gets prefixed with the appropriate context that should be there (i.e. numeric sequence followed by a tab). PR: 252446 Reviewed by: emaste, ngie Differential Revision: https://reviews.freebsd.org/D27983 --- usr.bin/du/tests/du_test.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/du/tests/du_test.sh b/usr.bin/du/tests/du_test.sh index 395051a0d781..4a8f11e83ff5 100755 --- a/usr.bin/du/tests/du_test.sh +++ b/usr.bin/du/tests/du_test.sh @@ -46,15 +46,16 @@ H_flag_body() { local paths1='testdir/A/B testdir/A testdir/C testdir' local paths2='testdir/A/B testdir/A testdir/C testdir' - local sep='\n[0-9]+\t' + local lineprefix="^[0-9]+$(printf "\t")" + local sep="\n${lineprefix}" atf_check mkdir testdir atf_check -x "cd testdir && mkdir A && touch A/B && ln -s A C" atf_check -o save:du.out du -aAH testdir - atf_check egrep -q "[0-9]+\t$(echo $paths1 | tr ' ' "$sep")\n" du.out + atf_check egrep -q "${lineprefix}$(echo $paths1 | sed -e "s/ /$sep/g")" du.out atf_check -o save:du_C.out du -aAH testdir/C - atf_check egrep -q "[0-9]+\t$(echo $paths2 | tr ' ' "$sep")\n" du_C.out + atf_check egrep -q "${lineprefix}$(echo $paths2 | sed -e "s/ /$sep/g")" du_C.out } atf_test_case I_flag From owner-dev-commits-src-all@freebsd.org Thu Jan 7 22:58:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 067754DE4C4; Thu, 7 Jan 2021 22:58:45 +0000 (UTC) (envelope-from git@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 4DBhVX6lT1z4RYj; Thu, 7 Jan 2021 22:58:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA81918F2A; Thu, 7 Jan 2021 22:58:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107Mwip9028475; Thu, 7 Jan 2021 22:58:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107MwiZb028474; Thu, 7 Jan 2021 22:58:44 GMT (envelope-from git) Date: Thu, 7 Jan 2021 22:58:44 GMT Message-Id: <202101072258.107MwiZb028474@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 5cc52631b3b8 - main - Rewrite the disk I/O management system in fsck_ffs(8). Other than making fsck_ffs(8) run faster, there should be no functional change. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5cc52631b3b88dfc36d8049dc8bece8573c5f9af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 22:58:45 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=5cc52631b3b88dfc36d8049dc8bece8573c5f9af commit 5cc52631b3b88dfc36d8049dc8bece8573c5f9af Author: Kirk McKusick AuthorDate: 2021-01-07 01:37:08 +0000 Commit: Kirk McKusick CommitDate: 2021-01-07 23:03:15 +0000 Rewrite the disk I/O management system in fsck_ffs(8). Other than making fsck_ffs(8) run faster, there should be no functional change. The original fsck_ffs(8) had its own disk I/O management system. When gjournal(8) was added to FreeBSD 7, code was added to fsck_ffs(8) to do the necessary gjournal rollback. Rather than use the existing fsck_ffs(8) disk I/O system, it wrote its own from scratch. Similarly when journalled soft updates were added in FreeBSD 9, code was added to fsck_ffs(8) to do the necessary journal rollback. And once again, rather than using either of the existing fsck_ffs(8) disk I/O systems, it wrote its own from scratch. Lastly the fsdb(8) utility uses the fsck_ffs(8) disk I/O management system. In preparation for making the changes necessary to enable snapshots to be taken when using journalled soft updates, it was necessary to have a single disk I/O system used by all the various subsystems in fsck_ffs(8). This commit merges the functionality required by all the different subsystems into a single disk I/O system that supports all of their needs. In so doing it picks up optimizations from each of them with the results that each of the subsystems does fewer reads and writes than it did with its own customized I/O system. It also greatly simplifies making changes to fsck_ffs(8) since everything goes through a single place. For example the ginode() function fetches an inode from the disk. When inode check hashes were added, they previously had to be checked in the code implementing inode fetch in each of the three different disk I/O systems. Now they need only be checked in ginode(). Tested by: Peter Holm Sponsored by: Netflix --- sbin/fsck_ffs/dir.c | 139 ++++--- sbin/fsck_ffs/ea.c | 1 + sbin/fsck_ffs/fsck.h | 81 +++-- sbin/fsck_ffs/fsutil.c | 424 +++++++++++++++++----- sbin/fsck_ffs/gjournal.c | 411 ++------------------- sbin/fsck_ffs/globs.c | 9 +- sbin/fsck_ffs/inode.c | 368 ++++++++++++++----- sbin/fsck_ffs/main.c | 16 +- sbin/fsck_ffs/pass1.c | 61 ++-- sbin/fsck_ffs/pass1b.c | 14 +- sbin/fsck_ffs/pass2.c | 35 +- sbin/fsck_ffs/pass3.c | 7 +- sbin/fsck_ffs/pass4.c | 11 +- sbin/fsck_ffs/setup.c | 18 +- sbin/fsck_ffs/suj.c | 914 ++++++++++++++--------------------------------- sbin/fsdb/fsdb.c | 89 ++--- sbin/fsdb/fsdb.h | 1 + 17 files changed, 1215 insertions(+), 1384 deletions(-) diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c index a86d65a9f183..e88d1650ce5a 100644 --- a/sbin/fsck_ffs/dir.c +++ b/sbin/fsck_ffs/dir.c @@ -62,7 +62,7 @@ static struct dirtemplate dirhead = { static int chgino(struct inodesc *); static int dircheck(struct inodesc *, struct bufarea *, struct direct *); -static int expanddir(union dinode *dp, char *name); +static int expanddir(struct inode *ip, char *name); static void freedir(ino_t ino, ino_t parent); static struct direct *fsck_readdir(struct inodesc *); static struct bufarea *getdirblk(ufs2_daddr_t blkno, long size); @@ -126,6 +126,8 @@ dirscan(struct inodesc *idesc) idesc->id_dirp = (struct direct *)dbuf; if ((n = (*idesc->id_func)(idesc)) & ALTERED) { bp = getdirblk(idesc->id_blkno, blksiz); + if (bp->b_errs != 0) + return (STOP); memmove(bp->b_un.b_buf + idesc->id_loc - dsize, dbuf, (size_t)dsize); dirty(bp); @@ -155,6 +157,8 @@ fsck_readdir(struct inodesc *idesc) if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz) return (NULL); bp = getdirblk(idesc->id_blkno, blksiz); + if (bp->b_errs != 0) + return (NULL); dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); /* * Only need to check current entry if it is the first in the @@ -330,6 +334,7 @@ direrror(ino_t ino, const char *errmesg) void fileerror(ino_t cwd, ino_t ino, const char *errmesg) { + struct inode ip; union dinode *dp; char pathbuf[MAXPATHLEN + 1]; @@ -338,8 +343,9 @@ fileerror(ino_t cwd, ino_t ino, const char *errmesg) pfatal("out-of-range inode number %ju", (uintmax_t)ino); return; } - dp = ginode(ino); - prtinode(ino, dp); + ginode(ino, &ip); + dp = ip.i_dp; + prtinode(&ip); printf("\n"); getpathname(pathbuf, cwd, ino); if (ftypeok(dp)) @@ -348,15 +354,18 @@ fileerror(ino_t cwd, ino_t ino, const char *errmesg) pathbuf); else pfatal("NAME=%s\n", pathbuf); + irelse(&ip); } void adjust(struct inodesc *idesc, int lcnt) { + struct inode ip; union dinode *dp; int saveresolved; - dp = ginode(idesc->id_number); + ginode(idesc->id_number, &ip); + dp = ip.i_dp; if (DIP(dp, di_nlink) == lcnt) { /* * If we have not hit any unresolved problems, are running @@ -365,6 +374,7 @@ adjust(struct inodesc *idesc, int lcnt) */ if (resolved && (preen || bkgrdflag) && usedsoftdep) { clri(idesc, "UNREF", 1); + irelse(&ip); return; } else { /* @@ -377,19 +387,19 @@ adjust(struct inodesc *idesc, int lcnt) if (linkup(idesc->id_number, (ino_t)0, NULL) == 0) { resolved = saveresolved; clri(idesc, "UNREF", 0); + irelse(&ip); return; } /* * Account for the new reference created by linkup(). */ - dp = ginode(idesc->id_number); lcnt--; } } if (lcnt != 0) { pwarn("LINK COUNT %s", (lfdir == idesc->id_number) ? lfname : ((DIP(dp, di_mode) & IFMT) == IFDIR ? "DIR" : "FILE")); - prtinode(idesc->id_number, dp); + prtinode(&ip); printf(" COUNT %d SHOULD BE %d", DIP(dp, di_nlink), DIP(dp, di_nlink) - lcnt); if (preen || usedsoftdep) { @@ -403,7 +413,7 @@ adjust(struct inodesc *idesc, int lcnt) if (preen || reply("ADJUST") == 1) { if (bkgrdflag == 0) { DIP_SET(dp, di_nlink, DIP(dp, di_nlink) - lcnt); - inodirty(dp); + inodirty(&ip); } else { cmd.value = idesc->id_number; cmd.size = -lcnt; @@ -417,6 +427,7 @@ adjust(struct inodesc *idesc, int lcnt) } } } + irelse(&ip); } static int @@ -460,6 +471,7 @@ chgino(struct inodesc *idesc) int linkup(ino_t orphan, ino_t parentdir, char *name) { + struct inode ip; union dinode *dp; int lostdir; ino_t oldlfdir; @@ -467,29 +479,32 @@ linkup(ino_t orphan, ino_t parentdir, char *name) char tempname[BUFSIZ]; memset(&idesc, 0, sizeof(struct inodesc)); - dp = ginode(orphan); + ginode(orphan, &ip); + dp = ip.i_dp; lostdir = (DIP(dp, di_mode) & IFMT) == IFDIR; pwarn("UNREF %s ", lostdir ? "DIR" : "FILE"); - prtinode(orphan, dp); + prtinode(&ip); printf("\n"); - if (preen && DIP(dp, di_size) == 0) + if (preen && DIP(dp, di_size) == 0) { + irelse(&ip); return (0); + } + irelse(&ip); if (cursnapshot != 0) { pfatal("FILE LINKUP IN SNAPSHOT"); return (0); } if (preen) printf(" (RECONNECTED)\n"); - else - if (reply("RECONNECT") == 0) - return (0); + else if (reply("RECONNECT") == 0) + return (0); if (lfdir == 0) { - dp = ginode(UFS_ROOTINO); + ginode(UFS_ROOTINO, &ip); idesc.id_name = strdup(lfname); idesc.id_type = DATA; idesc.id_func = findino; idesc.id_number = UFS_ROOTINO; - if ((ckinode(dp, &idesc) & FOUND) != 0) { + if ((ckinode(ip.i_dp, &idesc) & FOUND) != 0) { lfdir = idesc.id_parent; } else { pwarn("NO lost+found DIRECTORY"); @@ -510,42 +525,52 @@ linkup(ino_t orphan, ino_t parentdir, char *name) } } } + irelse(&ip); if (lfdir == 0) { pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY"); printf("\n\n"); return (0); } } - dp = ginode(lfdir); + ginode(lfdir, &ip); + dp = ip.i_dp; if ((DIP(dp, di_mode) & IFMT) != IFDIR) { pfatal("lost+found IS NOT A DIRECTORY"); - if (reply("REALLOCATE") == 0) + if (reply("REALLOCATE") == 0) { + irelse(&ip); return (0); + } oldlfdir = lfdir; if ((lfdir = allocdir(UFS_ROOTINO, (ino_t)0, lfmode)) == 0) { pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n"); + irelse(&ip); return (0); } if ((changeino(UFS_ROOTINO, lfname, lfdir) & ALTERED) == 0) { pfatal("SORRY. CANNOT CREATE lost+found DIRECTORY\n\n"); + irelse(&ip); return (0); } - inodirty(dp); - idesc.id_type = ADDR; + idesc.id_type = inoinfo(oldlfdir)->ino_idtype; idesc.id_func = freeblock; idesc.id_number = oldlfdir; adjust(&idesc, inoinfo(oldlfdir)->ino_linkcnt + 1); inoinfo(oldlfdir)->ino_linkcnt = 0; - dp = ginode(lfdir); + inodirty(&ip); + irelse(&ip); + ginode(lfdir, &ip); + dp = ip.i_dp; } if (inoinfo(lfdir)->ino_state != DFOUND) { pfatal("SORRY. NO lost+found DIRECTORY\n\n"); + irelse(&ip); return (0); } (void)lftempname(tempname, orphan); if (makeentry(lfdir, orphan, (name ? name : tempname)) == 0) { pfatal("SORRY. NO SPACE IN lost+found DIRECTORY"); printf("\n\n"); + irelse(&ip); return (0); } inoinfo(orphan)->ino_linkcnt--; @@ -553,9 +578,8 @@ linkup(ino_t orphan, ino_t parentdir, char *name) if ((changeino(orphan, "..", lfdir) & ALTERED) == 0 && parentdir != (ino_t)-1) (void)makeentry(orphan, lfdir, ".."); - dp = ginode(lfdir); DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1); - inodirty(dp); + inodirty(&ip); inoinfo(lfdir)->ino_linkcnt++; pwarn("DIR I=%lu CONNECTED. ", (u_long)orphan); if (parentdir != (ino_t)-1) { @@ -572,6 +596,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name) if (preen == 0) printf("\n"); } + irelse(&ip); return (1); } @@ -582,6 +607,8 @@ int changeino(ino_t dir, const char *name, ino_t newnum) { struct inodesc idesc; + struct inode ip; + int error; memset(&idesc, 0, sizeof(struct inodesc)); idesc.id_type = DATA; @@ -590,7 +617,10 @@ changeino(ino_t dir, const char *name, ino_t newnum) idesc.id_fix = DONTKNOW; idesc.id_name = strdup(name); idesc.id_parent = newnum; /* new value for name */ - return (ckinode(ginode(dir), &idesc)); + ginode(dir, &ip); + error = ckinode(ip.i_dp, &idesc); + irelse(&ip); + return (error); } /* @@ -599,8 +629,10 @@ changeino(ino_t dir, const char *name, ino_t newnum) int makeentry(ino_t parent, ino_t ino, const char *name) { + struct inode ip; union dinode *dp; struct inodesc idesc; + int retval; char pathbuf[MAXPATHLEN + 1]; if (parent < UFS_ROOTINO || parent >= maxino || @@ -613,30 +645,37 @@ makeentry(ino_t parent, ino_t ino, const char *name) idesc.id_parent = ino; /* this is the inode to enter */ idesc.id_fix = DONTKNOW; idesc.id_name = strdup(name); - dp = ginode(parent); + ginode(parent, &ip); + dp = ip.i_dp; if (DIP(dp, di_size) % DIRBLKSIZ) { DIP_SET(dp, di_size, roundup(DIP(dp, di_size), DIRBLKSIZ)); - inodirty(dp); + inodirty(&ip); } - if ((ckinode(dp, &idesc) & ALTERED) != 0) + if ((ckinode(dp, &idesc) & ALTERED) != 0) { + irelse(&ip); return (1); + } getpathname(pathbuf, parent, parent); - dp = ginode(parent); - if (expanddir(dp, pathbuf) == 0) + if (expanddir(&ip, pathbuf) == 0) { + irelse(&ip); return (0); - return (ckinode(dp, &idesc) & ALTERED); + } + retval = ckinode(dp, &idesc) & ALTERED; + irelse(&ip); + return (retval); } /* * Attempt to expand the size of a directory */ static int -expanddir(union dinode *dp, char *name) +expanddir(struct inode *ip, char *name) { ufs2_daddr_t lastlbn, oldblk, newblk, indirblk; size_t filesize, lastlbnsize; struct bufarea *bp, *nbp; struct inodesc idesc; + union dinode *dp; int indiralloced; char *cp; @@ -645,6 +684,7 @@ expanddir(union dinode *dp, char *name) pwarn("NO SPACE LEFT IN %s", name); if (!preen && reply("EXPAND") == 0) return (0); + dp = ip->i_dp; filesize = DIP(dp, di_size); lastlbn = lblkno(&sblock, filesize); /* @@ -671,7 +711,7 @@ expanddir(union dinode *dp, char *name) DIP_SET(dp, di_size, filesize + sblock.fs_bsize - lastlbnsize); DIP_SET(dp, di_blocks, DIP(dp, di_blocks) + btodb(sblock.fs_bsize - lastlbnsize)); - inodirty(dp); + inodirty(ip); memmove(nbp->b_un.b_buf, bp->b_un.b_buf, lastlbnsize); memset(&nbp->b_un.b_buf[lastlbnsize], 0, sblock.fs_bsize - lastlbnsize); @@ -680,10 +720,12 @@ expanddir(union dinode *dp, char *name) cp += DIRBLKSIZ) memmove(cp, &emptydir, sizeof emptydir); dirty(nbp); - nbp->b_flags &= ~B_INUSE; + brelse(nbp); idesc.id_blkno = oldblk; idesc.id_numfrags = numfrags(&sblock, lastlbnsize); (void)freeblock(&idesc); + if (preen) + printf(" (EXPANDED)\n"); return (1); } if ((newblk = allocblk(sblock.fs_frag)) == 0) @@ -719,18 +761,18 @@ expanddir(union dinode *dp, char *name) } IBLK_SET(nbp, lastlbn - UFS_NDADDR, newblk); dirty(nbp); - nbp->b_flags &= ~B_INUSE; + brelse(nbp); } DIP_SET(dp, di_size, filesize + sblock.fs_bsize); DIP_SET(dp, di_blocks, DIP(dp, di_blocks) + btodb(sblock.fs_bsize)); - inodirty(dp); + inodirty(ip); if (preen) printf(" (EXPANDED)\n"); return (1); bad: pfatal(" (EXPANSION FAILED)\n"); if (nbp != NULL) - nbp->b_flags &= ~B_INUSE; + brelse(nbp); if (newblk != 0) { idesc.id_blkno = newblk; idesc.id_numfrags = sblock.fs_frag; @@ -752,6 +794,7 @@ allocdir(ino_t parent, ino_t request, int mode) { ino_t ino; char *cp; + struct inode ip; union dinode *dp; struct bufarea *bp; struct inoinfo *inp; @@ -761,10 +804,12 @@ allocdir(ino_t parent, ino_t request, int mode) dirp = &dirhead; dirp->dot_ino = ino; dirp->dotdot_ino = parent; - dp = ginode(ino); + ginode(ino, &ip); + dp = ip.i_dp; bp = getdirblk(DIP(dp, di_db[0]), sblock.fs_fsize); if (bp->b_errs) { freeino(ino); + irelse(&ip); return (0); } memmove(bp->b_un.b_buf, dirp, sizeof(struct dirtemplate)); @@ -774,14 +819,16 @@ allocdir(ino_t parent, ino_t request, int mode) memmove(cp, &emptydir, sizeof emptydir); dirty(bp); DIP_SET(dp, di_nlink, 2); - inodirty(dp); + inodirty(&ip); if (ino == UFS_ROOTINO) { inoinfo(ino)->ino_linkcnt = DIP(dp, di_nlink); cacheino(dp, ino); + irelse(&ip); return(ino); } if (!INO_IS_DVALID(parent)) { freeino(ino); + irelse(&ip); return (0); } cacheino(dp, ino); @@ -793,9 +840,12 @@ allocdir(ino_t parent, ino_t request, int mode) inoinfo(ino)->ino_linkcnt = DIP(dp, di_nlink); inoinfo(parent)->ino_linkcnt++; } - dp = ginode(parent); + irelse(&ip); + ginode(parent, &ip); + dp = ip.i_dp; DIP_SET(dp, di_nlink, DIP(dp, di_nlink) + 1); - inodirty(dp); + inodirty(&ip); + irelse(&ip); return (ino); } @@ -805,12 +855,15 @@ allocdir(ino_t parent, ino_t request, int mode) static void freedir(ino_t ino, ino_t parent) { + struct inode ip; union dinode *dp; if (ino != parent) { - dp = ginode(parent); + ginode(parent, &ip); + dp = ip.i_dp; DIP_SET(dp, di_nlink, DIP(dp, di_nlink) - 1); - inodirty(dp); + inodirty(&ip); + irelse(&ip); } freeino(ino); } @@ -847,8 +900,8 @@ static struct bufarea * getdirblk(ufs2_daddr_t blkno, long size) { - if (pdirbp != NULL) - pdirbp->b_flags &= ~B_INUSE; + if (pdirbp != NULL && pdirbp->b_errs == 0) + brelse(pdirbp); pdirbp = getdatablk(blkno, size, BT_DIRDATA); return (pdirbp); } diff --git a/sbin/fsck_ffs/ea.c b/sbin/fsck_ffs/ea.c index 29e5f46d7651..7cf20196dfae 100644 --- a/sbin/fsck_ffs/ea.c +++ b/sbin/fsck_ffs/ea.c @@ -82,6 +82,7 @@ eascan(struct inodesc *idesc, struct ufs2_dinode *dp) if ((n & 31) == 31) printf("\n"); } + brelse(bp); return (STOP); #endif } diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h index a471d1979438..676350b75767 100644 --- a/sbin/fsck_ffs/fsck.h +++ b/sbin/fsck_ffs/fsck.h @@ -73,8 +73,7 @@ #define MAXDUP 10 /* limit on dup blks (per inode) */ #define MAXBAD 10 /* limit on bad blks (per inode) */ -#define MINBUFS 10 /* minimum number of buffers required */ -#define MAXBUFS 40 /* maximum space to allocate to buffers */ +#define MINBUFS 100 /* minimum number of buffers required */ #define INOBUFSIZE 64*1024 /* size of buffer to read inodes in pass1 */ #define ZEROBUFSIZE (dev_bsize * 128) /* size of zero buffer used by -Z */ @@ -101,9 +100,10 @@ union dinode { * have its link count adjusted by the value remaining in ino_linkcnt. */ struct inostat { - char ino_state; /* state of inode, see below */ - char ino_type; /* type of inode */ - short ino_linkcnt; /* number of links not found */ + u_char ino_state; /* state of inode, see below */ + u_char ino_type:4; /* type of inode */ + u_char ino_idtype:4; /* idesc id_type, SNAP or ADDR */ + u_short ino_linkcnt; /* number of links not found */ }; /* * Inode states. @@ -132,16 +132,35 @@ extern struct inostatlist { struct inostat *il_stat;/* inostat info for this cylinder group */ } *inostathead; +/* + * Structure to reference a dinode. + */ +struct inode { + struct bufarea *i_bp; /* buffer containing the dinode */ + union dinode *i_dp; /* pointer to dinode in buffer */ + ino_t i_number; /* inode number */ +}; + +/* + * Size of hash tables + */ +#define HASHSIZE 2048 +#define HASH(x) ((x * 2654435761) & (HASHSIZE - 1)) + /* * buffer cache structure. */ struct bufarea { - TAILQ_ENTRY(bufarea) b_list; /* buffer list */ + TAILQ_ENTRY(bufarea) b_list; /* LRU buffer queue */ + LIST_ENTRY(bufarea) b_hash; /* hash list */ ufs2_daddr_t b_bno; /* disk block number */ int b_size; /* size of I/O */ int b_errs; /* I/O error */ int b_flags; /* B_ flags below */ int b_type; /* BT_ type below */ + int b_refcnt; /* ref count of users */ + int b_index; /* for BT_LEVEL, ptr index */ + /* for BT_INODES, first inum */ union { char *b_buf; /* buffer space */ ufs1_daddr_t *b_indir1; /* UFS1 indirect block */ @@ -151,7 +170,6 @@ struct bufarea { struct ufs1_dinode *b_dinode1; /* UFS1 inode block */ struct ufs2_dinode *b_dinode2; /* UFS2 inode block */ } b_un; - char b_dirty; }; #define IBLK(bp, i) \ @@ -168,7 +186,7 @@ struct bufarea { /* * Buffer flags */ -#define B_INUSE 0x00000001 /* Buffer is in use */ +#define B_DIRTY 0x00000001 /* Buffer is dirty */ /* * Type of data in buffer */ @@ -182,7 +200,8 @@ struct bufarea { #define BT_INODES 7 /* Buffer holds inodes */ #define BT_DIRDATA 8 /* Buffer holds directory data */ #define BT_DATA 9 /* Buffer holds user data */ -#define BT_NUMBUFTYPES 10 +#define BT_EMPTY 10 /* Buffer allocated but not filled */ +#define BT_NUMBUFTYPES 11 #define BT_NAMES { \ "unknown", \ "Superblock", \ @@ -193,27 +212,33 @@ struct bufarea { "External Attribute", \ "Inode Block", \ "Directory Contents", \ - "User Data" } + "User Data", \ + "Allocated but not filled" } +extern char *buftype[]; +#define BT_BUFTYPE(type) \ + type < BT_NUMBUFTYPES ? buftype[type] : buftype[BT_UNKNOWN] extern long readcnt[BT_NUMBUFTYPES]; extern long totalreadcnt[BT_NUMBUFTYPES]; extern struct timespec readtime[BT_NUMBUFTYPES]; extern struct timespec totalreadtime[BT_NUMBUFTYPES]; extern struct timespec startprog; +extern struct bufarea *icachebp; /* inode cache buffer */ extern struct bufarea sblk; /* file system superblock */ extern struct bufarea *pdirbp; /* current directory contents */ -extern struct bufarea *pbp; /* current inode block */ +extern int sujrecovery; /* 1 => doing check using the journal */ #define dirty(bp) do { \ if (fswritefd < 0) \ pfatal("SETTING DIRTY FLAG IN READ_ONLY MODE\n"); \ else \ - (bp)->b_dirty = 1; \ + (bp)->b_flags |= B_DIRTY; \ } while (0) #define initbarea(bp, type) do { \ - (bp)->b_dirty = 0; \ (bp)->b_bno = (ufs2_daddr_t)-1; \ (bp)->b_flags = 0; \ + (bp)->b_refcnt = 0; \ + (bp)->b_index = 0; \ (bp)->b_type = type; \ } while (0) @@ -227,6 +252,8 @@ struct inodesc { enum fixstate id_fix; /* policy on fixing errors */ int (*id_func)(struct inodesc *); /* function to be applied to blocks of inode */ + struct bufarea *id_bp; /* ckinode: buffer with indirect pointers */ + union dinode *id_dp; /* ckinode: dinode being traversed */ ino_t id_number; /* inode number described */ ino_t id_parent; /* for DATA nodes, their parent */ ufs_lbn_t id_lbn; /* logical block number of current block */ @@ -239,7 +266,7 @@ struct inodesc { int id_loc; /* for DATA nodes, current location in dir */ struct direct *id_dirp; /* for DATA nodes, ptr to current entry */ char *id_name; /* for DATA nodes, name to find or enter */ - char id_type; /* type of descriptor, DATA or ADDR */ + char id_type; /* type of descriptor, DATA, ADDR, or SNAP */ }; /* file types */ #define DATA 1 /* a directory */ @@ -332,7 +359,6 @@ extern char skipclean; /* skip clean file systems if preening */ extern int fsmodified; /* 1 => write done to file system */ extern int fsreadfd; /* file descriptor for reading file system */ extern int fswritefd; /* file descriptor for writing file system */ -extern struct uufsd disk; /* libufs user-ufs disk structure */ extern int surrender; /* Give up if reads fail */ extern int wantrestart; /* Restart fsck on early termination */ @@ -352,12 +378,11 @@ extern volatile sig_atomic_t got_sigalarm; /* received a SIGALRM */ #define clearinode(dp) \ if (sblock.fs_magic == FS_UFS1_MAGIC) { \ - (dp)->dp1 = ufs1_zino; \ + (dp)->dp1 = zino.dp1; \ } else { \ - (dp)->dp2 = ufs2_zino; \ + (dp)->dp2 = zino.dp2; \ } -extern struct ufs1_dinode ufs1_zino; -extern struct ufs2_dinode ufs2_zino; +extern union dinode zino; #define setbmap(blkno) setbit(blockmap, blkno) #define testbmap(blkno) isset(blockmap, blkno) @@ -408,6 +433,7 @@ struct fstab; void adjust(struct inodesc *, int lcnt); +void alarmhandler(int sig); ufs2_daddr_t allocblk(long frags); ino_t allocdir(ino_t parent, ino_t request, int mode); ino_t allocino(ino_t request, int type); @@ -418,12 +444,14 @@ void bufinit(void); void blwrite(int fd, char *buf, ufs2_daddr_t blk, ssize_t size); void blerase(int fd, ufs2_daddr_t blk, long size); void blzero(int fd, ufs2_daddr_t blk, long size); +void brelse(struct bufarea *); void cacheino(union dinode *dp, ino_t inumber); void catch(int); void catchquit(int); void cgdirty(struct bufarea *); +struct bufarea *cglookup(int cg); int changeino(ino_t dir, const char *name, ino_t newnum); -int check_cgmagic(int cg, struct bufarea *cgbp); +int check_cgmagic(int cg, struct bufarea *cgbp, int requestrebuild); int chkrange(ufs2_daddr_t blk, int cnt); void ckfini(int markclean); int ckinode(union dinode *dp, struct inodesc *); @@ -444,16 +472,17 @@ void freeinodebuf(void); void fsutilinit(void); int ftypeok(union dinode *dp); void getblk(struct bufarea *bp, ufs2_daddr_t blk, long size); -struct bufarea *cglookup(int cg); struct bufarea *getdatablk(ufs2_daddr_t blkno, long size, int type); struct inoinfo *getinoinfo(ino_t inumber); union dinode *getnextinode(ino_t inumber, int rebuildcg); void getpathname(char *namebuf, ino_t curdir, ino_t ino); -union dinode *ginode(ino_t inumber); +void ginode(ino_t, struct inode *); void infohandler(int sig); -void alarmhandler(int sig); +void irelse(struct inode *); +ufs2_daddr_t ino_blkatoff(union dinode *, ino_t, ufs_lbn_t, int *, + struct bufarea **); void inocleanup(void); -void inodirty(union dinode *); +void inodirty(struct inode *); struct inostat *inoinfo(ino_t inum); void IOstats(char *what); int linkup(ino_t orphan, ino_t parentdir, char *name); @@ -468,13 +497,13 @@ void pass4(void); void pass5(void); void pfatal(const char *fmt, ...) __printflike(1, 2); void propagate(void); -void prtinode(ino_t ino, union dinode *dp); +void prtinode(struct inode *); void pwarn(const char *fmt, ...) __printflike(1, 2); int readsb(int listerr); int reply(const char *question); void rwerror(const char *mesg, ufs2_daddr_t blk); void sblock_init(void); -void setinodebuf(ino_t); +void setinodebuf(int, ino_t); int setup(char *dev); void gjournal_check(const char *filesys); int suj_check(const char *filesys); diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 11d2ebd598fd..64c4701d9b7f 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -64,9 +64,14 @@ __FBSDID("$FreeBSD$"); #include "fsck.h" +int sujrecovery = 0; + +static struct bufarea *allocbuf(const char *); +static void cg_write(struct bufarea *); static void slowio_start(void); static void slowio_end(void); static void printIOstats(void); +static void prtbuf(const char *, struct bufarea *); static long diskreads, totaldiskreads, totalreads; /* Disk cache statistics */ static struct timespec startpass, finishpass; @@ -74,12 +79,16 @@ struct timeval slowio_starttime; int slowio_delay_usec = 10000; /* Initial IO delay for background fsck */ int slowio_pollcnt; static struct bufarea cgblk; /* backup buffer for cylinder group blocks */ -static TAILQ_HEAD(buflist, bufarea) bufhead; /* head of buffer cache list */ +static TAILQ_HEAD(bufqueue, bufarea) bufqueuehd; /* head of buffer cache LRU */ +static LIST_HEAD(bufhash, bufarea) bufhashhd[HASHSIZE]; /* buffer hash list */ static int numbufs; /* size of buffer cache */ -static char *buftype[BT_NUMBUFTYPES] = BT_NAMES; +static int cachelookups; /* number of cache lookups */ +static int cachereads; /* number of cache reads */ static struct bufarea *cgbufs; /* header for cylinder group cache */ static int flushtries; /* number of tries to reclaim memory */ +char *buftype[BT_NUMBUFTYPES] = BT_NAMES; + void fsutilinit(void) { @@ -89,11 +98,6 @@ fsutilinit(void) bzero(&slowio_starttime, sizeof(struct timeval)); slowio_delay_usec = 10000; slowio_pollcnt = 0; - bzero(&cgblk, sizeof(struct bufarea)); - TAILQ_INIT(&bufhead); - numbufs = 0; - /* buftype ? */ - cgbufs = NULL; flushtries = 0; } @@ -181,33 +185,19 @@ inoinfo(ino_t inum) void bufinit(void) { - struct bufarea *bp; - long bufcnt, i; - char *bufp; + int i; - pbp = pdirbp = (struct bufarea *)0; - bufp = Malloc((unsigned int)sblock.fs_bsize); - if (bufp == NULL) - errx(EEXIT, "cannot allocate buffer pool"); - cgblk.b_un.b_buf = bufp; + pdirbp = (struct bufarea *)0; + bzero(&cgblk, sizeof(struct bufarea)); + cgblk.b_un.b_buf = Malloc((unsigned int)sblock.fs_bsize); + if (cgblk.b_un.b_buf == NULL) + errx(EEXIT, "Initial malloc(%d) failed", sblock.fs_bsize); initbarea(&cgblk, BT_CYLGRP); - TAILQ_INIT(&bufhead); - bufcnt = MAXBUFS; - if (bufcnt < MINBUFS) - bufcnt = MINBUFS; - for (i = 0; i < bufcnt; i++) { - bp = (struct bufarea *)Malloc(sizeof(struct bufarea)); - bufp = Malloc((unsigned int)sblock.fs_bsize); - if (bp == NULL || bufp == NULL) { - if (i >= MINBUFS) - break; - errx(EEXIT, "cannot allocate buffer pool"); - } - bp->b_un.b_buf = bufp; - TAILQ_INSERT_HEAD(&bufhead, bp, b_list); - initbarea(bp, BT_UNKNOWN); - } - numbufs = i; /* save number of buffers */ + cgbufs = NULL; + numbufs = cachelookups = cachereads = 0; + TAILQ_INIT(&bufqueuehd); + for (i = 0; i < HASHSIZE; i++) + LIST_INIT(&bufhashhd[i]); for (i = 0; i < BT_NUMBUFTYPES; i++) { readtime[i].tv_sec = totalreadtime[i].tv_sec = 0; readtime[i].tv_nsec = totalreadtime[i].tv_nsec = 0; @@ -215,6 +205,25 @@ bufinit(void) } } +static struct bufarea * +allocbuf(const char *failreason) +{ + struct bufarea *bp; + char *bufp; + + bp = (struct bufarea *)Malloc(sizeof(struct bufarea)); + bufp = Malloc((unsigned int)sblock.fs_bsize); + if (bp == NULL || bufp == NULL) { + errx(EEXIT, "%s", failreason); + /* NOTREACHED */ + } + numbufs++; + bp->b_un.b_buf = bufp; + TAILQ_INSERT_HEAD(&bufqueuehd, bp, b_list); + initbarea(bp, BT_UNKNOWN); + return (bp); +} + /* * Manage cylinder group buffers. * @@ -230,18 +239,22 @@ cglookup(int cg) struct bufarea *cgbp; struct cg *cgp; + if ((unsigned) cg >= sblock.fs_ncg) + errx(EEXIT, "cglookup: out of range cylinder group %d", cg); if (cgbufs == NULL) { cgbufs = calloc(sblock.fs_ncg, sizeof(struct bufarea)); if (cgbufs == NULL) - errx(EEXIT, "cannot allocate cylinder group buffers"); + errx(EEXIT, "Cannot allocate cylinder group buffers"); } cgbp = &cgbufs[cg]; if (cgbp->b_un.b_cg != NULL) return (cgbp); cgp = NULL; if (flushtries == 0) - cgp = malloc((unsigned int)sblock.fs_cgsize); + cgp = Malloc((unsigned int)sblock.fs_cgsize); if (cgp == NULL) { + if (sujrecovery) + errx(EEXIT,"Ran out of memory during journal recovery"); getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize); return (&cgblk); } @@ -278,7 +291,7 @@ flushentry(void) { struct bufarea *cgbp; - if (flushtries == sblock.fs_ncg || cgbufs == NULL) + if (sujrecovery || flushtries == sblock.fs_ncg || cgbufs == NULL) return (0); cgbp = &cgbufs[flushtries++]; if (cgbp->b_un.b_cg == NULL) @@ -296,25 +309,84 @@ struct bufarea * getdatablk(ufs2_daddr_t blkno, long size, int type) { struct bufarea *bp; + struct bufhash *bhdp; - TAILQ_FOREACH(bp, &bufhead, b_list) - if (bp->b_bno == fsbtodb(&sblock, blkno)) + cachelookups++; + /* If out of range, return empty buffer with b_err == -1 */ + if (type != BT_INODES && chkrange(blkno, size / sblock.fs_fsize)) { + blkno = -1; + type = BT_EMPTY; + } + bhdp = &bufhashhd[HASH(blkno)]; + LIST_FOREACH(bp, bhdp, b_hash) + if (bp->b_bno == fsbtodb(&sblock, blkno)) { + if (debug && bp->b_size != size) { + prtbuf("getdatablk: size mismatch", bp); + pfatal("getdatablk: b_size %d != size %ld\n", + bp->b_size, size); + } goto foundit; - TAILQ_FOREACH_REVERSE(bp, &bufhead, buflist, b_list) - if ((bp->b_flags & B_INUSE) == 0) - break; - if (bp == NULL) - errx(EEXIT, "deadlocked buffer pool"); + } + /* + * Move long-term busy buffer back to the front of the LRU so we + * do not endless inspect them for recycling. + */ + bp = TAILQ_LAST(&bufqueuehd, bufqueue); + if (bp != NULL && bp->b_refcnt != 0) { + TAILQ_REMOVE(&bufqueuehd, bp, b_list); + TAILQ_INSERT_HEAD(&bufqueuehd, bp, b_list); + } + /* + * Allocate up to the minimum number of buffers before + * considering recycling any of them. + */ + if (size > sblock.fs_bsize) + errx(EEXIT, "Excessive buffer size %ld > %d\n", size, + sblock.fs_bsize); + if (numbufs < MINBUFS) { + bp = allocbuf("cannot create minimal buffer pool"); + } else if (sujrecovery) { + /* + * SUJ recovery does not want anything written until it + * has successfully completed (so it can fail back to + * full fsck). Thus, we can only recycle clean buffers. + */ + TAILQ_FOREACH_REVERSE(bp, &bufqueuehd, bufqueue, b_list) + if ((bp->b_flags & B_DIRTY) == 0 && bp->b_refcnt == 0) + break; + if (bp == NULL) + bp = allocbuf("Ran out of memory during " + "journal recovery"); + else + LIST_REMOVE(bp, b_hash); + } else { + /* + * Recycle oldest non-busy buffer. + */ + TAILQ_FOREACH_REVERSE(bp, &bufqueuehd, bufqueue, b_list) + if (bp->b_refcnt == 0) + break; *** 4026 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A1DA04DEAEC; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@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 4DBj024G77z4Sdn; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85C1F19652; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKodP062997; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKoqM062996; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:50 GMT Message-Id: <202101072320.107NKoqM062996@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: a84b0e94cdbf - main - hid: Add UPDATING entry and bump __FreeBSD_version MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a84b0e94cdbf1a17a798ab7f77375aacb4d400ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:50 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=a84b0e94cdbf1a17a798ab7f77375aacb4d400ff commit a84b0e94cdbf1a17a798ab7f77375aacb4d400ff Author: Vladimir Kondratyev AuthorDate: 2021-01-06 13:44:11 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:44 +0000 hid: Add UPDATING entry and bump __FreeBSD_version Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D28019 --- UPDATING | 6 ++++++ sys/sys/param.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index c2163a4342e4..77b4bacdc6c0 100644 --- a/UPDATING +++ b/UPDATING @@ -26,6 +26,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +2021XXXX: + Transport-independent parts of HID support have been split off the USB + code in to separate subsystem. Kernel configs which include one of + ums, ukbd, uhid, atp, wsp, wmt, uaudio, ugold or ucycom drivers should + be updated with adding of "device hid" line. + 20210105: ncurses installation has been modified to only keep the widechar enabled version. Incremental build is broken for that change, so it diff --git a/sys/sys/param.h b/sys/sys/param.h index 3137693848f1..a1747efbf1b4 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300133 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300134 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B21354DEC0D; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@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 4DBj024ZHXz4Sp1; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F7C119529; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKorQ063014; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKocW063013; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:50 GMT Message-Id: <202101072320.107NKocW063013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: d97d5c0ce89d - main - hid: Import hidmap-based drivers written by Greg V MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d97d5c0ce89da10c1de150e0555774dec2ed7aed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:50 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=d97d5c0ce89da10c1de150e0555774dec2ed7aed commit d97d5c0ce89da10c1de150e0555774dec2ed7aed Author: Vladimir Kondratyev AuthorDate: 2020-10-14 22:02:15 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:44 +0000 hid: Import hidmap-based drivers written by Greg V This change includes: hpen - Generic / MS Windows compatible HID pen tablet driver. hgame - Generic game controller and joystick driver. xb360gp - Xbox360-compatible game controller driver. Submitted by: Greg V Reviewed by: hselasky (as part of D27993) --- share/man/man4/Makefile | 3 + share/man/man4/hgame.4 | 105 ++++++++++++++++ share/man/man4/hpen.4 | 112 +++++++++++++++++ share/man/man4/xb360gp.4 | 98 +++++++++++++++ sys/conf/files | 3 + sys/dev/hid/hgame.c | 200 ++++++++++++++++++++++++++++++ sys/dev/hid/hgame.h | 45 +++++++ sys/dev/hid/hpen.c | 256 +++++++++++++++++++++++++++++++++++++++ sys/dev/hid/xb360gp.c | 183 ++++++++++++++++++++++++++++ sys/modules/hid/Makefile | 5 +- sys/modules/hid/hgame/Makefile | 9 ++ sys/modules/hid/hpen/Makefile | 9 ++ sys/modules/hid/xb360gp/Makefile | 9 ++ 13 files changed, 1036 insertions(+), 1 deletion(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 60c1b5f19a9b..b905d97d80d0 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -181,6 +181,7 @@ MAN= aac.4 \ h_ertt.4 \ hconf.4 \ hcons.4 \ + hgame.4 \ hidbus.4 \ hidquirk.4 \ hidraw.4 \ @@ -188,6 +189,7 @@ MAN= aac.4 \ hkbd.4 \ hms.4 \ hmt.4 \ + hpen.4 \ hpet.4 \ ${_hpt27xx.4} \ ${_hptiop.4} \ @@ -592,6 +594,7 @@ MAN= aac.4 \ wmt.4 \ ${_wpi.4} \ wsp.4 \ + xb360gp.4 \ ${_xen.4} \ xhci.4 \ xl.4 \ diff --git a/share/man/man4/hgame.4 b/share/man/man4/hgame.4 new file mode 100644 index 000000000000..addf14d9f5c5 --- /dev/null +++ b/share/man/man4/hgame.4 @@ -0,0 +1,105 @@ +.\" Copyright (c) 2020 Vladimir Kondratyev +.\" +.\" 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 September 14, 2020 +.Dt HGAME 4 +.Os +.Sh NAME +.Nm hgame +.Nd Generic HID game controller (joystick/gamepad) driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device hgame" +.Cd "device hid" +.Cd "device hidbus" +.Cd "device hidmap" +.Cd "device evdev" +.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 +hgame_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for generic game controllers (joysticks/gamepads) +that attach to the HID transport backend. +See +.Xr iichid 4 +or +.Xr usbhid 4 . +.Pp +The +.Pa /dev/input/event* +device presents the game controller as a +.Ar evdev +type device. +.Sh SYSCTL VARIABLES +The following variable is available as both +.Xr sysctl 8 +variable and +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va dev.hgame.X.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Pp +It's default value is set with +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va hw.hid.hgame.debug +.El +.Sh FILES +.Bl -tag -width /dev/input/event* -compact +.It Pa /dev/input/event* +input event device node. +.El +.Sh SEE ALSO +.Xr iichid 4 , +.Xr usbhid 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0. +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Greg V Aq Mt greg@unrelenting.technology . +.Pp +This manual page was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . diff --git a/share/man/man4/hpen.4 b/share/man/man4/hpen.4 new file mode 100644 index 000000000000..a043169895ec --- /dev/null +++ b/share/man/man4/hpen.4 @@ -0,0 +1,112 @@ +.\" Copyright (c) 2020 Vladimir Kondratyev +.\" +.\" 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 September 14, 2020 +.Dt HPEN 4 +.Os +.Sh NAME +.Nm hpen +.Nd MS Windows compatible HID pen tablet driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device hpen" +.Cd "device hid" +.Cd "device hidbus" +.Cd "device hidmap" +.Cd "device evdev" +.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 +hpen_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for generic MS Windows compatible HID pen tablet +and digitizer that attach to the HID transport backend. +See +.Xr iichid 4 +or +.Xr usbhid 4 . +.Pp +The +.Pa /dev/input/event* +device presents the pen as a +.Ar evdev +type device. +.Sh SYSCTL VARIABLES +The following variable is available as both +.Xr sysctl 8 +variable and +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va dev.hpen.X.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Pp +It's default value is set with +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va hw.hid.hpen.debug +.El +.Sh FILES +.Bl -tag -width /dev/input/event* -compact +.It Pa /dev/input/event* +input event device node. +.El +.Sh SEE ALSO +.Xr iichid 4 , +.Xr usbhid 4 , +.Xr xorg.conf 5 Pq Pa ports/x11/xorg +.Sh BUGS +.Nm +cannot act like +.Xr sysmouse 4 . +.Pp +Pen battery charge level reporting is not supported. +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0. +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Greg V Aq Mt greg@unrelenting.technology . +.Pp +This manual page was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . diff --git a/share/man/man4/xb360gp.4 b/share/man/man4/xb360gp.4 new file mode 100644 index 000000000000..b19334cc3a0b --- /dev/null +++ b/share/man/man4/xb360gp.4 @@ -0,0 +1,98 @@ +.\" Copyright (c) 2020 Vladimir Kondratyev +.\" +.\" 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 September 16, 2020 +.Dt XB360GP 4 +.Os +.Sh NAME +.Nm xb360gp +.Nd XBox 360 gamepad driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device xb360gp" +.Cd "device hgame" +.Cd "device hid" +.Cd "device hidbus" +.Cd "device hidmap" +.Cd "device evdev" +.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 +xb360gp_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for XBox 360 gamepad driver. +.Pp +The +.Pa /dev/input/event* +device presents the game controller as a +.Ar evdev +type device. +.Sh SYSCTL VARIABLES +The following variable is available as both +.Xr sysctl 8 +variable and +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va dev.xb360gp.X.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Pp +It's default value is set with +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va hw.hid.xb360gp.debug +.El +.Sh FILES +.Bl -tag -width /dev/input/event* -compact +.It Pa /dev/input/event* +input event device node. +.El +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0. +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Greg V Aq Mt greg@unrelenting.technology . +.Pp +This manual page was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . diff --git a/sys/conf/files b/sys/conf/files index 31a06150a329..6597d9e471a4 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1817,6 +1817,7 @@ dev/gpio/gpiopps.c optional gpiopps fdt dev/gpio/ofw_gpiobus.c optional fdt gpio dev/hid/hconf.c optional hconf dev/hid/hcons.c optional hcons +dev/hid/hgame.c optional hgame dev/hid/hid.c optional hid dev/hid/hid_if.m optional hid dev/hid/hidbus.c optional hidbus @@ -1826,8 +1827,10 @@ dev/hid/hidraw.c optional hidraw dev/hid/hkbd.c optional hkbd dev/hid/hms.c optional hms dev/hid/hmt.c optional hmt hconf +dev/hid/hpen.c optional hpen dev/hid/hsctrl.c optional hsctrl dev/hid/ps4dshock.c optional ps4dshock +dev/hid/xb360gp.c optional xb360gp dev/hifn/hifn7751.c optional hifn dev/hptiop/hptiop.c optional hptiop scbus dev/hwpmc/hwpmc_logging.c optional hwpmc diff --git a/sys/dev/hid/hgame.c b/sys/dev/hid/hgame.c new file mode 100644 index 000000000000..099af092a4e5 --- /dev/null +++ b/sys/dev/hid/hgame.c @@ -0,0 +1,200 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Vladimir Kondratyev + * Copyright (c) 2020 Greg V + * + * 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 +__FBSDID("$FreeBSD$"); + +/* + * Generic HID game controller (joystick/gamepad) driver, + */ + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#define HGAME_MAP_BRG(number_from, number_to, code) \ + { HIDMAP_KEY_RANGE(HUP_BUTTON, number_from, number_to, code) } +#define HGAME_MAP_ABS(usage, code) \ + { HIDMAP_ABS(HUP_GENERIC_DESKTOP, HUG_##usage, code) } +#define HGAME_MAP_CRG(usage_from, usage_to, callback) \ + { HIDMAP_ANY_CB_RANGE(HUP_GENERIC_DESKTOP, \ + HUG_##usage_from, HUG_##usage_to, callback) } +#define HGAME_FINALCB(cb) \ + { HIDMAP_FINAL_CB(&cb) } + +static const struct hidmap_item hgame_map[] = { + HGAME_MAP_BRG(1, 16, BTN_TRIGGER), + HGAME_MAP_ABS(X, ABS_X), + HGAME_MAP_ABS(Y, ABS_Y), + HGAME_MAP_ABS(Z, ABS_Z), + HGAME_MAP_ABS(RX, ABS_RX), + HGAME_MAP_ABS(RY, ABS_RY), + HGAME_MAP_ABS(RZ, ABS_RZ), + HGAME_MAP_ABS(HAT_SWITCH, ABS_HAT0X), + HGAME_MAP_CRG(D_PAD_UP, D_PAD_LEFT, hgame_dpad_cb), + HGAME_MAP_BRG(17, 57, BTN_TRIGGER_HAPPY), + HGAME_FINALCB( hgame_final_cb), +}; + +static const struct hid_device_id hgame_devs[] = { + { HID_TLC(HUP_GENERIC_DESKTOP, HUG_JOYSTICK), + HID_DRIVER_INFO(HUG_JOYSTICK) }, + { HID_TLC(HUP_GENERIC_DESKTOP, HUG_GAME_PAD), + HID_DRIVER_INFO(HUG_GAME_PAD) }, +}; + +/* + * Emulate the hat switch report via the D-pad usages + * found on XInput/XBox style devices + */ +int +hgame_dpad_cb(HIDMAP_CB_ARGS) +{ + struct hgame_softc *sc = HIDMAP_CB_GET_SOFTC(); + struct evdev_dev *evdev = HIDMAP_CB_GET_EVDEV(); + int32_t data; + + switch (HIDMAP_CB_GET_STATE()) { + case HIDMAP_CB_IS_ATTACHING: + HIDMAP_CB_UDATA64 = HID_GET_USAGE(ctx.hi->usage); + evdev_support_event(evdev, EV_ABS); + evdev_support_abs(evdev, ABS_HAT0X, -1, 1, 0, 0, 0); + evdev_support_abs(evdev, ABS_HAT0Y, -1, 1, 0, 0, 0); + break; + + case HIDMAP_CB_IS_RUNNING: + data = ctx.data; + switch (HIDMAP_CB_UDATA64) { + case HUG_D_PAD_UP: + if (sc->dpad_down) + return (ENOMSG); + evdev_push_abs(evdev, ABS_HAT0Y, (data == 0) ? 0 : -1); + sc->dpad_up = (data != 0); + break; + case HUG_D_PAD_DOWN: + if (sc->dpad_up) + return (ENOMSG); + evdev_push_abs(evdev, ABS_HAT0Y, (data == 0) ? 0 : 1); + sc->dpad_down = (data != 0); + break; + case HUG_D_PAD_RIGHT: + if (sc->dpad_left) + return (ENOMSG); + evdev_push_abs(evdev, ABS_HAT0X, (data == 0) ? 0 : 1); + sc->dpad_right = (data != 0); + break; + case HUG_D_PAD_LEFT: + if (sc->dpad_right) + return (ENOMSG); + evdev_push_abs(evdev, ABS_HAT0X, (data == 0) ? 0 : -1); + sc->dpad_left = (data != 0); + break; + } + } + + return (0); +} + +int +hgame_final_cb(HIDMAP_CB_ARGS) +{ + struct evdev_dev *evdev = HIDMAP_CB_GET_EVDEV(); + + if (HIDMAP_CB_GET_STATE() == HIDMAP_CB_IS_ATTACHING) + evdev_support_prop(evdev, INPUT_PROP_DIRECT); + + /* Do not execute callback at interrupt handler and detach */ + return (ENOSYS); +} + +static int +hgame_probe(device_t dev) +{ + const struct hid_device_info *hw = hid_get_device_info(dev); + struct hgame_softc *sc = device_get_softc(dev); + int error; + + if (hid_test_quirk(hw, HQ_IS_XBOX360GP)) + return(ENXIO); + + error = HIDMAP_PROBE(&sc->hm, dev, hgame_devs, hgame_map, NULL); + if (error > 0) + return (error); + + hidbus_set_desc(dev, hidbus_get_driver_info(dev) == HUG_GAME_PAD ? + "Gamepad" : "Joystick"); + + return (BUS_PROBE_GENERIC); +} + + + +static int +hgame_attach(device_t dev) +{ + struct hgame_softc *sc = device_get_softc(dev); + + return (hidmap_attach(&sc->hm)); +} + +static int +hgame_detach(device_t dev) +{ + struct hgame_softc *sc = device_get_softc(dev); + + return (hidmap_detach(&sc->hm)); +} + +static devclass_t hgame_devclass; +static device_method_t hgame_methods[] = { + DEVMETHOD(device_probe, hgame_probe), + DEVMETHOD(device_attach, hgame_attach), + DEVMETHOD(device_detach, hgame_detach), + + DEVMETHOD_END +}; + +DEFINE_CLASS_0(hgame, hgame_driver, hgame_methods, sizeof(struct hgame_softc)); +DRIVER_MODULE(hgame, hidbus, hgame_driver, hgame_devclass, NULL, 0); +MODULE_DEPEND(hgame, hid, 1, 1, 1); +MODULE_DEPEND(hgame, hidbus, 1, 1, 1); +MODULE_DEPEND(hgame, hidmap, 1, 1, 1); +MODULE_DEPEND(hgame, evdev, 1, 1, 1); +MODULE_VERSION(hgame, 1); +HID_PNP_INFO(hgame_devs); diff --git a/sys/dev/hid/hgame.h b/sys/dev/hid/hgame.h new file mode 100644 index 000000000000..32086ec4923c --- /dev/null +++ b/sys/dev/hid/hgame.h @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Vladimir Kondratyev + * Copyright (c) 2020 Greg V + * + * 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. + */ + +#ifndef _HID_HGAME_H_ +#define _HID_HGAME_H_ + +#include + +hidmap_cb_t hgame_dpad_cb; +hidmap_cb_t hgame_final_cb; + +struct hgame_softc { + struct hidmap hm; + bool dpad_up; + bool dpad_down; + bool dpad_right; + bool dpad_left; +}; + +#endif /* !_HGAME_H_ */ diff --git a/sys/dev/hid/hpen.c b/sys/dev/hid/hpen.c new file mode 100644 index 000000000000..430461d87727 --- /dev/null +++ b/sys/dev/hid/hpen.c @@ -0,0 +1,256 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Vladimir Kondratyev + * Copyright (c) 2019 Greg V + * + * 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 +__FBSDID("$FreeBSD$"); + +/* + * Generic / MS Windows compatible HID pen tablet driver: + * https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/required-hid-top-level-collections + * + * Tested on: Wacom WCOM50C1 (Google Pixelbook "eve") + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include "usbdevs.h" + +static const uint8_t hpen_graphire_report_descr[] = + { HID_GRAPHIRE_REPORT_DESCR() }; +static const uint8_t hpen_graphire3_4x5_report_descr[] = + { HID_GRAPHIRE3_4X5_REPORT_DESCR() }; + +static hidmap_cb_t hpen_battery_strenght_cb; +static hidmap_cb_t hpen_final_digi_cb; +static hidmap_cb_t hpen_final_pen_cb; + +#define HPEN_MAP_BUT(usage, code) \ + HIDMAP_KEY(HUP_DIGITIZERS, HUD_##usage, code) +#define HPEN_MAP_ABS(usage, code) \ + HIDMAP_ABS(HUP_DIGITIZERS, HUD_##usage, code) +#define HPEN_MAP_ABS_GD(usage, code) \ + HIDMAP_ABS(HUP_GENERIC_DESKTOP, HUG_##usage, code) +#define HPEN_MAP_ABS_CB(usage, cb) \ + HIDMAP_ABS_CB(HUP_DIGITIZERS, HUD_##usage, &cb) + +/* Generic map digitizer page map according to hut1_12v2.pdf */ +static const struct hidmap_item hpen_map_digi[] = { + { HPEN_MAP_ABS_GD(X, ABS_X), .required = true }, + { HPEN_MAP_ABS_GD(Y, ABS_Y), .required = true }, + { HPEN_MAP_ABS( TIP_PRESSURE, ABS_PRESSURE) }, + { HPEN_MAP_ABS( X_TILT, ABS_TILT_X) }, + { HPEN_MAP_ABS( Y_TILT, ABS_TILT_Y) }, + { HPEN_MAP_ABS_CB(BATTERY_STRENGTH, hpen_battery_strenght_cb) }, + { HPEN_MAP_BUT( TOUCH, BTN_TOUCH) }, + { HPEN_MAP_BUT( TIP_SWITCH, BTN_TOUCH) }, + { HPEN_MAP_BUT( SEC_TIP_SWITCH, BTN_TOUCH) }, + { HPEN_MAP_BUT( IN_RANGE, BTN_TOOL_PEN) }, + { HPEN_MAP_BUT( BARREL_SWITCH, BTN_STYLUS) }, + { HPEN_MAP_BUT( INVERT, BTN_TOOL_RUBBER) }, + { HPEN_MAP_BUT( ERASER, BTN_TOUCH) }, + { HPEN_MAP_BUT( TABLET_PICK, BTN_STYLUS2) }, + { HPEN_MAP_BUT( SEC_BARREL_SWITCH,BTN_STYLUS2) }, + { HIDMAP_FINAL_CB( &hpen_final_digi_cb) }, +}; + +/* Microsoft-standardized pen support */ +static const struct hidmap_item hpen_map_pen[] = { + { HPEN_MAP_ABS_GD(X, ABS_X), .required = true }, + { HPEN_MAP_ABS_GD(Y, ABS_Y), .required = true }, + { HPEN_MAP_ABS( TIP_PRESSURE, ABS_PRESSURE), .required = true }, + { HPEN_MAP_ABS( X_TILT, ABS_TILT_X) }, + { HPEN_MAP_ABS( Y_TILT, ABS_TILT_Y) }, + { HPEN_MAP_ABS_CB(BATTERY_STRENGTH, hpen_battery_strenght_cb) }, + { HPEN_MAP_BUT( TIP_SWITCH, BTN_TOUCH), .required = true }, + { HPEN_MAP_BUT( IN_RANGE, BTN_TOOL_PEN), .required = true }, + { HPEN_MAP_BUT( BARREL_SWITCH, BTN_STYLUS) }, + { HPEN_MAP_BUT( INVERT, BTN_TOOL_RUBBER), .required = true }, + { HPEN_MAP_BUT( ERASER, BTN_TOUCH), .required = true }, + { HIDMAP_FINAL_CB( &hpen_final_pen_cb) }, +}; + +static const struct hid_device_id hpen_devs[] = { + { HID_TLC(HUP_DIGITIZERS, HUD_DIGITIZER) }, + { HID_TLC(HUP_DIGITIZERS, HUD_PEN) }, +}; + +static int +hpen_battery_strenght_cb(HIDMAP_CB_ARGS) +{ + struct evdev_dev *evdev = HIDMAP_CB_GET_EVDEV(); + int32_t data; + + switch (HIDMAP_CB_GET_STATE()) { + case HIDMAP_CB_IS_ATTACHING: + evdev_support_event(evdev, EV_PWR); + /* TODO */ + break; + case HIDMAP_CB_IS_RUNNING: + data = ctx.data; + /* TODO */ + } + + return (0); +} + +static int +hpen_final_digi_cb(HIDMAP_CB_ARGS) +{ + struct evdev_dev *evdev = HIDMAP_CB_GET_EVDEV(); + + if (HIDMAP_CB_GET_STATE() == HIDMAP_CB_IS_ATTACHING) + evdev_support_prop(evdev, INPUT_PROP_POINTER); + + /* Do not execute callback at interrupt handler and detach */ + return (ENOSYS); +} + +static int +hpen_final_pen_cb(HIDMAP_CB_ARGS) +{ + struct evdev_dev *evdev = HIDMAP_CB_GET_EVDEV(); + + if (HIDMAP_CB_GET_STATE() == HIDMAP_CB_IS_ATTACHING) + evdev_support_prop(evdev, INPUT_PROP_DIRECT); + + /* Do not execute callback at interrupt handler and detach */ + return (ENOSYS); +} + +static void +hpen_identify(driver_t *driver, device_t parent) +{ + const struct hid_device_info *hw = hid_get_device_info(parent); + + /* the report descriptor for the Wacom Graphire is broken */ + if (hw->idBus == BUS_USB && hw->idVendor == USB_VENDOR_WACOM) { + switch (hw->idProduct) { + case USB_PRODUCT_WACOM_GRAPHIRE: + hid_set_report_descr(parent, + hpen_graphire_report_descr, + sizeof(hpen_graphire_report_descr)); + break; + + case USB_PRODUCT_WACOM_GRAPHIRE3_4X5: + hid_set_report_descr(parent, + hpen_graphire3_4x5_report_descr, + sizeof(hpen_graphire3_4x5_report_descr)); + break; + } + } +} + +static int +hpen_probe(device_t dev) +{ + struct hidmap *hm = device_get_softc(dev); + int error; + bool is_pen; + + error = HIDBUS_LOOKUP_DRIVER_INFO(dev, hpen_devs); + if (error != 0) + return (error); + + hidmap_set_dev(hm, dev); + + /* Check if report descriptor belongs to a HID tablet device */ + is_pen = hidbus_get_usage(dev) == HID_USAGE2(HUP_DIGITIZERS, HUD_PEN); + error = is_pen + ? HIDMAP_ADD_MAP(hm, hpen_map_pen, NULL) + : HIDMAP_ADD_MAP(hm, hpen_map_digi, NULL); + if (error != 0) + return (error); + + hidbus_set_desc(dev, is_pen ? "Pen" : "Digitizer"); + + return (BUS_PROBE_DEFAULT); +} + +static int +hpen_attach(device_t dev) +{ + const struct hid_device_info *hw = hid_get_device_info(dev); + struct hidmap *hm = device_get_softc(dev); + int error; + + if (hw->idBus == BUS_USB && hw->idVendor == USB_VENDOR_WACOM && + hw->idProduct == USB_PRODUCT_WACOM_GRAPHIRE3_4X5) { + /* + * The Graphire3 needs 0x0202 to be written to + * feature report ID 2 before it'll start + * returning digitizer data. + */ + static const uint8_t reportbuf[3] = {2, 2, 2}; + error = hid_set_report(dev, reportbuf, sizeof(reportbuf), + HID_FEATURE_REPORT, reportbuf[0]); + if (error) + device_printf(dev, "set feature report failed, " + "error=%d (ignored)\n", error); + } + + return (hidmap_attach(hm)); +} + +static int +hpen_detach(device_t dev) +{ + return (hidmap_detach(device_get_softc(dev))); +} + + +static devclass_t hpen_devclass; +static device_method_t hpen_methods[] = { + DEVMETHOD(device_identify, hpen_identify), + DEVMETHOD(device_probe, hpen_probe), + DEVMETHOD(device_attach, hpen_attach), + DEVMETHOD(device_detach, hpen_detach), + + DEVMETHOD_END +}; + +DEFINE_CLASS_0(hpen, hpen_driver, hpen_methods, sizeof(struct hidmap)); +DRIVER_MODULE(hpen, hidbus, hpen_driver, hpen_devclass, NULL, 0); +MODULE_DEPEND(hpen, hid, 1, 1, 1); +MODULE_DEPEND(hpen, hidbus, 1, 1, 1); +MODULE_DEPEND(hpen, hidmap, 1, 1, 1); +MODULE_DEPEND(hpen, evdev, 1, 1, 1); +MODULE_VERSION(hpen, 1); +HID_PNP_INFO(hpen_devs); diff --git a/sys/dev/hid/xb360gp.c b/sys/dev/hid/xb360gp.c new file mode 100644 index 000000000000..f255c110f47c --- /dev/null +++ b/sys/dev/hid/xb360gp.c @@ -0,0 +1,183 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Vladimir Kondratyev + * Copyright (c) 2020 Greg V + * + * 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 +__FBSDID("$FreeBSD$"); + +/* + * XBox 360 gamepad driver thanks to the custom descriptor in usbhid. + * + * Tested on: SVEN GC-5070 in both XInput (XBox 360) and DirectInput modes + */ + +#include +#include +#include +#include +#include *** 205 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C06704DE9BC; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@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 4DBj02553vz4Sw0; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A07EF19343; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKoZ4063031; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKosW063030; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:50 GMT Message-Id: <202101072320.107NKosW063030@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: afd590d9e566 - main - hid: Import hidmap and bunch of drivers based on it MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: afd590d9e56686e179cbbf626ec567aeaaa49199 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:50 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=afd590d9e56686e179cbbf626ec567aeaaa49199 commit afd590d9e56686e179cbbf626ec567aeaaa49199 Author: Vladimir Kondratyev AuthorDate: 2020-10-14 22:02:15 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:44 +0000 hid: Import hidmap and bunch of drivers based on it hidmap is a kernel module that maps HID input usages to evdev events. Following dependent drivers is included in the commit: hms - HID mouse driver. hcons - Consumer page AKA Multimedia keys driver. hsctrl - System Controls page (Power/Sleep keys) driver. ps4dshock - Sony DualShock 4 gamepad driver. Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D27993 --- share/man/man4/Makefile | 4 + share/man/man4/hcons.4 | 98 +++ share/man/man4/hms.4 | 115 +++ share/man/man4/hsctrl.4 | 98 +++ share/man/man4/ps4dshock.4 | 109 +++ sys/conf/files | 5 + sys/dev/hid/hcons.c | 295 ++++++++ sys/dev/hid/hidmap.c | 832 +++++++++++++++++++++ sys/dev/hid/hidmap.h | 262 +++++++ sys/dev/hid/hms.c | 267 +++++++ sys/dev/hid/hsctrl.c | 110 +++ sys/dev/hid/ps4dshock.c | 1406 ++++++++++++++++++++++++++++++++++++ sys/modules/hid/Makefile | 7 +- sys/modules/hid/hcons/Makefile | 9 + sys/modules/hid/hidmap/Makefile | 9 + sys/modules/hid/hms/Makefile | 9 + sys/modules/hid/hsctrl/Makefile | 9 + sys/modules/hid/ps4dshock/Makefile | 9 + 18 files changed, 3652 insertions(+), 1 deletion(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 02d1bca75a3f..60c1b5f19a9b 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -180,11 +180,13 @@ MAN= aac.4 \ gre.4 \ h_ertt.4 \ hconf.4 \ + hcons.4 \ hidbus.4 \ hidquirk.4 \ hidraw.4 \ hifn.4 \ hkbd.4 \ + hms.4 \ hmt.4 \ hpet.4 \ ${_hpt27xx.4} \ @@ -192,6 +194,7 @@ MAN= aac.4 \ ${_hptmv.4} \ ${_hptnr.4} \ ${_hptrr.4} \ + hsctrl.4 \ ${_hv_kvp.4} \ ${_hv_netvsc.4} \ ${_hv_storvsc.4} \ @@ -432,6 +435,7 @@ MAN= aac.4 \ ppi.4 \ procdesc.4 \ proto.4 \ + ps4dshock.4 \ psm.4 \ pst.4 \ pt.4 \ diff --git a/share/man/man4/hcons.4 b/share/man/man4/hcons.4 new file mode 100644 index 000000000000..a8fe22983453 --- /dev/null +++ b/share/man/man4/hcons.4 @@ -0,0 +1,98 @@ +.\" Copyright (c) 2020 Vladimir Kondratyev +.\" +.\" 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 September 14, 2020 +.Dt HCONS 4 +.Os +.Sh NAME +.Nm hcons +.Nd HID consumer page controls driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device hcons" +.Cd "device hid" +.Cd "device hidbus" +.Cd "device hidmap" +.Cd "device evdev" +.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 +hgame_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for HID consumer page controls most often used as +"Multimedia keys" found on many keyboards. +.Pp +The +.Pa /dev/input/event* +device presents the consumer page controls as a +.Ar evdev +type device. +.Sh SYSCTL VARIABLES +The following variable is available as both +.Xr sysctl 8 +variable and +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va dev.hcons.X.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Pp +It default value is set with +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va hw.hid.hcons.debug +.El +.Sh FILES +.Bl -tag -width /dev/input/event* -compact +.It Pa /dev/input/event* +input event device node. +.El +.Sh SEE ALSO +.Xr iichid 4 , +.Xr usbhid 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0. +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . diff --git a/share/man/man4/hms.4 b/share/man/man4/hms.4 new file mode 100644 index 000000000000..eb413e943976 --- /dev/null +++ b/share/man/man4/hms.4 @@ -0,0 +1,115 @@ +.\" Copyright (c) +.\" 1999 Nick Hibma . All rights reserved. +.\" 2020 Vladimir Kondratyev . +.\" +.\" 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 September 12, 2020 +.Dt HMS 4 +.Os +.Sh NAME +.Nm hms +.Nd HID mouse driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device hms" +.Cd "device hidbus" +.Cd "device hid" +.Cd "device evdev" +.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 +hms_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for HID mice that attach to the HID transport +backend. +See +.Xr iichid 4 +or +.Xr usbhid 4 . +Supported are +mice with any number of buttons, mice with a wheel and absolute mice. +.Pp +The +.Pa /dev/input/eventX +device presents the mouse as a +.Ar evdev +type device. +.Sh SYSCTL VARIABLES +The following variable is available as both +.Xr sysctl 8 +variable and +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va dev.hms.X.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Pp +It default value is derived from +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va hw.hid.hms.debug +.El +.Sh FILES +.Bl -tag -width /dev/input/eventX -compact +.It Pa /dev/input/eventX +input event device node. +.El +.Sh SEE ALSO +.Xr iichid 4 , +.Xr usbhid 4 , +.Xr xorg.conf 5 Pq Pa ports/x11/xorg +.\.Xr moused 8 +.Sh BUGS +.Nm +cannot act like +.Xr sysmouse 4 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . +.Pp +This manual page was originally written by +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org +for +.Xr umt 4 +driver and was adopted for +.Nm +by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . diff --git a/share/man/man4/hsctrl.4 b/share/man/man4/hsctrl.4 new file mode 100644 index 000000000000..ba7976c3c03d --- /dev/null +++ b/share/man/man4/hsctrl.4 @@ -0,0 +1,98 @@ +.\" Copyright (c) 2020 Vladimir Kondratyev +.\" +.\" 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 September 14, 2020 +.Dt HSCTRL 4 +.Os +.Sh NAME +.Nm hsctrl +.Nd HID system controls driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device hsctrl" +.Cd "device hid" +.Cd "device hidbus" +.Cd "device hidmap" +.Cd "device evdev" +.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 +hgame_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for HID system controls most often used as +"Power off/Sleep keys" found on many keyboards. +.Pp +The +.Pa /dev/input/event* +device presents the consumer page controls as a +.Ar evdev +type device. +.Sh SYSCTL VARIABLES +The following variable is available as both +.Xr sysctl 8 +variable and +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va dev.hsctrl.X.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Pp +It default value is set with +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va hw.hid.hsctrl.debug +.El +.Sh FILES +.Bl -tag -width /dev/input/event* -compact +.It Pa /dev/input/event* +input event device node. +.El +.Sh SEE ALSO +.Xr iichid 4 , +.Xr usbhid 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0. +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . diff --git a/share/man/man4/ps4dshock.4 b/share/man/man4/ps4dshock.4 new file mode 100644 index 000000000000..e2295533989f --- /dev/null +++ b/share/man/man4/ps4dshock.4 @@ -0,0 +1,109 @@ +.\" Copyright (c) 2020 Vladimir Kondratyev +.\" +.\" 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 September 19, 2020 +.Dt PS4DSHOCK 4 +.Os +.Sh NAME +.Nm ps4dshock +.Nd Sony PlayStation 4 Dualshock 4 gamepad driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ps4dshock" +.Cd "device hid" +.Cd "device hidbus" +.Cd "device hidmap" +.Cd "device evdev" +.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 +ps4dshock_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for Sony PlayStation 4 Dualshock 4 gamepad driver. +.Pp +The +.Pa /dev/input/event* +device presents the game controller as a +.Ar evdev +type device. +.Sh SYSCTL VARIABLES +Next parameters are available as +.Xr sysctl 8 +variables. +Debug parameter is available as +.Xr loader 8 +tunable as well. +.Bl -tag -width indent +.It Va dev.p4dshock.*.led_state +LED state: 0 - off, 1 - on, 2 - blinking. +.It Va dev.p4dshock.*.led_color_r +LED color. +Red component. +.It Va dev.p4dshock.*.led_color_g +LED color. +Green component. +.It Va dev.p4dshock.*.led_color_b +LED color. +Blue component. +.It Va dev.p4dshock.*.led_delay_on +LED blink. +On delay, msecs. +.It Va dev.p4dshock.*.led_delay_off +LED blink. +Off delay, msecs. +.It Va hw.hid.ps4dshock.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Sh FILES +.Bl -tag -width /dev/input/event* -compact +.It Pa /dev/input/event* +input event device node. +.El +.Sh BUGS +The +.Nm +does not support force-feedback events. +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0. +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . diff --git a/sys/conf/files b/sys/conf/files index cea809deb039..31a06150a329 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1816,13 +1816,18 @@ dev/gpio/gpiobus_if.m optional gpio dev/gpio/gpiopps.c optional gpiopps fdt dev/gpio/ofw_gpiobus.c optional fdt gpio dev/hid/hconf.c optional hconf +dev/hid/hcons.c optional hcons dev/hid/hid.c optional hid dev/hid/hid_if.m optional hid dev/hid/hidbus.c optional hidbus +dev/hid/hidmap.c optional hidmap dev/hid/hidquirk.c optional hid dev/hid/hidraw.c optional hidraw dev/hid/hkbd.c optional hkbd +dev/hid/hms.c optional hms dev/hid/hmt.c optional hmt hconf +dev/hid/hsctrl.c optional hsctrl +dev/hid/ps4dshock.c optional ps4dshock dev/hifn/hifn7751.c optional hifn dev/hptiop/hptiop.c optional hptiop scbus dev/hwpmc/hwpmc_logging.c optional hwpmc diff --git a/sys/dev/hid/hcons.c b/sys/dev/hid/hcons.c new file mode 100644 index 000000000000..559e84d468f3 --- /dev/null +++ b/sys/dev/hid/hcons.c @@ -0,0 +1,295 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Vladimir Kondratyev + * + * 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 +__FBSDID("$FreeBSD$"); + +/* + * Consumer Controls usage page driver + * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +static hidmap_cb_t hcons_rel_volume_cb; + +#define HCONS_MAP_KEY(usage, code) \ + { HIDMAP_KEY(HUP_CONSUMER, usage, code) } +#define HCONS_MAP_ABS(usage, code) \ + { HIDMAP_ABS(HUP_CONSUMER, usage, code) } +#define HCONS_MAP_REL(usage, code) \ + { HIDMAP_REL(HUP_CONSUMER, usage, code) } +#define HCONS_MAP_REL_CB(usage, callback) \ + { HIDMAP_REL_CB(HUP_CONSUMER, usage, &callback) } + +static const struct hidmap_item hcons_map[] = { + HCONS_MAP_KEY(0x030, KEY_POWER), + HCONS_MAP_KEY(0x031, KEY_RESTART), + HCONS_MAP_KEY(0x032, KEY_SLEEP), + HCONS_MAP_KEY(0x034, KEY_SLEEP), + HCONS_MAP_KEY(0x035, KEY_KBDILLUMTOGGLE), + HCONS_MAP_KEY(0x036, BTN_MISC), + HCONS_MAP_KEY(0x040, KEY_MENU), /* Menu */ + HCONS_MAP_KEY(0x041, KEY_SELECT), /* Menu Pick */ + HCONS_MAP_KEY(0x042, KEY_UP), /* Menu Up */ + HCONS_MAP_KEY(0x043, KEY_DOWN), /* Menu Down */ + HCONS_MAP_KEY(0x044, KEY_LEFT), /* Menu Left */ + HCONS_MAP_KEY(0x045, KEY_RIGHT), /* Menu Right */ + HCONS_MAP_KEY(0x046, KEY_ESC), /* Menu Escape */ + HCONS_MAP_KEY(0x047, KEY_KPPLUS), /* Menu Value Increase */ + HCONS_MAP_KEY(0x048, KEY_KPMINUS), /* Menu Value Decrease */ + HCONS_MAP_KEY(0x060, KEY_INFO), /* Data On Screen */ + HCONS_MAP_KEY(0x061, KEY_SUBTITLE), /* Closed Caption */ + HCONS_MAP_KEY(0x063, KEY_VCR), /* VCR/TV */ + HCONS_MAP_KEY(0x065, KEY_CAMERA), /* Snapshot */ + HCONS_MAP_KEY(0x069, KEY_RED), + HCONS_MAP_KEY(0x06a, KEY_GREEN), + HCONS_MAP_KEY(0x06b, KEY_BLUE), + HCONS_MAP_KEY(0x06c, KEY_YELLOW), + HCONS_MAP_KEY(0x06d, KEY_ASPECT_RATIO), + HCONS_MAP_KEY(0x06f, KEY_BRIGHTNESSUP), + HCONS_MAP_KEY(0x070, KEY_BRIGHTNESSDOWN), + HCONS_MAP_KEY(0x072, KEY_BRIGHTNESS_TOGGLE), + HCONS_MAP_KEY(0x073, KEY_BRIGHTNESS_MIN), + HCONS_MAP_KEY(0x074, KEY_BRIGHTNESS_MAX), + HCONS_MAP_KEY(0x075, KEY_BRIGHTNESS_AUTO), + HCONS_MAP_KEY(0x079, KEY_KBDILLUMUP), + HCONS_MAP_KEY(0x07a, KEY_KBDILLUMDOWN), + HCONS_MAP_KEY(0x07c, KEY_KBDILLUMTOGGLE), + HCONS_MAP_KEY(0x082, KEY_VIDEO_NEXT), + HCONS_MAP_KEY(0x083, KEY_LAST), + HCONS_MAP_KEY(0x084, KEY_ENTER), + HCONS_MAP_KEY(0x088, KEY_PC), + HCONS_MAP_KEY(0x089, KEY_TV), + HCONS_MAP_KEY(0x08a, KEY_WWW), + HCONS_MAP_KEY(0x08b, KEY_DVD), + HCONS_MAP_KEY(0x08c, KEY_PHONE), + HCONS_MAP_KEY(0x08d, KEY_PROGRAM), + HCONS_MAP_KEY(0x08e, KEY_VIDEOPHONE), + HCONS_MAP_KEY(0x08f, KEY_GAMES), + HCONS_MAP_KEY(0x090, KEY_MEMO), + HCONS_MAP_KEY(0x091, KEY_CD), + HCONS_MAP_KEY(0x092, KEY_VCR), + HCONS_MAP_KEY(0x093, KEY_TUNER), + HCONS_MAP_KEY(0x094, KEY_EXIT), + HCONS_MAP_KEY(0x095, KEY_HELP), + HCONS_MAP_KEY(0x096, KEY_TAPE), + HCONS_MAP_KEY(0x097, KEY_TV2), + HCONS_MAP_KEY(0x098, KEY_SAT), + HCONS_MAP_KEY(0x09a, KEY_PVR), + HCONS_MAP_KEY(0x09c, KEY_CHANNELUP), + HCONS_MAP_KEY(0x09d, KEY_CHANNELDOWN), + HCONS_MAP_KEY(0x0a0, KEY_VCR2), + HCONS_MAP_KEY(0x0b0, KEY_PLAY), + HCONS_MAP_KEY(0x0b1, KEY_PAUSE), + HCONS_MAP_KEY(0x0b2, KEY_RECORD), + HCONS_MAP_KEY(0x0b3, KEY_FASTFORWARD), + HCONS_MAP_KEY(0x0b4, KEY_REWIND), + HCONS_MAP_KEY(0x0b5, KEY_NEXTSONG), + HCONS_MAP_KEY(0x0b6, KEY_PREVIOUSSONG), + HCONS_MAP_KEY(0x0b7, KEY_STOPCD), + HCONS_MAP_KEY(0x0b8, KEY_EJECTCD), + HCONS_MAP_KEY(0x0bc, KEY_MEDIA_REPEAT), + HCONS_MAP_KEY(0x0b9, KEY_SHUFFLE), + HCONS_MAP_KEY(0x0bf, KEY_SLOW), + HCONS_MAP_KEY(0x0cd, KEY_PLAYPAUSE), + HCONS_MAP_KEY(0x0cf, KEY_VOICECOMMAND), + HCONS_MAP_ABS(0x0e0, ABS_VOLUME), + HCONS_MAP_REL_CB(0x0e0, hcons_rel_volume_cb), + HCONS_MAP_KEY(0x0e2, KEY_MUTE), + HCONS_MAP_KEY(0x0e5, KEY_BASSBOOST), + HCONS_MAP_KEY(0x0e9, KEY_VOLUMEUP), + HCONS_MAP_KEY(0x0ea, KEY_VOLUMEDOWN), + HCONS_MAP_KEY(0x0f5, KEY_SLOW), + HCONS_MAP_KEY(0x181, KEY_BUTTONCONFIG), + HCONS_MAP_KEY(0x182, KEY_BOOKMARKS), + HCONS_MAP_KEY(0x183, KEY_CONFIG), + HCONS_MAP_KEY(0x184, KEY_WORDPROCESSOR), + HCONS_MAP_KEY(0x185, KEY_EDITOR), + HCONS_MAP_KEY(0x186, KEY_SPREADSHEET), + HCONS_MAP_KEY(0x187, KEY_GRAPHICSEDITOR), + HCONS_MAP_KEY(0x188, KEY_PRESENTATION), + HCONS_MAP_KEY(0x189, KEY_DATABASE), + HCONS_MAP_KEY(0x18a, KEY_MAIL), + HCONS_MAP_KEY(0x18b, KEY_NEWS), + HCONS_MAP_KEY(0x18c, KEY_VOICEMAIL), + HCONS_MAP_KEY(0x18d, KEY_ADDRESSBOOK), + HCONS_MAP_KEY(0x18e, KEY_CALENDAR), + HCONS_MAP_KEY(0x18f, KEY_TASKMANAGER), + HCONS_MAP_KEY(0x190, KEY_JOURNAL), + HCONS_MAP_KEY(0x191, KEY_FINANCE), + HCONS_MAP_KEY(0x192, KEY_CALC), + HCONS_MAP_KEY(0x193, KEY_PLAYER), + HCONS_MAP_KEY(0x194, KEY_FILE), + HCONS_MAP_KEY(0x196, KEY_WWW), + HCONS_MAP_KEY(0x199, KEY_CHAT), + HCONS_MAP_KEY(0x19c, KEY_LOGOFF), + HCONS_MAP_KEY(0x19e, KEY_COFFEE), + HCONS_MAP_KEY(0x19f, KEY_CONTROLPANEL), + HCONS_MAP_KEY(0x1a2, KEY_APPSELECT), + HCONS_MAP_KEY(0x1a3, KEY_NEXT), + HCONS_MAP_KEY(0x1a4, KEY_PREVIOUS), + HCONS_MAP_KEY(0x1a6, KEY_HELP), + HCONS_MAP_KEY(0x1a7, KEY_DOCUMENTS), + HCONS_MAP_KEY(0x1ab, KEY_SPELLCHECK), + HCONS_MAP_KEY(0x1ae, KEY_KEYBOARD), + HCONS_MAP_KEY(0x1b1, KEY_SCREENSAVER), + HCONS_MAP_KEY(0x1b4, KEY_FILE), + HCONS_MAP_KEY(0x1b6, KEY_IMAGES), + HCONS_MAP_KEY(0x1b7, KEY_AUDIO), + HCONS_MAP_KEY(0x1b8, KEY_VIDEO), + HCONS_MAP_KEY(0x1bc, KEY_MESSENGER), + HCONS_MAP_KEY(0x1bd, KEY_INFO), + HCONS_MAP_KEY(0x1cb, KEY_ASSISTANT), + HCONS_MAP_KEY(0x201, KEY_NEW), + HCONS_MAP_KEY(0x202, KEY_OPEN), + HCONS_MAP_KEY(0x203, KEY_CLOSE), + HCONS_MAP_KEY(0x204, KEY_EXIT), + HCONS_MAP_KEY(0x207, KEY_SAVE), + HCONS_MAP_KEY(0x208, KEY_PRINT), + HCONS_MAP_KEY(0x209, KEY_PROPS), + HCONS_MAP_KEY(0x21a, KEY_UNDO), + HCONS_MAP_KEY(0x21b, KEY_COPY), + HCONS_MAP_KEY(0x21c, KEY_CUT), + HCONS_MAP_KEY(0x21d, KEY_PASTE), + HCONS_MAP_KEY(0x21f, KEY_FIND), + HCONS_MAP_KEY(0x221, KEY_SEARCH), + HCONS_MAP_KEY(0x222, KEY_GOTO), + HCONS_MAP_KEY(0x223, KEY_HOMEPAGE), + HCONS_MAP_KEY(0x224, KEY_BACK), + HCONS_MAP_KEY(0x225, KEY_FORWARD), + HCONS_MAP_KEY(0x226, KEY_STOP), + HCONS_MAP_KEY(0x227, KEY_REFRESH), + HCONS_MAP_KEY(0x22a, KEY_BOOKMARKS), + HCONS_MAP_KEY(0x22d, KEY_ZOOMIN), + HCONS_MAP_KEY(0x22e, KEY_ZOOMOUT), + HCONS_MAP_KEY(0x22f, KEY_ZOOMRESET), + HCONS_MAP_KEY(0x232, KEY_FULL_SCREEN), + HCONS_MAP_KEY(0x233, KEY_SCROLLUP), + HCONS_MAP_KEY(0x234, KEY_SCROLLDOWN), + HCONS_MAP_REL(0x238, REL_HWHEEL), /* AC Pan */ + HCONS_MAP_KEY(0x23d, KEY_EDIT), + HCONS_MAP_KEY(0x25f, KEY_CANCEL), + HCONS_MAP_KEY(0x269, KEY_INSERT), + HCONS_MAP_KEY(0x26a, KEY_DELETE), + HCONS_MAP_KEY(0x279, KEY_REDO), + HCONS_MAP_KEY(0x289, KEY_REPLY), + HCONS_MAP_KEY(0x28b, KEY_FORWARDMAIL), + HCONS_MAP_KEY(0x28c, KEY_SEND), + HCONS_MAP_KEY(0x29d, KEY_KBD_LAYOUT_NEXT), + HCONS_MAP_KEY(0x2c7, KEY_KBDINPUTASSIST_PREV), + HCONS_MAP_KEY(0x2c8, KEY_KBDINPUTASSIST_NEXT), + HCONS_MAP_KEY(0x2c9, KEY_KBDINPUTASSIST_PREVGROUP), + HCONS_MAP_KEY(0x2ca, KEY_KBDINPUTASSIST_NEXTGROUP), + HCONS_MAP_KEY(0x2cb, KEY_KBDINPUTASSIST_ACCEPT), + HCONS_MAP_KEY(0x2cc, KEY_KBDINPUTASSIST_CANCEL), + HCONS_MAP_KEY(0x29f, KEY_SCALE), +}; + +static const struct hid_device_id hcons_devs[] = { + { HID_TLC(HUP_CONSUMER, HUC_CONTROL) }, +}; + +/* + * Emulate relative Consumer volume usage with pressing + * VOLUMEUP and VOLUMEDOWN keys appropriate number of times + */ +static int +hcons_rel_volume_cb(HIDMAP_CB_ARGS) +{ + struct evdev_dev *evdev = HIDMAP_CB_GET_EVDEV(); + int32_t code; + int nrepeats; + + switch (HIDMAP_CB_GET_STATE()) { + case HIDMAP_CB_IS_ATTACHING: + evdev_support_event(evdev, EV_KEY); + evdev_support_key(evdev, KEY_VOLUMEUP); + evdev_support_key(evdev, KEY_VOLUMEDOWN); + break; + case HIDMAP_CB_IS_RUNNING: + /* Nothing to report. */ + if (ctx.data == 0) + return (ENOMSG); + code = ctx.data > 0 ? KEY_VOLUMEUP : KEY_VOLUMEDOWN; + for (nrepeats = abs(ctx.data); nrepeats > 0; nrepeats--) { + evdev_push_key(evdev, code, 1); + evdev_push_key(evdev, code, 0); + } + } + + return (0); +} + +static int +hcons_probe(device_t dev) +{ + return (HIDMAP_PROBE(device_get_softc(dev), dev, + hcons_devs, hcons_map, "Consumer Control")); +} + +static int +hcons_attach(device_t dev) +{ + return (hidmap_attach(device_get_softc(dev))); +} + +static int +hcons_detach(device_t dev) +{ + return (hidmap_detach(device_get_softc(dev))); +} + +static devclass_t hcons_devclass; +static device_method_t hcons_methods[] = { + DEVMETHOD(device_probe, hcons_probe), + DEVMETHOD(device_attach, hcons_attach), + DEVMETHOD(device_detach, hcons_detach), + + DEVMETHOD_END +}; + +DEFINE_CLASS_0(hcons, hcons_driver, hcons_methods, sizeof(struct hidmap)); +DRIVER_MODULE(hcons, hidbus, hcons_driver, hcons_devclass, NULL, 0); +MODULE_DEPEND(hcons, hid, 1, 1, 1); +MODULE_DEPEND(hcons, hidbus, 1, 1, 1); +MODULE_DEPEND(hcons, hidmap, 1, 1, 1); +MODULE_DEPEND(hcons, evdev, 1, 1, 1); +MODULE_VERSION(hcons, 1); +HID_PNP_INFO(hcons_devs); diff --git a/sys/dev/hid/hidmap.c b/sys/dev/hid/hidmap.c new file mode 100644 index 000000000000..163d63c20232 --- /dev/null +++ b/sys/dev/hid/hidmap.c @@ -0,0 +1,832 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Vladimir Kondratyev + * + * 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 +__FBSDID("$FreeBSD$"); + +/* + * Abstract 1 to 1 HID input usage to evdev event mapper driver. + */ + +#include "opt_hid.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#ifdef HID_DEBUG +#define DPRINTFN(hm, n, fmt, ...) do { \ + if ((hm)->debug_var != NULL && *(hm)->debug_var >= (n)) { \ + device_printf((hm)->dev, "%s: " fmt, \ + __FUNCTION__ ,##__VA_ARGS__); \ + } \ +} while (0) +#define DPRINTF(hm, ...) DPRINTFN(hm, 1, __VA_ARGS__) +#else +#define DPRINTF(...) do { } while (0) +#define DPRINTFN(...) do { } while (0) +#endif + +static evdev_open_t hidmap_ev_open; +static evdev_close_t hidmap_ev_close; + +#define HIDMAP_WANT_MERGE_KEYS(hm) ((hm)->key_rel != NULL) + +#define HIDMAP_FOREACH_ITEM(hm, mi, uoff) \ + for (u_int _map = 0, _item = 0, _uoff_priv = -1; \ + ((mi) = hidmap_get_next_map_item( \ + (hm), &_map, &_item, &_uoff_priv, &(uoff))) != NULL;) + +static inline bool +hidmap_get_next_map_index(const struct hidmap_item *map, int nmap_items, + uint32_t *index, uint16_t *usage_offset) +{ + + ++*usage_offset; + if ((*index != 0 || *usage_offset != 0) && + *usage_offset >= map[*index].nusages) { + ++*index; + *usage_offset = 0; + } + + return (*index < nmap_items); +} + +static inline const struct hidmap_item * +hidmap_get_next_map_item(struct hidmap *hm, u_int *map, u_int *item, + u_int *uoff_priv, uint16_t *uoff) +{ + + *uoff = *uoff_priv; + while (!hidmap_get_next_map_index( + hm->map[*map], hm->nmap_items[*map], item, uoff)) { + ++*map; + *item = 0; + *uoff = -1; + if (*map >= hm->nmaps) + return (NULL); + } + *uoff_priv = *uoff; + + return (hm->map[*map] + *item); +} + +void +_hidmap_set_debug_var(struct hidmap *hm, int *debug_var) +{ +#ifdef HID_DEBUG + hm->debug_var = debug_var; +#endif +} + +static int +hidmap_ev_close(struct evdev_dev *evdev) +{ + return (hidbus_intr_stop(evdev_get_softc(evdev))); +} + +static int +hidmap_ev_open(struct evdev_dev *evdev) +{ + return (hidbus_intr_start(evdev_get_softc(evdev))); +} + +void +hidmap_support_key(struct hidmap *hm, uint16_t key) +{ + if (hm->key_press == NULL) { + hm->key_press = malloc(howmany(KEY_CNT, 8), M_DEVBUF, + M_ZERO | M_WAITOK); *** 2864 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 052604DE952; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@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 4DBj026CCzz4Sw2; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C53A619653; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKoVt063065; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKokf063064; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:50 GMT Message-Id: <202101072320.107NKokf063064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 9be6b22da9b2 - main - hidraw(4): Add HIDRAW_MAKE_UHID_ALIAS kernel option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9be6b22da9b2df9903310a307f36f5297b1660b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:51 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=9be6b22da9b2df9903310a307f36f5297b1660b6 commit 9be6b22da9b2df9903310a307f36f5297b1660b6 Author: Vladimir Kondratyev AuthorDate: 2020-12-13 09:37:55 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:44 +0000 hidraw(4): Add HIDRAW_MAKE_UHID_ALIAS kernel option which installs /dev/uhid# alias to hidraw character device for compatibility with some existing uhid(4) users like Firefox. As side effect it renames traditional uhid(4) driver to hidraw to make possible using of common unit number allocator. Requested by: Greg V Reviewed by: hselasky (as part of D27992) --- sys/conf/options | 1 + sys/dev/hid/hid.c | 4 ++++ sys/dev/hid/hid.h | 3 +++ sys/dev/hid/hidraw.c | 9 ++++++++- sys/dev/usb/input/uhid.c | 12 ++++++++++++ sys/modules/hid/hidraw/Makefile | 2 +- sys/modules/usb/uhid/Makefile | 4 ++-- 7 files changed, 31 insertions(+), 4 deletions(-) diff --git a/sys/conf/options b/sys/conf/options index 789def58cb48..e69ee92d1136 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -1020,3 +1020,4 @@ HID_DEBUG opt_hid.h IICHID_DEBUG opt_hid.h IICHID_SAMPLING opt_hid.h HKBD_DFLT_KEYMAP opt_hkbd.h +HIDRAW_MAKE_UHID_ALIAS opt_hid.h diff --git a/sys/dev/hid/hid.c b/sys/dev/hid/hid.c index 5a91692e1038..699bfa4a8bb3 100644 --- a/sys/dev/hid/hid.c +++ b/sys/dev/hid/hid.c @@ -58,6 +58,10 @@ SYSCTL_NODE(_hw, OID_AUTO, hid, CTLFLAG_RW, 0, "HID debugging"); SYSCTL_INT(_hw_hid, OID_AUTO, debug, CTLFLAG_RWTUN, &hid_debug, 0, "Debug level"); +#ifdef HIDRAW_MAKE_UHID_ALIAS +devclass_t hidraw_devclass; +#endif + static void hid_clear_local(struct hid_item *); static uint8_t hid_get_byte(struct hid_data *s, const uint16_t wSize); diff --git a/sys/dev/hid/hid.h b/sys/dev/hid/hid.h index cea33f7b4af8..e88cbba04d9a 100644 --- a/sys/dev/hid/hid.h +++ b/sys/dev/hid/hid.h @@ -193,6 +193,9 @@ #define HID_MAX_AUTO_QUIRK 8 /* maximum number of dynamic quirks */ #define HID_PNP_ID_SIZE 20 /* includes null terminator */ +/* Share unit number pool between uhid and hidraw */ +extern devclass_t hidraw_devclass; + /* Declare global HID debug variable. */ extern int hid_debug; diff --git a/sys/dev/hid/hidraw.c b/sys/dev/hid/hidraw.c index 1da8cb202bd9..6cc67ff14d23 100644 --- a/sys/dev/hid/hidraw.c +++ b/sys/dev/hid/hidraw.c @@ -38,6 +38,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_hid.h" + #include #include #include @@ -207,6 +209,9 @@ hidraw_attach(device_t self) hidraw_detach(self); return (error); } +#ifdef HIDRAW_MAKE_UHID_ALIAS + (void)make_dev_alias(sc->dev, "uhid%d", device_get_unit(self)); +#endif hidbus_set_lock(self, &sc->sc_mtx); hidbus_set_intr(self, hidraw_intr, sc); @@ -893,7 +898,9 @@ static driver_t hidraw_driver = { sizeof(struct hidraw_softc) }; -static devclass_t hidraw_devclass; +#ifndef HIDRAW_MAKE_UHID_ALIAS +devclass_t hidraw_devclass; +#endif DRIVER_MODULE(hidraw, hidbus, hidraw_driver, hidraw_devclass, NULL, 0); MODULE_DEPEND(hidraw, hidbus, 1, 1, 1); diff --git a/sys/dev/usb/input/uhid.c b/sys/dev/usb/input/uhid.c index dd463dd7de8c..e5eae534a6d0 100644 --- a/sys/dev/usb/input/uhid.c +++ b/sys/dev/usb/input/uhid.c @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); * HID spec: http://www.usb.org/developers/devclass_docs/HID1_11.pdf */ +#include "opt_hid.h" + #include #include #include @@ -891,7 +893,9 @@ uhid_detach(device_t dev) return (0); } +#ifndef HIDRAW_MAKE_UHID_ALIAS static devclass_t uhid_devclass; +#endif static device_method_t uhid_methods[] = { DEVMETHOD(device_probe, uhid_probe), @@ -902,12 +906,20 @@ static device_method_t uhid_methods[] = { }; static driver_t uhid_driver = { +#ifdef HIDRAW_MAKE_UHID_ALIAS + .name = "hidraw", +#else .name = "uhid", +#endif .methods = uhid_methods, .size = sizeof(struct uhid_softc), }; +#ifdef HIDRAW_MAKE_UHID_ALIAS +DRIVER_MODULE(uhid, uhub, uhid_driver, hidraw_devclass, NULL, 0); +#else DRIVER_MODULE(uhid, uhub, uhid_driver, uhid_devclass, NULL, 0); +#endif MODULE_DEPEND(uhid, usb, 1, 1, 1); MODULE_DEPEND(uhid, hid, 1, 1, 1); MODULE_VERSION(uhid, 1); diff --git a/sys/modules/hid/hidraw/Makefile b/sys/modules/hid/hidraw/Makefile index e6305bc5bdb6..fdf9c31c9f3a 100644 --- a/sys/modules/hid/hidraw/Makefile +++ b/sys/modules/hid/hidraw/Makefile @@ -4,6 +4,6 @@ KMOD= hidraw SRCS= hidraw.c -SRCS+= bus_if.h device_if.h +SRCS+= opt_hid.h bus_if.h device_if.h .include diff --git a/sys/modules/usb/uhid/Makefile b/sys/modules/usb/uhid/Makefile index f1fa4f660b36..1ae7b012903f 100644 --- a/sys/modules/usb/uhid/Makefile +++ b/sys/modules/usb/uhid/Makefile @@ -30,7 +30,7 @@ S= ${SRCTOP}/sys .PATH: $S/dev/usb/input KMOD= uhid -SRCS= opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h vnode_if.h usbdevs.h \ - uhid.c +SRCS= opt_bus.h opt_hid.h opt_usb.h device_if.h bus_if.h usb_if.h \ + vnode_if.h usbdevs.h uhid.c .include From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 93A3A4DE8F1; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@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 4DBj031QTdz4Sqf; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E37B19345; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpem063133; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKo5T063132; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:50 GMT Message-Id: <202101072320.107NKo5T063132@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 08d88401754b - main - hid: Copy ukbd(4) to HID subsystem. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 08d88401754b335a549507b86d219c90a0fc7e13 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:52 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=08d88401754b335a549507b86d219c90a0fc7e13 commit 08d88401754b335a549507b86d219c90a0fc7e13 Author: Vladimir Kondratyev AuthorDate: 2020-10-11 22:36:35 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:43 +0000 hid: Copy ukbd(4) to HID subsystem. --- share/man/man4/hkbd.4 | 188 +++++ sys/dev/hid/hkbd.c | 2197 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2385 insertions(+) diff --git a/share/man/man4/hkbd.4 b/share/man/man4/hkbd.4 new file mode 100644 index 000000000000..f443f51ce8e1 --- /dev/null +++ b/share/man/man4/hkbd.4 @@ -0,0 +1,188 @@ +.\" Copyright (c) 1997, 1998 +.\" Nick Hibma . All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 24, 2018 +.Dt UKBD 4 +.Os +.Sh NAME +.Nm ukbd +.Nd USB keyboard driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ukbd" +.Cd "device hid" +.Cd "device usb" +.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 +ukbd_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for keyboards that attach to the USB port. +.Xr usb 4 +and one of +.Xr uhci 4 +or +.Xr ohci 4 +must be configured in the kernel as well. +.Sh CONFIGURATION +By default, the keyboard subsystem does not create the appropriate devices yet. +Make sure you reconfigure your kernel with the following option in the kernel +config file: +.Pp +.Dl "options KBD_INSTALL_CDEV" +.Pp +If both an AT keyboard USB keyboards are used at the same time, the +AT keyboard will appear as +.Pa kbd0 +in +.Pa /dev . +The USB keyboards will be +.Pa kbd1 , kbd2 , +etc. +You can see some information about the keyboard with the following command: +.Pp +.Dl "kbdcontrol -i < /dev/kbd1" +.Pp +or load a keymap with +.Pp +.Dl "kbdcontrol -l keymaps/pt.iso < /dev/kbd1" +.Pp +See +.Xr kbdcontrol 1 +for more possible options. +.Pp +You can swap console keyboards by using the command +.Pp +.Dl "kbdcontrol -k /dev/kbd1" +.Pp +From this point on, the first USB keyboard will be the keyboard +to be used by the console. +.Pp +If you want to use a USB keyboard as your default and not use an AT keyboard at +all, you will have to remove the +.Cd "device atkbd" +line from the kernel configuration file. +Because of the device initialization order, +the USB keyboard will be detected +.Em after +the console driver +initializes itself and you have to explicitly tell the console +driver to use the existence of the USB keyboard. +This can be done in +one of the following two ways. +.Pp +Run the following command as a part of system initialization: +.Pp +.Dl "kbdcontrol -k /dev/kbd0 < /dev/ttyv0 > /dev/null" +.Pp +(Note that as the USB keyboard is the only keyboard, it is accessed as +.Pa /dev/kbd0 ) +or otherwise tell the console driver to periodically look for a +keyboard by setting a flag in the kernel configuration file: +.Pp +.Dl "device sc0 at isa? flags 0x100" +.Pp +With the above flag, the console driver will try to detect any +keyboard in the system if it did not detect one while it was +initialized at boot time. +.Sh DRIVER CONFIGURATION +.D1 Cd "options KBD_INSTALL_CDEV" +.Pp +Make the keyboards available through a character device in +.Pa /dev . +.Pp +.D1 Cd options UKBD_DFLT_KEYMAP +.D1 Cd makeoptions UKBD_DFLT_KEYMAP=fr.iso +.Pp +The above lines will put the French ISO keymap in the ukbd driver. +You can specify any keymap in +.Pa /usr/share/syscons/keymaps +or +.Pa /usr/share/vt/keymaps +(depending on the console driver being used) with this option. +.Pp +.D1 Cd "options KBD_DISABLE_KEYMAP_LOADING" +.Pp +Do not allow the user to change the keymap. +Note that these options also affect the AT keyboard driver, +.Xr atkbd 4 . +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables: +.Bl -tag -width indent +.It Va hw.usb.ukbd.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Sh FILES +.Bl -tag -width ".Pa /dev/kbd*" -compact +.It Pa /dev/kbd* +blocking device nodes +.El +.Sh EXAMPLES +.D1 Cd "device ukbd" +.Pp +Add the +.Nm +driver to the kernel. +.Sh SEE ALSO +.Xr kbdcontrol 1 , +.Xr ohci 4 , +.Xr syscons 4 , +.Xr uhci 4 , +.Xr usb 4 , +.Xr vt 4 , +.Xr config 8 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Lennart Augustsson Aq Mt augustss@cs.chalmers.se +for +.Nx +and was substantially rewritten for +.Fx +by +.An Kazutaka YOKOTA Aq Mt yokota@zodiac.mech.utsunomiya-u.ac.jp . +.Pp +This manual page was written by +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org +with a large amount of input from +.An Kazutaka YOKOTA Aq Mt yokota@zodiac.mech.utsunomiya-u.ac.jp . diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c new file mode 100644 index 000000000000..0edacbefcbfc --- /dev/null +++ b/sys/dev/hid/hkbd.c @@ -0,0 +1,2197 @@ +#include +__FBSDID("$FreeBSD$"); + +/*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Lennart Augustsson (lennart@augustsson.net) at + * Carlstedt Research & Technology. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + * + */ + +/* + * HID spec: http://www.usb.org/developers/devclass_docs/HID1_11.pdf + */ + +#include "opt_kbd.h" +#include "opt_ukbd.h" +#include "opt_evdev.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#define USB_DEBUG_VAR ukbd_debug +#include + +#include + +#ifdef EVDEV_SUPPORT +#include +#include +#endif + +#include +#include +#include + +#include + +/* the initial key map, accent map and fkey strings */ +#if defined(UKBD_DFLT_KEYMAP) && !defined(KLD_MODULE) +#define KBD_DFLT_KEYMAP +#include "ukbdmap.h" +#endif + +/* the following file must be included after "ukbdmap.h" */ +#include + +#ifdef USB_DEBUG +static int ukbd_debug = 0; +static int ukbd_no_leds = 0; +static int ukbd_pollrate = 0; + +static SYSCTL_NODE(_hw_usb, OID_AUTO, ukbd, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "USB keyboard"); +SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, debug, CTLFLAG_RWTUN, + &ukbd_debug, 0, "Debug level"); +SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, no_leds, CTLFLAG_RWTUN, + &ukbd_no_leds, 0, "Disables setting of keyboard leds"); +SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, pollrate, CTLFLAG_RWTUN, + &ukbd_pollrate, 0, "Force this polling rate, 1-1000Hz"); +#endif + +#define UKBD_EMULATE_ATSCANCODE 1 +#define UKBD_DRIVER_NAME "ukbd" +#define UKBD_NKEYCODE 256 /* units */ +#define UKBD_IN_BUF_SIZE (4 * UKBD_NKEYCODE) /* scancodes */ +#define UKBD_IN_BUF_FULL ((UKBD_IN_BUF_SIZE / 2) - 1) /* scancodes */ +#define UKBD_NFKEY (sizeof(fkey_tab)/sizeof(fkey_tab[0])) /* units */ +#define UKBD_BUFFER_SIZE 64 /* bytes */ +#define UKBD_KEY_PRESSED(map, key) ({ \ + CTASSERT((key) >= 0 && (key) < UKBD_NKEYCODE); \ + ((map)[(key) / 64] & (1ULL << ((key) % 64))); \ +}) + +#define MOD_EJECT 0x01 +#define MOD_FN 0x02 + +struct ukbd_data { + uint64_t bitmap[howmany(UKBD_NKEYCODE, 64)]; +}; + +enum { + UKBD_INTR_DT_0, + UKBD_INTR_DT_1, + UKBD_CTRL_LED, + UKBD_N_TRANSFER, +}; + +struct ukbd_softc { + keyboard_t sc_kbd; + keymap_t sc_keymap; + accentmap_t sc_accmap; + fkeytab_t sc_fkeymap[UKBD_NFKEY]; + uint64_t sc_loc_key_valid[howmany(UKBD_NKEYCODE, 64)]; + struct hid_location sc_loc_apple_eject; + struct hid_location sc_loc_apple_fn; + struct hid_location sc_loc_key[UKBD_NKEYCODE]; + struct hid_location sc_loc_numlock; + struct hid_location sc_loc_capslock; + struct hid_location sc_loc_scrolllock; + struct usb_callout sc_callout; + struct ukbd_data sc_ndata; + struct ukbd_data sc_odata; + + struct thread *sc_poll_thread; + struct usb_device *sc_udev; + struct usb_interface *sc_iface; + struct usb_xfer *sc_xfer[UKBD_N_TRANSFER]; +#ifdef EVDEV_SUPPORT + struct evdev_dev *sc_evdev; +#endif + + sbintime_t sc_co_basetime; + int sc_delay; + uint32_t sc_repeat_time; + uint32_t sc_input[UKBD_IN_BUF_SIZE]; /* input buffer */ + uint32_t sc_time_ms; + uint32_t sc_composed_char; /* composed char code, if non-zero */ +#ifdef UKBD_EMULATE_ATSCANCODE + uint32_t sc_buffered_char[2]; +#endif + uint32_t sc_flags; /* flags */ +#define UKBD_FLAG_COMPOSE 0x00000001 +#define UKBD_FLAG_POLLING 0x00000002 +#define UKBD_FLAG_SET_LEDS 0x00000004 +#define UKBD_FLAG_ATTACHED 0x00000010 +#define UKBD_FLAG_GONE 0x00000020 + +#define UKBD_FLAG_HID_MASK 0x003fffc0 +#define UKBD_FLAG_APPLE_EJECT 0x00000040 +#define UKBD_FLAG_APPLE_FN 0x00000080 +#define UKBD_FLAG_APPLE_SWAP 0x00000100 +#define UKBD_FLAG_NUMLOCK 0x00080000 +#define UKBD_FLAG_CAPSLOCK 0x00100000 +#define UKBD_FLAG_SCROLLLOCK 0x00200000 + + int sc_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ + int sc_state; /* shift/lock key state */ + int sc_accents; /* accent key index (> 0) */ + int sc_polling; /* polling recursion count */ + int sc_led_size; + int sc_kbd_size; + + uint16_t sc_inputs; + uint16_t sc_inputhead; + uint16_t sc_inputtail; + + uint8_t sc_leds; /* store for async led requests */ + uint8_t sc_iface_index; + uint8_t sc_iface_no; + uint8_t sc_id_apple_eject; + uint8_t sc_id_apple_fn; + uint8_t sc_id_loc_key[UKBD_NKEYCODE]; + uint8_t sc_id_numlock; + uint8_t sc_id_capslock; + uint8_t sc_id_scrolllock; + uint8_t sc_kbd_id; + uint8_t sc_repeat_key; + + uint8_t sc_buffer[UKBD_BUFFER_SIZE]; +}; + +#define KEY_NONE 0x00 +#define KEY_ERROR 0x01 + +#define KEY_PRESS 0 +#define KEY_RELEASE 0x400 +#define KEY_INDEX(c) ((c) & 0xFF) + +#define SCAN_PRESS 0 +#define SCAN_RELEASE 0x80 +#define SCAN_PREFIX_E0 0x100 +#define SCAN_PREFIX_E1 0x200 +#define SCAN_PREFIX_CTL 0x400 +#define SCAN_PREFIX_SHIFT 0x800 +#define SCAN_PREFIX (SCAN_PREFIX_E0 | SCAN_PREFIX_E1 | \ + SCAN_PREFIX_CTL | SCAN_PREFIX_SHIFT) +#define SCAN_CHAR(c) ((c) & 0x7f) + +#define UKBD_LOCK() USB_MTX_LOCK(&Giant) +#define UKBD_UNLOCK() USB_MTX_UNLOCK(&Giant) +#define UKBD_LOCK_ASSERT() USB_MTX_ASSERT(&Giant, MA_OWNED) + +#define NN 0 /* no translation */ +/* + * Translate USB keycodes to AT keyboard scancodes. + */ +/* + * FIXME: Mac USB keyboard generates: + * 0x53: keypad NumLock/Clear + * 0x66: Power + * 0x67: keypad = + * 0x68: F13 + * 0x69: F14 + * 0x6a: F15 + * + * USB Apple Keyboard JIS generates: + * 0x90: Kana + * 0x91: Eisu + */ +static const uint8_t ukbd_trtab[256] = { + 0, 0, 0, 0, 30, 48, 46, 32, /* 00 - 07 */ + 18, 33, 34, 35, 23, 36, 37, 38, /* 08 - 0F */ + 50, 49, 24, 25, 16, 19, 31, 20, /* 10 - 17 */ + 22, 47, 17, 45, 21, 44, 2, 3, /* 18 - 1F */ + 4, 5, 6, 7, 8, 9, 10, 11, /* 20 - 27 */ + 28, 1, 14, 15, 57, 12, 13, 26, /* 28 - 2F */ + 27, 43, 43, 39, 40, 41, 51, 52, /* 30 - 37 */ + 53, 58, 59, 60, 61, 62, 63, 64, /* 38 - 3F */ + 65, 66, 67, 68, 87, 88, 92, 70, /* 40 - 47 */ + 104, 102, 94, 96, 103, 99, 101, 98, /* 48 - 4F */ + 97, 100, 95, 69, 91, 55, 74, 78,/* 50 - 57 */ + 89, 79, 80, 81, 75, 76, 77, 71, /* 58 - 5F */ + 72, 73, 82, 83, 86, 107, 122, NN, /* 60 - 67 */ + NN, NN, NN, NN, NN, NN, NN, NN, /* 68 - 6F */ + NN, NN, NN, NN, 115, 108, 111, 113, /* 70 - 77 */ + 109, 110, 112, 118, 114, 116, 117, 119, /* 78 - 7F */ + 121, 120, NN, NN, NN, NN, NN, 123, /* 80 - 87 */ + 124, 125, 126, 127, 128, NN, NN, NN, /* 88 - 8F */ + 129, 130, NN, NN, NN, NN, NN, NN, /* 90 - 97 */ + NN, NN, NN, NN, NN, NN, NN, NN, /* 98 - 9F */ + NN, NN, NN, NN, NN, NN, NN, NN, /* A0 - A7 */ + NN, NN, NN, NN, NN, NN, NN, NN, /* A8 - AF */ + NN, NN, NN, NN, NN, NN, NN, NN, /* B0 - B7 */ + NN, NN, NN, NN, NN, NN, NN, NN, /* B8 - BF */ + NN, NN, NN, NN, NN, NN, NN, NN, /* C0 - C7 */ + NN, NN, NN, NN, NN, NN, NN, NN, /* C8 - CF */ + NN, NN, NN, NN, NN, NN, NN, NN, /* D0 - D7 */ + NN, NN, NN, NN, NN, NN, NN, NN, /* D8 - DF */ + 29, 42, 56, 105, 90, 54, 93, 106, /* E0 - E7 */ + NN, NN, NN, NN, NN, NN, NN, NN, /* E8 - EF */ + NN, NN, NN, NN, NN, NN, NN, NN, /* F0 - F7 */ + NN, NN, NN, NN, NN, NN, NN, NN, /* F8 - FF */ +}; + +static const uint8_t ukbd_boot_desc[] = { + 0x05, 0x01, 0x09, 0x06, 0xa1, + 0x01, 0x05, 0x07, 0x19, 0xe0, + 0x29, 0xe7, 0x15, 0x00, 0x25, + 0x01, 0x75, 0x01, 0x95, 0x08, + 0x81, 0x02, 0x95, 0x01, 0x75, + 0x08, 0x81, 0x01, 0x95, 0x03, + 0x75, 0x01, 0x05, 0x08, 0x19, + 0x01, 0x29, 0x03, 0x91, 0x02, + 0x95, 0x05, 0x75, 0x01, 0x91, + 0x01, 0x95, 0x06, 0x75, 0x08, + 0x15, 0x00, 0x26, 0xff, 0x00, + 0x05, 0x07, 0x19, 0x00, 0x2a, + 0xff, 0x00, 0x81, 0x00, 0xc0 +}; + +/* prototypes */ +static void ukbd_timeout(void *); +static void ukbd_set_leds(struct ukbd_softc *, uint8_t); +static int ukbd_set_typematic(keyboard_t *, int); +#ifdef UKBD_EMULATE_ATSCANCODE +static uint32_t ukbd_atkeycode(int, const uint64_t *); +static int ukbd_key2scan(struct ukbd_softc *, int, const uint64_t *, int); +#endif +static uint32_t ukbd_read_char(keyboard_t *, int); +static void ukbd_clear_state(keyboard_t *); +static int ukbd_ioctl(keyboard_t *, u_long, caddr_t); +static int ukbd_enable(keyboard_t *); +static int ukbd_disable(keyboard_t *); +static void ukbd_interrupt(struct ukbd_softc *); +static void ukbd_event_keyinput(struct ukbd_softc *); + +static device_probe_t ukbd_probe; +static device_attach_t ukbd_attach; +static device_detach_t ukbd_detach; +static device_resume_t ukbd_resume; + +#ifdef EVDEV_SUPPORT +static evdev_event_t ukbd_ev_event; + +static const struct evdev_methods ukbd_evdev_methods = { + .ev_event = ukbd_ev_event, +}; +#endif + +static bool +ukbd_any_key_pressed(struct ukbd_softc *sc) +{ + bool ret = false; + unsigned i; + + for (i = 0; i != howmany(UKBD_NKEYCODE, 64); i++) + ret |= (sc->sc_odata.bitmap[i] != 0); + return (ret); +} + +static bool +ukbd_any_key_valid(struct ukbd_softc *sc) +{ + bool ret = false; + unsigned i; + + for (i = 0; i != howmany(UKBD_NKEYCODE, 64); i++) + ret |= (sc->sc_loc_key_valid[i] != 0); + return (ret); +} + +static bool +ukbd_is_modifier_key(uint32_t key) +{ + + return (key >= 0xe0 && key <= 0xe7); +} + +static void +ukbd_start_timer(struct ukbd_softc *sc) +{ + sbintime_t delay, now, prec; + + now = sbinuptime(); + + /* check if initial delay passed and fallback to key repeat delay */ + if (sc->sc_delay == 0) + sc->sc_delay = sc->sc_kbd.kb_delay2; + + /* compute timeout */ + delay = SBT_1MS * sc->sc_delay; + sc->sc_co_basetime += delay; + + /* check if we are running behind */ + if (sc->sc_co_basetime < now) + sc->sc_co_basetime = now; + + /* This is rarely called, so prefer precision to efficiency. */ + prec = qmin(delay >> 7, SBT_1MS * 10); + usb_callout_reset_sbt(&sc->sc_callout, sc->sc_co_basetime, prec, + ukbd_timeout, sc, C_ABSOLUTE); +} + +static void +ukbd_put_key(struct ukbd_softc *sc, uint32_t key) +{ + + UKBD_LOCK_ASSERT(); + + DPRINTF("0x%02x (%d) %s\n", key, key, + (key & KEY_RELEASE) ? "released" : "pressed"); + +#ifdef EVDEV_SUPPORT + if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) + evdev_push_event(sc->sc_evdev, EV_KEY, + evdev_hid2key(KEY_INDEX(key)), !(key & KEY_RELEASE)); +#endif + + if (sc->sc_inputs < UKBD_IN_BUF_SIZE) { + sc->sc_input[sc->sc_inputtail] = key; + ++(sc->sc_inputs); + ++(sc->sc_inputtail); + if (sc->sc_inputtail >= UKBD_IN_BUF_SIZE) { + sc->sc_inputtail = 0; + } + } else { + DPRINTF("input buffer is full\n"); + } +} + +static void +ukbd_do_poll(struct ukbd_softc *sc, uint8_t wait) +{ + + UKBD_LOCK_ASSERT(); + KASSERT((sc->sc_flags & UKBD_FLAG_POLLING) != 0, + ("ukbd_do_poll called when not polling\n")); + DPRINTFN(2, "polling\n"); + + if (USB_IN_POLLING_MODE_FUNC() == 0) { + /* + * In this context the kernel is polling for input, + * but the USB subsystem works in normal interrupt-driven + * mode, so we just wait on the USB threads to do the job. + * Note that we currently hold the Giant, but it's also used + * as the transfer mtx, so we must release it while waiting. + */ + while (sc->sc_inputs == 0) { + /* + * Give USB threads a chance to run. Note that + * kern_yield performs DROP_GIANT + PICKUP_GIANT. + */ + kern_yield(PRI_UNCHANGED); + if (!wait) + break; + } + return; + } + + while (sc->sc_inputs == 0) { + usbd_transfer_poll(sc->sc_xfer, UKBD_N_TRANSFER); + + /* Delay-optimised support for repetition of keys */ + if (ukbd_any_key_pressed(sc)) { + /* a key is pressed - need timekeeping */ + DELAY(1000); + + /* 1 millisecond has passed */ + sc->sc_time_ms += 1; + } + + ukbd_interrupt(sc); + + if (!wait) + break; + } +} + +static int32_t +ukbd_get_key(struct ukbd_softc *sc, uint8_t wait) +{ + int32_t c; + + UKBD_LOCK_ASSERT(); + KASSERT((USB_IN_POLLING_MODE_FUNC() == 0) || + (sc->sc_flags & UKBD_FLAG_POLLING) != 0, + ("not polling in kdb or panic\n")); + + if (sc->sc_inputs == 0 && + (sc->sc_flags & UKBD_FLAG_GONE) == 0) { + /* start transfer, if not already started */ + usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_0]); + usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_1]); + } + + if (sc->sc_flags & UKBD_FLAG_POLLING) + ukbd_do_poll(sc, wait); + + if (sc->sc_inputs == 0) { + c = -1; + } else { + c = sc->sc_input[sc->sc_inputhead]; + --(sc->sc_inputs); + ++(sc->sc_inputhead); + if (sc->sc_inputhead >= UKBD_IN_BUF_SIZE) { + sc->sc_inputhead = 0; + } + } + return (c); +} + +static void +ukbd_interrupt(struct ukbd_softc *sc) +{ + const uint32_t now = sc->sc_time_ms; + unsigned key; + + UKBD_LOCK_ASSERT(); + + /* Check for modifier key changes first */ + for (key = 0xe0; key != 0xe8; key++) { + const uint64_t mask = 1ULL << (key % 64); + const uint64_t delta = + sc->sc_odata.bitmap[key / 64] ^ + sc->sc_ndata.bitmap[key / 64]; + + if (delta & mask) { + if (sc->sc_odata.bitmap[key / 64] & mask) + ukbd_put_key(sc, key | KEY_RELEASE); + else + ukbd_put_key(sc, key | KEY_PRESS); + } + } + + /* Check for key changes */ + for (key = 0; key != UKBD_NKEYCODE; key++) { + const uint64_t mask = 1ULL << (key % 64); + const uint64_t delta = + sc->sc_odata.bitmap[key / 64] ^ + sc->sc_ndata.bitmap[key / 64]; + + if (mask == 1 && delta == 0) { + key += 63; + continue; /* skip empty areas */ + } else if (ukbd_is_modifier_key(key)) { + continue; + } else if (delta & mask) { + if (sc->sc_odata.bitmap[key / 64] & mask) { + ukbd_put_key(sc, key | KEY_RELEASE); + + /* clear repeating key, if any */ + if (sc->sc_repeat_key == key) + sc->sc_repeat_key = 0; + } else { + ukbd_put_key(sc, key | KEY_PRESS); + + sc->sc_co_basetime = sbinuptime(); + sc->sc_delay = sc->sc_kbd.kb_delay1; + ukbd_start_timer(sc); + + /* set repeat time for last key */ + sc->sc_repeat_time = now + sc->sc_kbd.kb_delay1; + sc->sc_repeat_key = key; + } + } + } + + /* synchronize old data with new data */ + sc->sc_odata = sc->sc_ndata; + + /* check if last key is still pressed */ + if (sc->sc_repeat_key != 0) { + const int32_t dtime = (sc->sc_repeat_time - now); + + /* check if time has elapsed */ + if (dtime <= 0) { + ukbd_put_key(sc, sc->sc_repeat_key | KEY_PRESS); + sc->sc_repeat_time = now + sc->sc_kbd.kb_delay2; + } + } + +#ifdef EVDEV_SUPPORT + if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && sc->sc_evdev != NULL) + evdev_sync(sc->sc_evdev); +#endif + + /* wakeup keyboard system */ + ukbd_event_keyinput(sc); +} + +static void +ukbd_event_keyinput(struct ukbd_softc *sc) +{ + int c; + + UKBD_LOCK_ASSERT(); + + if ((sc->sc_flags & UKBD_FLAG_POLLING) != 0) + return; + + if (sc->sc_inputs == 0) + return; + + if (KBD_IS_ACTIVE(&sc->sc_kbd) && + KBD_IS_BUSY(&sc->sc_kbd)) { + /* let the callback function process the input */ + (sc->sc_kbd.kb_callback.kc_func) (&sc->sc_kbd, KBDIO_KEYINPUT, + sc->sc_kbd.kb_callback.kc_arg); + } else { + /* read and discard the input, no one is waiting for it */ + do { + c = ukbd_read_char(&sc->sc_kbd, 0); + } while (c != NOKEY); + } +} + +static void +ukbd_timeout(void *arg) +{ + struct ukbd_softc *sc = arg; + + UKBD_LOCK_ASSERT(); + + sc->sc_time_ms += sc->sc_delay; + sc->sc_delay = 0; + + ukbd_interrupt(sc); + + /* Make sure any leftover key events gets read out */ + ukbd_event_keyinput(sc); + + if (ukbd_any_key_pressed(sc) || (sc->sc_inputs != 0)) { + ukbd_start_timer(sc); + } +} + +static uint32_t +ukbd_apple_fn(uint32_t keycode) +{ + switch (keycode) { + case 0x28: return 0x49; /* RETURN -> INSERT */ + case 0x2a: return 0x4c; /* BACKSPACE -> DEL */ + case 0x50: return 0x4a; /* LEFT ARROW -> HOME */ + case 0x4f: return 0x4d; /* RIGHT ARROW -> END */ + case 0x52: return 0x4b; /* UP ARROW -> PGUP */ + case 0x51: return 0x4e; /* DOWN ARROW -> PGDN */ + default: return keycode; + } +} + +static uint32_t +ukbd_apple_swap(uint32_t keycode) +{ + switch (keycode) { + case 0x35: return 0x64; + case 0x64: return 0x35; + default: return keycode; + } +} + +static void +ukbd_intr_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct ukbd_softc *sc = usbd_xfer_softc(xfer); + struct usb_page_cache *pc; + uint32_t i; + uint8_t id; + uint8_t modifiers; + int offset; + int len; + + UKBD_LOCK_ASSERT(); + + usbd_xfer_status(xfer, &len, NULL, NULL, NULL); + pc = usbd_xfer_get_frame(xfer, 0); + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + DPRINTF("actlen=%d bytes\n", len); + + if (len == 0) { + DPRINTF("zero length data\n"); + goto tr_setup; + } + + if (sc->sc_kbd_id != 0) { + /* check and remove HID ID byte */ + usbd_copy_out(pc, 0, &id, 1); + offset = 1; + len--; + if (len == 0) { + DPRINTF("zero length data\n"); + goto tr_setup; + } + } else { + offset = 0; + id = 0; + } + + if (len > UKBD_BUFFER_SIZE) + len = UKBD_BUFFER_SIZE; + + /* get data */ + usbd_copy_out(pc, offset, sc->sc_buffer, len); + + /* clear temporary storage */ + memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); + + /* clear modifiers */ + modifiers = 0; + + /* scan through HID data */ + if ((sc->sc_flags & UKBD_FLAG_APPLE_EJECT) && + (id == sc->sc_id_apple_eject)) { + if (hid_get_data(sc->sc_buffer, len, &sc->sc_loc_apple_eject)) + modifiers |= MOD_EJECT; + } + if ((sc->sc_flags & UKBD_FLAG_APPLE_FN) && + (id == sc->sc_id_apple_fn)) { + if (hid_get_data(sc->sc_buffer, len, &sc->sc_loc_apple_fn)) + modifiers |= MOD_FN; + } + + for (i = 0; i != UKBD_NKEYCODE; i++) { + const uint64_t valid = sc->sc_loc_key_valid[i / 64]; + const uint64_t mask = 1ULL << (i % 64); + + if (mask == 1 && valid == 0) { + i += 63; + continue; /* skip empty areas */ + } else if (~valid & mask) { + continue; /* location is not valid */ + } else if (id != sc->sc_id_loc_key[i]) { + continue; /* invalid HID ID */ + } else if (i == 0) { + struct hid_location tmp_loc = sc->sc_loc_key[0]; + /* range check array size */ + if (tmp_loc.count > UKBD_NKEYCODE) + tmp_loc.count = UKBD_NKEYCODE; + while (tmp_loc.count--) { + uint32_t key = + hid_get_udata(sc->sc_buffer, len, &tmp_loc); + /* advance to next location */ + tmp_loc.pos += tmp_loc.size; + if (modifiers & MOD_FN) + key = ukbd_apple_fn(key); + if (sc->sc_flags & UKBD_FLAG_APPLE_SWAP) + key = ukbd_apple_swap(key); + if (key == KEY_NONE || key == KEY_ERROR || key >= UKBD_NKEYCODE) + continue; + /* set key in bitmap */ + sc->sc_ndata.bitmap[key / 64] |= 1ULL << (key % 64); + } + } else if (hid_get_data(sc->sc_buffer, len, &sc->sc_loc_key[i])) { + uint32_t key = i; + + if (modifiers & MOD_FN) + key = ukbd_apple_fn(key); + if (sc->sc_flags & UKBD_FLAG_APPLE_SWAP) + key = ukbd_apple_swap(key); + if (key == KEY_NONE || key == KEY_ERROR || key >= UKBD_NKEYCODE) + continue; + /* set key in bitmap */ + sc->sc_ndata.bitmap[key / 64] |= 1ULL << (key % 64); + } + } +#ifdef USB_DEBUG + DPRINTF("modifiers = 0x%04x\n", modifiers); + for (i = 0; i != UKBD_NKEYCODE; i++) { + const uint64_t valid = sc->sc_ndata.bitmap[i / 64]; + const uint64_t mask = 1ULL << (i % 64); + + if (valid & mask) + DPRINTF("Key 0x%02x pressed\n", i); + } +#endif + ukbd_interrupt(sc); + + case USB_ST_SETUP: +tr_setup: + if (sc->sc_inputs < UKBD_IN_BUF_FULL) { + usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); + usbd_transfer_submit(xfer); + } else { + DPRINTF("input queue is full!\n"); + } + break; + + default: /* Error */ + DPRINTF("error=%s\n", usbd_errstr(error)); + *** 1426 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5A6504DE8EF; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@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 4DBj0318yjz4Sdp; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AE7819274; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKo9d063116; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKo1o063115; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:50 GMT Message-Id: <202101072320.107NKo1o063115@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: b93f6bfca343 - main - hid: Port ukbd to HID and attach to build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b93f6bfca34363f9c285e3e027fbfd4032b02b64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:51 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=b93f6bfca34363f9c285e3e027fbfd4032b02b64 commit b93f6bfca34363f9c285e3e027fbfd4032b02b64 Author: Vladimir Kondratyev AuthorDate: 2020-10-12 19:52:29 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:43 +0000 hid: Port ukbd to HID and attach to build Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D27991 --- share/man/man4/Makefile | 1 + share/man/man4/hkbd.4 | 59 +- sys/conf/files | 3 +- sys/conf/options | 1 + sys/dev/hid/hkbd.c | 1354 ++++++++++++++++++----------------------- sys/modules/hid/Makefile | 1 + sys/modules/hid/hkbd/Makefile | 10 + 7 files changed, 628 insertions(+), 801 deletions(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index c92c8f50545f..4fd816804062 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -183,6 +183,7 @@ MAN= aac.4 \ hidbus.4 \ hidquirk.4 \ hifn.4 \ + hkbd.4 \ hmt.4 \ hpet.4 \ ${_hpt27xx.4} \ diff --git a/share/man/man4/hkbd.4 b/share/man/man4/hkbd.4 index f443f51ce8e1..400bf1d989cd 100644 --- a/share/man/man4/hkbd.4 +++ b/share/man/man4/hkbd.4 @@ -24,37 +24,41 @@ .\" .\" $FreeBSD$ .\" -.Dd April 24, 2018 -.Dt UKBD 4 +.Dd September 12, 2020 +.Dt HKBD 4 .Os .Sh NAME -.Nm ukbd -.Nd USB keyboard driver +.Nm hkbd +.Nd HID keyboard driver .Sh SYNOPSIS To compile this driver into the kernel, place the following line in your kernel configuration file: .Bd -ragged -offset indent -.Cd "device ukbd" +.Cd "device hkbd" .Cd "device hid" -.Cd "device usb" +.Cd "device hidbus" +.Cd "device evdev" +.Cd "options EVDEV_SUPPORT" .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 -ukbd_load="YES" +hkbd_load="YES" .Ed .Sh DESCRIPTION The .Nm -driver provides support for keyboards that attach to the USB port. -.Xr usb 4 +driver provides support for keyboards that attach to the HID transport +backend. +.Xr hid 4 , +.Xr hidbus 4 , and one of -.Xr uhci 4 +.Xr iichid 4 or -.Xr ohci 4 +.Xr usbhid 4 must be configured in the kernel as well. .Sh CONFIGURATION By default, the keyboard subsystem does not create the appropriate devices yet. @@ -63,12 +67,12 @@ config file: .Pp .Dl "options KBD_INSTALL_CDEV" .Pp -If both an AT keyboard USB keyboards are used at the same time, the +If both an AT keyboard HID keyboards are used at the same time, the AT keyboard will appear as .Pa kbd0 in .Pa /dev . -The USB keyboards will be +The HID keyboards will be .Pa kbd1 , kbd2 , etc. You can see some information about the keyboard with the following command: @@ -87,19 +91,19 @@ You can swap console keyboards by using the command .Pp .Dl "kbdcontrol -k /dev/kbd1" .Pp -From this point on, the first USB keyboard will be the keyboard +From this point on, the first HID keyboard will be the keyboard to be used by the console. .Pp -If you want to use a USB keyboard as your default and not use an AT keyboard at +If you want to use a HID keyboard as your default and not use an AT keyboard at all, you will have to remove the .Cd "device atkbd" line from the kernel configuration file. Because of the device initialization order, -the USB keyboard will be detected +the HID keyboard will be detected .Em after the console driver initializes itself and you have to explicitly tell the console -driver to use the existence of the USB keyboard. +driver to use the existence of the HID keyboard. This can be done in one of the following two ways. .Pp @@ -107,7 +111,7 @@ Run the following command as a part of system initialization: .Pp .Dl "kbdcontrol -k /dev/kbd0 < /dev/ttyv0 > /dev/null" .Pp -(Note that as the USB keyboard is the only keyboard, it is accessed as +(Note that as the HID keyboard is the only keyboard, it is accessed as .Pa /dev/kbd0 ) or otherwise tell the console driver to periodically look for a keyboard by setting a flag in the kernel configuration file: @@ -123,8 +127,8 @@ initialized at boot time. Make the keyboards available through a character device in .Pa /dev . .Pp -.D1 Cd options UKBD_DFLT_KEYMAP -.D1 Cd makeoptions UKBD_DFLT_KEYMAP=fr.iso +.D1 Cd options HKBD_DFLT_KEYMAP +.D1 Cd makeoptions HKBD_DFLT_KEYMAP=fr.iso .Pp The above lines will put the French ISO keymap in the ukbd driver. You can specify any keymap in @@ -145,28 +149,31 @@ variables and .Xr loader 8 tunables: .Bl -tag -width indent -.It Va hw.usb.ukbd.debug +.It Va hw.hid.hkbd.debug Debug output level, where 0 is debugging disabled and larger values increase debug message verbosity. Default is 0. .El .Sh FILES -.Bl -tag -width ".Pa /dev/kbd*" -compact +.Bl -tag -width ".Pa /dev/input/event*" -compact .It Pa /dev/kbd* blocking device nodes +.It Pa /dev/input/event* +input event device nodes. .El .Sh EXAMPLES -.D1 Cd "device ukbd" +.D1 Cd "device hkbd" .Pp Add the .Nm driver to the kernel. .Sh SEE ALSO .Xr kbdcontrol 1 , -.Xr ohci 4 , +.Xr hid 4 , +.Xr hidbus 4 , +.Xr iichid 4 , .Xr syscons 4 , -.Xr uhci 4 , -.Xr usb 4 , +.Xr usbhid 4 , .Xr vt 4 , .Xr config 8 .Sh AUTHORS diff --git a/sys/conf/files b/sys/conf/files index 13dd93d9d2cd..71d78778d500 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1820,6 +1820,7 @@ dev/hid/hid.c optional hid dev/hid/hid_if.m optional hid dev/hid/hidbus.c optional hidbus dev/hid/hidquirk.c optional hid +dev/hid/hkbd.c optional hkbd dev/hid/hmt.c optional hmt hconf dev/hifn/hifn7751.c optional hifn dev/hptiop/hptiop.c optional hptiop scbus @@ -2327,7 +2328,7 @@ dev/ixgbe/ixgbe_dcb_82599.c optional ix inet | ixv inet \ compile-with "${NORMAL_C} -I$S/dev/ixgbe" dev/jedec_dimm/jedec_dimm.c optional jedec_dimm smbus dev/jme/if_jme.c optional jme pci -dev/kbd/kbd.c optional atkbd | pckbd | sc | ukbd | vt +dev/kbd/kbd.c optional atkbd | pckbd | sc | ukbd | vt | hkbd dev/kbdmux/kbdmux.c optional kbdmux dev/ksyms/ksyms.c optional ksyms dev/le/am7990.c optional le diff --git a/sys/conf/options b/sys/conf/options index 48b7f362a80a..789def58cb48 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -1019,3 +1019,4 @@ LINDEBUGFS HID_DEBUG opt_hid.h IICHID_DEBUG opt_hid.h IICHID_SAMPLING opt_hid.h +HKBD_DFLT_KEYMAP opt_hkbd.h diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index 0edacbefcbfc..321a51734664 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); */ #include "opt_kbd.h" -#include "opt_ukbd.h" +#include "opt_hkbd.h" #include "opt_evdev.h" #include @@ -61,18 +61,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include +#define HID_DEBUG_VAR hkbd_debug #include - -#include -#include -#include -#include - -#define USB_DEBUG_VAR ukbd_debug -#include - -#include +#include +#include +#include #ifdef EVDEV_SUPPORT #include @@ -86,7 +82,7 @@ __FBSDID("$FreeBSD$"); #include /* the initial key map, accent map and fkey strings */ -#if defined(UKBD_DFLT_KEYMAP) && !defined(KLD_MODULE) +#if defined(HKBD_DFLT_KEYMAP) && !defined(KLD_MODULE) #define KBD_DFLT_KEYMAP #include "ukbdmap.h" #endif @@ -94,67 +90,60 @@ __FBSDID("$FreeBSD$"); /* the following file must be included after "ukbdmap.h" */ #include -#ifdef USB_DEBUG -static int ukbd_debug = 0; -static int ukbd_no_leds = 0; -static int ukbd_pollrate = 0; - -static SYSCTL_NODE(_hw_usb, OID_AUTO, ukbd, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, - "USB keyboard"); -SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, debug, CTLFLAG_RWTUN, - &ukbd_debug, 0, "Debug level"); -SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, no_leds, CTLFLAG_RWTUN, - &ukbd_no_leds, 0, "Disables setting of keyboard leds"); -SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, pollrate, CTLFLAG_RWTUN, - &ukbd_pollrate, 0, "Force this polling rate, 1-1000Hz"); +#ifdef HID_DEBUG +static int hkbd_debug = 0; +static int hkbd_no_leds = 0; + +static SYSCTL_NODE(_hw_hid, OID_AUTO, hkbd, CTLFLAG_RW, 0, "USB keyboard"); +SYSCTL_INT(_hw_hid_hkbd, OID_AUTO, debug, CTLFLAG_RWTUN, + &hkbd_debug, 0, "Debug level"); +SYSCTL_INT(_hw_hid_hkbd, OID_AUTO, no_leds, CTLFLAG_RWTUN, + &hkbd_no_leds, 0, "Disables setting of keyboard leds"); #endif -#define UKBD_EMULATE_ATSCANCODE 1 -#define UKBD_DRIVER_NAME "ukbd" -#define UKBD_NKEYCODE 256 /* units */ -#define UKBD_IN_BUF_SIZE (4 * UKBD_NKEYCODE) /* scancodes */ -#define UKBD_IN_BUF_FULL ((UKBD_IN_BUF_SIZE / 2) - 1) /* scancodes */ -#define UKBD_NFKEY (sizeof(fkey_tab)/sizeof(fkey_tab[0])) /* units */ -#define UKBD_BUFFER_SIZE 64 /* bytes */ -#define UKBD_KEY_PRESSED(map, key) ({ \ - CTASSERT((key) >= 0 && (key) < UKBD_NKEYCODE); \ +#define INPUT_EPOCH global_epoch_preempt + +#define HKBD_EMULATE_ATSCANCODE 1 +#define HKBD_DRIVER_NAME "hkbd" +#define HKBD_NKEYCODE 256 /* units */ +#define HKBD_IN_BUF_SIZE (4 * HKBD_NKEYCODE) /* scancodes */ +#define HKBD_IN_BUF_FULL ((HKBD_IN_BUF_SIZE / 2) - 1) /* scancodes */ +#define HKBD_NFKEY (sizeof(fkey_tab)/sizeof(fkey_tab[0])) /* units */ +#define HKBD_BUFFER_SIZE 64 /* bytes */ +#define HKBD_KEY_PRESSED(map, key) ({ \ + CTASSERT((key) >= 0 && (key) < HKBD_NKEYCODE); \ ((map)[(key) / 64] & (1ULL << ((key) % 64))); \ }) #define MOD_EJECT 0x01 #define MOD_FN 0x02 -struct ukbd_data { - uint64_t bitmap[howmany(UKBD_NKEYCODE, 64)]; -}; +#define MOD_MIN 0xe0 +#define MOD_MAX 0xe7 -enum { - UKBD_INTR_DT_0, - UKBD_INTR_DT_1, - UKBD_CTRL_LED, - UKBD_N_TRANSFER, +struct hkbd_data { + uint64_t bitmap[howmany(HKBD_NKEYCODE, 64)]; }; -struct ukbd_softc { +struct hkbd_softc { + device_t sc_dev; + keyboard_t sc_kbd; keymap_t sc_keymap; accentmap_t sc_accmap; - fkeytab_t sc_fkeymap[UKBD_NFKEY]; - uint64_t sc_loc_key_valid[howmany(UKBD_NKEYCODE, 64)]; + fkeytab_t sc_fkeymap[HKBD_NFKEY]; + uint64_t sc_loc_key_valid[howmany(HKBD_NKEYCODE, 64)]; struct hid_location sc_loc_apple_eject; struct hid_location sc_loc_apple_fn; - struct hid_location sc_loc_key[UKBD_NKEYCODE]; + struct hid_location sc_loc_key[HKBD_NKEYCODE]; struct hid_location sc_loc_numlock; struct hid_location sc_loc_capslock; struct hid_location sc_loc_scrolllock; - struct usb_callout sc_callout; - struct ukbd_data sc_ndata; - struct ukbd_data sc_odata; + struct callout sc_callout; + struct hkbd_data sc_ndata; + struct hkbd_data sc_odata; struct thread *sc_poll_thread; - struct usb_device *sc_udev; - struct usb_interface *sc_iface; - struct usb_xfer *sc_xfer[UKBD_N_TRANSFER]; #ifdef EVDEV_SUPPORT struct evdev_dev *sc_evdev; #endif @@ -162,26 +151,25 @@ struct ukbd_softc { sbintime_t sc_co_basetime; int sc_delay; uint32_t sc_repeat_time; - uint32_t sc_input[UKBD_IN_BUF_SIZE]; /* input buffer */ + uint32_t sc_input[HKBD_IN_BUF_SIZE]; /* input buffer */ uint32_t sc_time_ms; uint32_t sc_composed_char; /* composed char code, if non-zero */ -#ifdef UKBD_EMULATE_ATSCANCODE +#ifdef HKBD_EMULATE_ATSCANCODE uint32_t sc_buffered_char[2]; #endif uint32_t sc_flags; /* flags */ -#define UKBD_FLAG_COMPOSE 0x00000001 -#define UKBD_FLAG_POLLING 0x00000002 -#define UKBD_FLAG_SET_LEDS 0x00000004 -#define UKBD_FLAG_ATTACHED 0x00000010 -#define UKBD_FLAG_GONE 0x00000020 - -#define UKBD_FLAG_HID_MASK 0x003fffc0 -#define UKBD_FLAG_APPLE_EJECT 0x00000040 -#define UKBD_FLAG_APPLE_FN 0x00000080 -#define UKBD_FLAG_APPLE_SWAP 0x00000100 -#define UKBD_FLAG_NUMLOCK 0x00080000 -#define UKBD_FLAG_CAPSLOCK 0x00100000 -#define UKBD_FLAG_SCROLLLOCK 0x00200000 +#define HKBD_FLAG_COMPOSE 0x00000001 +#define HKBD_FLAG_POLLING 0x00000002 +#define HKBD_FLAG_ATTACHED 0x00000010 +#define HKBD_FLAG_GONE 0x00000020 + +#define HKBD_FLAG_HID_MASK 0x003fffc0 +#define HKBD_FLAG_APPLE_EJECT 0x00000040 +#define HKBD_FLAG_APPLE_FN 0x00000080 +#define HKBD_FLAG_APPLE_SWAP 0x00000100 +#define HKBD_FLAG_NUMLOCK 0x00080000 +#define HKBD_FLAG_CAPSLOCK 0x00100000 +#define HKBD_FLAG_SCROLLLOCK 0x00200000 int sc_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ int sc_state; /* shift/lock key state */ @@ -194,19 +182,16 @@ struct ukbd_softc { uint16_t sc_inputhead; uint16_t sc_inputtail; - uint8_t sc_leds; /* store for async led requests */ uint8_t sc_iface_index; uint8_t sc_iface_no; uint8_t sc_id_apple_eject; uint8_t sc_id_apple_fn; - uint8_t sc_id_loc_key[UKBD_NKEYCODE]; - uint8_t sc_id_numlock; - uint8_t sc_id_capslock; - uint8_t sc_id_scrolllock; + uint8_t sc_id_loc_key[HKBD_NKEYCODE]; + uint8_t sc_id_leds; uint8_t sc_kbd_id; uint8_t sc_repeat_key; - uint8_t sc_buffer[UKBD_BUFFER_SIZE]; + uint8_t sc_buffer[HKBD_BUFFER_SIZE]; }; #define KEY_NONE 0x00 @@ -226,9 +211,18 @@ struct ukbd_softc { SCAN_PREFIX_CTL | SCAN_PREFIX_SHIFT) #define SCAN_CHAR(c) ((c) & 0x7f) -#define UKBD_LOCK() USB_MTX_LOCK(&Giant) -#define UKBD_UNLOCK() USB_MTX_UNLOCK(&Giant) -#define UKBD_LOCK_ASSERT() USB_MTX_ASSERT(&Giant, MA_OWNED) +#define HKBD_LOCK() do { \ + if (!HID_IN_POLLING_MODE()) \ + mtx_lock(&Giant); \ +} while (0) +#define HKBD_UNLOCK() do { \ + if (!HID_IN_POLLING_MODE()) \ + mtx_unlock(&Giant); \ +} while (0) +#define HKBD_LOCK_ASSERT() do { \ + if (!HID_IN_POLLING_MODE()) \ + mtx_assert(&Giant, MA_OWNED); \ +} while (0) #define NN 0 /* no translation */ /* @@ -247,7 +241,7 @@ struct ukbd_softc { * 0x90: Kana * 0x91: Eisu */ -static const uint8_t ukbd_trtab[256] = { +static const uint8_t hkbd_trtab[256] = { 0, 0, 0, 0, 30, 48, 46, 32, /* 00 - 07 */ 18, 33, 34, 35, 23, 36, 37, 38, /* 08 - 0F */ 50, 49, 24, 25, 16, 19, 31, 20, /* 10 - 17 */ @@ -282,82 +276,68 @@ static const uint8_t ukbd_trtab[256] = { NN, NN, NN, NN, NN, NN, NN, NN, /* F8 - FF */ }; -static const uint8_t ukbd_boot_desc[] = { - 0x05, 0x01, 0x09, 0x06, 0xa1, - 0x01, 0x05, 0x07, 0x19, 0xe0, - 0x29, 0xe7, 0x15, 0x00, 0x25, - 0x01, 0x75, 0x01, 0x95, 0x08, - 0x81, 0x02, 0x95, 0x01, 0x75, - 0x08, 0x81, 0x01, 0x95, 0x03, - 0x75, 0x01, 0x05, 0x08, 0x19, - 0x01, 0x29, 0x03, 0x91, 0x02, - 0x95, 0x05, 0x75, 0x01, 0x91, - 0x01, 0x95, 0x06, 0x75, 0x08, - 0x15, 0x00, 0x26, 0xff, 0x00, - 0x05, 0x07, 0x19, 0x00, 0x2a, - 0xff, 0x00, 0x81, 0x00, 0xc0 -}; +static const uint8_t hkbd_boot_desc[] = { HID_KBD_BOOTPROTO_DESCR() }; /* prototypes */ -static void ukbd_timeout(void *); -static void ukbd_set_leds(struct ukbd_softc *, uint8_t); -static int ukbd_set_typematic(keyboard_t *, int); -#ifdef UKBD_EMULATE_ATSCANCODE -static uint32_t ukbd_atkeycode(int, const uint64_t *); -static int ukbd_key2scan(struct ukbd_softc *, int, const uint64_t *, int); +static void hkbd_timeout(void *); +static int hkbd_set_leds(struct hkbd_softc *, uint8_t); +static int hkbd_set_typematic(keyboard_t *, int); +#ifdef HKBD_EMULATE_ATSCANCODE +static uint32_t hkbd_atkeycode(int, const uint64_t *); +static int hkbd_key2scan(struct hkbd_softc *, int, const uint64_t *, int); #endif -static uint32_t ukbd_read_char(keyboard_t *, int); -static void ukbd_clear_state(keyboard_t *); -static int ukbd_ioctl(keyboard_t *, u_long, caddr_t); -static int ukbd_enable(keyboard_t *); -static int ukbd_disable(keyboard_t *); -static void ukbd_interrupt(struct ukbd_softc *); -static void ukbd_event_keyinput(struct ukbd_softc *); - -static device_probe_t ukbd_probe; -static device_attach_t ukbd_attach; -static device_detach_t ukbd_detach; -static device_resume_t ukbd_resume; +static uint32_t hkbd_read_char(keyboard_t *, int); +static void hkbd_clear_state(keyboard_t *); +static int hkbd_ioctl(keyboard_t *, u_long, caddr_t); +static int hkbd_enable(keyboard_t *); +static int hkbd_disable(keyboard_t *); +static void hkbd_interrupt(struct hkbd_softc *); +static void hkbd_event_keyinput(struct hkbd_softc *); + +static device_probe_t hkbd_probe; +static device_attach_t hkbd_attach; +static device_detach_t hkbd_detach; +static device_resume_t hkbd_resume; #ifdef EVDEV_SUPPORT -static evdev_event_t ukbd_ev_event; +static evdev_event_t hkbd_ev_event; -static const struct evdev_methods ukbd_evdev_methods = { - .ev_event = ukbd_ev_event, +static const struct evdev_methods hkbd_evdev_methods = { + .ev_event = hkbd_ev_event, }; #endif static bool -ukbd_any_key_pressed(struct ukbd_softc *sc) +hkbd_any_key_pressed(struct hkbd_softc *sc) { bool ret = false; unsigned i; - for (i = 0; i != howmany(UKBD_NKEYCODE, 64); i++) + for (i = 0; i != howmany(HKBD_NKEYCODE, 64); i++) ret |= (sc->sc_odata.bitmap[i] != 0); return (ret); } static bool -ukbd_any_key_valid(struct ukbd_softc *sc) +hkbd_any_key_valid(struct hkbd_softc *sc) { bool ret = false; unsigned i; - for (i = 0; i != howmany(UKBD_NKEYCODE, 64); i++) + for (i = 0; i != howmany(HKBD_NKEYCODE, 64); i++) ret |= (sc->sc_loc_key_valid[i] != 0); return (ret); } static bool -ukbd_is_modifier_key(uint32_t key) +hkbd_is_modifier_key(uint32_t key) { - return (key >= 0xe0 && key <= 0xe7); + return (key >= MOD_MIN && key <= MOD_MAX); } static void -ukbd_start_timer(struct ukbd_softc *sc) +hkbd_start_timer(struct hkbd_softc *sc) { sbintime_t delay, now, prec; @@ -377,15 +357,16 @@ ukbd_start_timer(struct ukbd_softc *sc) /* This is rarely called, so prefer precision to efficiency. */ prec = qmin(delay >> 7, SBT_1MS * 10); - usb_callout_reset_sbt(&sc->sc_callout, sc->sc_co_basetime, prec, - ukbd_timeout, sc, C_ABSOLUTE); + if (!HID_IN_POLLING_MODE()) + callout_reset_sbt(&sc->sc_callout, sc->sc_co_basetime, prec, + hkbd_timeout, sc, C_ABSOLUTE); } static void -ukbd_put_key(struct ukbd_softc *sc, uint32_t key) +hkbd_put_key(struct hkbd_softc *sc, uint32_t key) { - UKBD_LOCK_ASSERT(); + HKBD_LOCK_ASSERT(); DPRINTF("0x%02x (%d) %s\n", key, key, (key & KEY_RELEASE) ? "released" : "pressed"); @@ -396,11 +377,11 @@ ukbd_put_key(struct ukbd_softc *sc, uint32_t key) evdev_hid2key(KEY_INDEX(key)), !(key & KEY_RELEASE)); #endif - if (sc->sc_inputs < UKBD_IN_BUF_SIZE) { + if (sc->sc_inputs < HKBD_IN_BUF_SIZE) { sc->sc_input[sc->sc_inputtail] = key; ++(sc->sc_inputs); ++(sc->sc_inputtail); - if (sc->sc_inputtail >= UKBD_IN_BUF_SIZE) { + if (sc->sc_inputtail >= HKBD_IN_BUF_SIZE) { sc->sc_inputtail = 0; } } else { @@ -409,15 +390,15 @@ ukbd_put_key(struct ukbd_softc *sc, uint32_t key) } static void -ukbd_do_poll(struct ukbd_softc *sc, uint8_t wait) +hkbd_do_poll(struct hkbd_softc *sc, uint8_t wait) { - UKBD_LOCK_ASSERT(); - KASSERT((sc->sc_flags & UKBD_FLAG_POLLING) != 0, - ("ukbd_do_poll called when not polling\n")); + HKBD_LOCK_ASSERT(); + KASSERT((sc->sc_flags & HKBD_FLAG_POLLING) != 0, + ("hkbd_do_poll called when not polling\n")); DPRINTFN(2, "polling\n"); - if (USB_IN_POLLING_MODE_FUNC() == 0) { + if (!HID_IN_POLLING_MODE()) { /* * In this context the kernel is polling for input, * but the USB subsystem works in normal interrupt-driven @@ -438,10 +419,10 @@ ukbd_do_poll(struct ukbd_softc *sc, uint8_t wait) } while (sc->sc_inputs == 0) { - usbd_transfer_poll(sc->sc_xfer, UKBD_N_TRANSFER); + hidbus_intr_poll(sc->sc_dev); /* Delay-optimised support for repetition of keys */ - if (ukbd_any_key_pressed(sc)) { + if (hkbd_any_key_pressed(sc)) { /* a key is pressed - need timekeeping */ DELAY(1000); @@ -449,7 +430,7 @@ ukbd_do_poll(struct ukbd_softc *sc, uint8_t wait) sc->sc_time_ms += 1; } - ukbd_interrupt(sc); + hkbd_interrupt(sc); if (!wait) break; @@ -457,24 +438,17 @@ ukbd_do_poll(struct ukbd_softc *sc, uint8_t wait) } static int32_t -ukbd_get_key(struct ukbd_softc *sc, uint8_t wait) +hkbd_get_key(struct hkbd_softc *sc, uint8_t wait) { int32_t c; - UKBD_LOCK_ASSERT(); - KASSERT((USB_IN_POLLING_MODE_FUNC() == 0) || - (sc->sc_flags & UKBD_FLAG_POLLING) != 0, + HKBD_LOCK_ASSERT(); + KASSERT(!HID_IN_POLLING_MODE() || + (sc->sc_flags & HKBD_FLAG_POLLING) != 0, ("not polling in kdb or panic\n")); - if (sc->sc_inputs == 0 && - (sc->sc_flags & UKBD_FLAG_GONE) == 0) { - /* start transfer, if not already started */ - usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_0]); - usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT_1]); - } - - if (sc->sc_flags & UKBD_FLAG_POLLING) - ukbd_do_poll(sc, wait); + if (sc->sc_flags & HKBD_FLAG_POLLING) + hkbd_do_poll(sc, wait); if (sc->sc_inputs == 0) { c = -1; @@ -482,7 +456,7 @@ ukbd_get_key(struct ukbd_softc *sc, uint8_t wait) c = sc->sc_input[sc->sc_inputhead]; --(sc->sc_inputs); ++(sc->sc_inputhead); - if (sc->sc_inputhead >= UKBD_IN_BUF_SIZE) { + if (sc->sc_inputhead >= HKBD_IN_BUF_SIZE) { sc->sc_inputhead = 0; } } @@ -490,53 +464,54 @@ ukbd_get_key(struct ukbd_softc *sc, uint8_t wait) } static void -ukbd_interrupt(struct ukbd_softc *sc) +hkbd_interrupt(struct hkbd_softc *sc) { const uint32_t now = sc->sc_time_ms; unsigned key; - UKBD_LOCK_ASSERT(); + HKBD_LOCK_ASSERT(); - /* Check for modifier key changes first */ - for (key = 0xe0; key != 0xe8; key++) { + /* Check for key changes, the order is: + * 1. Modifier keys down + * 2. Regular keys up/down + * 3. Modifier keys up + * + * This allows devices which send events changing the state of + * both a modifier key and a regular key, to be correctly + * translated. */ + for (key = MOD_MIN; key <= MOD_MAX; key++) { const uint64_t mask = 1ULL << (key % 64); - const uint64_t delta = - sc->sc_odata.bitmap[key / 64] ^ - sc->sc_ndata.bitmap[key / 64]; - if (delta & mask) { - if (sc->sc_odata.bitmap[key / 64] & mask) - ukbd_put_key(sc, key | KEY_RELEASE); - else - ukbd_put_key(sc, key | KEY_PRESS); + if (!(sc->sc_odata.bitmap[key / 64] & mask) && + (sc->sc_ndata.bitmap[key / 64] & mask)) { + hkbd_put_key(sc, key | KEY_PRESS); } } - - /* Check for key changes */ - for (key = 0; key != UKBD_NKEYCODE; key++) { + for (key = 0; key != HKBD_NKEYCODE; key++) { const uint64_t mask = 1ULL << (key % 64); const uint64_t delta = sc->sc_odata.bitmap[key / 64] ^ sc->sc_ndata.bitmap[key / 64]; + if (hkbd_is_modifier_key(key)) + continue; + if (mask == 1 && delta == 0) { key += 63; continue; /* skip empty areas */ - } else if (ukbd_is_modifier_key(key)) { - continue; } else if (delta & mask) { if (sc->sc_odata.bitmap[key / 64] & mask) { - ukbd_put_key(sc, key | KEY_RELEASE); + hkbd_put_key(sc, key | KEY_RELEASE); /* clear repeating key, if any */ if (sc->sc_repeat_key == key) sc->sc_repeat_key = 0; } else { - ukbd_put_key(sc, key | KEY_PRESS); + hkbd_put_key(sc, key | KEY_PRESS); sc->sc_co_basetime = sbinuptime(); sc->sc_delay = sc->sc_kbd.kb_delay1; - ukbd_start_timer(sc); + hkbd_start_timer(sc); /* set repeat time for last key */ sc->sc_repeat_time = now + sc->sc_kbd.kb_delay1; @@ -544,6 +519,14 @@ ukbd_interrupt(struct ukbd_softc *sc) } } } + for (key = MOD_MIN; key <= MOD_MAX; key++) { + const uint64_t mask = 1ULL << (key % 64); + + if ((sc->sc_odata.bitmap[key / 64] & mask) && + !(sc->sc_ndata.bitmap[key / 64] & mask)) { + hkbd_put_key(sc, key | KEY_RELEASE); + } + } /* synchronize old data with new data */ sc->sc_odata = sc->sc_ndata; @@ -554,7 +537,7 @@ ukbd_interrupt(struct ukbd_softc *sc) /* check if time has elapsed */ if (dtime <= 0) { - ukbd_put_key(sc, sc->sc_repeat_key | KEY_PRESS); + hkbd_put_key(sc, sc->sc_repeat_key | KEY_PRESS); sc->sc_repeat_time = now + sc->sc_kbd.kb_delay2; } } @@ -565,17 +548,17 @@ ukbd_interrupt(struct ukbd_softc *sc) #endif /* wakeup keyboard system */ - ukbd_event_keyinput(sc); + hkbd_event_keyinput(sc); } static void -ukbd_event_keyinput(struct ukbd_softc *sc) +hkbd_event_keyinput(struct hkbd_softc *sc) { int c; - UKBD_LOCK_ASSERT(); + HKBD_LOCK_ASSERT(); - if ((sc->sc_flags & UKBD_FLAG_POLLING) != 0) + if ((sc->sc_flags & HKBD_FLAG_POLLING) != 0) return; if (sc->sc_inputs == 0) @@ -589,33 +572,36 @@ ukbd_event_keyinput(struct ukbd_softc *sc) } else { /* read and discard the input, no one is waiting for it */ do { - c = ukbd_read_char(&sc->sc_kbd, 0); + c = hkbd_read_char(&sc->sc_kbd, 0); } while (c != NOKEY); } } static void -ukbd_timeout(void *arg) +hkbd_timeout(void *arg) { - struct ukbd_softc *sc = arg; + struct hkbd_softc *sc = arg; + struct epoch_tracker et; - UKBD_LOCK_ASSERT(); + HKBD_LOCK_ASSERT(); sc->sc_time_ms += sc->sc_delay; sc->sc_delay = 0; - ukbd_interrupt(sc); + epoch_enter_preempt(INPUT_EPOCH, &et); + hkbd_interrupt(sc); + epoch_exit_preempt(INPUT_EPOCH, &et); /* Make sure any leftover key events gets read out */ - ukbd_event_keyinput(sc); + hkbd_event_keyinput(sc); - if (ukbd_any_key_pressed(sc) || (sc->sc_inputs != 0)) { - ukbd_start_timer(sc); + if (hkbd_any_key_pressed(sc) || (sc->sc_inputs != 0)) { + hkbd_start_timer(sc); } } static uint32_t -ukbd_apple_fn(uint32_t keycode) +hkbd_apple_fn(uint32_t keycode) { switch (keycode) { case 0x28: return 0x49; /* RETURN -> INSERT */ @@ -629,7 +615,7 @@ ukbd_apple_fn(uint32_t keycode) } static uint32_t -ukbd_apple_swap(uint32_t keycode) +hkbd_apple_swap(uint32_t keycode) { switch (keycode) { case 0x35: return 0x64; @@ -639,347 +625,141 @@ ukbd_apple_swap(uint32_t keycode) } static void -ukbd_intr_callback(struct usb_xfer *xfer, usb_error_t error) +hkbd_intr_callback(void *context, void *data, hid_size_t len) { - struct ukbd_softc *sc = usbd_xfer_softc(xfer); - struct usb_page_cache *pc; + struct hkbd_softc *sc = context; + uint8_t *buf = data; uint32_t i; - uint8_t id; + uint8_t id = 0; uint8_t modifiers; int offset; - int len; - UKBD_LOCK_ASSERT(); + HKBD_LOCK_ASSERT(); - usbd_xfer_status(xfer, &len, NULL, NULL, NULL); - pc = usbd_xfer_get_frame(xfer, 0); + DPRINTF("actlen=%d bytes\n", len); - switch (USB_GET_STATE(xfer)) { - case USB_ST_TRANSFERRED: - DPRINTF("actlen=%d bytes\n", len); + if (len == 0) { + DPRINTF("zero length data\n"); + return; + } + if (sc->sc_kbd_id != 0) { + /* check and remove HID ID byte */ + id = buf[0]; + buf++; + len--; if (len == 0) { DPRINTF("zero length data\n"); - goto tr_setup; + return; } + } - if (sc->sc_kbd_id != 0) { - /* check and remove HID ID byte */ - usbd_copy_out(pc, 0, &id, 1); - offset = 1; - len--; - if (len == 0) { - DPRINTF("zero length data\n"); - goto tr_setup; - } - } else { - offset = 0; - id = 0; - } - - if (len > UKBD_BUFFER_SIZE) - len = UKBD_BUFFER_SIZE; - - /* get data */ - usbd_copy_out(pc, offset, sc->sc_buffer, len); - - /* clear temporary storage */ - memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); + /* clear temporary storage */ + memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); - /* clear modifiers */ - modifiers = 0; + /* clear modifiers */ + modifiers = 0; - /* scan through HID data */ - if ((sc->sc_flags & UKBD_FLAG_APPLE_EJECT) && - (id == sc->sc_id_apple_eject)) { - if (hid_get_data(sc->sc_buffer, len, &sc->sc_loc_apple_eject)) - modifiers |= MOD_EJECT; - } - if ((sc->sc_flags & UKBD_FLAG_APPLE_FN) && - (id == sc->sc_id_apple_fn)) { - if (hid_get_data(sc->sc_buffer, len, &sc->sc_loc_apple_fn)) - modifiers |= MOD_FN; - } + /* scan through HID data */ + if ((sc->sc_flags & HKBD_FLAG_APPLE_EJECT) && + (id == sc->sc_id_apple_eject)) { + if (hid_get_data(buf, len, &sc->sc_loc_apple_eject)) + modifiers |= MOD_EJECT; + } + if ((sc->sc_flags & HKBD_FLAG_APPLE_FN) && + (id == sc->sc_id_apple_fn)) { + if (hid_get_data(buf, len, &sc->sc_loc_apple_fn)) + modifiers |= MOD_FN; + } - for (i = 0; i != UKBD_NKEYCODE; i++) { - const uint64_t valid = sc->sc_loc_key_valid[i / 64]; - const uint64_t mask = 1ULL << (i % 64); - - if (mask == 1 && valid == 0) { - i += 63; - continue; /* skip empty areas */ - } else if (~valid & mask) { - continue; /* location is not valid */ - } else if (id != sc->sc_id_loc_key[i]) { - continue; /* invalid HID ID */ - } else if (i == 0) { - struct hid_location tmp_loc = sc->sc_loc_key[0]; - /* range check array size */ - if (tmp_loc.count > UKBD_NKEYCODE) - tmp_loc.count = UKBD_NKEYCODE; - while (tmp_loc.count--) { - uint32_t key = - hid_get_udata(sc->sc_buffer, len, &tmp_loc); - /* advance to next location */ *** 1579 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 218554DE953; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@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 4DBj026YG2z4Sw3; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D17B619273; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKou9063082; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKosq063081; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:50 GMT Message-Id: <202101072320.107NKosq063081@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 947739079604 - main - hid: Import hidraw(4) - driver for access to raw HID device data MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 947739079604f5f9fea92d783c9ef43dce52e462 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:51 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=947739079604f5f9fea92d783c9ef43dce52e462 commit 947739079604f5f9fea92d783c9ef43dce52e462 Author: Vladimir Kondratyev AuthorDate: 2020-10-14 00:52:47 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:43 +0000 hid: Import hidraw(4) - driver for access to raw HID device data This driver provides raw access to HID devices through uhid(4)-compatible interface and is based on pre-8.x uhid(4) code. Unlike uhid(4) it does not take devices in to monopoly ownership and allows parallel access from other drivers. hidraw supports Linux's hidraw-compatible interface as well. Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D27992 --- include/Makefile | 6 +- share/man/man4/Makefile | 1 + share/man/man4/hidraw.4 | 308 ++++++++++++++ sys/conf/files | 1 + sys/dev/hid/hidraw.c | 902 ++++++++++++++++++++++++++++++++++++++++ sys/dev/hid/hidraw.h | 97 +++++ sys/dev/usb/usb_ioctl.h | 2 +- sys/modules/hid/Makefile | 3 +- sys/modules/hid/hidraw/Makefile | 9 + 9 files changed, 1325 insertions(+), 4 deletions(-) diff --git a/include/Makefile b/include/Makefile index 7e19f66edf71..59f62f1d4897 100644 --- a/include/Makefile +++ b/include/Makefile @@ -95,7 +95,8 @@ EVDEV= input.h \ EVDEVDIR= ${INCLUDEDIR}/dev/evdev .PATH: ${SRCTOP}/sys/dev/hid -HID= hid.h +HID= hid.h \ + hidraw.h HIDDIR= ${INCLUDEDIR}/dev/hid .PATH: ${SRCTOP}/sys/dev/hyperv/include ${SRCTOP}/sys/dev/hyperv/utilities @@ -340,7 +341,8 @@ symlinks: .PHONY .META ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ ${SDESTDIR}${INCLUDEDIR}/dev/evdev; - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hid/hid.h \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \ ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 4fd816804062..02d1bca75a3f 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -182,6 +182,7 @@ MAN= aac.4 \ hconf.4 \ hidbus.4 \ hidquirk.4 \ + hidraw.4 \ hifn.4 \ hkbd.4 \ hmt.4 \ diff --git a/share/man/man4/hidraw.4 b/share/man/man4/hidraw.4 new file mode 100644 index 000000000000..7012089e354b --- /dev/null +++ b/share/man/man4/hidraw.4 @@ -0,0 +1,308 @@ +.\" $NetBSD: uhid.4,v 1.13 2001/12/29 14:41:59 augustss Exp $ +.\" +.\" Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Lennart Augustsson. +.\" +.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 1, 2018 +.Dt HIDRAW 4 +.Os +.Sh NAME +.Nm hidraw +.Nd Raw Access to HID devices +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device hidraw" +.Cd "device hid" +.Cd "device hidbus" +.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 +hidraw_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides a raw interface to Human Interface Devices (HIDs). +The reports are sent to and received from the device unmodified. +.Pp +The device handles 2 sets of +.Xr ioctl 2 +calls: +.Pp +.Fx +.Xr uhid 4 +\-compatible calls: +.Bl -tag -width indent +.It Dv HID_GET_REPORT_ID Pq Vt int +Get the report identifier used by this HID report. +.It Dv HID_GET_REPORT_DESC Pq Vt "struct hidraw_gen_descriptor" +Get the HID report descriptor. +Copies a maximum of +.Va hgd_maxlen +bytes of the report descriptor data into the memory +specified by +.Va hgd_data . +Upon return +.Va hgd_actlen +is set to the number of bytes copied. +Using +this descriptor the exact layout and meaning of data to/from +the device can be found. +The report descriptor is delivered +without any processing. +.Bd -literal +struct hidraw_gen_descriptor { + void *hgd_data; + uint16_t hgd_maxlen; + uint16_t hgd_actlen; + uint8_t hgd_report_type; + ... +}; +.Ed +.It Dv HID_SET_IMMED Pq Vt int +Sets the device in a mode where each +.Xr read 2 +will return the current value of the input report. +Normally +a +.Xr read 2 +will only return the data that the device reports on its +interrupt pipe. +This call may fail if the device does not support +this feature. +.It Dv HID_GET_REPORT Pq Vt "struct hidraw_gen_descriptor" +Get a report from the device without waiting for data on +the interrupt pipe. +Copies a maximum of +.Va hgd_maxlen +bytes of the report data into the memory specified by +.Va hgd_data . +Upon return +.Va hgd_actlen +is set to the number of bytes copied. +The +.Va hgd_report_type +field indicates which report is requested. +It should be +.Dv HID_INPUT_REPORT , +.Dv HID_OUTPUT_REPORT , +or +.Dv HID_FEATURE_REPORT . +On a device which uses numbered reports, the first byte of the returned data +is the report number. +The report data begins from the second byte. +For devices which do not use numbered reports, the report data begins at the +first byte. +This call may fail if the device does not support this feature. +.It Dv HID_SET_REPORT Pq Vt "struct hidraw_gen_descriptor" +Set a report in the device. +The +.Va hgd_report_type +field indicates which report is to be set. +It should be +.Dv HID_INPUT_REPORT , +.Dv HID_OUTPUT_REPORT , +or +.Dv HID_FEATURE_REPORT . +The value of the report is specified by the +.Va hgd_data +and the +.Va hgd_maxlen +fields. +On a device which uses numbered reports, the first byte of data to be sent is +the report number. +The report data begins from the second byte. +For devices which do not use numbered reports, the report data begins at the +first byte. +This call may fail if the device does not support this feature. +.El +.Pp +Linux +.Nm +\-compatible calls: +.Bl -tag -width indent +.It Dv HIDIOCGRDESCSIZE Pq Vt int +Get the HID report descriptor size. +Returns the size of the device report descriptor to use with +.Dv HIDIOCGRDESC +.Xr ioctl 2 . +.It Dv HIDIOCGRDESC Pq Vt "struct hidraw_report_descriptor" +Get the HID report descriptor. +Copies a maximum of +.Va size +bytes of the report descriptor data into the memory +specified by +.Va value . +.Bd -literal +struct hidraw_report_descriptor { + uint32_t size; + uint8_t value[HID_MAX_DESCRIPTOR_SIZE]; +}; +.Ed +.It Dv HIDIOCGRAWINFO Pq Vt "struct hidraw_devinfo" +Get structure containing the bus type, the vendor ID (VID), and product ID +(PID) of the device. The bus type can be one of: +.Dv BUS_USB +or +.Dv BUS_I2C +which are defined in dev/evdev/input.h. +.Bd -literal +struct hidraw_devinfo { + uint32_t bustype; + int16_t vendor; + int16_t product; +}; +.Ed +.It Dv HIDIOCGRAWNAME(len) Pq Vt "char[] buf" +Get device description. +Copies a maximum of +.Va len +bytes of the device description previously set with +.Xr device_set_desc 9 +procedure into the memory +specified by +.Va buf . +.It Dv HIDIOCGRAWPHYS(len) Pq Vt "char[] buf" +Get the newbus path to the device. +.\For Bluetooth devices, it returns the hardware (MAC) address of the device. +Copies a maximum of +.Va len +bytes of the newbus device path +into the memory +specified by +.Va buf . +.It Dv HIDIOCGFEATURE(len) Pq Vt "void[] buf" +Get a feature report from the device. +Copies a maximum of +.Va len +bytes of the feature report data into the memory specified by +.Va buf . +The first byte of the supplied buffer should be set to the report +number of the requested report. +For devices which do not use numbered reports, set the first byte to 0. +The report will be returned starting at the first byte of the buffer +(ie: the report number is not returned). +This call may fail if the device does not support this feature. +.It Dv HIDIOCSFEATURE(len) Pq Vt "void[] buf" +Set a feature Report in the device. +The value of the report is specified by the +.Va buf +and the +.Va len +parameters. +Set the first byte of the supplied buffer to the report number. +For devices which do not use numbered reports, set the first byte to 0. +The report data begins in the second byte. +Make sure to set len accordingly, to one more than the length of the report +(to account for the report number). +This call may fail if the device does not support this feature. +.El +.Pp +Use +.Xr read 2 +to get data from the device. +Data should be read in chunks of the +size prescribed by the report descriptor. +On a device which uses numbered reports, the first byte of the returned data +is the report number. +The report data begins from the second byte. +For devices which do not use numbered reports, the report data begins at the +first byte. +.Pp +Use +.Xr write 2 +to send data to the device. +Data should be written in chunks of the +size prescribed by the report descriptor. +The first byte of the buffer passed to +.Xr write 2 +should be set to the report number. +If the device does not use numbered reports, there are 2 operation modes: +.Nm +mode and +.Xr uhid 4 +mode. +In the +.Nm +mode, the first byte should be set to 0 and the report data itself should +begin at the second byte. +In the +.Xr uhid 4 +mode, the report data should begin at the first byte. +The modes can be switched with issuing one of +.Dv HIDIOCGRDESC +or +.Dv HID_GET_REPORT_DESC +.Xr ioctl 2 +accordingly. +Default mode is +.Nm . +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables: +.Bl -tag -width indent +.It Va hw.hid.hidraw.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Sh FILES +.Bl -tag -width ".Pa /dev/hidraw?" +.It Pa /dev/hidraw? +.El +.Sh SEE ALSO +.Xr usbhidctl 1 , +.Xr hid 4 , +.Xr hidbus 4 , +.Xr uhid 4 +.Sh HISTORY +The +.Xr uhid 4 +driver +appeared in +.Nx 1.4 . +.Nm +protocol support was added in +.Fx 13 +by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . +This manual page was adopted from +.Nx +by +.An Tom Rhodes Aq Mt trhodes@FreeBSD.org +in April 2002. diff --git a/sys/conf/files b/sys/conf/files index 71d78778d500..cea809deb039 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1820,6 +1820,7 @@ dev/hid/hid.c optional hid dev/hid/hid_if.m optional hid dev/hid/hidbus.c optional hidbus dev/hid/hidquirk.c optional hid +dev/hid/hidraw.c optional hidraw dev/hid/hkbd.c optional hkbd dev/hid/hmt.c optional hmt hconf dev/hifn/hifn7751.c optional hifn diff --git a/sys/dev/hid/hidraw.c b/sys/dev/hid/hidraw.c new file mode 100644 index 000000000000..1da8cb202bd9 --- /dev/null +++ b/sys/dev/hid/hidraw.c @@ -0,0 +1,902 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * Copyright (c) 2020 Vladimir Kondratyev + * + * This code is derived from software contributed to The NetBSD Foundation + * by Lennart Augustsson (lennart@augustsson.net) at + * Carlstedt Research & Technology. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +/* + * HID spec: http://www.usb.org/developers/devclass_docs/HID1_11.pdf + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define HID_DEBUG_VAR hidraw_debug +#include +#include +#include + +#ifdef HID_DEBUG +static int hidraw_debug = 0; +static SYSCTL_NODE(_hw_hid, OID_AUTO, hidraw, CTLFLAG_RW, 0, + "HID raw interface"); +SYSCTL_INT(_hw_hid_hidraw, OID_AUTO, debug, CTLFLAG_RWTUN, + &hidraw_debug, 0, "Debug level"); +#endif + +#define HIDRAW_INDEX 0xFF /* Arbitrary high value */ + +#define HIDRAW_LOCAL_BUFSIZE 64 /* Size of on-stack buffer. */ +#define HIDRAW_LOCAL_ALLOC(local_buf, size) \ + (sizeof(local_buf) > (size) ? (local_buf) : \ + malloc((size), M_DEVBUF, M_ZERO | M_WAITOK)) +#define HIDRAW_LOCAL_FREE(local_buf, buf) \ + if ((local_buf) != (buf)) { \ + free((buf), M_DEVBUF); \ + } + +struct hidraw_softc { + device_t sc_dev; /* base device */ + + struct mtx sc_mtx; /* hidbus private mutex */ + + struct hid_rdesc_info *sc_rdesc; + const struct hid_device_info *sc_hw; + + uint8_t *sc_q; + hid_size_t *sc_qlen; + int sc_head; + int sc_tail; + int sc_sleepcnt; + + struct selinfo sc_rsel; + struct proc *sc_async; /* process that wants SIGIO */ + struct { /* driver state */ + bool open:1; /* device is open */ + bool aslp:1; /* waiting for device data in read() */ + bool sel:1; /* waiting for device data in poll() */ + bool quiet:1; /* Ignore input data */ + bool immed:1; /* return read data immediately */ + bool uhid:1; /* driver switched in to uhid mode */ + bool lock:1; /* input queue sleepable lock */ + bool flush:1; /* do not wait for data in read() */ + } sc_state; + int sc_fflags; /* access mode for open lifetime */ + + struct cdev *dev; +}; + +static d_open_t hidraw_open; +static d_read_t hidraw_read; +static d_write_t hidraw_write; +static d_ioctl_t hidraw_ioctl; +static d_poll_t hidraw_poll; +static d_kqfilter_t hidraw_kqfilter; + +static d_priv_dtor_t hidraw_dtor; + +static struct cdevsw hidraw_cdevsw = { + .d_version = D_VERSION, + .d_open = hidraw_open, + .d_read = hidraw_read, + .d_write = hidraw_write, + .d_ioctl = hidraw_ioctl, + .d_poll = hidraw_poll, + .d_kqfilter = hidraw_kqfilter, + .d_name = "hidraw", +}; + +static hid_intr_t hidraw_intr; + +static device_identify_t hidraw_identify; +static device_probe_t hidraw_probe; +static device_attach_t hidraw_attach; +static device_detach_t hidraw_detach; + +static int hidraw_kqread(struct knote *, long); +static void hidraw_kqdetach(struct knote *); +static void hidraw_notify(struct hidraw_softc *); + +static struct filterops hidraw_filterops_read = { + .f_isfd = 1, + .f_detach = hidraw_kqdetach, + .f_event = hidraw_kqread, +}; + +static void +hidraw_identify(driver_t *driver, device_t parent) +{ + device_t child; + + if (device_find_child(parent, "hidraw", -1) == NULL) { + child = BUS_ADD_CHILD(parent, 0, "hidraw", + device_get_unit(parent)); + if (child != NULL) + hidbus_set_index(child, HIDRAW_INDEX); + } +} + +static int +hidraw_probe(device_t self) +{ + + if (hidbus_get_index(self) != HIDRAW_INDEX) + return (ENXIO); + + hidbus_set_desc(self, "Raw HID Device"); + + return (BUS_PROBE_GENERIC); +} + +static int +hidraw_attach(device_t self) +{ + struct hidraw_softc *sc = device_get_softc(self); + struct make_dev_args mda; + int error; + + sc->sc_dev = self; + sc->sc_rdesc = hidbus_get_rdesc_info(self); + sc->sc_hw = hid_get_device_info(self); + + /* Hidraw mode does not require report descriptor to work */ + if (sc->sc_rdesc->data == NULL || sc->sc_rdesc->len == 0) + device_printf(self, "no report descriptor\n"); + + mtx_init(&sc->sc_mtx, "hidraw lock", NULL, MTX_DEF); + knlist_init_mtx(&sc->sc_rsel.si_note, &sc->sc_mtx); + + make_dev_args_init(&mda); + mda.mda_flags = MAKEDEV_WAITOK; + mda.mda_devsw = &hidraw_cdevsw; + mda.mda_uid = UID_ROOT; + mda.mda_gid = GID_OPERATOR; + mda.mda_mode = 0600; + mda.mda_si_drv1 = sc; + + error = make_dev_s(&mda, &sc->dev, "hidraw%d", device_get_unit(self)); + if (error) { + device_printf(self, "Can not create character device\n"); + hidraw_detach(self); + return (error); + } + + hidbus_set_lock(self, &sc->sc_mtx); + hidbus_set_intr(self, hidraw_intr, sc); + + return (0); +} + +static int +hidraw_detach(device_t self) +{ + struct hidraw_softc *sc = device_get_softc(self); + + DPRINTF("sc=%p\n", sc); + + if (sc->dev != NULL) { + mtx_lock(&sc->sc_mtx); + sc->dev->si_drv1 = NULL; + /* Wake everyone */ + hidraw_notify(sc); + mtx_unlock(&sc->sc_mtx); + destroy_dev(sc->dev); + } + + knlist_clear(&sc->sc_rsel.si_note, 0); + knlist_destroy(&sc->sc_rsel.si_note); + seldrain(&sc->sc_rsel); + mtx_destroy(&sc->sc_mtx); + + return (0); +} + +void +hidraw_intr(void *context, void *buf, hid_size_t len) +{ + struct hidraw_softc *sc = context; + int next; + + DPRINTFN(5, "len=%d\n", len); + DPRINTFN(5, "data = %*D\n", len, buf, " "); + + next = (sc->sc_tail + 1) % HIDRAW_BUFFER_SIZE; + if (sc->sc_state.quiet || next == sc->sc_head) + return; + + bcopy(buf, sc->sc_q + sc->sc_tail * sc->sc_rdesc->rdsize, len); + + /* Make sure we don't process old data */ + if (len < sc->sc_rdesc->rdsize) + bzero(sc->sc_q + sc->sc_tail * sc->sc_rdesc->rdsize + len, + sc->sc_rdesc->isize - len); + + sc->sc_qlen[sc->sc_tail] = len; + sc->sc_tail = next; + + hidraw_notify(sc); +} + +static inline int +hidraw_lock_queue(struct hidraw_softc *sc, bool flush) +{ + int error = 0; + + mtx_assert(&sc->sc_mtx, MA_OWNED); + + if (flush) + sc->sc_state.flush = true; + ++sc->sc_sleepcnt; + while (sc->sc_state.lock && error == 0) { + /* Flush is requested. Wakeup all readers and forbid sleeps */ + if (flush && sc->sc_state.aslp) { + sc->sc_state.aslp = false; + DPRINTFN(5, "waking %p\n", &sc->sc_q); + wakeup(&sc->sc_q); + } + error = mtx_sleep(&sc->sc_sleepcnt, &sc->sc_mtx, + PZERO | PCATCH, "hidrawio", 0); + } + --sc->sc_sleepcnt; + if (flush) + sc->sc_state.flush = false; + if (error == 0) + sc->sc_state.lock = true; + + return (error); +} + +static inline void +hidraw_unlock_queue(struct hidraw_softc *sc) +{ + + mtx_assert(&sc->sc_mtx, MA_OWNED); + KASSERT(sc->sc_state.lock, ("input buffer is not locked")); + + if (sc->sc_sleepcnt != 0) + wakeup_one(&sc->sc_sleepcnt); + sc->sc_state.lock = false; +} + +static int +hidraw_open(struct cdev *dev, int flag, int mode, struct thread *td) +{ + struct hidraw_softc *sc; + int error; + + sc = dev->si_drv1; + if (sc == NULL) + return (ENXIO); + + DPRINTF("sc=%p\n", sc); + + mtx_lock(&sc->sc_mtx); + if (sc->sc_state.open) { + mtx_unlock(&sc->sc_mtx); + return (EBUSY); + } + sc->sc_state.open = true; + mtx_unlock(&sc->sc_mtx); + + error = devfs_set_cdevpriv(sc, hidraw_dtor); + if (error != 0) { + mtx_lock(&sc->sc_mtx); + sc->sc_state.open = false; + mtx_unlock(&sc->sc_mtx); + return (error); + } + + sc->sc_q = malloc(sc->sc_rdesc->rdsize * HIDRAW_BUFFER_SIZE, M_DEVBUF, + M_ZERO | M_WAITOK); + sc->sc_qlen = malloc(sizeof(hid_size_t) * HIDRAW_BUFFER_SIZE, M_DEVBUF, + M_ZERO | M_WAITOK); + + /* Set up interrupt pipe. */ + sc->sc_state.immed = false; + sc->sc_async = 0; + sc->sc_state.uhid = false; /* hidraw mode is default */ + sc->sc_state.quiet = false; + sc->sc_head = sc->sc_tail = 0; + sc->sc_fflags = flag; + + hidbus_intr_start(sc->sc_dev); + + return (0); +} + +static void +hidraw_dtor(void *data) +{ + struct hidraw_softc *sc = data; + + DPRINTF("sc=%p\n", sc); + + /* Disable interrupts. */ + hidbus_intr_stop(sc->sc_dev); + + sc->sc_tail = sc->sc_head = 0; + sc->sc_async = 0; + free(sc->sc_q, M_DEVBUF); + free(sc->sc_qlen, M_DEVBUF); + sc->sc_q = NULL; + + mtx_lock(&sc->sc_mtx); + sc->sc_state.open = false; + mtx_unlock(&sc->sc_mtx); +} + +static int +hidraw_read(struct cdev *dev, struct uio *uio, int flag) +{ + struct hidraw_softc *sc; + size_t length; + int error; + + DPRINTFN(1, "\n"); + + sc = dev->si_drv1; + if (sc == NULL) + return (EIO); + + mtx_lock(&sc->sc_mtx); + error = dev->si_drv1 == NULL ? EIO : hidraw_lock_queue(sc, false); + if (error != 0) { + mtx_unlock(&sc->sc_mtx); + return (error); + } + + if (sc->sc_state.immed) { + mtx_unlock(&sc->sc_mtx); + DPRINTFN(1, "immed\n"); + + error = hid_get_report(sc->sc_dev, sc->sc_q, + sc->sc_rdesc->isize, NULL, HID_INPUT_REPORT, + sc->sc_rdesc->iid); + if (error == 0) + error = uiomove(sc->sc_q, sc->sc_rdesc->isize, uio); + mtx_lock(&sc->sc_mtx); + goto exit; + } + + while (sc->sc_tail == sc->sc_head && !sc->sc_state.flush) { + if (flag & O_NONBLOCK) { + error = EWOULDBLOCK; + goto exit; + } + sc->sc_state.aslp = true; + DPRINTFN(5, "sleep on %p\n", &sc->sc_q); + error = mtx_sleep(&sc->sc_q, &sc->sc_mtx, PZERO | PCATCH, + "hidrawrd", 0); + DPRINTFN(5, "woke, error=%d\n", error); + if (dev->si_drv1 == NULL) + error = EIO; + if (error) { + sc->sc_state.aslp = false; + goto exit; + } + } + + while (sc->sc_tail != sc->sc_head && uio->uio_resid > 0) { + length = min(uio->uio_resid, sc->sc_state.uhid ? + sc->sc_rdesc->isize : sc->sc_qlen[sc->sc_head]); + mtx_unlock(&sc->sc_mtx); + + /* Copy the data to the user process. */ + DPRINTFN(5, "got %lu chars\n", (u_long)length); + error = uiomove(sc->sc_q + sc->sc_head * sc->sc_rdesc->rdsize, + length, uio); + + mtx_lock(&sc->sc_mtx); + if (error != 0) + goto exit; + /* Remove a small chunk from the input queue. */ + sc->sc_head = (sc->sc_head + 1) % HIDRAW_BUFFER_SIZE; + /* + * In uhid mode transfer as many chunks as possible. Hidraw + * packets are transferred one by one due to different length. + */ + if (!sc->sc_state.uhid) + goto exit; + } +exit: + hidraw_unlock_queue(sc); + mtx_unlock(&sc->sc_mtx); + + return (error); +} + +static int +hidraw_write(struct cdev *dev, struct uio *uio, int flag) +{ + uint8_t local_buf[HIDRAW_LOCAL_BUFSIZE], *buf; + struct hidraw_softc *sc; + int error; + int size; + size_t buf_offset; + uint8_t id = 0; + + DPRINTFN(1, "\n"); + + sc = dev->si_drv1; + if (sc == NULL) + return (EIO); + + if (sc->sc_rdesc->osize == 0) + return (EOPNOTSUPP); + + buf_offset = 0; + if (sc->sc_state.uhid) { + size = sc->sc_rdesc->osize; + if (uio->uio_resid != size) + return (EINVAL); + } else { + size = uio->uio_resid; + if (size < 2) + return (EINVAL); + /* Strip leading 0 if the device doesnt use numbered reports */ + error = uiomove(&id, 1, uio); + if (error) + return (error); + if (id != 0) + buf_offset++; + else + size--; + /* Check if underlying driver could process this request */ + if (size > sc->sc_rdesc->wrsize) + return (ENOBUFS); + } + buf = HIDRAW_LOCAL_ALLOC(local_buf, size); + buf[0] = id; + error = uiomove(buf + buf_offset, uio->uio_resid, uio); + if (error == 0) + error = hid_write(sc->sc_dev, buf, size); + HIDRAW_LOCAL_FREE(local_buf, buf); + + return (error); +} + +static int +hidraw_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, + struct thread *td) +{ + uint8_t local_buf[HIDRAW_LOCAL_BUFSIZE]; + void *buf; + struct hidraw_softc *sc; + struct hidraw_gen_descriptor *hgd; + struct hidraw_report_descriptor *hrd; + struct hidraw_devinfo *hdi; + uint32_t size; + int id, len; + int error = 0; + + DPRINTFN(2, "cmd=%lx\n", cmd); + + sc = dev->si_drv1; + if (sc == NULL) + return (EIO); + + /* fixed-length ioctls handling */ + switch (cmd) { + case FIONBIO: + /* All handled in the upper FS layer. */ + return (0); + + case FIOASYNC: + mtx_lock(&sc->sc_mtx); + if (*(int *)addr) { + if (sc->sc_async == NULL) { + sc->sc_async = td->td_proc; + DPRINTF("FIOASYNC %p\n", sc->sc_async); + } else + error = EBUSY; + } else + sc->sc_async = NULL; + mtx_unlock(&sc->sc_mtx); + return (error); + + /* XXX this is not the most general solution. */ + case TIOCSPGRP: + mtx_lock(&sc->sc_mtx); + if (sc->sc_async == NULL) + error = EINVAL; + else if (*(int *)addr != sc->sc_async->p_pgid) + error = EPERM; + mtx_unlock(&sc->sc_mtx); + return (error); + + case HIDRAW_GET_REPORT_DESC: + if (sc->sc_rdesc->data == NULL || sc->sc_rdesc->len == 0) + return (EOPNOTSUPP); + mtx_lock(&sc->sc_mtx); + sc->sc_state.uhid = true; + mtx_unlock(&sc->sc_mtx); + hgd = (struct hidraw_gen_descriptor *)addr; + if (sc->sc_rdesc->len > hgd->hgd_maxlen) { + size = hgd->hgd_maxlen; + } else { + size = sc->sc_rdesc->len; + } + hgd->hgd_actlen = size; + if (hgd->hgd_data == NULL) + return (0); /* descriptor length only */ + return (copyout(sc->sc_rdesc->data, hgd->hgd_data, size)); + + + case HIDRAW_SET_REPORT_DESC: + if (!(sc->sc_fflags & FWRITE)) + return (EPERM); + + /* check privileges */ + error = priv_check(curthread, PRIV_DRIVER); + if (error) + return (error); + + /* Stop interrupts and clear input report buffer */ + mtx_lock(&sc->sc_mtx); + sc->sc_tail = sc->sc_head = 0; + error = hidraw_lock_queue(sc, true); + if (error == 0) + sc->sc_state.quiet = true; *** 461 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E06334DEBA1; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@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 4DBj032BbDz4Ssy; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23E4319347; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpiK063150; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpeN063149; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpeN063149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: cb022db825e7 - main - hid: Port multitouch hmt(4) driver to hidbus and attach to build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb022db825e72ec4d2a8a2b9ff9fd80368e6e309 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:55 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=cb022db825e72ec4d2a8a2b9ff9fd80368e6e309 commit cb022db825e72ec4d2a8a2b9ff9fd80368e6e309 Author: Vladimir Kondratyev AuthorDate: 2020-10-10 23:42:25 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:43 +0000 hid: Port multitouch hmt(4) driver to hidbus and attach to build Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D27990 --- share/man/man4/Makefile | 1 + share/man/man4/hmt.4 | 25 +- sys/conf/files | 1 + sys/dev/hid/hmt.c | 849 ++++++++++++++++++------------------------- sys/modules/hid/Makefile | 3 +- sys/modules/hid/hmt/Makefile | 9 + 6 files changed, 383 insertions(+), 505 deletions(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 477ea009a153..c92c8f50545f 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -183,6 +183,7 @@ MAN= aac.4 \ hidbus.4 \ hidquirk.4 \ hifn.4 \ + hmt.4 \ hpet.4 \ ${_hpt27xx.4} \ ${_hptiop.4} \ diff --git a/share/man/man4/hmt.4 b/share/man/man4/hmt.4 index e09fc5286fe2..d939c655d24d 100644 --- a/share/man/man4/hmt.4 +++ b/share/man/man4/hmt.4 @@ -1,4 +1,4 @@ -.\" Copyright (c) 2014-2017 Vladimir Kondratyev +.\" Copyright (c) 2014-2020 Vladimir Kondratyev .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -24,32 +24,34 @@ .\" .\" $FreeBSD$ .\" -.Dd August 19, 2017 -.Dt WMT 4 +.Dd August 11, 2020 +.Dt HMT 4 .Os .Sh NAME -.Nm wmt -.Nd MS Windows 7/8/10 - compatible USB HID multi-touch device driver +.Nm hmt +.Nd MS Windows 7/8/10 - compatible HID multi-touch device driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines into your kernel configuration file: .Bd -ragged -offset indent -.Cd "device wmt" -.Cd "device usb" +.Cd "device hmt" +.Cd "device hidbus" .Cd "device hid" +.Cd "device hconf" .Cd "device evdev" + .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 -wmt_load="YES" +hmt_load="YES" .Ed .Sh DESCRIPTION The .Nm -driver provides support for the MS Windows 7/8/10 - compatible USB HID +driver provides support for the MS Windows 7/8/10 - compatible HID multi-touch devices found in many laptops. .Pp To get multi-touch device working in @@ -62,7 +64,7 @@ creates a pseudo-device file, .Pa /dev/input/eventX which presents the multi-touch device as an input event device. .Sh SEE ALSO -.Xr usb 4 , +.Xr hid 4 , .Xr loader.conf 5 , .Xr xorg.conf 5 Pq Pa ports/x11/xorg , .Xr evdev 4 Pq Pa ports/x11-drivers/xf86-input-evdev . @@ -75,7 +77,4 @@ driver was written by .Sh BUGS .Nm cannot act like -.Xr sysmouse 4 , -as .Xr sysmouse 4 -does not support absolute motion events. diff --git a/sys/conf/files b/sys/conf/files index bd6b510f204c..13dd93d9d2cd 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1820,6 +1820,7 @@ dev/hid/hid.c optional hid dev/hid/hid_if.m optional hid dev/hid/hidbus.c optional hidbus dev/hid/hidquirk.c optional hid +dev/hid/hmt.c optional hmt hconf dev/hifn/hifn7751.c optional hifn dev/hptiop/hptiop.c optional hptiop scbus dev/hwpmc/hwpmc_logging.c optional hwpmc diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c index 79ed5a2b8f82..6cfe43157e64 100644 --- a/sys/dev/hid/hmt.c +++ b/sys/dev/hid/hmt.c @@ -1,6 +1,7 @@ /*- - * Copyright (c) 2014-2017 Vladimir Kondratyev - * All rights reserved. + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2014-2020 Vladimir Kondratyev * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,168 +29,149 @@ __FBSDID("$FreeBSD$"); /* - * MS Windows 7/8/10 compatible USB HID Multi-touch Device driver. + * MS Windows 7/8/10 compatible HID Multi-touch Device driver. * https://msdn.microsoft.com/en-us/library/windows/hardware/jj151569(v=vs.85).aspx + * http://download.microsoft.com/download/7/d/d/7dd44bb7-2a7a-4505-ac1c-7227d3d96d5b/hid-over-i2c-protocol-spec-v1-0.docx * https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt */ #include #include -#include #include #include #include #include #include -#include #include #include -#include - -#include "usbdevs.h" -#include -#include -#include -#include - -#include - #include #include -#define USB_DEBUG_VAR wmt_debug -#include - -static SYSCTL_NODE(_hw_usb, OID_AUTO, wmt, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, - "USB MSWindows 7/8/10 compatible Multi-touch Device"); -#ifdef USB_DEBUG -static int wmt_debug = 0; -SYSCTL_INT(_hw_usb_wmt, OID_AUTO, debug, CTLFLAG_RWTUN, - &wmt_debug, 1, "Debug level"); -#endif -static bool wmt_timestamps = 0; -SYSCTL_BOOL(_hw_usb_wmt, OID_AUTO, timestamps, CTLFLAG_RDTUN, - &wmt_timestamps, 1, "Enable hardware timestamp reporting"); +#define HID_DEBUG_VAR hmt_debug +#include +#include +#include -#define WMT_BSIZE 1024 /* bytes, buffer size */ -#define WMT_BTN_MAX 8 /* Number of buttons supported */ +#include -enum { - WMT_INTR_DT, - WMT_N_TRANSFER, -}; +static SYSCTL_NODE(_hw_hid, OID_AUTO, hmt, CTLFLAG_RW, 0, + "MSWindows 7/8/10 compatible HID Multi-touch Device"); +#ifdef HID_DEBUG +static int hmt_debug = 0; +SYSCTL_INT(_hw_hid_hmt, OID_AUTO, debug, CTLFLAG_RWTUN, + &hmt_debug, 1, "Debug level"); +#endif +static bool hmt_timestamps = 0; +SYSCTL_BOOL(_hw_hid_hmt, OID_AUTO, timestamps, CTLFLAG_RDTUN, + &hmt_timestamps, 1, "Enable hardware timestamp reporting"); -enum wmt_type { - WMT_TYPE_UNKNOWN = 0, /* HID report descriptor is not probed */ - WMT_TYPE_UNSUPPORTED, /* Repdescr does not belong to MT device */ - WMT_TYPE_TOUCHPAD, - WMT_TYPE_TOUCHSCREEN, -}; +#define HMT_BTN_MAX 8 /* Number of buttons supported */ -enum wmt_input_mode { - WMT_INPUT_MODE_MOUSE = 0x0, - WMT_INPUT_MODE_MT_TOUCHSCREEN = 0x2, - WMT_INPUT_MODE_MT_TOUCHPAD = 0x3, +enum hmt_type { + HMT_TYPE_UNKNOWN = 0, /* HID report descriptor is not probed */ + HMT_TYPE_UNSUPPORTED, /* Repdescr does not belong to MT device */ + HMT_TYPE_TOUCHPAD, + HMT_TYPE_TOUCHSCREEN, }; enum { - WMT_TIP_SWITCH, -#define WMT_SLOT WMT_TIP_SWITCH - WMT_WIDTH, -#define WMT_MAJOR WMT_WIDTH - WMT_HEIGHT, -#define WMT_MINOR WMT_HEIGHT - WMT_ORIENTATION, - WMT_X, - WMT_Y, - WMT_CONTACTID, - WMT_PRESSURE, - WMT_IN_RANGE, - WMT_CONFIDENCE, - WMT_TOOL_X, - WMT_TOOL_Y, - WMT_N_USAGES, + HMT_TIP_SWITCH, +#define HMT_SLOT HMT_TIP_SWITCH + HMT_WIDTH, +#define HMT_MAJOR HMT_WIDTH + HMT_HEIGHT, +#define HMT_MINOR HMT_HEIGHT + HMT_ORIENTATION, + HMT_X, + HMT_Y, + HMT_CONTACTID, + HMT_PRESSURE, + HMT_IN_RANGE, + HMT_CONFIDENCE, + HMT_TOOL_X, + HMT_TOOL_Y, + HMT_N_USAGES, }; -#define WMT_NO_CODE (ABS_MAX + 10) -#define WMT_NO_USAGE -1 +#define HMT_NO_CODE (ABS_MAX + 10) +#define HMT_NO_USAGE -1 -struct wmt_hid_map_item { +struct hmt_hid_map_item { char name[5]; int32_t usage; /* HID usage */ uint32_t code; /* Evdev event code */ bool required; /* Required for MT Digitizers */ }; -static const struct wmt_hid_map_item wmt_hid_map[WMT_N_USAGES] = { - [WMT_TIP_SWITCH] = { /* WMT_SLOT */ +static const struct hmt_hid_map_item hmt_hid_map[HMT_N_USAGES] = { + [HMT_TIP_SWITCH] = { /* HMT_SLOT */ .name = "TIP", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_TIP_SWITCH), .code = ABS_MT_SLOT, .required = true, }, - [WMT_WIDTH] = { /* WMT_MAJOR */ + [HMT_WIDTH] = { /* HMT_MAJOR */ .name = "WDTH", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_WIDTH), .code = ABS_MT_TOUCH_MAJOR, .required = false, }, - [WMT_HEIGHT] = { /* WMT_MINOR */ + [HMT_HEIGHT] = { /* HMT_MINOR */ .name = "HGHT", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_HEIGHT), .code = ABS_MT_TOUCH_MINOR, .required = false, }, - [WMT_ORIENTATION] = { + [HMT_ORIENTATION] = { .name = "ORIE", - .usage = WMT_NO_USAGE, + .usage = HMT_NO_USAGE, .code = ABS_MT_ORIENTATION, .required = false, }, - [WMT_X] = { + [HMT_X] = { .name = "X", .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), .code = ABS_MT_POSITION_X, .required = true, }, - [WMT_Y] = { + [HMT_Y] = { .name = "Y", .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), .code = ABS_MT_POSITION_Y, .required = true, }, - [WMT_CONTACTID] = { + [HMT_CONTACTID] = { .name = "C_ID", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_CONTACTID), .code = ABS_MT_TRACKING_ID, .required = true, }, - [WMT_PRESSURE] = { + [HMT_PRESSURE] = { .name = "PRES", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_TIP_PRESSURE), .code = ABS_MT_PRESSURE, .required = false, }, - [WMT_IN_RANGE] = { + [HMT_IN_RANGE] = { .name = "RANG", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_IN_RANGE), .code = ABS_MT_DISTANCE, .required = false, }, - [WMT_CONFIDENCE] = { + [HMT_CONFIDENCE] = { .name = "CONF", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_CONFIDENCE), - .code = WMT_NO_CODE, + .code = HMT_NO_CODE, .required = false, }, - [WMT_TOOL_X] = { /* Shares HID usage with WMT_X */ + [HMT_TOOL_X] = { /* Shares HID usage with HMT_X */ .name = "TL_X", .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), .code = ABS_MT_TOOL_X, .required = false, }, - [WMT_TOOL_Y] = { /* Shares HID usage with WMT_Y */ + [HMT_TOOL_Y] = { /* Shares HID usage with HMT_Y */ .name = "TL_Y", .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), .code = ABS_MT_TOOL_Y, @@ -197,21 +179,14 @@ static const struct wmt_hid_map_item wmt_hid_map[WMT_N_USAGES] = { }, }; -struct wmt_absinfo { - int32_t min; - int32_t max; - int32_t res; -}; - -struct wmt_softc { +struct hmt_softc { device_t dev; - enum wmt_type type; + enum hmt_type type; - struct mtx mtx; - struct wmt_absinfo ai[WMT_N_USAGES]; - struct hid_location locs[MAX_MT_SLOTS][WMT_N_USAGES]; + struct hid_absinfo ai[HMT_N_USAGES]; + struct hid_location locs[MAX_MT_SLOTS][HMT_N_USAGES]; struct hid_location cont_count_loc; - struct hid_location btn_loc[WMT_BTN_MAX]; + struct hid_location btn_loc[HMT_BTN_MAX]; struct hid_location int_btn_loc; struct hid_location scan_time_loc; int32_t scan_time_max; @@ -220,21 +195,19 @@ struct wmt_softc { bool touch; bool prev_touch; - struct usb_xfer *xfer[WMT_N_TRANSFER]; struct evdev_dev *evdev; - uint32_t slot_data[WMT_N_USAGES]; - uint8_t caps[howmany(WMT_N_USAGES, 8)]; - uint8_t buttons[howmany(WMT_BTN_MAX, 8)]; - uint32_t isize; + uint32_t slot_data[HMT_N_USAGES]; + uint8_t caps[howmany(HMT_N_USAGES, 8)]; + uint8_t buttons[howmany(HMT_BTN_MAX, 8)]; uint32_t nconts_per_report; uint32_t nconts_todo; - uint32_t report_len; uint8_t report_id; uint32_t max_button; bool has_int_button; bool is_clickpad; bool do_timestamps; + bool iichid_sampling; struct hid_location cont_max_loc; uint32_t cont_max_rlen; @@ -244,199 +217,186 @@ struct wmt_softc { uint8_t btn_type_rid; uint32_t thqa_cert_rlen; uint8_t thqa_cert_rid; - struct hid_location input_mode_loc; - uint32_t input_mode_rlen; - uint8_t input_mode_rid; - - uint8_t buf[WMT_BSIZE] __aligned(4); }; -#define WMT_FOREACH_USAGE(caps, usage) \ - for ((usage) = 0; (usage) < WMT_N_USAGES; ++(usage)) \ +#define HMT_FOREACH_USAGE(caps, usage) \ + for ((usage) = 0; (usage) < HMT_N_USAGES; ++(usage)) \ if (isset((caps), (usage))) -static enum wmt_type wmt_hid_parse(struct wmt_softc *, const void *, uint16_t); -static int wmt_set_input_mode(struct wmt_softc *, enum wmt_input_mode); +static enum hmt_type hmt_hid_parse(struct hmt_softc *, const void *, + hid_size_t, uint32_t, uint8_t); +static int hmt_set_input_mode(struct hmt_softc *, enum hconf_input_mode); -static usb_callback_t wmt_intr_callback; +static hid_intr_t hmt_intr; -static device_probe_t wmt_probe; -static device_attach_t wmt_attach; -static device_detach_t wmt_detach; +static device_probe_t hmt_probe; +static device_attach_t hmt_attach; +static device_detach_t hmt_detach; -#if __FreeBSD_version >= 1200077 -static evdev_open_t wmt_ev_open; -static evdev_close_t wmt_ev_close; -#else -static evdev_open_t wmt_ev_open_11; -static evdev_close_t wmt_ev_close_11; -#endif +static evdev_open_t hmt_ev_open; +static evdev_close_t hmt_ev_close; -static const struct evdev_methods wmt_evdev_methods = { -#if __FreeBSD_version >= 1200077 - .ev_open = &wmt_ev_open, - .ev_close = &wmt_ev_close, -#else - .ev_open = &wmt_ev_open_11, - .ev_close = &wmt_ev_close_11, -#endif +static const struct evdev_methods hmt_evdev_methods = { + .ev_open = &hmt_ev_open, + .ev_close = &hmt_ev_close, }; -static const struct usb_config wmt_config[WMT_N_TRANSFER] = { - [WMT_INTR_DT] = { - .type = UE_INTERRUPT, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_IN, - .flags = { .pipe_bof = 1, .short_xfer_ok = 1 }, - .bufsize = WMT_BSIZE, - .callback = &wmt_intr_callback, - }, +static const struct hid_device_id hmt_devs[] = { + { HID_TLC(HUP_DIGITIZERS, HUD_TOUCHSCREEN) }, + { HID_TLC(HUP_DIGITIZERS, HUD_TOUCHPAD) }, }; static int -wmt_probe(device_t dev) +hmt_ev_close(struct evdev_dev *evdev) { - struct usb_attach_arg *uaa = device_get_ivars(dev); - struct wmt_softc *sc = device_get_softc(dev); + return (hidbus_intr_stop(evdev_get_softc(evdev))); +} + +static int +hmt_ev_open(struct evdev_dev *evdev) +{ + return (hidbus_intr_start(evdev_get_softc(evdev))); +} + +static int +hmt_probe(device_t dev) +{ + struct hmt_softc *sc = device_get_softc(dev); void *d_ptr; - uint16_t d_len; + hid_size_t d_len; int err; - if (uaa->usb_mode != USB_MODE_HOST) - return (ENXIO); - - if (uaa->info.bInterfaceClass != UICLASS_HID) - return (ENXIO); + err = HIDBUS_LOOKUP_DRIVER_INFO(dev, hmt_devs); + if (err != 0) + return (err); - if (usb_test_quirk(uaa, UQ_WMT_IGNORE)) + err = hid_get_report_descr(dev, &d_ptr, &d_len); + if (err != 0) { + device_printf(dev, "could not retrieve report descriptor from " + "device: %d\n", err); return (ENXIO); + } - err = usbd_req_get_hid_desc(uaa->device, NULL, - &d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex); - if (err) + /* Check if report descriptor belongs to a HID multitouch device */ + if (sc->type == HMT_TYPE_UNKNOWN) + sc->type = hmt_hid_parse(sc, d_ptr, d_len, + hidbus_get_usage(dev), hidbus_get_index(dev)); + if (sc->type == HMT_TYPE_UNSUPPORTED) return (ENXIO); - /* Check if report descriptor belongs to a HID multitouch device */ - if (sc->type == WMT_TYPE_UNKNOWN) - sc->type = wmt_hid_parse(sc, d_ptr, d_len); - if (sc->type != WMT_TYPE_UNSUPPORTED) - err = BUS_PROBE_DEFAULT; - else - err = ENXIO; - - /* Check HID report length */ - if (sc->type != WMT_TYPE_UNSUPPORTED && - (sc->isize <= 0 || sc->isize > WMT_BSIZE)) { - DPRINTF("Input size invalid or too large: %d\n", sc->isize); - err = ENXIO; - } + hidbus_set_desc(dev, + sc->type == HMT_TYPE_TOUCHPAD ? "TouchPad" : "TouchScreen"); - free(d_ptr, M_TEMP); - return (err); + return (BUS_PROBE_DEFAULT); } static int -wmt_attach(device_t dev) +hmt_attach(device_t dev) { - struct usb_attach_arg *uaa = device_get_ivars(dev); - struct wmt_softc *sc = device_get_softc(dev); + struct hmt_softc *sc = device_get_softc(dev); + const struct hid_device_info *hw = hid_get_device_info(dev); + void *d_ptr; + uint8_t *fbuf = NULL; + hid_size_t d_len, fsize; uint32_t cont_count_max; int nbuttons, btn; size_t i; int err; - device_set_usb_desc(dev); + err = hid_get_report_descr(dev, &d_ptr, &d_len); + if (err != 0) { + device_printf(dev, "could not retrieve report descriptor from " + "device: %d\n", err); + return (ENXIO); + } + sc->dev = dev; + fsize = hid_report_size_max(d_ptr, d_len, hid_feature, NULL); + if (fsize != 0) + fbuf = malloc(fsize, M_TEMP, M_WAITOK | M_ZERO); + /* Fetch and parse "Contact count maximum" feature report */ - if (sc->cont_max_rlen > 0 && sc->cont_max_rlen <= WMT_BSIZE) { - err = usbd_req_get_report(uaa->device, NULL, sc->buf, - sc->cont_max_rlen, uaa->info.bIfaceIndex, - UHID_FEATURE_REPORT, sc->cont_max_rid); - if (err == USB_ERR_NORMAL_COMPLETION) { - cont_count_max = hid_get_udata(sc->buf + 1, + if (sc->cont_max_rlen > 1) { + err = hid_get_report(dev, fbuf, sc->cont_max_rlen, NULL, + HID_FEATURE_REPORT, sc->cont_max_rid); + if (err == 0) { + cont_count_max = hid_get_udata(fbuf + 1, sc->cont_max_rlen - 1, &sc->cont_max_loc); /* * Feature report is a primary source of * 'Contact Count Maximum' */ if (cont_count_max > 0) - sc->ai[WMT_SLOT].max = cont_count_max - 1; + sc->ai[HMT_SLOT].max = cont_count_max - 1; } else - DPRINTF("usbd_req_get_report error=(%s)\n", - usbd_errstr(err)); + DPRINTF("hid_get_report error=%d\n", err); } else - DPRINTF("Feature report %hhu size invalid or too large: %u\n", + DPRINTF("Feature report %hhu size invalid: %u\n", sc->cont_max_rid, sc->cont_max_rlen); /* Fetch and parse "Button type" feature report */ - if (sc->btn_type_rlen > 1 && sc->btn_type_rlen <= WMT_BSIZE && - sc->btn_type_rid != sc->cont_max_rid) { - bzero(sc->buf, sc->btn_type_rlen); - err = usbd_req_get_report(uaa->device, NULL, sc->buf, - sc->btn_type_rlen, uaa->info.bIfaceIndex, - UHID_FEATURE_REPORT, sc->btn_type_rid); + if (sc->btn_type_rlen > 1 && sc->btn_type_rid != sc->cont_max_rid) { + bzero(fbuf, fsize); + err = hid_get_report(dev, fbuf, sc->btn_type_rlen, NULL, + HID_FEATURE_REPORT, sc->btn_type_rid); } if (sc->btn_type_rlen > 1) { if (err == 0) - sc->is_clickpad = hid_get_udata(sc->buf + 1, + sc->is_clickpad = hid_get_udata(fbuf + 1, sc->btn_type_rlen - 1, &sc->btn_type_loc) == 0; else - DPRINTF("usbd_req_get_report error=%d\n", err); + DPRINTF("hid_get_report error=%d\n", err); } /* Fetch THQA certificate to enable some devices like WaveShare */ - if (sc->thqa_cert_rlen > 0 && sc->thqa_cert_rlen <= WMT_BSIZE && - sc->thqa_cert_rid != sc->cont_max_rid) - (void)usbd_req_get_report(uaa->device, NULL, sc->buf, - sc->thqa_cert_rlen, uaa->info.bIfaceIndex, - UHID_FEATURE_REPORT, sc->thqa_cert_rid); + if (sc->thqa_cert_rlen > 1 && sc->thqa_cert_rid != sc->cont_max_rid) + (void)hid_get_report(dev, fbuf, sc->thqa_cert_rlen, NULL, + HID_FEATURE_REPORT, sc->thqa_cert_rid); + + free(fbuf, M_TEMP); /* Switch touchpad in to absolute multitouch mode */ - if (sc->type == WMT_TYPE_TOUCHPAD) { - err = wmt_set_input_mode(sc, WMT_INPUT_MODE_MT_TOUCHPAD); + if (sc->type == HMT_TYPE_TOUCHPAD) { + err = hmt_set_input_mode(sc, HCONF_INPUT_MODE_MT_TOUCHPAD); if (err != 0) DPRINTF("Failed to set input mode: %d\n", err); } /* Cap contact count maximum to MAX_MT_SLOTS */ - if (sc->ai[WMT_SLOT].max >= MAX_MT_SLOTS) { + if (sc->ai[HMT_SLOT].max >= MAX_MT_SLOTS) { DPRINTF("Hardware reported %d contacts while only %d is " - "supported\n", (int)sc->ai[WMT_SLOT].max+1, MAX_MT_SLOTS); - sc->ai[WMT_SLOT].max = MAX_MT_SLOTS - 1; + "supported\n", (int)sc->ai[HMT_SLOT].max+1, MAX_MT_SLOTS); + sc->ai[HMT_SLOT].max = MAX_MT_SLOTS - 1; } - if (/*usb_test_quirk(hw, UQ_MT_TIMESTAMP) ||*/ wmt_timestamps) + if (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps) sc->do_timestamps = true; + if (hid_test_quirk(hw, HQ_IICHID_SAMPLING)) + sc->iichid_sampling = true; - mtx_init(&sc->mtx, "wmt lock", NULL, MTX_DEF); - - err = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, - sc->xfer, wmt_config, WMT_N_TRANSFER, sc, &sc->mtx); - if (err != USB_ERR_NORMAL_COMPLETION) { - DPRINTF("usbd_transfer_setup error=%s\n", usbd_errstr(err)); - goto detach; - } + hidbus_set_intr(dev, hmt_intr, sc); sc->evdev = evdev_alloc(); evdev_set_name(sc->evdev, device_get_desc(dev)); evdev_set_phys(sc->evdev, device_get_nameunit(dev)); - evdev_set_id(sc->evdev, BUS_USB, uaa->info.idVendor, - uaa->info.idProduct, 0); - evdev_set_serial(sc->evdev, usb_get_serial(uaa->device)); - evdev_set_methods(sc->evdev, sc, &wmt_evdev_methods); + evdev_set_id(sc->evdev, hw->idBus, hw->idVendor, hw->idProduct, + hw->idVersion); + evdev_set_serial(sc->evdev, hw->serial); + evdev_set_methods(sc->evdev, dev, &hmt_evdev_methods); evdev_set_flag(sc->evdev, EVDEV_FLAG_MT_STCOMPAT); + evdev_set_flag(sc->evdev, EVDEV_FLAG_EXT_EPOCH); /* hidbus child */ switch (sc->type) { - case WMT_TYPE_TOUCHSCREEN: + case HMT_TYPE_TOUCHSCREEN: evdev_support_prop(sc->evdev, INPUT_PROP_DIRECT); break; - case WMT_TYPE_TOUCHPAD: + case HMT_TYPE_TOUCHPAD: evdev_support_prop(sc->evdev, INPUT_PROP_POINTER); if (sc->is_clickpad) evdev_support_prop(sc->evdev, INPUT_PROP_BUTTONPAD); break; default: - KASSERT(0, ("wmt_attach: unsupported touch device type")); + KASSERT(0, ("hmt_attach: unsupported touch device type")); } evdev_support_event(sc->evdev, EV_SYN); evdev_support_event(sc->evdev, EV_ABS); @@ -444,6 +404,8 @@ wmt_attach(device_t dev) evdev_support_event(sc->evdev, EV_MSC); evdev_support_msc(sc->evdev, MSC_TIMESTAMP); } + if (sc->iichid_sampling) + evdev_set_flag(sc->evdev, EVDEV_FLAG_MT_AUTOREL); nbuttons = 0; if (sc->max_button != 0 || sc->has_int_button) { evdev_support_event(sc->evdev, EV_KEY); @@ -456,53 +418,51 @@ wmt_attach(device_t dev) } } } - WMT_FOREACH_USAGE(sc->caps, i) { - if (wmt_hid_map[i].code != WMT_NO_CODE) - evdev_support_abs(sc->evdev, wmt_hid_map[i].code, + HMT_FOREACH_USAGE(sc->caps, i) { + if (hmt_hid_map[i].code != HMT_NO_CODE) + evdev_support_abs(sc->evdev, hmt_hid_map[i].code, sc->ai[i].min, sc->ai[i].max, 0, 0, sc->ai[i].res); } - err = evdev_register_mtx(sc->evdev, &sc->mtx); - if (err) - goto detach; + err = evdev_register(sc->evdev); + if (err) { + hmt_detach(dev); + return (ENXIO); + } /* Announce information about the touch device */ device_printf(sc->dev, "Multitouch %s with %d external button%s%s\n", - sc->type == WMT_TYPE_TOUCHSCREEN ? "touchscreen" : "touchpad", + sc->type == HMT_TYPE_TOUCHSCREEN ? "touchscreen" : "touchpad", nbuttons, nbuttons != 1 ? "s" : "", sc->is_clickpad ? ", click-pad" : ""); device_printf(sc->dev, - "%d contacts and [%s%s%s%s%s]. Report range [%d:%d] - [%d:%d]\n", - (int)sc->ai[WMT_SLOT].max + 1, - isset(sc->caps, WMT_IN_RANGE) ? "R" : "", - isset(sc->caps, WMT_CONFIDENCE) ? "C" : "", - isset(sc->caps, WMT_WIDTH) ? "W" : "", - isset(sc->caps, WMT_HEIGHT) ? "H" : "", - isset(sc->caps, WMT_PRESSURE) ? "P" : "", - (int)sc->ai[WMT_X].min, (int)sc->ai[WMT_Y].min, - (int)sc->ai[WMT_X].max, (int)sc->ai[WMT_Y].max); + "%d contacts with [%s%s%s%s%s] properties. Report range [%d:%d] - [%d:%d]\n", + (int)sc->ai[HMT_SLOT].max + 1, + isset(sc->caps, HMT_IN_RANGE) ? "R" : "", + isset(sc->caps, HMT_CONFIDENCE) ? "C" : "", + isset(sc->caps, HMT_WIDTH) ? "W" : "", + isset(sc->caps, HMT_HEIGHT) ? "H" : "", + isset(sc->caps, HMT_PRESSURE) ? "P" : "", + (int)sc->ai[HMT_X].min, (int)sc->ai[HMT_Y].min, + (int)sc->ai[HMT_X].max, (int)sc->ai[HMT_Y].max); return (0); - -detach: - wmt_detach(dev); - return (ENXIO); } static int -wmt_detach(device_t dev) +hmt_detach(device_t dev) { - struct wmt_softc *sc = device_get_softc(dev); + struct hmt_softc *sc = device_get_softc(dev); evdev_free(sc->evdev); - usbd_transfer_unsetup(sc->xfer, WMT_N_TRANSFER); - mtx_destroy(&sc->mtx); + return (0); } static void -wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) +hmt_intr(void *context, void *buf, hid_size_t len) { + struct hmt_softc *sc = context; size_t usage; uint32_t *slot_data = sc->slot_data; uint32_t cont, btn; @@ -514,6 +474,37 @@ wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) int32_t slot; uint32_t scan_time; int32_t delta; + uint8_t id; + + /* + * Special packet of zero length is generated by iichid driver running + * in polling mode at the start of inactivity period to workaround + * "stuck touch" problem caused by miss of finger release events. + * This snippet is to be removed after GPIO interrupt support is added. + */ + if (sc->iichid_sampling && len == 0) { + sc->prev_touch = false; + sc->timestamp = 0; + for (slot = 0; slot <= sc->ai[HMT_SLOT].max; slot++) { + evdev_push_abs(sc->evdev, ABS_MT_SLOT, slot); + evdev_push_abs(sc->evdev, ABS_MT_TRACKING_ID, -1); + } + evdev_sync(sc->evdev); + return; + } + + /* Ignore irrelevant reports */ + id = sc->report_id != 0 ? *(uint8_t *)buf : 0; + if (sc->report_id != id) { + DPRINTF("Skip report with unexpected ID: %hhu\n", id); + return; + } + + /* Strip leading "report ID" byte */ + if (sc->report_id != 0) { + len--; + buf = (uint8_t *)buf + 1; + } /* * "In Parallel mode, devices report all contact information in a @@ -542,12 +533,12 @@ wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) if (cont_count != 0) sc->nconts_todo = cont_count; -#ifdef USB_DEBUG +#ifdef HID_DEBUG DPRINTFN(6, "cont_count:%2u", (unsigned)cont_count); - if (wmt_debug >= 6) { - WMT_FOREACH_USAGE(sc->caps, usage) { - if (wmt_hid_map[usage].usage != WMT_NO_USAGE) - printf(" %-4s", wmt_hid_map[usage].name); + if (hmt_debug >= 6) { + HMT_FOREACH_USAGE(sc->caps, usage) { + if (hmt_hid_map[usage].usage != HMT_NO_USAGE) + printf(" %-4s", hmt_hid_map[usage].name); } printf("\n"); } @@ -559,20 +550,20 @@ wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) /* Use protocol Type B for reporting events */ for (cont = 0; cont < cont_count; cont++) { bzero(slot_data, sizeof(sc->slot_data)); - WMT_FOREACH_USAGE(sc->caps, usage) { + HMT_FOREACH_USAGE(sc->caps, usage) { if (sc->locs[cont][usage].size > 0) slot_data[usage] = hid_get_udata( buf, len, &sc->locs[cont][usage]); } slot = evdev_get_mt_slot_by_tracking_id(sc->evdev, - slot_data[WMT_CONTACTID]); + slot_data[HMT_CONTACTID]); -#ifdef USB_DEBUG +#ifdef HID_DEBUG DPRINTFN(6, "cont%01x: data = ", cont); - if (wmt_debug >= 6) { - WMT_FOREACH_USAGE(sc->caps, usage) { - if (wmt_hid_map[usage].usage != WMT_NO_USAGE) + if (hmt_debug >= 6) { + HMT_FOREACH_USAGE(sc->caps, usage) { + if (hmt_hid_map[usage].usage != HMT_NO_USAGE) printf("%04x ", slot_data[usage]); } printf("slot = %d\n", (int)slot); @@ -581,28 +572,28 @@ wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) if (slot == -1) { DPRINTF("Slot overflow for contact_id %u\n", - (unsigned)slot_data[WMT_CONTACTID]); + (unsigned)slot_data[HMT_CONTACTID]); continue; } - if (slot_data[WMT_TIP_SWITCH] != 0 && - !(isset(sc->caps, WMT_CONFIDENCE) && - slot_data[WMT_CONFIDENCE] == 0)) { + if (slot_data[HMT_TIP_SWITCH] != 0 && + !(isset(sc->caps, HMT_CONFIDENCE) && + slot_data[HMT_CONFIDENCE] == 0)) { /* This finger is in proximity of the sensor */ sc->touch = true; - slot_data[WMT_SLOT] = slot; - slot_data[WMT_IN_RANGE] = !slot_data[WMT_IN_RANGE]; + slot_data[HMT_SLOT] = slot; + slot_data[HMT_IN_RANGE] = !slot_data[HMT_IN_RANGE]; /* Divided by two to match visual scale of touch */ - width = slot_data[WMT_WIDTH] >> 1; - height = slot_data[WMT_HEIGHT] >> 1; - slot_data[WMT_ORIENTATION] = width > height; - slot_data[WMT_MAJOR] = MAX(width, height); - slot_data[WMT_MINOR] = MIN(width, height); - - WMT_FOREACH_USAGE(sc->caps, usage) - if (wmt_hid_map[usage].code != WMT_NO_CODE) + width = slot_data[HMT_WIDTH] >> 1; + height = slot_data[HMT_HEIGHT] >> 1; + slot_data[HMT_ORIENTATION] = width > height; + slot_data[HMT_MAJOR] = MAX(width, height); + slot_data[HMT_MINOR] = MIN(width, height); + + HMT_FOREACH_USAGE(sc->caps, usage) + if (hmt_hid_map[usage].code != HMT_NO_CODE) evdev_push_abs(sc->evdev, - wmt_hid_map[usage].code, + hmt_hid_map[usage].code, slot_data[usage]); } else { evdev_push_abs(sc->evdev, ABS_MT_SLOT, slot); @@ -648,193 +639,80 @@ wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) } } -static void -wmt_intr_callback(struct usb_xfer *xfer, usb_error_t error) -{ - struct wmt_softc *sc = usbd_xfer_softc(xfer); - struct usb_page_cache *pc; - uint8_t *buf = sc->buf; - int len; - - usbd_xfer_status(xfer, &len, NULL, NULL, NULL); - - switch (USB_GET_STATE(xfer)) { - case USB_ST_TRANSFERRED: - pc = usbd_xfer_get_frame(xfer, 0); - - DPRINTFN(6, "sc=%p actlen=%d\n", sc, len); - - if (len >= (int)sc->report_len || - (len > 0 && sc->report_id != 0)) { - /* Limit report length to the maximum */ - if (len > (int)sc->report_len) - len = sc->report_len; - - usbd_copy_out(pc, 0, buf, len); - - /* Ignore irrelevant reports */ - if (sc->report_id && *buf != sc->report_id) - goto tr_ignore; - - /* Make sure we don't process old data */ - if (len < sc->report_len) - bzero(buf + len, sc->report_len - len); - - /* Strip leading "report ID" byte */ - if (sc->report_id) { - len--; - buf++; - } - - wmt_process_report(sc, buf, len); - } else { -tr_ignore: - DPRINTF("Ignored transfer, %d bytes\n", len); - } - - case USB_ST_SETUP: -tr_setup: - usbd_xfer_set_frame_len(xfer, 0, sc->isize); - usbd_transfer_submit(xfer); - break; - default: - if (error != USB_ERR_CANCELLED) { - /* Try clear stall first */ - usbd_xfer_set_stall(xfer); - goto tr_setup; - } - break; - } -} - *** 408 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8F6864DE9BF; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@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 4DBj031cDdz4Sqh; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2121819654; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpSM063167; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpsf063166; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpsf063166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: b9b347e9bfc3 - main - hid: Copy wmt(4) to HID subsystem as a base to upcoming hmt(4) driver. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b9b347e9bfc37b199294a10162d32c5884a4e7b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:52 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=b9b347e9bfc37b199294a10162d32c5884a4e7b9 commit b9b347e9bfc37b199294a10162d32c5884a4e7b9 Author: Vladimir Kondratyev AuthorDate: 2020-10-10 21:47:21 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:43 +0000 hid: Copy wmt(4) to HID subsystem as a base to upcoming hmt(4) driver. --- share/man/man4/hmt.4 | 81 ++++ sys/dev/hid/hmt.c | 1043 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1124 insertions(+) diff --git a/share/man/man4/hmt.4 b/share/man/man4/hmt.4 new file mode 100644 index 000000000000..e09fc5286fe2 --- /dev/null +++ b/share/man/man4/hmt.4 @@ -0,0 +1,81 @@ +.\" Copyright (c) 2014-2017 Vladimir Kondratyev +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 19, 2017 +.Dt WMT 4 +.Os +.Sh NAME +.Nm wmt +.Nd MS Windows 7/8/10 - compatible USB HID multi-touch device driver +.Sh SYNOPSIS +To compile this driver into the kernel, place the following lines into +your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device wmt" +.Cd "device usb" +.Cd "device hid" +.Cd "device evdev" +.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 +wmt_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the MS Windows 7/8/10 - compatible USB HID +multi-touch devices found in many laptops. +.Pp +To get multi-touch device working in +.Xr X 7 , +install +.Pa ports/x11-drivers/xf86-input-evdev . +.Sh FILES +.Nm +creates a pseudo-device file, +.Pa /dev/input/eventX +which presents the multi-touch device as an input event device. +.Sh SEE ALSO +.Xr usb 4 , +.Xr loader.conf 5 , +.Xr xorg.conf 5 Pq Pa ports/x11/xorg , +.Xr evdev 4 Pq Pa ports/x11-drivers/xf86-input-evdev . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . +.Sh BUGS +.Nm +cannot act like +.Xr sysmouse 4 , +as +.Xr sysmouse 4 +does not support absolute motion events. diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c new file mode 100644 index 000000000000..79ed5a2b8f82 --- /dev/null +++ b/sys/dev/hid/hmt.c @@ -0,0 +1,1043 @@ +/*- + * Copyright (c) 2014-2017 Vladimir Kondratyev + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * MS Windows 7/8/10 compatible USB HID Multi-touch Device driver. + * https://msdn.microsoft.com/en-us/library/windows/hardware/jj151569(v=vs.85).aspx + * https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "usbdevs.h" +#include +#include +#include +#include + +#include + +#include +#include + +#define USB_DEBUG_VAR wmt_debug +#include + +static SYSCTL_NODE(_hw_usb, OID_AUTO, wmt, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "USB MSWindows 7/8/10 compatible Multi-touch Device"); +#ifdef USB_DEBUG +static int wmt_debug = 0; +SYSCTL_INT(_hw_usb_wmt, OID_AUTO, debug, CTLFLAG_RWTUN, + &wmt_debug, 1, "Debug level"); +#endif +static bool wmt_timestamps = 0; +SYSCTL_BOOL(_hw_usb_wmt, OID_AUTO, timestamps, CTLFLAG_RDTUN, + &wmt_timestamps, 1, "Enable hardware timestamp reporting"); + +#define WMT_BSIZE 1024 /* bytes, buffer size */ +#define WMT_BTN_MAX 8 /* Number of buttons supported */ + +enum { + WMT_INTR_DT, + WMT_N_TRANSFER, +}; + +enum wmt_type { + WMT_TYPE_UNKNOWN = 0, /* HID report descriptor is not probed */ + WMT_TYPE_UNSUPPORTED, /* Repdescr does not belong to MT device */ + WMT_TYPE_TOUCHPAD, + WMT_TYPE_TOUCHSCREEN, +}; + +enum wmt_input_mode { + WMT_INPUT_MODE_MOUSE = 0x0, + WMT_INPUT_MODE_MT_TOUCHSCREEN = 0x2, + WMT_INPUT_MODE_MT_TOUCHPAD = 0x3, +}; + +enum { + WMT_TIP_SWITCH, +#define WMT_SLOT WMT_TIP_SWITCH + WMT_WIDTH, +#define WMT_MAJOR WMT_WIDTH + WMT_HEIGHT, +#define WMT_MINOR WMT_HEIGHT + WMT_ORIENTATION, + WMT_X, + WMT_Y, + WMT_CONTACTID, + WMT_PRESSURE, + WMT_IN_RANGE, + WMT_CONFIDENCE, + WMT_TOOL_X, + WMT_TOOL_Y, + WMT_N_USAGES, +}; + +#define WMT_NO_CODE (ABS_MAX + 10) +#define WMT_NO_USAGE -1 + +struct wmt_hid_map_item { + char name[5]; + int32_t usage; /* HID usage */ + uint32_t code; /* Evdev event code */ + bool required; /* Required for MT Digitizers */ +}; + +static const struct wmt_hid_map_item wmt_hid_map[WMT_N_USAGES] = { + [WMT_TIP_SWITCH] = { /* WMT_SLOT */ + .name = "TIP", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_TIP_SWITCH), + .code = ABS_MT_SLOT, + .required = true, + }, + [WMT_WIDTH] = { /* WMT_MAJOR */ + .name = "WDTH", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_WIDTH), + .code = ABS_MT_TOUCH_MAJOR, + .required = false, + }, + [WMT_HEIGHT] = { /* WMT_MINOR */ + .name = "HGHT", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_HEIGHT), + .code = ABS_MT_TOUCH_MINOR, + .required = false, + }, + [WMT_ORIENTATION] = { + .name = "ORIE", + .usage = WMT_NO_USAGE, + .code = ABS_MT_ORIENTATION, + .required = false, + }, + [WMT_X] = { + .name = "X", + .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), + .code = ABS_MT_POSITION_X, + .required = true, + }, + [WMT_Y] = { + .name = "Y", + .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), + .code = ABS_MT_POSITION_Y, + .required = true, + }, + [WMT_CONTACTID] = { + .name = "C_ID", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_CONTACTID), + .code = ABS_MT_TRACKING_ID, + .required = true, + }, + [WMT_PRESSURE] = { + .name = "PRES", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_TIP_PRESSURE), + .code = ABS_MT_PRESSURE, + .required = false, + }, + [WMT_IN_RANGE] = { + .name = "RANG", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_IN_RANGE), + .code = ABS_MT_DISTANCE, + .required = false, + }, + [WMT_CONFIDENCE] = { + .name = "CONF", + .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_CONFIDENCE), + .code = WMT_NO_CODE, + .required = false, + }, + [WMT_TOOL_X] = { /* Shares HID usage with WMT_X */ + .name = "TL_X", + .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), + .code = ABS_MT_TOOL_X, + .required = false, + }, + [WMT_TOOL_Y] = { /* Shares HID usage with WMT_Y */ + .name = "TL_Y", + .usage = HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), + .code = ABS_MT_TOOL_Y, + .required = false, + }, +}; + +struct wmt_absinfo { + int32_t min; + int32_t max; + int32_t res; +}; + +struct wmt_softc { + device_t dev; + enum wmt_type type; + + struct mtx mtx; + struct wmt_absinfo ai[WMT_N_USAGES]; + struct hid_location locs[MAX_MT_SLOTS][WMT_N_USAGES]; + struct hid_location cont_count_loc; + struct hid_location btn_loc[WMT_BTN_MAX]; + struct hid_location int_btn_loc; + struct hid_location scan_time_loc; + int32_t scan_time_max; + int32_t scan_time; + int32_t timestamp; + bool touch; + bool prev_touch; + + struct usb_xfer *xfer[WMT_N_TRANSFER]; + struct evdev_dev *evdev; + + uint32_t slot_data[WMT_N_USAGES]; + uint8_t caps[howmany(WMT_N_USAGES, 8)]; + uint8_t buttons[howmany(WMT_BTN_MAX, 8)]; + uint32_t isize; + uint32_t nconts_per_report; + uint32_t nconts_todo; + uint32_t report_len; + uint8_t report_id; + uint32_t max_button; + bool has_int_button; + bool is_clickpad; + bool do_timestamps; + + struct hid_location cont_max_loc; + uint32_t cont_max_rlen; + uint8_t cont_max_rid; + struct hid_location btn_type_loc; + uint32_t btn_type_rlen; + uint8_t btn_type_rid; + uint32_t thqa_cert_rlen; + uint8_t thqa_cert_rid; + struct hid_location input_mode_loc; + uint32_t input_mode_rlen; + uint8_t input_mode_rid; + + uint8_t buf[WMT_BSIZE] __aligned(4); +}; + +#define WMT_FOREACH_USAGE(caps, usage) \ + for ((usage) = 0; (usage) < WMT_N_USAGES; ++(usage)) \ + if (isset((caps), (usage))) + +static enum wmt_type wmt_hid_parse(struct wmt_softc *, const void *, uint16_t); +static int wmt_set_input_mode(struct wmt_softc *, enum wmt_input_mode); + +static usb_callback_t wmt_intr_callback; + +static device_probe_t wmt_probe; +static device_attach_t wmt_attach; +static device_detach_t wmt_detach; + +#if __FreeBSD_version >= 1200077 +static evdev_open_t wmt_ev_open; +static evdev_close_t wmt_ev_close; +#else +static evdev_open_t wmt_ev_open_11; +static evdev_close_t wmt_ev_close_11; +#endif + +static const struct evdev_methods wmt_evdev_methods = { +#if __FreeBSD_version >= 1200077 + .ev_open = &wmt_ev_open, + .ev_close = &wmt_ev_close, +#else + .ev_open = &wmt_ev_open_11, + .ev_close = &wmt_ev_close_11, +#endif +}; + +static const struct usb_config wmt_config[WMT_N_TRANSFER] = { + [WMT_INTR_DT] = { + .type = UE_INTERRUPT, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_IN, + .flags = { .pipe_bof = 1, .short_xfer_ok = 1 }, + .bufsize = WMT_BSIZE, + .callback = &wmt_intr_callback, + }, +}; + +static int +wmt_probe(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct wmt_softc *sc = device_get_softc(dev); + void *d_ptr; + uint16_t d_len; + int err; + + if (uaa->usb_mode != USB_MODE_HOST) + return (ENXIO); + + if (uaa->info.bInterfaceClass != UICLASS_HID) + return (ENXIO); + + if (usb_test_quirk(uaa, UQ_WMT_IGNORE)) + return (ENXIO); + + err = usbd_req_get_hid_desc(uaa->device, NULL, + &d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex); + if (err) + return (ENXIO); + + /* Check if report descriptor belongs to a HID multitouch device */ + if (sc->type == WMT_TYPE_UNKNOWN) + sc->type = wmt_hid_parse(sc, d_ptr, d_len); + if (sc->type != WMT_TYPE_UNSUPPORTED) + err = BUS_PROBE_DEFAULT; + else + err = ENXIO; + + /* Check HID report length */ + if (sc->type != WMT_TYPE_UNSUPPORTED && + (sc->isize <= 0 || sc->isize > WMT_BSIZE)) { + DPRINTF("Input size invalid or too large: %d\n", sc->isize); + err = ENXIO; + } + + free(d_ptr, M_TEMP); + return (err); +} + +static int +wmt_attach(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct wmt_softc *sc = device_get_softc(dev); + uint32_t cont_count_max; + int nbuttons, btn; + size_t i; + int err; + + device_set_usb_desc(dev); + sc->dev = dev; + + /* Fetch and parse "Contact count maximum" feature report */ + if (sc->cont_max_rlen > 0 && sc->cont_max_rlen <= WMT_BSIZE) { + err = usbd_req_get_report(uaa->device, NULL, sc->buf, + sc->cont_max_rlen, uaa->info.bIfaceIndex, + UHID_FEATURE_REPORT, sc->cont_max_rid); + if (err == USB_ERR_NORMAL_COMPLETION) { + cont_count_max = hid_get_udata(sc->buf + 1, + sc->cont_max_rlen - 1, &sc->cont_max_loc); + /* + * Feature report is a primary source of + * 'Contact Count Maximum' + */ + if (cont_count_max > 0) + sc->ai[WMT_SLOT].max = cont_count_max - 1; + } else + DPRINTF("usbd_req_get_report error=(%s)\n", + usbd_errstr(err)); + } else + DPRINTF("Feature report %hhu size invalid or too large: %u\n", + sc->cont_max_rid, sc->cont_max_rlen); + + /* Fetch and parse "Button type" feature report */ + if (sc->btn_type_rlen > 1 && sc->btn_type_rlen <= WMT_BSIZE && + sc->btn_type_rid != sc->cont_max_rid) { + bzero(sc->buf, sc->btn_type_rlen); + err = usbd_req_get_report(uaa->device, NULL, sc->buf, + sc->btn_type_rlen, uaa->info.bIfaceIndex, + UHID_FEATURE_REPORT, sc->btn_type_rid); + } + if (sc->btn_type_rlen > 1) { + if (err == 0) + sc->is_clickpad = hid_get_udata(sc->buf + 1, + sc->btn_type_rlen - 1, &sc->btn_type_loc) == 0; + else + DPRINTF("usbd_req_get_report error=%d\n", err); + } + + /* Fetch THQA certificate to enable some devices like WaveShare */ + if (sc->thqa_cert_rlen > 0 && sc->thqa_cert_rlen <= WMT_BSIZE && + sc->thqa_cert_rid != sc->cont_max_rid) + (void)usbd_req_get_report(uaa->device, NULL, sc->buf, + sc->thqa_cert_rlen, uaa->info.bIfaceIndex, + UHID_FEATURE_REPORT, sc->thqa_cert_rid); + + /* Switch touchpad in to absolute multitouch mode */ + if (sc->type == WMT_TYPE_TOUCHPAD) { + err = wmt_set_input_mode(sc, WMT_INPUT_MODE_MT_TOUCHPAD); + if (err != 0) + DPRINTF("Failed to set input mode: %d\n", err); + } + + /* Cap contact count maximum to MAX_MT_SLOTS */ + if (sc->ai[WMT_SLOT].max >= MAX_MT_SLOTS) { + DPRINTF("Hardware reported %d contacts while only %d is " + "supported\n", (int)sc->ai[WMT_SLOT].max+1, MAX_MT_SLOTS); + sc->ai[WMT_SLOT].max = MAX_MT_SLOTS - 1; + } + + if (/*usb_test_quirk(hw, UQ_MT_TIMESTAMP) ||*/ wmt_timestamps) + sc->do_timestamps = true; + + mtx_init(&sc->mtx, "wmt lock", NULL, MTX_DEF); + + err = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, + sc->xfer, wmt_config, WMT_N_TRANSFER, sc, &sc->mtx); + if (err != USB_ERR_NORMAL_COMPLETION) { + DPRINTF("usbd_transfer_setup error=%s\n", usbd_errstr(err)); + goto detach; + } + + sc->evdev = evdev_alloc(); + evdev_set_name(sc->evdev, device_get_desc(dev)); + evdev_set_phys(sc->evdev, device_get_nameunit(dev)); + evdev_set_id(sc->evdev, BUS_USB, uaa->info.idVendor, + uaa->info.idProduct, 0); + evdev_set_serial(sc->evdev, usb_get_serial(uaa->device)); + evdev_set_methods(sc->evdev, sc, &wmt_evdev_methods); + evdev_set_flag(sc->evdev, EVDEV_FLAG_MT_STCOMPAT); + switch (sc->type) { + case WMT_TYPE_TOUCHSCREEN: + evdev_support_prop(sc->evdev, INPUT_PROP_DIRECT); + break; + case WMT_TYPE_TOUCHPAD: + evdev_support_prop(sc->evdev, INPUT_PROP_POINTER); + if (sc->is_clickpad) + evdev_support_prop(sc->evdev, INPUT_PROP_BUTTONPAD); + break; + default: + KASSERT(0, ("wmt_attach: unsupported touch device type")); + } + evdev_support_event(sc->evdev, EV_SYN); + evdev_support_event(sc->evdev, EV_ABS); + if (sc->do_timestamps) { + evdev_support_event(sc->evdev, EV_MSC); + evdev_support_msc(sc->evdev, MSC_TIMESTAMP); + } + nbuttons = 0; + if (sc->max_button != 0 || sc->has_int_button) { + evdev_support_event(sc->evdev, EV_KEY); + if (sc->has_int_button) + evdev_support_key(sc->evdev, BTN_LEFT); + for (btn = 0; btn < sc->max_button; ++btn) { + if (isset(sc->buttons, btn)) { + evdev_support_key(sc->evdev, BTN_MOUSE + btn); + nbuttons++; + } + } + } + WMT_FOREACH_USAGE(sc->caps, i) { + if (wmt_hid_map[i].code != WMT_NO_CODE) + evdev_support_abs(sc->evdev, wmt_hid_map[i].code, + sc->ai[i].min, sc->ai[i].max, 0, 0, sc->ai[i].res); + } + + err = evdev_register_mtx(sc->evdev, &sc->mtx); + if (err) + goto detach; + + /* Announce information about the touch device */ + device_printf(sc->dev, "Multitouch %s with %d external button%s%s\n", + sc->type == WMT_TYPE_TOUCHSCREEN ? "touchscreen" : "touchpad", + nbuttons, nbuttons != 1 ? "s" : "", + sc->is_clickpad ? ", click-pad" : ""); + device_printf(sc->dev, + "%d contacts and [%s%s%s%s%s]. Report range [%d:%d] - [%d:%d]\n", + (int)sc->ai[WMT_SLOT].max + 1, + isset(sc->caps, WMT_IN_RANGE) ? "R" : "", + isset(sc->caps, WMT_CONFIDENCE) ? "C" : "", + isset(sc->caps, WMT_WIDTH) ? "W" : "", + isset(sc->caps, WMT_HEIGHT) ? "H" : "", + isset(sc->caps, WMT_PRESSURE) ? "P" : "", + (int)sc->ai[WMT_X].min, (int)sc->ai[WMT_Y].min, + (int)sc->ai[WMT_X].max, (int)sc->ai[WMT_Y].max); + + return (0); + +detach: + wmt_detach(dev); + return (ENXIO); +} + +static int +wmt_detach(device_t dev) +{ + struct wmt_softc *sc = device_get_softc(dev); + + evdev_free(sc->evdev); + usbd_transfer_unsetup(sc->xfer, WMT_N_TRANSFER); + mtx_destroy(&sc->mtx); + return (0); +} + +static void +wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) +{ + size_t usage; + uint32_t *slot_data = sc->slot_data; + uint32_t cont, btn; + uint32_t cont_count; + uint32_t width; + uint32_t height; + uint32_t int_btn = 0; + uint32_t left_btn = 0; + int32_t slot; + uint32_t scan_time; + int32_t delta; + + /* + * "In Parallel mode, devices report all contact information in a + * single packet. Each physical contact is represented by a logical + * collection that is embedded in the top-level collection." + * + * Since additional contacts that were not present will still be in the + * report with contactid=0 but contactids are zero-based, find + * contactcount first. + */ + cont_count = hid_get_udata(buf, len, &sc->cont_count_loc); + /* + * "In Hybrid mode, the number of contacts that can be reported in one + * report is less than the maximum number of contacts that the device + * supports. For example, a device that supports a maximum of + * 4 concurrent physical contacts, can set up its top-level collection + * to deliver a maximum of two contacts in one report. If four contact + * points are present, the device can break these up into two serial + * reports that deliver two contacts each. + * + * "When a device delivers data in this manner, the Contact Count usage + * value in the first report should reflect the total number of + * contacts that are being delivered in the hybrid reports. The other + * serial reports should have a contact count of zero (0)." + */ + if (cont_count != 0) + sc->nconts_todo = cont_count; + +#ifdef USB_DEBUG + DPRINTFN(6, "cont_count:%2u", (unsigned)cont_count); + if (wmt_debug >= 6) { + WMT_FOREACH_USAGE(sc->caps, usage) { + if (wmt_hid_map[usage].usage != WMT_NO_USAGE) + printf(" %-4s", wmt_hid_map[usage].name); + } + printf("\n"); + } +#endif + + /* Find the number of contacts reported in current report */ + cont_count = MIN(sc->nconts_todo, sc->nconts_per_report); + + /* Use protocol Type B for reporting events */ + for (cont = 0; cont < cont_count; cont++) { + bzero(slot_data, sizeof(sc->slot_data)); + WMT_FOREACH_USAGE(sc->caps, usage) { + if (sc->locs[cont][usage].size > 0) + slot_data[usage] = hid_get_udata( + buf, len, &sc->locs[cont][usage]); + } + + slot = evdev_get_mt_slot_by_tracking_id(sc->evdev, + slot_data[WMT_CONTACTID]); + +#ifdef USB_DEBUG + DPRINTFN(6, "cont%01x: data = ", cont); + if (wmt_debug >= 6) { + WMT_FOREACH_USAGE(sc->caps, usage) { + if (wmt_hid_map[usage].usage != WMT_NO_USAGE) + printf("%04x ", slot_data[usage]); + } + printf("slot = %d\n", (int)slot); + } +#endif + + if (slot == -1) { + DPRINTF("Slot overflow for contact_id %u\n", + (unsigned)slot_data[WMT_CONTACTID]); + continue; + } + + if (slot_data[WMT_TIP_SWITCH] != 0 && + !(isset(sc->caps, WMT_CONFIDENCE) && + slot_data[WMT_CONFIDENCE] == 0)) { + /* This finger is in proximity of the sensor */ + sc->touch = true; + slot_data[WMT_SLOT] = slot; + slot_data[WMT_IN_RANGE] = !slot_data[WMT_IN_RANGE]; + /* Divided by two to match visual scale of touch */ + width = slot_data[WMT_WIDTH] >> 1; + height = slot_data[WMT_HEIGHT] >> 1; + slot_data[WMT_ORIENTATION] = width > height; + slot_data[WMT_MAJOR] = MAX(width, height); + slot_data[WMT_MINOR] = MIN(width, height); + + WMT_FOREACH_USAGE(sc->caps, usage) + if (wmt_hid_map[usage].code != WMT_NO_CODE) + evdev_push_abs(sc->evdev, + wmt_hid_map[usage].code, + slot_data[usage]); + } else { + evdev_push_abs(sc->evdev, ABS_MT_SLOT, slot); + evdev_push_abs(sc->evdev, ABS_MT_TRACKING_ID, -1); + } + } + + sc->nconts_todo -= cont_count; + if (sc->do_timestamps && sc->nconts_todo == 0) { + /* HUD_SCAN_TIME is measured in 100us, convert to us. */ + scan_time = hid_get_udata(buf, len, &sc->scan_time_loc); + if (sc->prev_touch) { + delta = scan_time - sc->scan_time; + if (delta < 0) + delta += sc->scan_time_max; + } else + delta = 0; + sc->scan_time = scan_time; + sc->timestamp += delta * 100; + evdev_push_msc(sc->evdev, MSC_TIMESTAMP, sc->timestamp); + sc->prev_touch = sc->touch; + sc->touch = false; + if (!sc->prev_touch) + sc->timestamp = 0; + } + if (sc->nconts_todo == 0) { + /* Report both the click and external left btns as BTN_LEFT */ + if (sc->has_int_button) + int_btn = hid_get_data(buf, len, &sc->int_btn_loc); + if (isset(sc->buttons, 0)) + left_btn = hid_get_data(buf, len, &sc->btn_loc[0]); + if (sc->has_int_button || isset(sc->buttons, 0)) + evdev_push_key(sc->evdev, BTN_LEFT, + (int_btn != 0) | (left_btn != 0)); + for (btn = 1; btn < sc->max_button; ++btn) { + if (isset(sc->buttons, btn)) + evdev_push_key(sc->evdev, BTN_MOUSE + btn, + hid_get_data(buf, + len, + &sc->btn_loc[btn]) != 0); + } + evdev_sync(sc->evdev); + } +} + +static void +wmt_intr_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct wmt_softc *sc = usbd_xfer_softc(xfer); + struct usb_page_cache *pc; + uint8_t *buf = sc->buf; + int len; + + usbd_xfer_status(xfer, &len, NULL, NULL, NULL); + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + pc = usbd_xfer_get_frame(xfer, 0); + + DPRINTFN(6, "sc=%p actlen=%d\n", sc, len); + + if (len >= (int)sc->report_len || + (len > 0 && sc->report_id != 0)) { + /* Limit report length to the maximum */ + if (len > (int)sc->report_len) + len = sc->report_len; + + usbd_copy_out(pc, 0, buf, len); + + /* Ignore irrelevant reports */ + if (sc->report_id && *buf != sc->report_id) + goto tr_ignore; + + /* Make sure we don't process old data */ + if (len < sc->report_len) + bzero(buf + len, sc->report_len - len); + + /* Strip leading "report ID" byte */ + if (sc->report_id) { + len--; + buf++; + } + + wmt_process_report(sc, buf, len); + } else { +tr_ignore: + DPRINTF("Ignored transfer, %d bytes\n", len); + } + + case USB_ST_SETUP: +tr_setup: + usbd_xfer_set_frame_len(xfer, 0, sc->isize); + usbd_transfer_submit(xfer); + break; + default: + if (error != USB_ERR_CANCELLED) { + /* Try clear stall first */ + usbd_xfer_set_stall(xfer); + goto tr_setup; + } + break; + } +} + +static void +wmt_ev_close_11(struct evdev_dev *evdev, void *ev_softc) +{ + struct wmt_softc *sc = ev_softc; + + mtx_assert(&sc->mtx, MA_OWNED); + usbd_transfer_stop(sc->xfer[WMT_INTR_DT]); +} + +static int +wmt_ev_open_11(struct evdev_dev *evdev, void *ev_softc) +{ + struct wmt_softc *sc = ev_softc; + + mtx_assert(&sc->mtx, MA_OWNED); + usbd_transfer_start(sc->xfer[WMT_INTR_DT]); + + return (0); +} + +#if __FreeBSD_version >= 1200077 +static int +wmt_ev_close(struct evdev_dev *evdev) +{ + struct wmt_softc *sc = evdev_get_softc(evdev); + + wmt_ev_close_11(evdev, sc); + + return (0); +} + +static int +wmt_ev_open(struct evdev_dev *evdev) +{ + struct wmt_softc *sc = evdev_get_softc(evdev); + + return (wmt_ev_open_11(evdev, sc)); + +} +#endif + +static enum wmt_type +wmt_hid_parse(struct wmt_softc *sc, const void *d_ptr, uint16_t d_len) +{ + struct hid_item hi; + struct hid_data *hd; + size_t i; + size_t cont = 0; + enum wmt_type type = WMT_TYPE_UNSUPPORTED; + uint32_t left_btn, btn; + int32_t cont_count_max = 0; + uint8_t report_id = 0; + bool touch_coll = false; + bool finger_coll = false; + bool cont_count_found = false; + bool scan_time_found = false; + bool has_int_button = false; + +#define WMT_HI_ABSOLUTE(hi) \ + (((hi).flags & (HIO_CONST|HIO_VARIABLE|HIO_RELATIVE)) == HIO_VARIABLE) +#define HUMS_THQA_CERT 0xC5 + + /* Parse features for maximum contact count */ + hd = hid_start_parse(d_ptr, d_len, 1 << hid_feature); + while (hid_get_item(hd, &hi)) { + switch (hi.kind) { + case hid_collection: + if (hi.collevel == 1 && hi.usage == + HID_USAGE2(HUP_DIGITIZERS, HUD_TOUCHSCREEN)) { + touch_coll = true; + type = WMT_TYPE_TOUCHSCREEN; + left_btn = 1; + break; + } + if (hi.collevel == 1 && hi.usage == + HID_USAGE2(HUP_DIGITIZERS, HUD_TOUCHPAD)) { + touch_coll = true; + type = WMT_TYPE_TOUCHPAD; + left_btn = 2; + } + break; + case hid_endcollection: + if (hi.collevel == 0 && touch_coll) + touch_coll = false; + break; + case hid_feature: + if (hi.collevel == 1 && touch_coll && hi.usage == + HID_USAGE2(HUP_MICROSOFT, HUMS_THQA_CERT)) { + sc->thqa_cert_rid = hi.report_ID; + break; + } + if (hi.collevel == 1 && touch_coll && hi.usage == + HID_USAGE2(HUP_DIGITIZERS, HUD_CONTACT_MAX)) { + cont_count_max = hi.logical_maximum; + sc->cont_max_rid = hi.report_ID; + sc->cont_max_loc = hi.loc; + break; + } + if (hi.collevel == 1 && touch_coll && hi.usage == + HID_USAGE2(HUP_DIGITIZERS, HUD_BUTTON_TYPE)) { + sc->btn_type_rid = hi.report_ID; + sc->btn_type_loc = hi.loc; + } + break; + default: + break; + } + } + hid_end_parse(hd); + + if (type == WMT_TYPE_UNSUPPORTED) + return (WMT_TYPE_UNSUPPORTED); + /* Maximum contact count is required usage */ + if (sc->cont_max_rid == 0) + return (WMT_TYPE_UNSUPPORTED); + + touch_coll = false; + + /* Parse input for other parameters */ + hd = hid_start_parse(d_ptr, d_len, 1 << hid_input); + while (hid_get_item(hd, &hi)) { + switch (hi.kind) { + case hid_collection: + if (hi.collevel == 1 && hi.usage == + HID_USAGE2(HUP_DIGITIZERS, HUD_TOUCHSCREEN)) + touch_coll = true; + else if (touch_coll && hi.collevel == 2 && + (report_id == 0 || report_id == hi.report_ID) && + hi.usage == HID_USAGE2(HUP_DIGITIZERS, HUD_FINGER)) + finger_coll = true; + break; + case hid_endcollection: + if (hi.collevel == 1 && finger_coll) { + finger_coll = false; + cont++; + } else if (hi.collevel == 0 && touch_coll) + touch_coll = false; + break; + case hid_input: + /* + * Ensure that all usages are located within the same + * report and proper collection. + */ + if (WMT_HI_ABSOLUTE(hi) && touch_coll && + (report_id == 0 || report_id == hi.report_ID)) + report_id = hi.report_ID; + else + break; + + if (hi.collevel == 1 && left_btn == 2 && + hi.usage == HID_USAGE2(HUP_BUTTON, 1)) { + has_int_button = true; + sc->int_btn_loc = hi.loc; + break; + } + if (hi.collevel == 1 && + hi.usage >= HID_USAGE2(HUP_BUTTON, left_btn) && + hi.usage <= HID_USAGE2(HUP_BUTTON, WMT_BTN_MAX)) { + btn = (hi.usage & 0xFFFF) - left_btn; + setbit(sc->buttons, btn); + sc->btn_loc[btn] = hi.loc; + if (btn >= sc->max_button) + sc->max_button = btn + 1; + break; + } + if (hi.collevel == 1 && hi.usage == + HID_USAGE2(HUP_DIGITIZERS, HUD_CONTACTCOUNT)) { + cont_count_found = true; + sc->cont_count_loc = hi.loc; *** 165 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D701C4DEC0E; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@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 4DBj025g6zz4SbF; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3BC9193DD; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKo1p063048; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKox0063047; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:50 GMT Message-Id: <202101072320.107NKox0063047@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 3b2175fdb62c - main - evdev: Implement fuzz. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b2175fdb62c7f872e78ce732952f2ac2ff99c8d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:51 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=3b2175fdb62c7f872e78ce732952f2ac2ff99c8d commit 3b2175fdb62c7f872e78ce732952f2ac2ff99c8d Author: Vladimir Kondratyev AuthorDate: 2020-11-30 21:10:04 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:44 +0000 evdev: Implement fuzz. Fuzz is used to filter noise from the event stream. Upcoming gamepad drivers use it. Reviewed by: hselasky (as part of D27993) --- sys/dev/evdev/evdev.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index e76abbc816d3..086ee36333dc 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -684,6 +684,7 @@ static void evdev_modify_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, int32_t *value) { + int32_t fuzz, old_value, abs_change; EVDEV_LOCK_ASSERT(evdev); @@ -710,7 +711,24 @@ evdev_modify_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, break; case EV_ABS: - /* TBD: implement fuzz */ + fuzz = evdev->ev_absinfo[code].fuzz; + if (fuzz == 0 || code == ABS_MT_SLOT) + break; + else if (!ABS_IS_MT(code)) + old_value = evdev->ev_absinfo[code].value; + else if (bit_test(evdev->ev_abs_flags, ABS_MT_SLOT)) + old_value = evdev_get_mt_value(evdev, + evdev_get_last_mt_slot(evdev), code); + else /* Pass MT protocol type A events as is */ + break; + + abs_change = abs(*value - old_value); + if (abs_change < fuzz / 2) + *value = old_value; + else if (abs_change < fuzz) + *value = (old_value * 3 + *value) / 4; + else if (abs_change < fuzz * 2) + *value = (old_value + *value) / 2; break; } } From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0FB864DEBA6; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@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 4DBj034wD5z4SSk; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D62818F57; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpLL063255; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpMZ063253; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpMZ063253@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 2b4464b0b114 - main - hid: Import hidbus(4) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b4464b0b1143024ede8bd3ea69134ea17bc5355 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:57 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=2b4464b0b1143024ede8bd3ea69134ea17bc5355 commit 2b4464b0b1143024ede8bd3ea69134ea17bc5355 Author: Vladimir Kondratyev AuthorDate: 2020-10-09 01:10:23 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:42 +0000 hid: Import hidbus(4) This driver provides support for multiple HID driver attachments to single HID transport backend. This ability existed in Net/OpenBSD (uhidev and ihidev drivers) but has never been ported to FreeBSD. Unlike Net/OpenBSD we do not use report number alone to distinct report source but we follow MS way and use a top level collection (TLC) usage index that report belongs to as a location key. The driver performs child device autodiscovery based on HID report descriptor data, proxying of HID requests from child devices to parent transport backends and broadcasting of interrupts in backward direction. Differential revision: https://reviews.freebsd.org/D27888 --- share/man/man4/Makefile | 1 + share/man/man4/hidbus.4 | 102 +++++ sys/conf/files | 1 + sys/dev/hid/hidbus.c | 905 ++++++++++++++++++++++++++++++++++++++++ sys/dev/hid/hidbus.h | 176 ++++++++ sys/modules/hid/Makefile | 3 +- sys/modules/hid/hidbus/Makefile | 9 + 7 files changed, 1196 insertions(+), 1 deletion(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index c9bf21503096..9fbfe1dd8411 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -179,6 +179,7 @@ MAN= aac.4 \ gpioths.4 \ gre.4 \ h_ertt.4 \ + hidbus.4 \ hifn.4 \ hpet.4 \ ${_hpt27xx.4} \ diff --git a/share/man/man4/hidbus.4 b/share/man/man4/hidbus.4 new file mode 100644 index 000000000000..1ce17d449002 --- /dev/null +++ b/share/man/man4/hidbus.4 @@ -0,0 +1,102 @@ +.\" Copyright (c) 2020 Vladimir Kondratyev +.\" +.\" 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 September 14, 2020 +.Dt HIDBUS 4 +.Os +.Sh NAME +.Nm hidbus +.Nd generic HID bus driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device hidbus" +.Cd "device hid" +.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 +hidbus_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for multiple HID driver attachments to single HID +transport backend. +See +.Xr iichid 4 +or +.Xr usbhid 4 . +.Pp +Each HID device can have several components, e.g., a keyboard and +a mouse. +These components use different report identifiers (a byte) combined into +groups called collections to distinguish which one data is coming from. +The +.Nm +driver has other drivers attached that handle particular +kinds of devices and +.Nm +broadcasts data to all of them. +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables: +.Bl -tag -width indent +.It Va hw.hid.hidbus.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Sh SEE ALSO +.Xr hconf 4 , +.Xr hcons 4 , +.Xr hgame 4 , +.Xr hidraw 4 , +.Xr hkbd 4 , +.Xr hms 4 , +.Xr hmt 4 , +.Xr hpen 4 , +.Xr hsctrl 4 , +.Xr hskbd 4 , +.Xr iichid 4 , +.Xr usbhid 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0. +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . diff --git a/sys/conf/files b/sys/conf/files index 88ab9ce95e9e..52551baa5847 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1817,6 +1817,7 @@ dev/gpio/gpiopps.c optional gpiopps fdt dev/gpio/ofw_gpiobus.c optional fdt gpio dev/hid/hid.c optional hid dev/hid/hid_if.m optional hid +dev/hid/hidbus.c optional hidbus dev/hifn/hifn7751.c optional hifn dev/hptiop/hptiop.c optional hptiop scbus dev/hwpmc/hwpmc_logging.c optional hwpmc diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c new file mode 100644 index 000000000000..8feb28302a44 --- /dev/null +++ b/sys/dev/hid/hidbus.c @@ -0,0 +1,905 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019-2020 Vladimir Kondratyev + * + * 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define HID_DEBUG_VAR hid_debug +#include +#include +#include + +#include "hid_if.h" + +#define INPUT_EPOCH global_epoch_preempt +#define HID_RSIZE_MAX 1024 + +static hid_intr_t hidbus_intr; + +static device_probe_t hidbus_probe; +static device_attach_t hidbus_attach; +static device_detach_t hidbus_detach; + +struct hidbus_ivars { + int32_t usage; + uint8_t index; + uint32_t flags; + uintptr_t driver_info; /* for internal use */ + struct mtx *mtx; /* child intr mtx */ + hid_intr_t *intr_handler; /* executed under mtx*/ + void *intr_ctx; + unsigned int refcnt; /* protected by mtx */ + struct epoch_context epoch_ctx; + CK_STAILQ_ENTRY(hidbus_ivars) link; +}; + +struct hidbus_softc { + device_t dev; + struct sx sx; + struct mtx mtx; + + bool nowrite; + + struct hid_rdesc_info rdesc; + bool overloaded; + int nest; /* Child attach nesting lvl */ + int nauto; /* Number of autochildren */ + + CK_STAILQ_HEAD(, hidbus_ivars) tlcs; +}; + +static int +hidbus_fill_rdesc_info(struct hid_rdesc_info *hri, const void *data, + hid_size_t len) +{ + int error = 0; + + hri->data = __DECONST(void *, data); + hri->len = len; + + /* + * If report descriptor is not available yet, set maximal + * report sizes high enough to allow hidraw to work. + */ + hri->isize = len == 0 ? HID_RSIZE_MAX : + hid_report_size_max(data, len, hid_input, &hri->iid); + hri->osize = len == 0 ? HID_RSIZE_MAX : + hid_report_size_max(data, len, hid_output, &hri->oid); + hri->fsize = len == 0 ? HID_RSIZE_MAX : + hid_report_size_max(data, len, hid_feature, &hri->fid); + + if (hri->isize > HID_RSIZE_MAX) { + DPRINTF("input size is too large, %u bytes (truncating)\n", + hri->isize); + hri->isize = HID_RSIZE_MAX; + error = EOVERFLOW; + } + if (hri->osize > HID_RSIZE_MAX) { + DPRINTF("output size is too large, %u bytes (truncating)\n", + hri->osize); + hri->osize = HID_RSIZE_MAX; + error = EOVERFLOW; + } + if (hri->fsize > HID_RSIZE_MAX) { + DPRINTF("feature size is too large, %u bytes (truncating)\n", + hri->fsize); + hri->fsize = HID_RSIZE_MAX; + error = EOVERFLOW; + } + + return (error); +} + +int +hidbus_locate(const void *desc, hid_size_t size, int32_t u, enum hid_kind k, + uint8_t tlc_index, uint8_t index, struct hid_location *loc, + uint32_t *flags, uint8_t *id, struct hid_absinfo *ai) +{ + struct hid_data *d; + struct hid_item h; + int i; + + d = hid_start_parse(desc, size, 1 << k); + HIDBUS_FOREACH_ITEM(d, &h, tlc_index) { + for (i = 0; i < h.nusages; i++) { + if (h.kind == k && h.usages[i] == u) { + if (index--) + break; + if (loc != NULL) + *loc = h.loc; + if (flags != NULL) + *flags = h.flags; + if (id != NULL) + *id = h.report_ID; + if (ai != NULL && (h.flags&HIO_RELATIVE) == 0) + *ai = (struct hid_absinfo) { + .max = h.logical_maximum, + .min = h.logical_minimum, + .res = hid_item_resolution(&h), + }; + hid_end_parse(d); + return (1); + } + } + } + if (loc != NULL) + loc->size = 0; + if (flags != NULL) + *flags = 0; + if (id != NULL) + *id = 0; + hid_end_parse(d); + return (0); +} + +static device_t +hidbus_add_child(device_t dev, u_int order, const char *name, int unit) +{ + struct hidbus_softc *sc = device_get_softc(dev); + struct hidbus_ivars *tlc; + device_t child; + + child = device_add_child_ordered(dev, order, name, unit); + if (child == NULL) + return (child); + + tlc = malloc(sizeof(struct hidbus_ivars), M_DEVBUF, M_WAITOK | M_ZERO); + tlc->mtx = &sc->mtx; + device_set_ivars(child, tlc); + sx_xlock(&sc->sx); + CK_STAILQ_INSERT_TAIL(&sc->tlcs, tlc, link); + sx_unlock(&sc->sx); + + return (child); +} + +static int +hidbus_enumerate_children(device_t dev, const void* data, hid_size_t len) +{ + struct hidbus_softc *sc = device_get_softc(dev); + struct hid_data *hd; + struct hid_item hi; + device_t child; + uint8_t index = 0; + + if (data == NULL || len == 0) + return (ENXIO); + + /* Add a child for each top level collection */ + hd = hid_start_parse(data, len, 1 << hid_input); + while (hid_get_item(hd, &hi)) { + if (hi.kind != hid_collection || hi.collevel != 1) + continue; + child = BUS_ADD_CHILD(dev, 0, NULL, -1); + if (child == NULL) { + device_printf(dev, "Could not add HID device\n"); + continue; + } + hidbus_set_index(child, index); + hidbus_set_usage(child, hi.usage); + hidbus_set_flags(child, HIDBUS_FLAG_AUTOCHILD); + index++; + DPRINTF("Add child TLC: 0x%04x:0x%04x\n", + HID_GET_USAGE_PAGE(hi.usage), HID_GET_USAGE(hi.usage)); + } + hid_end_parse(hd); + + if (index == 0) + return (ENXIO); + + sc->nauto = index; + + return (0); +} + +static int +hidbus_attach_children(device_t dev) +{ + struct hidbus_softc *sc = device_get_softc(dev); + int error; + + HID_INTR_SETUP(device_get_parent(dev), hidbus_intr, sc, &sc->rdesc); + + error = hidbus_enumerate_children(dev, sc->rdesc.data, sc->rdesc.len); + if (error != 0) + DPRINTF("failed to enumerate children: error %d\n", error); + + /* + * hidbus_attach_children() can recurse through device_identify-> + * hid_set_report_descr() call sequence. Do not perform children + * attach twice in that case. + */ + sc->nest++; + bus_generic_probe(dev); + sc->nest--; + if (sc->nest != 0) + return (0); + + if (hid_is_keyboard(sc->rdesc.data, sc->rdesc.len) != 0) + error = bus_generic_attach(dev); + else + error = bus_delayed_attach_children(dev); + if (error != 0) + device_printf(dev, "failed to attach child: error %d\n", error); + + return (error); +} + +static int +hidbus_detach_children(device_t dev) +{ + device_t *children, bus; + bool is_bus; + int i, error; + + error = 0; + + is_bus = device_get_devclass(dev) == hidbus_devclass; + bus = is_bus ? dev : device_get_parent(dev); + + KASSERT(device_get_devclass(bus) == hidbus_devclass, + ("Device is not hidbus or it's child")); + + if (is_bus) { + /* If hidbus is passed, delete all children. */ + bus_generic_detach(bus); + device_delete_children(bus); + } else { + /* + * If hidbus child is passed, delete all hidbus children + * except caller. Deleting the caller may result in deadlock. + */ + error = device_get_children(bus, &children, &i); + if (error != 0) + return (error); + while (i-- > 0) { + if (children[i] == dev) + continue; + DPRINTF("Delete child. index=%d (%s)\n", + hidbus_get_index(children[i]), + device_get_nameunit(children[i])); + error = device_delete_child(bus, children[i]); + if (error) { + DPRINTF("Failed deleting %s\n", + device_get_nameunit(children[i])); + break; + } + } + free(children, M_TEMP); + } + + HID_INTR_UNSETUP(device_get_parent(bus)); + + return (error); +} + +static int +hidbus_probe(device_t dev) +{ + + device_set_desc(dev, "HID bus"); + + /* Allow other subclasses to override this driver. */ + return (BUS_PROBE_GENERIC); +} + +static int +hidbus_attach(device_t dev) +{ + struct hidbus_softc *sc = device_get_softc(dev); + struct hid_device_info *devinfo = device_get_ivars(dev); + void *d_ptr = NULL; + hid_size_t d_len; + int error; + + sc->dev = dev; + CK_STAILQ_INIT(&sc->tlcs); + mtx_init(&sc->mtx, "hidbus ivar lock", NULL, MTX_DEF); + sx_init(&sc->sx, "hidbus ivar list lock"); + + /* + * Ignore error. It is possible for non-HID device e.g. XBox360 gamepad + * to emulate HID through overloading of report descriptor. + */ + d_len = devinfo->rdescsize; + if (d_len != 0) { + d_ptr = malloc(d_len, M_DEVBUF, M_ZERO | M_WAITOK); + error = hid_get_rdesc(dev, d_ptr, d_len); + if (error != 0) { + free(d_ptr, M_DEVBUF); + d_len = 0; + d_ptr = NULL; + } + } + + hidbus_fill_rdesc_info(&sc->rdesc, d_ptr, d_len); + + sc->nowrite = hid_test_quirk(devinfo, HQ_NOWRITE); + + error = hidbus_attach_children(dev); + if (error != 0) { + hidbus_detach(dev); + return (ENXIO); + } + + return (0); +} + +static int +hidbus_detach(device_t dev) +{ + struct hidbus_softc *sc = device_get_softc(dev); + + hidbus_detach_children(dev); + sx_destroy(&sc->sx); + mtx_destroy(&sc->mtx); + free(sc->rdesc.data, M_DEVBUF); + + return (0); +} + +static void +hidbus_child_detached(device_t bus, device_t child) +{ + struct hidbus_softc *sc = device_get_softc(bus); + struct hidbus_ivars *tlc = device_get_ivars(child); + + KASSERT(tlc->refcnt == 0, ("Child device is running")); + tlc->mtx = &sc->mtx; + tlc->intr_handler = NULL; + tlc->flags &= ~HIDBUS_FLAG_CAN_POLL; +} + +/* + * Epoch callback indicating tlc is safe to destroy + */ +static void +hidbus_ivar_dtor(epoch_context_t ctx) +{ + struct hidbus_ivars *tlc; + + tlc = __containerof(ctx, struct hidbus_ivars, epoch_ctx); + free(tlc, M_DEVBUF); +} + +static void +hidbus_child_deleted(device_t bus, device_t child) +{ + struct hidbus_softc *sc = device_get_softc(bus); + struct hidbus_ivars *tlc = device_get_ivars(child); + + sx_xlock(&sc->sx); + KASSERT(tlc->refcnt == 0, ("Child device is running")); + CK_STAILQ_REMOVE(&sc->tlcs, tlc, hidbus_ivars, link); + sx_unlock(&sc->sx); + epoch_call(INPUT_EPOCH, hidbus_ivar_dtor, &tlc->epoch_ctx); +} + +static int +hidbus_read_ivar(device_t bus, device_t child, int which, uintptr_t *result) +{ + struct hidbus_softc *sc = device_get_softc(bus); + struct hidbus_ivars *tlc = device_get_ivars(child); + + switch (which) { + case HIDBUS_IVAR_INDEX: + *result = tlc->index; + break; + case HIDBUS_IVAR_USAGE: + *result = tlc->usage; + break; + case HIDBUS_IVAR_FLAGS: + *result = tlc->flags; + break; + case HIDBUS_IVAR_DRIVER_INFO: + *result = tlc->driver_info; + break; + case HIDBUS_IVAR_LOCK: + *result = (uintptr_t)(tlc->mtx == &sc->mtx ? NULL : tlc->mtx); + break; + default: + return (EINVAL); + } + return (0); +} + +static int +hidbus_write_ivar(device_t bus, device_t child, int which, uintptr_t value) +{ + struct hidbus_softc *sc = device_get_softc(bus); + struct hidbus_ivars *tlc = device_get_ivars(child); + + switch (which) { + case HIDBUS_IVAR_INDEX: + tlc->index = value; + break; + case HIDBUS_IVAR_USAGE: + tlc->usage = value; + break; + case HIDBUS_IVAR_FLAGS: + tlc->flags = value; + break; + case HIDBUS_IVAR_DRIVER_INFO: + tlc->driver_info = value; + break; + case HIDBUS_IVAR_LOCK: + tlc->mtx = (struct mtx *)value == NULL ? + &sc->mtx : (struct mtx *)value; + break; + default: + return (EINVAL); + } + return (0); +} + +/* Location hint for devctl(8) */ +static int +hidbus_child_location_str(device_t bus, device_t child, char *buf, + size_t buflen) +{ + struct hidbus_ivars *tlc = device_get_ivars(child); + + snprintf(buf, buflen, "index=%hhu", tlc->index); + return (0); +} + +/* PnP information for devctl(8) */ +static int +hidbus_child_pnpinfo_str(device_t bus, device_t child, char *buf, + size_t buflen) +{ + struct hidbus_ivars *tlc = device_get_ivars(child); + struct hid_device_info *devinfo = device_get_ivars(bus); + + snprintf(buf, buflen, "page=0x%04x usage=0x%04x bus=0x%02hx " + "vendor=0x%04hx product=0x%04hx version=0x%04hx%s%s", + HID_GET_USAGE_PAGE(tlc->usage), HID_GET_USAGE(tlc->usage), + devinfo->idBus, devinfo->idVendor, devinfo->idProduct, + devinfo->idVersion, devinfo->idPnP[0] == '\0' ? "" : " _HID=", + devinfo->idPnP[0] == '\0' ? "" : devinfo->idPnP); + return (0); +} + +void +hidbus_set_desc(device_t child, const char *suffix) +{ + device_t bus = device_get_parent(child); + struct hidbus_softc *sc = device_get_softc(bus); + struct hid_device_info *devinfo = device_get_ivars(bus); + struct hidbus_ivars *tlc = device_get_ivars(child); + char buf[80]; + + /* Do not add NULL suffix or if device name already contains it. */ + if (suffix != NULL && strcasestr(devinfo->name, suffix) == NULL && + (sc->nauto > 1 || (tlc->flags & HIDBUS_FLAG_AUTOCHILD) == 0)) { + snprintf(buf, sizeof(buf), "%s %s", devinfo->name, suffix); + device_set_desc_copy(child, buf); + } else + device_set_desc(child, devinfo->name); +} + +device_t +hidbus_find_child(device_t bus, int32_t usage) +{ + device_t *children, child; + int ccount, i; + + GIANT_REQUIRED; + + /* Get a list of all hidbus children */ + if (device_get_children(bus, &children, &ccount) != 0) + return (NULL); + + /* Scan through to find required TLC */ + for (i = 0, child = NULL; i < ccount; i++) { + if (hidbus_get_usage(children[i]) == usage) { + child = children[i]; + break; + } + } + free(children, M_TEMP); + + return (child); +} + +void +hidbus_intr(void *context, void *buf, hid_size_t len) +{ + struct hidbus_softc *sc = context; + struct hidbus_ivars *tlc; + struct epoch_tracker et; + + /* + * Broadcast input report to all subscribers. + * TODO: Add check for input report ID. + * + * Relock mutex on every TLC item as we can't hold any locks over whole + * TLC list here due to LOR with open()/close() handlers. + */ + if (!HID_IN_POLLING_MODE()) + epoch_enter_preempt(INPUT_EPOCH, &et); + CK_STAILQ_FOREACH(tlc, &sc->tlcs, link) { + if (tlc->refcnt == 0 || tlc->intr_handler == NULL) + continue; + if (HID_IN_POLLING_MODE()) { + if ((tlc->flags & HIDBUS_FLAG_CAN_POLL) != 0) + tlc->intr_handler(tlc->intr_ctx, buf, len); + } else { + mtx_lock(tlc->mtx); + tlc->intr_handler(tlc->intr_ctx, buf, len); + mtx_unlock(tlc->mtx); + } + } + if (!HID_IN_POLLING_MODE()) + epoch_exit_preempt(INPUT_EPOCH, &et); +} + +void +hidbus_set_intr(device_t child, hid_intr_t *handler, void *context) +{ + struct hidbus_ivars *tlc = device_get_ivars(child); + + tlc->intr_handler = handler; + tlc->intr_ctx = context; +} + +int +hidbus_intr_start(device_t child) +{ + device_t bus = device_get_parent(child); + struct hidbus_softc *sc = device_get_softc(bus); + struct hidbus_ivars *ivar = device_get_ivars(child); + struct hidbus_ivars *tlc; + int refcnt = 0; + int error; + + if (sx_xlock_sig(&sc->sx) != 0) + return (EINTR); + CK_STAILQ_FOREACH(tlc, &sc->tlcs, link) { + refcnt += tlc->refcnt; + if (tlc == ivar) { + mtx_lock(tlc->mtx); + ++tlc->refcnt; + mtx_unlock(tlc->mtx); + } + } + error = refcnt != 0 ? 0 : HID_INTR_START(device_get_parent(bus)); + sx_unlock(&sc->sx); + + return (error); +} + +int +hidbus_intr_stop(device_t child) +{ + device_t bus = device_get_parent(child); + struct hidbus_softc *sc = device_get_softc(bus); + struct hidbus_ivars *ivar = device_get_ivars(child); + struct hidbus_ivars *tlc; + bool refcnt = 0; + int error; + + if (sx_xlock_sig(&sc->sx) != 0) + return (EINTR); + CK_STAILQ_FOREACH(tlc, &sc->tlcs, link) { + if (tlc == ivar) { + mtx_lock(tlc->mtx); + MPASS(tlc->refcnt != 0); + --tlc->refcnt; + mtx_unlock(tlc->mtx); + } + refcnt += tlc->refcnt; + } + error = refcnt != 0 ? 0 : HID_INTR_STOP(device_get_parent(bus)); + sx_unlock(&sc->sx); + + return (error); +} + +void +hidbus_intr_poll(device_t child) +{ + device_t bus = device_get_parent(child); + + HID_INTR_POLL(device_get_parent(bus)); +} + +struct hid_rdesc_info * +hidbus_get_rdesc_info(device_t child) +{ + device_t bus = device_get_parent(child); + struct hidbus_softc *sc = device_get_softc(bus); + + return (&sc->rdesc); +} + +/* + * HID interface. + * + * Hidbus as well as any hidbus child can be passed as first arg. + */ + +/* Read cached report descriptor */ +int +hid_get_report_descr(device_t dev, void **data, hid_size_t *len) +{ + device_t bus; + struct hidbus_softc *sc; + + bus = device_get_devclass(dev) == hidbus_devclass ? + dev : device_get_parent(dev); + sc = device_get_softc(bus); + + /* + * Do not send request to a transport backend. + * Use cached report descriptor instead of it. + */ + if (sc->rdesc.data == NULL || sc->rdesc.len == 0) + return (ENXIO); + + if (data != NULL) + *data = sc->rdesc.data; + if (len != NULL) + *len = sc->rdesc.len; + + return (0); +} + +/* + * Replace cached report descriptor with top level driver provided one. + * + * It deletes all hidbus children except caller and enumerates them again after + * new descriptor has been registered. Currently it can not be called from + * autoenumerated (by report's TLC) child device context as it results in child + * duplication. To overcome this limitation hid_set_report_descr() should be + * called from device_identify driver's handler with hidbus itself passed as + * 'device_t dev' parameter. + */ +int +hid_set_report_descr(device_t dev, const void *data, hid_size_t len) +{ + struct hid_rdesc_info rdesc; + device_t bus; + struct hidbus_softc *sc; + bool is_bus; + int error; + + GIANT_REQUIRED; + + is_bus = device_get_devclass(dev) == hidbus_devclass; + bus = is_bus ? dev : device_get_parent(dev); + sc = device_get_softc(bus); + + /* + * Do not overload already overloaded report descriptor in + * device_identify handler. It causes infinite recursion loop. + */ + if (is_bus && sc->overloaded) + return(0); + + DPRINTFN(5, "len=%d\n", len); + DPRINTFN(5, "data = %*D\n", len, data, " "); + + error = hidbus_fill_rdesc_info(&rdesc, data, len); + if (error != 0) + return (error); + + error = hidbus_detach_children(dev); + if (error != 0) + return(error); + + /* Make private copy to handle a case of dynamicaly allocated data. */ + rdesc.data = malloc(len, M_DEVBUF, M_ZERO | M_WAITOK); + bcopy(data, rdesc.data, len); + sc->overloaded = true; + free(sc->rdesc.data, M_DEVBUF); + bcopy(&rdesc, &sc->rdesc, sizeof(struct hid_rdesc_info)); + + error = hidbus_attach_children(bus); + + return (error); +} + +static int +hidbus_write(device_t dev, const void *data, hid_size_t len) +{ + struct hidbus_softc *sc; + uint8_t id; + + sc = device_get_softc(dev); + /* + * Output interrupt endpoint is often optional. If HID device + * does not provide it, send reports via control pipe. + */ + if (sc->nowrite) { + /* try to extract the ID byte */ + id = (sc->rdesc.oid & (len > 0)) ? *(const uint8_t*)data : 0; + return (hid_set_report(dev, data, len, HID_OUTPUT_REPORT, id)); + } + + return (hid_write(dev, data, len)); +} + +/*------------------------------------------------------------------------* + * hidbus_lookup_id + * + * This functions takes an array of "struct hid_device_id" and tries + * to match the entries with the information in "struct hid_device_info". + * + * Return values: + * NULL: No match found. + * Else: Pointer to matching entry. + *------------------------------------------------------------------------*/ +const struct hid_device_id * +hidbus_lookup_id(device_t dev, const struct hid_device_id *id, int nitems_id) +{ + const struct hid_device_id *id_end; + const struct hid_device_info *info; + int32_t usage; + bool is_child; + + if (id == NULL) { + goto done; + } + + id_end = id + nitems_id; + info = hid_get_device_info(dev); + is_child = device_get_devclass(dev) != hidbus_devclass; + if (is_child) + usage = hidbus_get_usage(dev); + + /* + * Keep on matching array entries until we find a match or + * until we reach the end of the matching array: + */ + for (; id != id_end; id++) { + + if (is_child && (id->match_flag_page) && + (id->page != HID_GET_USAGE_PAGE(usage))) { + continue; + } + if (is_child && (id->match_flag_usage) && + (id->usage != HID_GET_USAGE(usage))) { + continue; + } + if ((id->match_flag_bus) && + (id->idBus != info->idBus)) { + continue; + } + if ((id->match_flag_vendor) && + (id->idVendor != info->idVendor)) { + continue; + } + if ((id->match_flag_product) && + (id->idProduct != info->idProduct)) { + continue; + } *** 300 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EBA3D4DEBA2; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@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 4DBj032h2Zz4Sqj; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CB1A19348; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpA6063203; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpa7063200; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpa7063200@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 01f2e864f795 - main - hid: Import usbhid - USB transport backend for HID subsystem. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 01f2e864f79584c0cd250a8e7cfb501a9985768a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:55 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=01f2e864f79584c0cd250a8e7cfb501a9985768a commit 01f2e864f79584c0cd250a8e7cfb501a9985768a Author: Vladimir Kondratyev AuthorDate: 2020-10-08 21:32:12 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:43 +0000 hid: Import usbhid - USB transport backend for HID subsystem. This change implements hid_if.m methods for HID-over-USB protocol [1]. Also, this change adds USBHID_ENABLED kernel option which changes device_probe() priority and adds/removes PnP records to prefer usbhid over ums, ukbd, wmt and other USB HID device drivers and vice-versa. The module is based on uhid(4) driver. It is disabled by default for now due to conflicts with existing USB HID drivers. [1] https://www.usb.org/sites/default/files/hid1_11.pdf Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D27893 --- share/man/man4/Makefile | 1 + share/man/man4/usbhid.4 | 79 ++++ sys/amd64/conf/GENERIC | 3 + sys/conf/files | 1 + sys/conf/options | 1 + sys/dev/hid/hidbus.c | 1 + sys/dev/usb/input/uhid.c | 2 + sys/dev/usb/input/ukbd.c | 2 + sys/dev/usb/input/ums.c | 2 + sys/dev/usb/input/usbhid.c | 786 ++++++++++++++++++++++++++++++++++++++++ sys/dev/usb/input/wmt.c | 4 + sys/i386/conf/GENERIC | 3 + sys/modules/usb/Makefile | 3 +- sys/modules/usb/usbhid/Makefile | 10 + 14 files changed, 897 insertions(+), 1 deletion(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 5b0b55968afc..f18e93152353 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1017,6 +1017,7 @@ MAN+= \ usb.4 \ usb_quirk.4 \ usb_template.4 \ + usbhid.4 \ usfs.4 \ uslcom.4 \ uvisor.4 \ diff --git a/share/man/man4/usbhid.4 b/share/man/man4/usbhid.4 new file mode 100644 index 000000000000..a8905dc76ea8 --- /dev/null +++ b/share/man/man4/usbhid.4 @@ -0,0 +1,79 @@ +.\" Copyright (c) 2020 Vladimir Kondratyev +.\" +.\" 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 September 21, 2020 +.Dt USBHID 4 +.Os +.Sh NAME +.Nm usbhid +.Nd USB HID transport driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device usbhid" +.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 +usbhid_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides a interface to USB Human Interface Devices (HIDs). +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables: +.Bl -tag -width indent +.It Va hw.usb.usbhid.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Sh SEE ALSO +.Xr ehci 4 , +.Xr ohci 4 , +.Xr uhci 4 , +.Xr usb 4 , +.Xr xhci 4 , +.Xr usbconfig 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0. +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index ee2a972d8302..94f184334648 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -385,3 +385,6 @@ device uinput # install /dev/uinput cdev options HID_DEBUG # enable debug msgs device hid # Generic HID support options IICHID_SAMPLING # Workaround missing GPIO INTR support +#device usbhid # USB transport support. +#device hidbus # HID bus (required by usbhid/iichid) +#options USBHID_ENABLED # Prefer usbhid to other USB drivers diff --git a/sys/conf/files b/sys/conf/files index 87b56eb0e8ae..6dd4e95815d1 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3406,6 +3406,7 @@ dev/usb/input/uhid.c optional uhid dev/usb/input/uhid_snes.c optional uhid_snes dev/usb/input/ukbd.c optional ukbd dev/usb/input/ums.c optional ums +dev/usb/input/usbhid.c optional usbhid dev/usb/input/wmt.c optional wmt dev/usb/input/wsp.c optional wsp # diff --git a/sys/conf/options b/sys/conf/options index 1c0b643df899..48b7f362a80a 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -669,6 +669,7 @@ UKBD_DFLT_KEYMAP opt_ukbd.h UPLCOM_INTR_INTERVAL opt_uplcom.h UVSCOM_DEFAULT_OPKTSIZE opt_uvscom.h UVSCOM_INTR_INTERVAL opt_uvscom.h +USBHID_ENABLED opt_usb.h # options for the Realtek rtwn driver RTWN_DEBUG opt_rtwn.h diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c index dfe1081c8888..be3564842988 100644 --- a/sys/dev/hid/hidbus.c +++ b/sys/dev/hid/hidbus.c @@ -904,3 +904,4 @@ driver_t hidbus_driver = { MODULE_DEPEND(hidbus, hid, 1, 1, 1); MODULE_VERSION(hidbus, 1); DRIVER_MODULE(hidbus, iichid, hidbus_driver, hidbus_devclass, 0, 0); +DRIVER_MODULE(hidbus, usbhid, hidbus_driver, hidbus_devclass, 0, 0); diff --git a/sys/dev/usb/input/uhid.c b/sys/dev/usb/input/uhid.c index 0f87264b7033..dd463dd7de8c 100644 --- a/sys/dev/usb/input/uhid.c +++ b/sys/dev/usb/input/uhid.c @@ -911,4 +911,6 @@ DRIVER_MODULE(uhid, uhub, uhid_driver, uhid_devclass, NULL, 0); MODULE_DEPEND(uhid, usb, 1, 1, 1); MODULE_DEPEND(uhid, hid, 1, 1, 1); MODULE_VERSION(uhid, 1); +#ifndef USBHID_ENABLED USB_PNP_HOST_INFO(uhid_devs); +#endif diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index 3314a3b3e70f..0edacbefcbfc 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -2192,4 +2192,6 @@ MODULE_DEPEND(ukbd, hid, 1, 1, 1); MODULE_DEPEND(ukbd, evdev, 1, 1, 1); #endif MODULE_VERSION(ukbd, 1); +#ifndef USBHID_ENABLED USB_PNP_HOST_INFO(ukbd_devs); +#endif diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c index 6b7c3d526ad0..248478770942 100644 --- a/sys/dev/usb/input/ums.c +++ b/sys/dev/usb/input/ums.c @@ -1220,4 +1220,6 @@ MODULE_DEPEND(ums, hid, 1, 1, 1); MODULE_DEPEND(ums, evdev, 1, 1, 1); #endif MODULE_VERSION(ums, 1); +#ifndef USBHID_ENABLED USB_PNP_HOST_INFO(ums_devs); +#endif diff --git a/sys/dev/usb/input/usbhid.c b/sys/dev/usb/input/usbhid.c new file mode 100644 index 000000000000..ab856dc14d75 --- /dev/null +++ b/sys/dev/usb/input/usbhid.c @@ -0,0 +1,786 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * Copyright (c) 2019 Vladimir Kondratyev + * + * This code is derived from software contributed to The NetBSD Foundation + * by Lennart Augustsson (lennart@augustsson.net) at + * Carlstedt Research & Technology. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__FBSDID("$FreeBSD$"); + +/* + * HID spec: https://www.usb.org/sites/default/files/documents/hid1_11.pdf + */ + +#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 + +#define USB_DEBUG_VAR usbhid_debug +#include + +#include + +#include "hid_if.h" + +#ifdef USB_DEBUG +static int usbhid_debug = 0; + +static SYSCTL_NODE(_hw_usb, OID_AUTO, usbhid, CTLFLAG_RW, 0, "USB usbhid"); +SYSCTL_INT(_hw_usb_usbhid, OID_AUTO, debug, CTLFLAG_RWTUN, + &usbhid_debug, 0, "Debug level"); +#endif + +enum { + USBHID_INTR_OUT_DT, + USBHID_INTR_IN_DT, + USBHID_CTRL_DT, + USBHID_N_TRANSFER, +}; + +struct usbhid_xfer_ctx; +typedef int usbhid_callback_t(struct usbhid_xfer_ctx *xfer_ctx); + +union usbhid_device_request { + struct { /* INTR xfers */ + uint16_t maxlen; + uint16_t actlen; + } intr; + struct usb_device_request ctrl; /* CTRL xfers */ +}; + +/* Syncronous USB transfer context */ +struct usbhid_xfer_ctx { + union usbhid_device_request req; + uint8_t *buf; + int error; + usbhid_callback_t *cb; + void *cb_ctx; + int waiters; + bool influx; +}; + +struct usbhid_softc { + hid_intr_t *sc_intr_handler; + void *sc_intr_ctx; + void *sc_intr_buf; + + struct hid_device_info sc_hw; + + struct mtx sc_mtx; + struct usb_config sc_config[USBHID_N_TRANSFER]; + struct usb_xfer *sc_xfer[USBHID_N_TRANSFER]; + struct usbhid_xfer_ctx sc_xfer_ctx[USBHID_N_TRANSFER]; + + struct usb_device *sc_udev; + uint8_t sc_iface_no; + uint8_t sc_iface_index; +}; + +/* prototypes */ + +static device_probe_t usbhid_probe; +static device_attach_t usbhid_attach; +static device_detach_t usbhid_detach; + +static usb_callback_t usbhid_intr_out_callback; +static usb_callback_t usbhid_intr_in_callback; +static usb_callback_t usbhid_ctrl_callback; + +static usbhid_callback_t usbhid_intr_handler_cb; +static usbhid_callback_t usbhid_sync_wakeup_cb; + +static void +usbhid_intr_out_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct usbhid_xfer_ctx *xfer_ctx = usbd_xfer_softc(xfer); + struct usb_page_cache *pc; + int len; + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + case USB_ST_SETUP: +tr_setup: + len = xfer_ctx->req.intr.maxlen; + if (len == 0) { + if (USB_IN_POLLING_MODE_FUNC()) + xfer_ctx->error = 0; + return; + } + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_in(pc, 0, xfer_ctx->buf, len); + usbd_xfer_set_frame_len(xfer, 0, len); + usbd_transfer_submit(xfer); + xfer_ctx->req.intr.maxlen = 0; + if (USB_IN_POLLING_MODE_FUNC()) + return; + xfer_ctx->error = 0; + goto tr_exit; + + default: /* Error */ + if (error != USB_ERR_CANCELLED) { + /* try to clear stall first */ + usbd_xfer_set_stall(xfer); + goto tr_setup; + } + xfer_ctx->error = EIO; +tr_exit: + (void)xfer_ctx->cb(xfer_ctx); + return; + } +} + +static void +usbhid_intr_in_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct usbhid_xfer_ctx *xfer_ctx = usbd_xfer_softc(xfer); + struct usb_page_cache *pc; + int actlen; + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + DPRINTF("transferred!\n"); + + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_out(pc, 0, xfer_ctx->buf, actlen); + xfer_ctx->req.intr.actlen = actlen; + if (xfer_ctx->cb(xfer_ctx) != 0) + return; + + case USB_ST_SETUP: +re_submit: + usbd_xfer_set_frame_len(xfer, 0, xfer_ctx->req.intr.maxlen); + usbd_transfer_submit(xfer); + return; + + default: /* Error */ + if (error != USB_ERR_CANCELLED) { + /* try to clear stall first */ + usbd_xfer_set_stall(xfer); + goto re_submit; + } + return; + } +} + +static void +usbhid_ctrl_callback(struct usb_xfer *xfer, usb_error_t error) +{ + struct usbhid_xfer_ctx *xfer_ctx = usbd_xfer_softc(xfer); + struct usb_device_request *req = &xfer_ctx->req.ctrl; + struct usb_page_cache *pc; + int len = UGETW(req->wLength); + bool is_rd = (req->bmRequestType & UT_READ) != 0; + + switch (USB_GET_STATE(xfer)) { + case USB_ST_SETUP: + if (!is_rd && len != 0) { + pc = usbd_xfer_get_frame(xfer, 1); + usbd_copy_in(pc, 0, xfer_ctx->buf, len); + } + + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_in(pc, 0, req, sizeof(*req)); + usbd_xfer_set_frame_len(xfer, 0, sizeof(*req)); + if (len != 0) + usbd_xfer_set_frame_len(xfer, 1, len); + usbd_xfer_set_frames(xfer, len != 0 ? 2 : 1); + usbd_transfer_submit(xfer); + return; + + case USB_ST_TRANSFERRED: + if (is_rd && len != 0) { + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_out(pc, sizeof(*req), xfer_ctx->buf, len); + } + xfer_ctx->error = 0; + goto tr_exit; + + default: /* Error */ + /* bomb out */ + DPRINTFN(1, "error=%s\n", usbd_errstr(error)); + xfer_ctx->error = EIO; +tr_exit: + (void)xfer_ctx->cb(xfer_ctx); + return; + } +} + +static int +usbhid_intr_handler_cb(struct usbhid_xfer_ctx *xfer_ctx) +{ + struct usbhid_softc *sc = xfer_ctx->cb_ctx; + + sc->sc_intr_handler(sc->sc_intr_ctx, xfer_ctx->buf, + xfer_ctx->req.intr.actlen); + + return (0); +} + +static int +usbhid_sync_wakeup_cb(struct usbhid_xfer_ctx *xfer_ctx) +{ + + if (!USB_IN_POLLING_MODE_FUNC()) + wakeup(xfer_ctx->cb_ctx); + + return (ECANCELED); +} + +static const struct usb_config usbhid_config[USBHID_N_TRANSFER] = { + + [USBHID_INTR_OUT_DT] = { + .type = UE_INTERRUPT, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_OUT, + .flags = {.pipe_bof = 1,.proxy_buffer = 1}, + .callback = &usbhid_intr_out_callback, + }, + [USBHID_INTR_IN_DT] = { + .type = UE_INTERRUPT, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_IN, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,.proxy_buffer = 1}, + .callback = &usbhid_intr_in_callback, + }, + [USBHID_CTRL_DT] = { + .type = UE_CONTROL, + .endpoint = 0x00, /* Control pipe */ + .direction = UE_DIR_ANY, + .flags = {.proxy_buffer = 1}, + .callback = &usbhid_ctrl_callback, + .timeout = 1000, /* 1 second */ + }, +}; + +static void +usbhid_intr_setup(device_t dev, hid_intr_t intr, void *context, + struct hid_rdesc_info *rdesc) +{ + struct usbhid_softc* sc = device_get_softc(dev); + uint16_t n; + bool nowrite; + int error; + + sc->sc_intr_handler = intr; + sc->sc_intr_ctx = context; + bcopy(usbhid_config, sc->sc_config, sizeof(usbhid_config)); + + /* Set buffer sizes to match HID report sizes */ + sc->sc_config[USBHID_INTR_OUT_DT].bufsize = rdesc->osize; + sc->sc_config[USBHID_INTR_IN_DT].bufsize = rdesc->isize; + sc->sc_config[USBHID_CTRL_DT].bufsize = + MAX(rdesc->isize, MAX(rdesc->osize, rdesc->fsize)); + + nowrite = hid_test_quirk(&sc->sc_hw, HQ_NOWRITE); + + /* + * Setup the USB transfers one by one, so they are memory independent + * which allows for handling panics triggered by the HID drivers + * itself, typically by hkbd via CTRL+ALT+ESC sequences. Or if the HID + * keyboard driver was processing a key at the moment of panic. + */ + for (n = 0; n != USBHID_N_TRANSFER; n++) { + if (nowrite && n == USBHID_INTR_OUT_DT) + continue; + error = usbd_transfer_setup(sc->sc_udev, &sc->sc_iface_index, + sc->sc_xfer + n, sc->sc_config + n, 1, + (void *)(sc->sc_xfer_ctx + n), &sc->sc_mtx); + if (error) + break; + } + + if (error) + DPRINTF("error=%s\n", usbd_errstr(error)); + + rdesc->rdsize = usbd_xfer_max_len(sc->sc_xfer[USBHID_INTR_IN_DT]); + rdesc->grsize = usbd_xfer_max_len(sc->sc_xfer[USBHID_CTRL_DT]); + rdesc->srsize = rdesc->grsize; + rdesc->wrsize = nowrite ? rdesc->srsize : + usbd_xfer_max_len(sc->sc_xfer[USBHID_INTR_OUT_DT]); + + sc->sc_intr_buf = malloc(rdesc->rdsize, M_USBDEV, M_ZERO | M_WAITOK); +} + +static void +usbhid_intr_unsetup(device_t dev) +{ + struct usbhid_softc* sc = device_get_softc(dev); + + usbd_transfer_unsetup(sc->sc_xfer, USBHID_N_TRANSFER); + free(sc->sc_intr_buf, M_USBDEV); +} + +static int +usbhid_intr_start(device_t dev) +{ + struct usbhid_softc* sc = device_get_softc(dev); + + mtx_lock(&sc->sc_mtx); + sc->sc_xfer_ctx[USBHID_INTR_IN_DT] = (struct usbhid_xfer_ctx) { + .req.intr.maxlen = + usbd_xfer_max_len(sc->sc_xfer[USBHID_INTR_IN_DT]), + .cb = usbhid_intr_handler_cb, + .cb_ctx = sc, + .buf = sc->sc_intr_buf, + }; + usbd_transfer_start(sc->sc_xfer[USBHID_INTR_IN_DT]); + mtx_unlock(&sc->sc_mtx); + + return (0); +} + +static int +usbhid_intr_stop(device_t dev) +{ + struct usbhid_softc* sc = device_get_softc(dev); + + usbd_transfer_drain(sc->sc_xfer[USBHID_INTR_IN_DT]); + usbd_transfer_drain(sc->sc_xfer[USBHID_INTR_OUT_DT]); + + return (0); +} + +static void +usbhid_intr_poll(device_t dev) +{ + struct usbhid_softc* sc = device_get_softc(dev); + + usbd_transfer_poll(sc->sc_xfer + USBHID_INTR_IN_DT, 1); +} + +/* + * HID interface + */ +static int +usbhid_sync_xfer(struct usbhid_softc* sc, int xfer_idx, + union usbhid_device_request *req, void *buf) +{ + int error, timeout; + struct usbhid_xfer_ctx *xfer_ctx, save; + + xfer_ctx = sc->sc_xfer_ctx + xfer_idx; + + if (USB_IN_POLLING_MODE_FUNC()) { + save = *xfer_ctx; + } else { + mtx_lock(&sc->sc_mtx); + ++xfer_ctx->waiters; + while (xfer_ctx->influx) + mtx_sleep(&xfer_ctx->waiters, &sc->sc_mtx, 0, + "usbhid wt", 0); + --xfer_ctx->waiters; + xfer_ctx->influx = true; + } + + xfer_ctx->buf = buf; + xfer_ctx->req = *req; + xfer_ctx->error = ETIMEDOUT; + xfer_ctx->cb = &usbhid_sync_wakeup_cb; + xfer_ctx->cb_ctx = xfer_ctx; + timeout = USB_DEFAULT_TIMEOUT; + usbd_transfer_start(sc->sc_xfer[xfer_idx]); + + if (USB_IN_POLLING_MODE_FUNC()) + while (timeout > 0 && xfer_ctx->error == ETIMEDOUT) { + usbd_transfer_poll(sc->sc_xfer + xfer_idx, 1); + DELAY(1000); + timeout--; + } + else + msleep_sbt(xfer_ctx, &sc->sc_mtx, 0, "usbhid io", + SBT_1MS * timeout, 0, C_HARDCLOCK); + + /* Perform usbhid_write() asyncronously to improve pipelining */ + if (USB_IN_POLLING_MODE_FUNC() || xfer_ctx->error != 0 || + sc->sc_config[xfer_idx].type != UE_INTERRUPT || + sc->sc_config[xfer_idx].direction != UE_DIR_OUT) + usbd_transfer_stop(sc->sc_xfer[xfer_idx]); + error = xfer_ctx->error; + if (error == 0) + *req = xfer_ctx->req; + + if (USB_IN_POLLING_MODE_FUNC()) { + *xfer_ctx = save; + } else { + xfer_ctx->influx = false; + if (xfer_ctx->waiters != 0) + wakeup_one(&xfer_ctx->waiters); + mtx_unlock(&sc->sc_mtx); + } + + if (error) + DPRINTF("USB IO error:%d\n", error); + + return (error); +} + +static int +usbhid_get_rdesc(device_t dev, void *buf, hid_size_t len) +{ + struct usbhid_softc* sc = device_get_softc(dev); + int error; + + error = usbd_req_get_report_descriptor(sc->sc_udev, NULL, + buf, len, sc->sc_iface_index); + + if (error) + DPRINTF("no report descriptor: %s\n", usbd_errstr(error)); + + return (error == 0 ? 0 : ENXIO); +} + +static int +usbhid_get_report(device_t dev, void *buf, hid_size_t maxlen, + hid_size_t *actlen, uint8_t type, uint8_t id) +{ + struct usbhid_softc* sc = device_get_softc(dev); + union usbhid_device_request req; + int error; + + if (maxlen > usbd_xfer_max_len(sc->sc_xfer[USBHID_CTRL_DT])) + return (ENOBUFS); + + req.ctrl.bmRequestType = UT_READ_CLASS_INTERFACE; + req.ctrl.bRequest = UR_GET_REPORT; + USETW2(req.ctrl.wValue, type, id); + req.ctrl.wIndex[0] = sc->sc_iface_no; + req.ctrl.wIndex[1] = 0; + USETW(req.ctrl.wLength, maxlen); + + error = usbhid_sync_xfer(sc, USBHID_CTRL_DT, &req, buf); + if (!error && actlen != NULL) + *actlen = maxlen; + + return (error); +} + +static int +usbhid_set_report(device_t dev, const void *buf, hid_size_t len, uint8_t type, + uint8_t id) +{ + struct usbhid_softc* sc = device_get_softc(dev); + union usbhid_device_request req; + + if (len > usbd_xfer_max_len(sc->sc_xfer[USBHID_CTRL_DT])) + return (ENOBUFS); + + req.ctrl.bmRequestType = UT_WRITE_CLASS_INTERFACE; + req.ctrl.bRequest = UR_SET_REPORT; + USETW2(req.ctrl.wValue, type, id); + req.ctrl.wIndex[0] = sc->sc_iface_no; + req.ctrl.wIndex[1] = 0; + USETW(req.ctrl.wLength, len); + + return (usbhid_sync_xfer(sc, USBHID_CTRL_DT, &req, + __DECONST(void *, buf))); +} + +static int +usbhid_read(device_t dev, void *buf, hid_size_t maxlen, hid_size_t *actlen) +{ + struct usbhid_softc* sc = device_get_softc(dev); + union usbhid_device_request req; + int error; + + if (maxlen > usbd_xfer_max_len(sc->sc_xfer[USBHID_INTR_IN_DT])) + return (ENOBUFS); + + req.intr.maxlen = maxlen; + error = usbhid_sync_xfer(sc, USBHID_INTR_IN_DT, &req, buf); + if (error == 0 && actlen != NULL) + *actlen = req.intr.actlen; + + return (error); +} + +static int +usbhid_write(device_t dev, const void *buf, hid_size_t len) +{ + struct usbhid_softc* sc = device_get_softc(dev); + union usbhid_device_request req; + + if (len > usbd_xfer_max_len(sc->sc_xfer[USBHID_INTR_OUT_DT])) + return (ENOBUFS); + + req.intr.maxlen = len; + return (usbhid_sync_xfer(sc, USBHID_INTR_OUT_DT, &req, + __DECONST(void *, buf))); +} + +static int +usbhid_set_idle(device_t dev, uint16_t duration, uint8_t id) +{ + struct usbhid_softc* sc = device_get_softc(dev); + union usbhid_device_request req; + + /* Duration is measured in 4 milliseconds per unit. */ + req.ctrl.bmRequestType = UT_WRITE_CLASS_INTERFACE; + req.ctrl.bRequest = UR_SET_IDLE; + USETW2(req.ctrl.wValue, (duration + 3) / 4, id); + req.ctrl.wIndex[0] = sc->sc_iface_no; + req.ctrl.wIndex[1] = 0; + USETW(req.ctrl.wLength, 0); + + return (usbhid_sync_xfer(sc, USBHID_CTRL_DT, &req, NULL)); +} + +static int +usbhid_set_protocol(device_t dev, uint16_t protocol) +{ + struct usbhid_softc* sc = device_get_softc(dev); + union usbhid_device_request req; + + req.ctrl.bmRequestType = UT_WRITE_CLASS_INTERFACE; + req.ctrl.bRequest = UR_SET_PROTOCOL; + USETW(req.ctrl.wValue, protocol); + req.ctrl.wIndex[0] = sc->sc_iface_no; + req.ctrl.wIndex[1] = 0; + USETW(req.ctrl.wLength, 0); + + return (usbhid_sync_xfer(sc, USBHID_CTRL_DT, &req, NULL)); +} + +static void +usbhid_init_device_info(struct usb_attach_arg *uaa, struct hid_device_info *hw) +{ + + hw->idBus = BUS_USB; + hw->idVendor = uaa->info.idVendor; + hw->idProduct = uaa->info.idProduct; + hw->idVersion = uaa->info.bcdDevice; + + /* Set various quirks based on usb_attach_arg */ + hid_add_dynamic_quirk(hw, USB_GET_DRIVER_INFO(uaa)); +} + +static void +usbhid_fill_device_info(struct usb_attach_arg *uaa, struct hid_device_info *hw) +{ + struct usb_device *udev = uaa->device; + struct usb_interface *iface = uaa->iface; + struct usb_hid_descriptor *hid; + struct usb_endpoint *ep; + + snprintf(hw->name, sizeof(hw->name), "%s %s", + usb_get_manufacturer(udev), usb_get_product(udev)); + strlcpy(hw->serial, usb_get_serial(udev), sizeof(hw->serial)); + + if (uaa->info.bInterfaceClass == UICLASS_HID && + iface != NULL && iface->idesc != NULL) { + hid = hid_get_descriptor_from_usb( + usbd_get_config_descriptor(udev), iface->idesc); + if (hid != NULL) + hw->rdescsize = + UGETW(hid->descrs[0].wDescriptorLength); + } + + /* See if there is a interrupt out endpoint. */ + ep = usbd_get_endpoint(udev, uaa->info.bIfaceIndex, + usbhid_config + USBHID_INTR_OUT_DT); + if (ep == NULL || ep->methods == NULL) + hid_add_dynamic_quirk(hw, HQ_NOWRITE); +} + +static const STRUCT_USB_HOST_ID usbhid_devs[] = { + /* the Xbox 360 gamepad doesn't use the HID class */ + {USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(UISUBCLASS_XBOX360_CONTROLLER), + USB_IFACE_PROTOCOL(UIPROTO_XBOX360_GAMEPAD), + USB_DRIVER_INFO(HQ_IS_XBOX360GP)}, + /* HID keyboard with boot protocol support */ + {USB_IFACE_CLASS(UICLASS_HID), + USB_IFACE_SUBCLASS(UISUBCLASS_BOOT), + USB_IFACE_PROTOCOL(UIPROTO_BOOT_KEYBOARD), + USB_DRIVER_INFO(HQ_HAS_KBD_BOOTPROTO)}, + /* HID mouse with boot protocol support */ + {USB_IFACE_CLASS(UICLASS_HID), + USB_IFACE_SUBCLASS(UISUBCLASS_BOOT), + USB_IFACE_PROTOCOL(UIPROTO_MOUSE), + USB_DRIVER_INFO(HQ_HAS_MS_BOOTPROTO)}, + /* generic HID class */ + {USB_IFACE_CLASS(UICLASS_HID), USB_DRIVER_INFO(HQ_NONE)}, +}; + +static int +usbhid_probe(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct usbhid_softc *sc = device_get_softc(dev); + int error; + + DPRINTFN(11, "\n"); + + if (uaa->usb_mode != USB_MODE_HOST) + return (ENXIO); + + error = usbd_lookup_id_by_uaa(usbhid_devs, sizeof(usbhid_devs), uaa); + if (error) + return (error); + + if (usb_test_quirk(uaa, UQ_HID_IGNORE)) + return (ENXIO); + + /* + * Setup temporary hid_device_info so that we can figure out some + * basic quirks for this device. + */ + usbhid_init_device_info(uaa, &sc->sc_hw); + + if (hid_test_quirk(&sc->sc_hw, HQ_HID_IGNORE)) + return (ENXIO); + +#ifdef USBHID_ENABLED + return (BUS_PROBE_GENERIC + 1); +#else + return (BUS_PROBE_GENERIC - 1); +#endif +} + +static int +usbhid_attach(device_t dev) +{ + struct usb_attach_arg *uaa = device_get_ivars(dev); + struct usbhid_softc *sc = device_get_softc(dev); + device_t child; + int error = 0; + + DPRINTFN(10, "sc=%p\n", sc); + + device_set_usb_desc(dev); + + sc->sc_udev = uaa->device; + sc->sc_iface_no = uaa->info.bIfaceNum; + sc->sc_iface_index = uaa->info.bIfaceIndex; + + usbhid_fill_device_info(uaa, &sc->sc_hw); + + error = usbd_req_set_idle(uaa->device, NULL, + uaa->info.bIfaceIndex, 0, 0); + if (error) + DPRINTF("set idle failed, error=%s (ignored)\n", + usbd_errstr(error)); + + mtx_init(&sc->sc_mtx, "usbhid lock", NULL, MTX_DEF); + + child = device_add_child(dev, "hidbus", -1); + if (child == NULL) { + device_printf(dev, "Could not add hidbus device\n"); + usbhid_detach(dev); + return (ENOMEM); + } + + device_set_ivars(child, &sc->sc_hw); + error = bus_generic_attach(dev); + if (error) { + device_printf(dev, "failed to attach child: %d\n", error); + usbhid_detach(dev); + return (error); + } + + return (0); /* success */ +} + +static int +usbhid_detach(device_t dev) +{ + struct usbhid_softc *sc = device_get_softc(dev); + + device_delete_children(dev); + mtx_destroy(&sc->sc_mtx); + + return (0); +} + +static devclass_t usbhid_devclass; + +static device_method_t usbhid_methods[] = { + DEVMETHOD(device_probe, usbhid_probe), + DEVMETHOD(device_attach, usbhid_attach), + DEVMETHOD(device_detach, usbhid_detach), + + DEVMETHOD(hid_intr_setup, usbhid_intr_setup), + DEVMETHOD(hid_intr_unsetup, usbhid_intr_unsetup), + DEVMETHOD(hid_intr_start, usbhid_intr_start), + DEVMETHOD(hid_intr_stop, usbhid_intr_stop), + DEVMETHOD(hid_intr_poll, usbhid_intr_poll), + + /* HID interface */ + DEVMETHOD(hid_get_rdesc, usbhid_get_rdesc), + DEVMETHOD(hid_read, usbhid_read), + DEVMETHOD(hid_write, usbhid_write), + DEVMETHOD(hid_get_report, usbhid_get_report), *** 87 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 036034DE956; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@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 4DBj032dQDz4SbJ; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 335D319157; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKppF063184; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpYb063183; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpYb063183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 10fbbdfbbd65 - main - hid: Import hconf(4) - digitizer configuration top-level collection support. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 10fbbdfbbd65eb076e136385a891015496f5171e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:57 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=10fbbdfbbd65eb076e136385a891015496f5171e commit 10fbbdfbbd65eb076e136385a891015496f5171e Author: Vladimir Kondratyev AuthorDate: 2020-10-10 21:45:17 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:43 +0000 hid: Import hconf(4) - digitizer configuration top-level collection support. Reviewed by: hselasky (as part of D27990) --- share/man/man4/Makefile | 1 + share/man/man4/hconf.4 | 90 +++++++++++ sys/conf/files | 1 + sys/dev/hid/hconf.c | 331 +++++++++++++++++++++++++++++++++++++++++ sys/dev/hid/hconf.h | 41 +++++ sys/modules/hid/Makefile | 3 + sys/modules/hid/hconf/Makefile | 9 ++ 7 files changed, 476 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index f18e93152353..477ea009a153 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -179,6 +179,7 @@ MAN= aac.4 \ gpioths.4 \ gre.4 \ h_ertt.4 \ + hconf.4 \ hidbus.4 \ hidquirk.4 \ hifn.4 \ diff --git a/share/man/man4/hconf.4 b/share/man/man4/hconf.4 new file mode 100644 index 000000000000..4d595e9f1c6c --- /dev/null +++ b/share/man/man4/hconf.4 @@ -0,0 +1,90 @@ +.\" Copyright (c) 2020 Vladimir Kondratyev +.\" +.\" 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 September 14, 2020 +.Dt HCONF 4 +.Os +.Sh NAME +.Nm hconf +.Nd MS Windows Precision Touchpad configuration driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device hconf" +.Cd "device hid" +.Cd "device hidbus" +.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 +hconf_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for generic MS Windows Precision Touchpad +configuration collection. +It enables the host to configure two different aspects of the device. +One allows the host to select input mode, and the other allows the host to be +selective in what is reported. +.Sh SYSCTL VARIABLES +Next parameters are available as +.Xr sysctl 8 +variables. +Debug parameter is available as +.Xr loader 8 +tunable as well. +.Bl -tag -width indent +.It Va dev.hmt.*.input_mode +HID device input mode: 0 = mouse, 3 = touchpad. +.It Va dev.hmt.*.surface_switch +Enable / disable switch for surface: 1 = on, 0 = off. +.It Va dev.hmt.*.buttons_switch +Enable / disable switch for buttons: 1 = on, 0 = off. +.It Va hw.hid.hconf.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Sh SEE ALSO +.Xr hms 4 , +.Xr hmt 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0. +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . +Switch parameter support was added by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . diff --git a/sys/conf/files b/sys/conf/files index 6dd4e95815d1..bd6b510f204c 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1815,6 +1815,7 @@ dev/gpio/gpio_if.m optional gpio dev/gpio/gpiobus_if.m optional gpio dev/gpio/gpiopps.c optional gpiopps fdt dev/gpio/ofw_gpiobus.c optional fdt gpio +dev/hid/hconf.c optional hconf dev/hid/hid.c optional hid dev/hid/hid_if.m optional hid dev/hid/hidbus.c optional hidbus diff --git a/sys/dev/hid/hconf.c b/sys/dev/hid/hconf.c new file mode 100644 index 000000000000..71650421ee33 --- /dev/null +++ b/sys/dev/hid/hconf.c @@ -0,0 +1,331 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Vladimir Kondratyev + * + * 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 +__FBSDID("$FreeBSD$"); + +/* + * Digitizer configuration top-level collection support. + * https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-required-hid-top-level-collections + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define HID_DEBUG_VAR hconf_debug +#include +#include + +#include + +#ifdef HID_DEBUG +static int hconf_debug = 0; + +static SYSCTL_NODE(_hw_hid, OID_AUTO, hconf, CTLFLAG_RW, 0, + "Digitizer configuration top-level collection"); +SYSCTL_INT(_hw_hid_hconf, OID_AUTO, debug, CTLFLAG_RWTUN, + &hconf_debug, 1, "Debug level"); +#endif + +enum feature_control_type { + INPUT_MODE = 0, + SURFACE_SWITCH, + BUTTONS_SWITCH, + CONTROLS_COUNT +}; + +struct feature_control_descr { + const char *name; + const char *descr; + uint16_t usage; +} feature_control_descrs[] = { + [INPUT_MODE] = { + .name = "input_mode", + .descr = "HID device input mode: 0 = mouse, 3 = touchpad", + .usage = HUD_INPUT_MODE + }, + [SURFACE_SWITCH] = { + .name = "surface_switch", + .descr = "Enable / disable switch for surface: 1 = on, 0 = off", + .usage = HUD_SURFACE_SWITCH + }, + [BUTTONS_SWITCH] = { + .name = "buttons_switch", + .descr = "Enable / disable switch for buttons: 1 = on, 0 = off", + .usage = HUD_BUTTONS_SWITCH + }, +}; + +struct feature_control { + u_int val; + struct hid_location loc; + hid_size_t rlen; + uint8_t rid; +}; + +struct hconf_softc { + device_t dev; + struct sx lock; + + struct feature_control feature_controls[CONTROLS_COUNT]; +}; + +static device_probe_t hconf_probe; +static device_attach_t hconf_attach; +static device_detach_t hconf_detach; +static device_resume_t hconf_resume; + +static devclass_t hconf_devclass; + +static device_method_t hconf_methods[] = { + + DEVMETHOD(device_probe, hconf_probe), + DEVMETHOD(device_attach, hconf_attach), + DEVMETHOD(device_detach, hconf_detach), + DEVMETHOD(device_resume, hconf_resume), + + DEVMETHOD_END +}; + +static driver_t hconf_driver = { + .name = "hconf", + .methods = hconf_methods, + .size = sizeof(struct hconf_softc), +}; + +static const struct hid_device_id hconf_devs[] = { + { HID_TLC(HUP_DIGITIZERS, HUD_CONFIG) }, +}; + +static int +hconf_set_feature_control(struct hconf_softc *sc, int ctrl_id, u_int val) +{ + struct feature_control *fc; + uint8_t *fbuf; + int error; + int i; + + KASSERT(ctrl_id >= 0 && ctrl_id < CONTROLS_COUNT, + ("impossible ctrl id %d", ctrl_id)); + fc = &sc->feature_controls[ctrl_id]; + if (fc->rlen <= 1) + return (ENXIO); + + fbuf = malloc(fc->rlen, M_TEMP, M_WAITOK | M_ZERO); + sx_xlock(&sc->lock); + + /* Reports are not strictly required to be readable */ + error = hid_get_report(sc->dev, fbuf, fc->rlen, NULL, + HID_FEATURE_REPORT, fc->rid); + + /* + * If the report is write-only, then we have to check for other controls + * that may share the same report and set their bits as well. + */ + if (error != 0) { + bzero(fbuf + 1, fc->rlen - 1); + for (i = 0; i < nitems(sc->feature_controls); i++) { + struct feature_control *ofc = &sc->feature_controls[i]; + + /* Skip unrelated report IDs. */ + if (ofc->rid != fc->rid) + continue; + /* Skip self. */ + if (ofc == fc) + continue; + KASSERT(fc->rlen == ofc->rlen, + ("different lengths for report %d: %d vs %d\n", + fc->rid, fc->rlen, ofc->rlen)); + hid_put_udata(fbuf + 1, ofc->rlen - 1, &ofc->loc, + ofc->val); + } + } + + fbuf[0] = fc->rid; + hid_put_udata(fbuf + 1, fc->rlen - 1, &fc->loc, val); + + error = hid_set_report(sc->dev, fbuf, fc->rlen, + HID_FEATURE_REPORT, fc->rid); + if (error == 0) + fc->val = val; + + sx_unlock(&sc->lock); + free(fbuf, M_TEMP); + + return (error); +} + +static int +hconf_feature_control_handler(SYSCTL_HANDLER_ARGS) +{ + struct feature_control *fc; + struct hconf_softc *sc = arg1; + int ctrl_id = arg2; + u_int value; + int error; + + if (ctrl_id < 0 || ctrl_id >= CONTROLS_COUNT) + return (ENXIO); + + fc = &sc->feature_controls[ctrl_id]; + value = fc->val; + error = sysctl_handle_int(oidp, &value, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + + error = hconf_set_feature_control(sc, ctrl_id, value); + if (error != 0) { + DPRINTF("Failed to set %s: %d\n", + feature_control_descrs[ctrl_id].name, error); + } + return (0); +} + + +static int +hconf_parse_feature(struct feature_control *fc, uint8_t tlc_index, + uint16_t usage, void *d_ptr, hid_size_t d_len) +{ + uint32_t flags; + + if (!hidbus_locate(d_ptr, d_len, HID_USAGE2(HUP_DIGITIZERS, usage), + hid_feature, tlc_index, 0, &fc->loc, &flags, &fc->rid, NULL)) + return (ENOENT); + + if ((flags & (HIO_VARIABLE | HIO_RELATIVE)) != HIO_VARIABLE) + return (EINVAL); + + fc->rlen = hid_report_size(d_ptr, d_len, hid_feature, fc->rid); + return (0); +} + +static int +hconf_probe(device_t dev) +{ + int error; + + error = HIDBUS_LOOKUP_DRIVER_INFO(dev, hconf_devs); + if (error != 0) + return (error); + + hidbus_set_desc(dev, "Configuration"); + + return (BUS_PROBE_DEFAULT); +} + +static int +hconf_attach(device_t dev) +{ + struct hconf_softc *sc = device_get_softc(dev); + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev); + struct sysctl_oid *tree = device_get_sysctl_tree(dev); + void *d_ptr; + hid_size_t d_len; + uint8_t tlc_index; + int error; + int i; + + error = hid_get_report_descr(dev, &d_ptr, &d_len); + if (error) { + device_printf(dev, "could not retrieve report descriptor from " + "device: %d\n", error); + return (ENXIO); + } + + sc->dev = dev; + sx_init(&sc->lock, device_get_nameunit(dev)); + + tlc_index = hidbus_get_index(dev); + for (i = 0; i < nitems(sc->feature_controls); i++) { + (void)hconf_parse_feature(&sc->feature_controls[i], tlc_index, + feature_control_descrs[i].usage, d_ptr, d_len); + if (sc->feature_controls[i].rlen > 1) { + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + feature_control_descrs[i].name, + CTLTYPE_UINT | CTLFLAG_RW, + sc, i, hconf_feature_control_handler, "I", + feature_control_descrs[i].descr); + } + } + + /* Fully enable (at least, try to). */ + (void)hconf_set_feature_control(sc, SURFACE_SWITCH, 1); + (void)hconf_set_feature_control(sc, BUTTONS_SWITCH, 1); + return (0); +} + +static int +hconf_detach(device_t dev) +{ + struct hconf_softc *sc = device_get_softc(dev); + + sx_destroy(&sc->lock); + + return (0); +} + +static int +hconf_resume(device_t dev) +{ + struct hconf_softc *sc = device_get_softc(dev); + int error; + int i; + + for (i = 0; i < nitems(sc->feature_controls); i++) { + if (sc->feature_controls[i].rlen < 2) + continue; + error = hconf_set_feature_control(sc, i, + sc->feature_controls[i].val); + if (error != 0) { + DPRINTF("Failed to restore %s: %d\n", + feature_control_descrs[i].name, error); + } + } + + return (0); +} + +int +hconf_set_input_mode(device_t dev, enum hconf_input_mode mode) +{ + struct hconf_softc *sc = device_get_softc(dev); + + return (hconf_set_feature_control(sc, INPUT_MODE, mode)); +} + +DRIVER_MODULE(hconf, hidbus, hconf_driver, hconf_devclass, NULL, 0); +MODULE_DEPEND(hconf, hidbus, 1, 1, 1); +MODULE_DEPEND(hconf, hid, 1, 1, 1); +MODULE_VERSION(hconf, 1); +HID_PNP_INFO(hconf_devs); diff --git a/sys/dev/hid/hconf.h b/sys/dev/hid/hconf.h new file mode 100644 index 000000000000..2bbcbb3892b3 --- /dev/null +++ b/sys/dev/hid/hconf.h @@ -0,0 +1,41 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Vladimir Kondratyev + * + * 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 _HCONF_H_ +#define _HCONF_H_ + +enum hconf_input_mode { + HCONF_INPUT_MODE_MOUSE = 0x0, + HCONF_INPUT_MODE_MT_TOUCHSCREEN = 0x2, + HCONF_INPUT_MODE_MT_TOUCHPAD = 0x3, +}; + +int hconf_set_input_mode(device_t, enum hconf_input_mode); + +#endif /* _HCONF_H_ */ diff --git a/sys/modules/hid/Makefile b/sys/modules/hid/Makefile index 8d6f7f221e4f..e7492187711d 100644 --- a/sys/modules/hid/Makefile +++ b/sys/modules/hid/Makefile @@ -5,4 +5,7 @@ SUBDIR = \ hidbus \ hidquirk +SUBDIR += \ + hconf + .include diff --git a/sys/modules/hid/hconf/Makefile b/sys/modules/hid/hconf/Makefile new file mode 100644 index 000000000000..1e5c68fe1848 --- /dev/null +++ b/sys/modules/hid/hconf/Makefile @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/hid + +KMOD= hconf +SRCS= hconf.c +SRCS+= bus_if.h device_if.h + +.include From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 57D764DEB26; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@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 4DBj030x48z4Sp2; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E836818F56; Thu, 7 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKopT063099; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKoS6063098; Thu, 7 Jan 2021 23:20:50 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:50 GMT Message-Id: <202101072320.107NKoS6063098@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 2775d1d5d1ef - main - hkbd(4): Split driver lock on interrupt and syscons locks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2775d1d5d1efeed02f4a805a86f89ee96d68006b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:52 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=2775d1d5d1efeed02f4a805a86f89ee96d68006b commit 2775d1d5d1efeed02f4a805a86f89ee96d68006b Author: Vladimir Kondratyev AuthorDate: 2020-11-09 19:25:14 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:43 +0000 hkbd(4): Split driver lock on interrupt and syscons locks This allows to mark HID-device interrupt handlers as MP-SAFE. Atomics-based lockless key event queue with swi_giant taskqueue is used to pass key-press events into Giant-protected system console. Reviewed by: hselasky (as part of D27991) --- sys/dev/hid/hkbd.c | 164 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 95 insertions(+), 69 deletions(-) diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index 321a51734664..63dd626cdef9 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -63,6 +63,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include + +#include #define HID_DEBUG_VAR hkbd_debug #include @@ -139,6 +142,8 @@ struct hkbd_softc { struct hid_location sc_loc_numlock; struct hid_location sc_loc_capslock; struct hid_location sc_loc_scrolllock; + struct mtx sc_mtx; + struct task sc_task; struct callout sc_callout; struct hkbd_data sc_ndata; struct hkbd_data sc_odata; @@ -178,9 +183,8 @@ struct hkbd_softc { int sc_led_size; int sc_kbd_size; - uint16_t sc_inputs; - uint16_t sc_inputhead; - uint16_t sc_inputtail; + uint32_t sc_inputhead; + uint32_t sc_inputtail; uint8_t sc_iface_index; uint8_t sc_iface_no; @@ -211,15 +215,27 @@ struct hkbd_softc { SCAN_PREFIX_CTL | SCAN_PREFIX_SHIFT) #define SCAN_CHAR(c) ((c) & 0x7f) -#define HKBD_LOCK() do { \ +#define HKBD_LOCK(sc) do { \ + if (!HID_IN_POLLING_MODE()) \ + mtx_lock(&(sc)->sc_mtx); \ +} while (0) +#define HKBD_UNLOCK(sc) do { \ + if (!HID_IN_POLLING_MODE()) \ + mtx_unlock(&(sc)->sc_mtx); \ +} while (0) +#define HKBD_LOCK_ASSERT(sc) do { \ + if (!HID_IN_POLLING_MODE()) \ + mtx_assert(&(sc)->sc_mtx, MA_OWNED); \ +} while (0) +#define SYSCONS_LOCK() do { \ if (!HID_IN_POLLING_MODE()) \ mtx_lock(&Giant); \ } while (0) -#define HKBD_UNLOCK() do { \ +#define SYSCONS_UNLOCK() do { \ if (!HID_IN_POLLING_MODE()) \ mtx_unlock(&Giant); \ } while (0) -#define HKBD_LOCK_ASSERT() do { \ +#define SYSCONS_LOCK_ASSERT() do { \ if (!HID_IN_POLLING_MODE()) \ mtx_assert(&Giant, MA_OWNED); \ } while (0) @@ -292,15 +308,16 @@ static int hkbd_ioctl(keyboard_t *, u_long, caddr_t); static int hkbd_enable(keyboard_t *); static int hkbd_disable(keyboard_t *); static void hkbd_interrupt(struct hkbd_softc *); -static void hkbd_event_keyinput(struct hkbd_softc *); -static device_probe_t hkbd_probe; -static device_attach_t hkbd_attach; -static device_detach_t hkbd_detach; -static device_resume_t hkbd_resume; +static task_fn_t hkbd_event_keyinput; + +static device_probe_t hkbd_probe; +static device_attach_t hkbd_attach; +static device_detach_t hkbd_detach; +static device_resume_t hkbd_resume; #ifdef EVDEV_SUPPORT -static evdev_event_t hkbd_ev_event; +static evdev_event_t hkbd_ev_event; static const struct evdev_methods hkbd_evdev_methods = { .ev_event = hkbd_ev_event, @@ -365,8 +382,9 @@ hkbd_start_timer(struct hkbd_softc *sc) static void hkbd_put_key(struct hkbd_softc *sc, uint32_t key) { + uint32_t tail; - HKBD_LOCK_ASSERT(); + HKBD_LOCK_ASSERT(sc); DPRINTF("0x%02x (%d) %s\n", key, key, (key & KEY_RELEASE) ? "released" : "pressed"); @@ -377,13 +395,10 @@ hkbd_put_key(struct hkbd_softc *sc, uint32_t key) evdev_hid2key(KEY_INDEX(key)), !(key & KEY_RELEASE)); #endif - if (sc->sc_inputs < HKBD_IN_BUF_SIZE) { + tail = (sc->sc_inputtail + 1) % HKBD_IN_BUF_SIZE; + if (tail != atomic_load_acq_32(&sc->sc_inputhead)) { sc->sc_input[sc->sc_inputtail] = key; - ++(sc->sc_inputs); - ++(sc->sc_inputtail); - if (sc->sc_inputtail >= HKBD_IN_BUF_SIZE) { - sc->sc_inputtail = 0; - } + atomic_store_rel_32(&sc->sc_inputtail, tail); } else { DPRINTF("input buffer is full\n"); } @@ -393,7 +408,7 @@ static void hkbd_do_poll(struct hkbd_softc *sc, uint8_t wait) { - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); KASSERT((sc->sc_flags & HKBD_FLAG_POLLING) != 0, ("hkbd_do_poll called when not polling\n")); DPRINTFN(2, "polling\n"); @@ -406,7 +421,8 @@ hkbd_do_poll(struct hkbd_softc *sc, uint8_t wait) * Note that we currently hold the Giant, but it's also used * as the transfer mtx, so we must release it while waiting. */ - while (sc->sc_inputs == 0) { + while (sc->sc_inputhead == + atomic_load_acq_32(&sc->sc_inputtail)) { /* * Give USB threads a chance to run. Note that * kern_yield performs DROP_GIANT + PICKUP_GIANT. @@ -418,7 +434,7 @@ hkbd_do_poll(struct hkbd_softc *sc, uint8_t wait) return; } - while (sc->sc_inputs == 0) { + while (sc->sc_inputhead == sc->sc_inputtail) { hidbus_intr_poll(sc->sc_dev); /* Delay-optimised support for repetition of keys */ @@ -440,9 +456,10 @@ hkbd_do_poll(struct hkbd_softc *sc, uint8_t wait) static int32_t hkbd_get_key(struct hkbd_softc *sc, uint8_t wait) { + uint32_t head; int32_t c; - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); KASSERT(!HID_IN_POLLING_MODE() || (sc->sc_flags & HKBD_FLAG_POLLING) != 0, ("not polling in kdb or panic\n")); @@ -450,15 +467,13 @@ hkbd_get_key(struct hkbd_softc *sc, uint8_t wait) if (sc->sc_flags & HKBD_FLAG_POLLING) hkbd_do_poll(sc, wait); - if (sc->sc_inputs == 0) { + head = sc->sc_inputhead; + if (head == atomic_load_acq_32(&sc->sc_inputtail)) { c = -1; } else { - c = sc->sc_input[sc->sc_inputhead]; - --(sc->sc_inputs); - ++(sc->sc_inputhead); - if (sc->sc_inputhead >= HKBD_IN_BUF_SIZE) { - sc->sc_inputhead = 0; - } + c = sc->sc_input[head]; + head = (head + 1) % HKBD_IN_BUF_SIZE; + atomic_store_rel_32(&sc->sc_inputhead, head); } return (c); } @@ -469,7 +484,7 @@ hkbd_interrupt(struct hkbd_softc *sc) const uint32_t now = sc->sc_time_ms; unsigned key; - HKBD_LOCK_ASSERT(); + HKBD_LOCK_ASSERT(sc); /* Check for key changes, the order is: * 1. Modifier keys down @@ -548,20 +563,22 @@ hkbd_interrupt(struct hkbd_softc *sc) #endif /* wakeup keyboard system */ - hkbd_event_keyinput(sc); + if (!HID_IN_POLLING_MODE()) + taskqueue_enqueue(taskqueue_swi_giant, &sc->sc_task); } static void -hkbd_event_keyinput(struct hkbd_softc *sc) +hkbd_event_keyinput(void *context, int pending) { + struct hkbd_softc *sc = context; int c; - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); if ((sc->sc_flags & HKBD_FLAG_POLLING) != 0) return; - if (sc->sc_inputs == 0) + if (sc->sc_inputhead == atomic_load_acq_32(&sc->sc_inputtail)) return; if (KBD_IS_ACTIVE(&sc->sc_kbd) && @@ -583,7 +600,7 @@ hkbd_timeout(void *arg) struct hkbd_softc *sc = arg; struct epoch_tracker et; - HKBD_LOCK_ASSERT(); + HKBD_LOCK_ASSERT(sc); sc->sc_time_ms += sc->sc_delay; sc->sc_delay = 0; @@ -593,9 +610,10 @@ hkbd_timeout(void *arg) epoch_exit_preempt(INPUT_EPOCH, &et); /* Make sure any leftover key events gets read out */ - hkbd_event_keyinput(sc); + taskqueue_enqueue(taskqueue_swi_giant, &sc->sc_task); - if (hkbd_any_key_pressed(sc) || (sc->sc_inputs != 0)) { + if (hkbd_any_key_pressed(sc) || + atomic_load_acq_32(&sc->sc_inputhead) != sc->sc_inputtail) { hkbd_start_timer(sc); } } @@ -634,7 +652,7 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) uint8_t modifiers; int offset; - HKBD_LOCK_ASSERT(); + HKBD_LOCK_ASSERT(sc); DPRINTF("actlen=%d bytes\n", len); @@ -747,6 +765,8 @@ hkbd_probe(device_t dev) if (error != 0) return (error); + hidbus_set_desc(dev, "Keyboard"); + return (BUS_PROBE_DEFAULT); } @@ -869,21 +889,21 @@ hkbd_attach(device_t dev) #endif sc->sc_dev = dev; - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); kbd_init_struct(kbd, HKBD_DRIVER_NAME, KB_OTHER, unit, 0, 0, 0); kbd->kb_data = (void *)sc; - hidbus_set_desc(dev, "Keyboard"); - sc->sc_mode = K_XLATE; - callout_init_mtx(&sc->sc_callout, &Giant, 0); + mtx_init(&sc->sc_mtx, "hkbd lock", NULL, MTX_DEF); + TASK_INIT(&sc->sc_task, 0, hkbd_event_keyinput, sc); + callout_init_mtx(&sc->sc_callout, &sc->sc_mtx, 0); hidbus_set_intr(dev, hkbd_intr_callback, sc); - /* interrupt handler will be called with Giant taken */ - hidbus_set_lock(dev, &Giant); + /* interrupt handler will be called with hkbd mutex taken */ + hidbus_set_lock(dev, &sc->sc_mtx); /* interrupt handler can be called during panic */ hidbus_set_flags(dev, hidbus_get_flags(dev) & HIDBUS_FLAG_CAN_POLL); @@ -1005,13 +1025,15 @@ hkbd_detach(device_t dev) struct hkbd_softc *sc = device_get_softc(dev); int error; - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); DPRINTF("\n"); sc->sc_flags |= HKBD_FLAG_GONE; + HKBD_LOCK(sc); callout_stop(&sc->sc_callout); + HKBD_UNLOCK(sc); /* kill any stuck keys */ if (sc->sc_flags & HKBD_FLAG_ATTACHED) { @@ -1022,9 +1044,13 @@ hkbd_detach(device_t dev) memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); /* process releasing of all keys */ + HKBD_LOCK(sc); hkbd_interrupt(sc); + HKBD_UNLOCK(sc); + taskqueue_drain(taskqueue_swi_giant, &sc->sc_task); } + mtx_destroy(&sc->sc_mtx); hkbd_disable(&sc->sc_kbd); #ifdef KBD_INSTALL_CDEV @@ -1063,7 +1089,7 @@ hkbd_resume(device_t dev) { struct hkbd_softc *sc = device_get_softc(dev); - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); hkbd_clear_state(&sc->sc_kbd); @@ -1143,9 +1169,9 @@ static int hkbd_enable(keyboard_t *kbd) { - HKBD_LOCK(); + SYSCONS_LOCK(); KBD_ACTIVATE(kbd); - HKBD_UNLOCK(); + SYSCONS_UNLOCK(); return (0); } @@ -1155,9 +1181,9 @@ static int hkbd_disable(keyboard_t *kbd) { - HKBD_LOCK(); + SYSCONS_LOCK(); KBD_DEACTIVATE(kbd); - HKBD_UNLOCK(); + SYSCONS_UNLOCK(); return (0); } @@ -1169,7 +1195,7 @@ hkbd_check(keyboard_t *kbd) { struct hkbd_softc *sc = kbd->kb_data; - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); if (!KBD_IS_ACTIVE(kbd)) return (0); @@ -1182,7 +1208,7 @@ hkbd_check(keyboard_t *kbd) return (1); } #endif - if (sc->sc_inputs > 0) { + if (sc->sc_inputhead != atomic_load_acq_32(&sc->sc_inputtail)) { return (1); } return (0); @@ -1194,7 +1220,7 @@ hkbd_check_char_locked(keyboard_t *kbd) { struct hkbd_softc *sc = kbd->kb_data; - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); if (!KBD_IS_ACTIVE(kbd)) return (0); @@ -1211,9 +1237,9 @@ hkbd_check_char(keyboard_t *kbd) { int result; - HKBD_LOCK(); + SYSCONS_LOCK(); result = hkbd_check_char_locked(kbd); - HKBD_UNLOCK(); + SYSCONS_UNLOCK(); return (result); } @@ -1231,7 +1257,7 @@ hkbd_read(keyboard_t *kbd, int wait) #endif - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); if (!KBD_IS_ACTIVE(kbd)) return (-1); @@ -1280,7 +1306,7 @@ hkbd_read_char_locked(keyboard_t *kbd, int wait) uint32_t scancode; #endif - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); if (!KBD_IS_ACTIVE(kbd)) return (NOKEY); @@ -1453,9 +1479,9 @@ hkbd_read_char(keyboard_t *kbd, int wait) { uint32_t keycode; - HKBD_LOCK(); + SYSCONS_LOCK(); keycode = hkbd_read_char_locked(kbd, wait); - HKBD_UNLOCK(); + SYSCONS_UNLOCK(); return (keycode); } @@ -1476,7 +1502,7 @@ hkbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg) #endif - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); switch (cmd) { case KDGKBMODE: /* get keyboard mode */ @@ -1649,9 +1675,9 @@ hkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) return (EDEADLK); /* best I could come up with */ /* FALLTHROUGH */ default: - HKBD_LOCK(); + SYSCONS_LOCK(); result = hkbd_ioctl_locked(kbd, cmd, arg); - HKBD_UNLOCK(); + SYSCONS_UNLOCK(); return (result); } } @@ -1662,7 +1688,7 @@ hkbd_clear_state(keyboard_t *kbd) { struct hkbd_softc *sc = kbd->kb_data; - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); sc->sc_flags &= ~(HKBD_FLAG_COMPOSE | HKBD_FLAG_POLLING); sc->sc_state &= LOCK_MASK; /* preserve locking key state */ @@ -1697,7 +1723,7 @@ hkbd_poll(keyboard_t *kbd, int on) { struct hkbd_softc *sc = kbd->kb_data; - HKBD_LOCK(); + SYSCONS_LOCK(); /* * Keep a reference count on polling to allow recursive * cngrab() during a panic for example. @@ -1714,7 +1740,7 @@ hkbd_poll(keyboard_t *kbd, int on) sc->sc_flags &= ~HKBD_FLAG_POLLING; sc->sc_delay = 0; } - HKBD_UNLOCK(); + SYSCONS_UNLOCK(); return (0); } @@ -1730,7 +1756,7 @@ hkbd_set_leds(struct hkbd_softc *sc, uint8_t leds) int len; int error; - HKBD_LOCK_ASSERT(); + SYSCONS_LOCK_ASSERT(); DPRINTF("leds=0x%02x\n", leds); #ifdef HID_DEBUG @@ -1784,9 +1810,9 @@ hkbd_set_leds(struct hkbd_softc *sc, uint8_t leds) DPRINTF("len=%d, id=%d\n", len, id); /* start data transfer */ - HKBD_UNLOCK(); + SYSCONS_UNLOCK(); error = hid_write(sc->sc_dev, buf, len); - HKBD_LOCK(); + SYSCONS_LOCK(); return (error); } From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C46474DE954; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@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 4DBj033GLBz4Sp5; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 493CF193DE; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpD1063237; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKprt063236; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKprt063236@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: e49fa9f6f327 - main - hid: Import quirk subsystem. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e49fa9f6f327f3b5464ad638eeb4dfb2d38adf4d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:54 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=e49fa9f6f327f3b5464ad638eeb4dfb2d38adf4d commit e49fa9f6f327f3b5464ad638eeb4dfb2d38adf4d Author: Vladimir Kondratyev AuthorDate: 2020-10-05 10:42:53 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:43 +0000 hid: Import quirk subsystem. hidquirk(4) is derived from usb_quirk(4) and inherits all its HID-related functionality. It does not support ioctl(2) interface yet. Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D27890 --- share/man/man4/Makefile | 1 + share/man/man4/hidquirk.4 | 143 +++++++++++++ sys/conf/files | 1 + sys/dev/hid/hidquirk.c | 437 ++++++++++++++++++++++++++++++++++++++ sys/modules/hid/Makefile | 3 +- sys/modules/hid/hidquirk/Makefile | 34 +++ 6 files changed, 618 insertions(+), 1 deletion(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 9fbfe1dd8411..81aa091ca4c2 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -180,6 +180,7 @@ MAN= aac.4 \ gre.4 \ h_ertt.4 \ hidbus.4 \ + hidquirk.4 \ hifn.4 \ hpet.4 \ ${_hpt27xx.4} \ diff --git a/share/man/man4/hidquirk.4 b/share/man/man4/hidquirk.4 new file mode 100644 index 000000000000..aa78e189765c --- /dev/null +++ b/share/man/man4/hidquirk.4 @@ -0,0 +1,143 @@ +.\" +.\" Copyright (c) 2010 AnyWi Technologies +.\" All rights reserved. +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $FreeBSD$ +.\" +.Dd September 16, 2020 +.Dt HIDQUIRK 4 +.Os +.Sh NAME +.Nm hidquirk +.Nd HID quirks module +.Sh SYNOPSIS +To compile this module into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device hid" +.Ed +.Pp +Alternatively, to load the module at boot +time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hidquirk_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +module provides support for adding quirks for HID devices +.Bl -tag -width Ds +.It HQ_HID_IGNORE +device should be ignored by hid class +.It HQ_KBD_BOOTPROTO +device should set the boot protocol +.It HQ_MS_BOOTPROTO +device should set the boot protocol +.It HQ_MS_BAD_CLASS +doesn't identify properly +.It HQ_MS_LEADING_BYTE +mouse sends an unknown leading byte +.It HQ_MS_REVZ +mouse has Z-axis reversed +.It HQ_SPUR_BUT_UP +spurious mouse button up events +.It HQ_MT_TIMESTAMP +Multitouch device exports HW timestamps +.Dv 0x1b5a01 +.El +.Pp +See +.Pa /sys/dev/hid/hidquirk.h +for the complete list of supported quirks. +.Sh LOADER TUNABLE +The following tunable can be set at the +.Xr loader 8 +prompt before booting the kernel, or stored in +.Xr loader.conf 5 . +.Bl -tag -width indent +.It Va hw.hid.quirk.%d +The value is a string whose format is: +.Bd -literal -offset indent +.Qo BusId VendorId ProductId LowRevision HighRevision HQ_QUIRK,... Qc +.Ed +.Pp +Installs the quirks +.Ic HQ_QUIRK,... +for all HID devices matching +.Ic BusId +and +.Ic VendorId +and +.Ic ProductId +which have a hardware revision between and including +.Ic LowRevision +and +.Ic HighRevision . +.Pp +.Ic BusId , +.Ic VendorId , +.Ic ProductId , +.Ic LowRevision +and +.Ic HighRevision +are all 16 bits numbers which can be decimal or hexadecimal based. +.Pp +A maximum of 100 variables +.Ic hw.hid.quirk.0, .1, ..., .99 +can be defined. +.Pp +If a matching entry is found in the kernel's internal quirks table, it +is replaced by the new definition. +.Pp +Else a new entry is created given that the quirk table is not full. +.Pp +The kernel iterates over the +.Ic hw.hid.quirk.N +variables starting at +.Ic N = 0 +and stops at +.Ic N = 99 +or the first non-existing one. +.El +.Sh EXAMPLES +To install a quirk at boot time, place one or several lines like the +following in +.Xr loader.conf 5 : +.Bd -literal -offset indent +hw.hid.quirk.0="0x18 0x6cb 0x1941 0 0xffff HQ_MT_TIMESTAMP" +.Ed +.Sh HISTORY +The +.Nm +module appeared in +.Fx 13.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Hans Petter Selasky Aq Mt hselasky@FreeBSD.org +for +.Xr usb 4 +subsystem and adopted to +.Xr hid 4 +by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . +This manual page is based on +.Xr usb_quirk 4 +manual page written by +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org . diff --git a/sys/conf/files b/sys/conf/files index 52551baa5847..189ea8137ca0 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1818,6 +1818,7 @@ dev/gpio/ofw_gpiobus.c optional fdt gpio dev/hid/hid.c optional hid dev/hid/hid_if.m optional hid dev/hid/hidbus.c optional hidbus +dev/hid/hidquirk.c optional hid dev/hifn/hifn7751.c optional hifn dev/hptiop/hptiop.c optional hptiop scbus dev/hwpmc/hwpmc_logging.c optional hwpmc diff --git a/sys/dev/hid/hidquirk.c b/sys/dev/hid/hidquirk.c new file mode 100644 index 000000000000..7c28e240582b --- /dev/null +++ b/sys/dev/hid/hidquirk.c @@ -0,0 +1,437 @@ +/* $FreeBSD$ */ +/*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * + * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. + * Copyright (c) 1998 Lennart Augustsson. All rights reserved. + * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2020 Vladimir Kondratyev + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define HID_DEBUG_VAR hid_debug +#include +#include +#include "usbdevs.h" + + +MODULE_DEPEND(hidquirk, hid, 1, 1, 1); +MODULE_VERSION(hidquirk, 1); + +#define HID_DEV_QUIRKS_MAX 384 +#define HID_SUB_QUIRKS_MAX 8 +#define HID_QUIRK_ENVROOT "hw.hid.quirk." + +struct hidquirk_entry { + uint16_t bus; + uint16_t vid; + uint16_t pid; + uint16_t lo_rev; + uint16_t hi_rev; + uint16_t quirks[HID_SUB_QUIRKS_MAX]; +}; + +static struct mtx hidquirk_mtx; + +#define HID_QUIRK_VP(b,v,p,l,h,...) \ + { .bus = (b), .vid = (v), .pid = (p), .lo_rev = (l), .hi_rev = (h), \ + .quirks = { __VA_ARGS__ } } +#define USB_QUIRK(v,p,l,h,...) \ + HID_QUIRK_VP(BUS_USB, USB_VENDOR_##v, USB_PRODUCT_##v##_##p, l, h, __VA_ARGS__) + +static struct hidquirk_entry hidquirks[HID_DEV_QUIRKS_MAX] = { + USB_QUIRK(ASUS, LCM, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(QTRONIX, 980N, 0x110, 0x110, HQ_SPUR_BUT_UP), + USB_QUIRK(ALCOR2, KBD_HUB, 0x001, 0x001, HQ_SPUR_BUT_UP), + USB_QUIRK(LOGITECH, G510S, 0x0000, 0xFFFF, HQ_KBD_BOOTPROTO), + /* Devices which should be ignored by usbhid */ + USB_QUIRK(APC, UPS, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(BELKIN, F6H375USB, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(BELKIN, F6C550AVR, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(BELKIN, F6C1250TWRK, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(BELKIN, F6C1500TWRK, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(BELKIN, F6C900UNV, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(BELKIN, F6C100UNV, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(BELKIN, F6C120UNV, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(BELKIN, F6C800UNV, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(BELKIN, F6C1100UNV, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(CYBERPOWER, BC900D, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(CYBERPOWER, 1500CAVRLCD, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(CYBERPOWER, OR2200LCDRM2U, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(DELL2, VARIOUS_UPS, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(CYPRESS, SILVERSHIELD, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(DELORME, EARTHMATE, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(DREAMLINK, DL100B, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(MICROCHIP, PICOLCD20X2, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(MICROCHIP, PICOLCD4X20, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(LIEBERT, POWERSURE_PXT, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(LIEBERT2, PSI1000, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(LIEBERT2, POWERSURE_PSA, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(MGE, UPS1, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(MGE, UPS2, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(POWERCOM, IMPERIAL_SERIES, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(POWERCOM, SMART_KING_PRO, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(POWERCOM, WOW, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(POWERCOM, VANGUARD, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(POWERCOM, BLACK_KNIGHT_PRO, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(TRIPPLITE2, AVR550U, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(TRIPPLITE2, AVR750U, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(TRIPPLITE2, ECO550UPS, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(TRIPPLITE2, T750_INTL, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(TRIPPLITE2, RT_2200_INTL, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(TRIPPLITE2, OMNI1000LCD, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(TRIPPLITE2, OMNI900LCD, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(TRIPPLITE2, SMART_2200RMXL2U, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(TRIPPLITE2, UPS_3014, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(TRIPPLITE2, SU1500RTXL2UA, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(TRIPPLITE2, SU6000RT4U, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(TRIPPLITE2, SU1500RTXL2UA_2, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(APPLE, IPHONE, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(APPLE, IPHONE_3G, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(MEGATEC, UPS, 0x0000, 0xffff, HQ_HID_IGNORE), + /* Devices which should be ignored by both ukbd and uhid */ + USB_QUIRK(CYPRESS, WISPY1A, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(METAGEEK, WISPY1B, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(METAGEEK, WISPY24X, 0x0000, 0xffff, HQ_HID_IGNORE), + USB_QUIRK(METAGEEK2, WISPYDBX, 0x0000, 0xffff, HQ_HID_IGNORE), + /* MS keyboards do weird things */ + USB_QUIRK(MICROSOFT, NATURAL4000, 0x0000, 0xFFFF, HQ_KBD_BOOTPROTO), + USB_QUIRK(MICROSOFT, WLINTELLIMOUSE, 0x0000, 0xffff, HQ_MS_LEADING_BYTE), + /* Quirk for Corsair Vengeance K60 keyboard */ + USB_QUIRK(CORSAIR, K60, 0x0000, 0xffff, HQ_KBD_BOOTPROTO), + /* Quirk for Corsair Gaming K68 keyboard */ + USB_QUIRK(CORSAIR, K68, 0x0000, 0xffff, HQ_KBD_BOOTPROTO), + /* Quirk for Corsair Vengeance K70 keyboard */ + USB_QUIRK(CORSAIR, K70, 0x0000, 0xffff, HQ_KBD_BOOTPROTO), + /* Quirk for Corsair K70 RGB keyboard */ + USB_QUIRK(CORSAIR, K70_RGB, 0x0000, 0xffff, HQ_KBD_BOOTPROTO), + /* Quirk for Corsair STRAFE Gaming keyboard */ + USB_QUIRK(CORSAIR, STRAFE, 0x0000, 0xffff, HQ_KBD_BOOTPROTO), + USB_QUIRK(CORSAIR, STRAFE2, 0x0000, 0xffff, HQ_KBD_BOOTPROTO), + /* Holtek USB gaming keyboard */ + USB_QUIRK(HOLTEK, F85, 0x0000, 0xffff, HQ_KBD_BOOTPROTO), +}; +#undef HID_QUIRK_VP +#undef USB_QUIRK + +/* hidquirk.h exposes only HID_QUIRK_LIST macro when HQ() is defined */ +#define HQ(x) [HQ_##x] = "HQ_"#x +#include "hidquirk.h" +static const char *hidquirk_str[HID_QUIRK_MAX] = { HID_QUIRK_LIST() }; +#undef HQ + +static hid_test_quirk_t hid_test_quirk_by_info; + +/*------------------------------------------------------------------------* + * hidquirkstr + * + * This function converts an USB quirk code into a string. + *------------------------------------------------------------------------*/ +static const char * +hidquirkstr(uint16_t quirk) +{ + return ((quirk < HID_QUIRK_MAX && hidquirk_str[quirk] != NULL) ? + hidquirk_str[quirk] : "HQ_UNKNOWN"); +} + +/*------------------------------------------------------------------------* + * hid_strquirk + * + * This function converts a string into a HID quirk code. + * + * Returns: + * Less than HID_QUIRK_MAX: Quirk code + * Else: Quirk code not found + *------------------------------------------------------------------------*/ +static uint16_t +hid_strquirk(const char *str, size_t len) +{ + const char *quirk; + uint16_t x; + + for (x = 0; x != HID_QUIRK_MAX; x++) { + quirk = hidquirkstr(x); + if (strncmp(str, quirk, len) == 0 && + quirk[len] == 0) + break; + } + return (x); +} + +/*------------------------------------------------------------------------* + * hid_test_quirk_by_info + * + * Returns: + * false: Quirk not found + * true: Quirk found + *------------------------------------------------------------------------*/ +bool +hid_test_quirk_by_info(const struct hid_device_info *info, uint16_t quirk) +{ + uint16_t x; + uint16_t y; + + if (quirk == HQ_NONE) + goto done; + + mtx_lock(&hidquirk_mtx); + + for (x = 0; x != HID_DEV_QUIRKS_MAX; x++) { + /* see if quirk information does not match */ + if ((hidquirks[x].bus != info->idBus) || + (hidquirks[x].vid != info->idVendor) || + (hidquirks[x].lo_rev > info->idVersion) || + (hidquirks[x].hi_rev < info->idVersion)) { + continue; + } + /* see if quirk only should match vendor ID */ + if (hidquirks[x].pid != info->idProduct) { + if (hidquirks[x].pid != 0) + continue; + + for (y = 0; y != HID_SUB_QUIRKS_MAX; y++) { + if (hidquirks[x].quirks[y] == HQ_MATCH_VENDOR_ONLY) + break; + } + if (y == HID_SUB_QUIRKS_MAX) + continue; + } + /* lookup quirk */ + for (y = 0; y != HID_SUB_QUIRKS_MAX; y++) { + if (hidquirks[x].quirks[y] == quirk) { + mtx_unlock(&hidquirk_mtx); + DPRINTF("Found quirk '%s'.\n", hidquirkstr(quirk)); + return (true); + } + } + } + mtx_unlock(&hidquirk_mtx); +done: + return (false); /* no quirk match */ +} + +static struct hidquirk_entry * +hidquirk_get_entry(uint16_t bus, uint16_t vid, uint16_t pid, + uint16_t lo_rev, uint16_t hi_rev, uint8_t do_alloc) +{ + uint16_t x; + + mtx_assert(&hidquirk_mtx, MA_OWNED); + + if ((bus | vid | pid | lo_rev | hi_rev) == 0) { + /* all zero - special case */ + return (hidquirks + HID_DEV_QUIRKS_MAX - 1); + } + /* search for an existing entry */ + for (x = 0; x != HID_DEV_QUIRKS_MAX; x++) { + /* see if quirk information does not match */ + if ((hidquirks[x].bus != bus) || + (hidquirks[x].vid != vid) || + (hidquirks[x].pid != pid) || + (hidquirks[x].lo_rev != lo_rev) || + (hidquirks[x].hi_rev != hi_rev)) { + continue; + } + return (hidquirks + x); + } + + if (do_alloc == 0) { + /* no match */ + return (NULL); + } + /* search for a free entry */ + for (x = 0; x != HID_DEV_QUIRKS_MAX; x++) { + /* see if quirk information does not match */ + if ((hidquirks[x].bus | + hidquirks[x].vid | + hidquirks[x].pid | + hidquirks[x].lo_rev | + hidquirks[x].hi_rev) != 0) { + continue; + } + hidquirks[x].bus = bus; + hidquirks[x].vid = vid; + hidquirks[x].pid = pid; + hidquirks[x].lo_rev = lo_rev; + hidquirks[x].hi_rev = hi_rev; + + return (hidquirks + x); + } + + /* no entry found */ + return (NULL); +} + +/*------------------------------------------------------------------------* + * usb_quirk_strtou16 + * + * Helper function to scan a 16-bit integer. + *------------------------------------------------------------------------*/ +static uint16_t +hidquirk_strtou16(const char **pptr, const char *name, const char *what) +{ + unsigned long value; + char *end; + + value = strtoul(*pptr, &end, 0); + if (value > 65535 || *pptr == end || (*end != ' ' && *end != '\t')) { + printf("%s: %s 16-bit %s value set to zero\n", + name, what, *end == 0 ? "incomplete" : "invalid"); + return (0); + } + *pptr = end + 1; + return ((uint16_t)value); +} + +/*------------------------------------------------------------------------* + * usb_quirk_add_entry_from_str + * + * Add a USB quirk entry from string. + * "VENDOR PRODUCT LO_REV HI_REV QUIRK[,QUIRK[,...]]" + *------------------------------------------------------------------------*/ +static void +hidquirk_add_entry_from_str(const char *name, const char *env) +{ + struct hidquirk_entry entry = { }; + struct hidquirk_entry *new; + uint16_t quirk_idx; + uint16_t quirk; + const char *end; + + /* check for invalid environment variable */ + if (name == NULL || env == NULL) + return; + + if (bootverbose) + printf("Adding HID QUIRK '%s' = '%s'\n", name, env); + + /* parse device information */ + entry.bus = hidquirk_strtou16(&env, name, "Bus ID"); + entry.vid = hidquirk_strtou16(&env, name, "Vendor ID"); + entry.pid = hidquirk_strtou16(&env, name, "Product ID"); + entry.lo_rev = hidquirk_strtou16(&env, name, "Low revision"); + entry.hi_rev = hidquirk_strtou16(&env, name, "High revision"); + + /* parse quirk information */ + quirk_idx = 0; + while (*env != 0 && quirk_idx != HID_SUB_QUIRKS_MAX) { + /* skip whitespace before quirks */ + while (*env == ' ' || *env == '\t') + env++; + + /* look for quirk separation character */ + end = strchr(env, ','); + if (end == NULL) + end = env + strlen(env); + + /* lookup quirk in string table */ + quirk = hid_strquirk(env, end - env); + if (quirk < HID_QUIRK_MAX) { + entry.quirks[quirk_idx++] = quirk; + } else { + printf("%s: unknown HID quirk '%.*s' (skipped)\n", + name, (int)(end - env), env); + } + env = end; + + /* skip quirk delimiter, if any */ + if (*env != 0) + env++; + } + + /* register quirk */ + if (quirk_idx != 0) { + if (*env != 0) { + printf("%s: Too many HID quirks, only %d allowed!\n", + name, HID_SUB_QUIRKS_MAX); + } + mtx_lock(&hidquirk_mtx); + new = hidquirk_get_entry(entry.bus, entry.vid, entry.pid, + entry.lo_rev, entry.hi_rev, 1); + if (new == NULL) + printf("%s: HID quirks table is full!\n", name); + else + memcpy(new->quirks, entry.quirks, sizeof(entry.quirks)); + mtx_unlock(&hidquirk_mtx); + } else { + printf("%s: No USB quirks found!\n", name); + } +} + +static void +hidquirk_init(void *arg) +{ + char envkey[sizeof(HID_QUIRK_ENVROOT) + 2]; /* 2 digits max, 0 to 99 */ + int i; + + /* initialize mutex */ + mtx_init(&hidquirk_mtx, "HID quirk", NULL, MTX_DEF); + + /* look for quirks defined by the environment variable */ + for (i = 0; i != 100; i++) { + snprintf(envkey, sizeof(envkey), HID_QUIRK_ENVROOT "%d", i); + + /* Stop at first undefined var */ + if (!testenv(envkey)) + break; + + /* parse environment variable */ + hidquirk_add_entry_from_str(envkey, kern_getenv(envkey)); + } + + /* register our function */ + hid_test_quirk_p = &hid_test_quirk_by_info; +} + +static void +hidquirk_uninit(void *arg) +{ + hid_quirk_unload(arg); + + /* destroy mutex */ + mtx_destroy(&hidquirk_mtx); +} + +SYSINIT(hidquirk_init, SI_SUB_LOCK, SI_ORDER_FIRST, hidquirk_init, NULL); +SYSUNINIT(hidquirk_uninit, SI_SUB_LOCK, SI_ORDER_ANY, hidquirk_uninit, NULL); diff --git a/sys/modules/hid/Makefile b/sys/modules/hid/Makefile index 1534458c4eb2..8d6f7f221e4f 100644 --- a/sys/modules/hid/Makefile +++ b/sys/modules/hid/Makefile @@ -2,6 +2,7 @@ SUBDIR = \ hid \ - hidbus + hidbus \ + hidquirk .include diff --git a/sys/modules/hid/hidquirk/Makefile b/sys/modules/hid/hidquirk/Makefile new file mode 100644 index 000000000000..56547fe9aaa4 --- /dev/null +++ b/sys/modules/hid/hidquirk/Makefile @@ -0,0 +1,34 @@ +# +# Copyright (c) 2020 Vladimir Kondratyev +# +# 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$ +# + +.PATH: ${SRCTOP}/sys/dev/hid + +KMOD= hidquirk +SRCS= hidquirk.c +SRCS+= bus_if.h device_if.h usbdevs.h + +.include From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 101ED4DEBA7; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@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 4DBj033Mkwz4Sw5; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BBA31968B; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpkV063220; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKp4C063219; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKp4C063219@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: b1f1b07f6d41 - main - hid: Import iichid - I2C transport backend for HID subsystem MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b1f1b07f6d412cb3ec8588a634836e26396eec70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:57 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=b1f1b07f6d412cb3ec8588a634836e26396eec70 commit b1f1b07f6d412cb3ec8588a634836e26396eec70 Author: Vladimir Kondratyev AuthorDate: 2020-10-06 21:50:16 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:43 +0000 hid: Import iichid - I2C transport backend for HID subsystem This implements hid_if.m methods for HID-over-I2C protocol [1]. Following kernel options are added: IICHID_SAMPLING - Enable support for a sampling mode as interrupt resource acquisition is not always possible in a case of GPIO interrupts. IICHID_DEBUG - Enable debug output. The module is based on prior Marc Priggemeyer work (D16698). [1] http://download.microsoft.com/download/7/d/d/7dd44bb7-2a7a-4505-ac1c-7227d3d96d5b/hid-over-i2c-protocol-spec-v1-0.docx Differential revision: https://reviews.freebsd.org/D27892 --- share/man/man4/Makefile | 1 + share/man/man4/iichid.4 | 96 +++ sys/amd64/conf/GENERIC | 1 + sys/conf/files | 1 + sys/conf/options | 2 + sys/dev/hid/hidbus.c | 1 + sys/dev/iicbus/iichid.c | 1252 +++++++++++++++++++++++++++++++++++++++ sys/i386/conf/GENERIC | 1 + sys/modules/i2c/Makefile | 5 + sys/modules/i2c/iichid/Makefile | 8 + 10 files changed, 1368 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 81aa091ca4c2..5b0b55968afc 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -211,6 +211,7 @@ MAN= aac.4 \ iic_gpiomux.4 \ iicbb.4 \ iicbus.4 \ + iichid.4 \ iicmux.4 \ iicsmb.4 \ iir.4 \ diff --git a/share/man/man4/iichid.4 b/share/man/man4/iichid.4 new file mode 100644 index 000000000000..526a6f444440 --- /dev/null +++ b/share/man/man4/iichid.4 @@ -0,0 +1,96 @@ +.\" Copyright (c) 2020 Vladimir Kondratyev +.\" +.\" 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 September 21, 2020 +.Dt IICHID 4 +.Os +.Sh NAME +.Nm iichid +.Nd I2C HID transport driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device iichid" +.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 +iichid_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides a interface to I2C Human Interface Devices (HIDs). +.Sh SYSCTL VARIABLES +Next parameters are available as +.Xr sysctl 8 +variables. +Debug parameter is available as +.Xr loader 8 +tunable as well. +.Bl -tag -width indent +.It Va dev.iichid.*.sampling_rate_fast +Active sampling rate in num/second (for sampling mode). +.It Va dev.iichid.*.sampling_rate_slow +Idle sampling rate in num/second (for sampling mode). +.It Va dev.iichid.*.sampling_hysteresis +Number of missing samples before enabling of slow mode (for sampling mode). +.It Va hw.iichid.debug +Debug output level, where 0 is debugging disabled and larger values increase +debug message verbosity. +Default is 0. +.El +.Sh SEE ALSO +.Xr ig4 4 +.Sh BUGS +The +.Nm +does not support GPIO interrupts yet. +In that case +.Nm +enables sampling mode with periodic polling of hardware by driver means. +See dev.iichid.*.sampling_* +.Xr sysctl 4 +variables for tuning of sampling parameters. +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0. +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Marc Priggemeyer Aq Mt marc.priggemeyer@gmail.com +and +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . +.Pp +This manual page was written by +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 98535be6133b..ee2a972d8302 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -384,3 +384,4 @@ device uinput # install /dev/uinput cdev # HID support options HID_DEBUG # enable debug msgs device hid # Generic HID support +options IICHID_SAMPLING # Workaround missing GPIO INTR support diff --git a/sys/conf/files b/sys/conf/files index 189ea8137ca0..87b56eb0e8ae 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1848,6 +1848,7 @@ dev/iicbus/iicbb.c optional iicbb dev/iicbus/iicbb_if.m optional iicbb dev/iicbus/iicbus.c optional iicbus dev/iicbus/iicbus_if.m optional iicbus +dev/iicbus/iichid.c optional iichid acpi hid iicbus dev/iicbus/iiconf.c optional iicbus dev/iicbus/iicsmb.c optional iicsmb \ dependency "iicbus_if.h" diff --git a/sys/conf/options b/sys/conf/options index 797fa67f1a92..1c0b643df899 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -1016,3 +1016,5 @@ LINDEBUGFS # options for HID support HID_DEBUG opt_hid.h +IICHID_DEBUG opt_hid.h +IICHID_SAMPLING opt_hid.h diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c index 8feb28302a44..dfe1081c8888 100644 --- a/sys/dev/hid/hidbus.c +++ b/sys/dev/hid/hidbus.c @@ -903,3 +903,4 @@ driver_t hidbus_driver = { MODULE_DEPEND(hidbus, hid, 1, 1, 1); MODULE_VERSION(hidbus, 1); +DRIVER_MODULE(hidbus, iichid, hidbus_driver, hidbus_devclass, 0, 0); diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c new file mode 100644 index 000000000000..c4bc2d3cee1f --- /dev/null +++ b/sys/dev/iicbus/iichid.c @@ -0,0 +1,1252 @@ +/*- + * Copyright (c) 2018-2019 Marc Priggemeyer + * Copyright (c) 2019-2020 Vladimir Kondratyev + * + * 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. + */ + +/* + * I2C HID transport backend. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_hid.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include + +#include "hid_if.h" + +#ifdef IICHID_DEBUG +static int iichid_debug = 0; + +static SYSCTL_NODE(_hw, OID_AUTO, iichid, CTLFLAG_RW, 0, "I2C HID"); +SYSCTL_INT(_hw_iichid, OID_AUTO, debug, CTLFLAG_RWTUN, + &iichid_debug, 1, "Debug level"); + +#define DPRINTFN(sc, n, ...) do { \ + if (iichid_debug >= (n)) \ + device_printf((sc)->dev, __VA_ARGS__); \ +} while (0) +#define DPRINTF(sc, ...) DPRINTFN(sc, 1, __VA_ARGS__) +#else +#define DPRINTFN(...) do {} while (0) +#define DPRINTF(...) do {} while (0) +#endif + +typedef hid_size_t iichid_size_t; +#define IICHID_SIZE_MAX (UINT16_MAX - 2) + +/* 7.2 */ +enum { + I2C_HID_CMD_DESCR = 0x0, + I2C_HID_CMD_RESET = 0x1, + I2C_HID_CMD_GET_REPORT = 0x2, + I2C_HID_CMD_SET_REPORT = 0x3, + I2C_HID_CMD_GET_IDLE = 0x4, + I2C_HID_CMD_SET_IDLE = 0x5, + I2C_HID_CMD_GET_PROTO = 0x6, + I2C_HID_CMD_SET_PROTO = 0x7, + I2C_HID_CMD_SET_POWER = 0x8, +}; + +#define I2C_HID_POWER_ON 0x0 +#define I2C_HID_POWER_OFF 0x1 + +/* + * Since interrupt resource acquisition is not always possible (in case of GPIO + * interrupts) iichid now supports a sampling_mode. + * Set dev.iichid..sampling_rate_slow to a value greater then 0 + * to activate sampling. A value of 0 is possible but will not reset the + * callout and, thereby, disable further report requests. Do not set the + * sampling_rate_fast value too high as it may result in periodical lags of + * cursor motion. + */ +#define IICHID_SAMPLING_RATE_FAST 60 +#define IICHID_SAMPLING_RATE_SLOW 10 +#define IICHID_SAMPLING_HYSTERESIS 1 + +/* 5.1.1 - HID Descriptor Format */ +struct i2c_hid_desc { + uint16_t wHIDDescLength; + uint16_t bcdVersion; + uint16_t wReportDescLength; + uint16_t wReportDescRegister; + uint16_t wInputRegister; + uint16_t wMaxInputLength; + uint16_t wOutputRegister; + uint16_t wMaxOutputLength; + uint16_t wCommandRegister; + uint16_t wDataRegister; + uint16_t wVendorID; + uint16_t wProductID; + uint16_t wVersionID; + uint32_t reserved; +} __packed; + +static char *iichid_ids[] = { + "PNP0C50", + "ACPI0C50", + NULL +}; + +enum iichid_powerstate_how { + IICHID_PS_NULL, + IICHID_PS_ON, + IICHID_PS_OFF, +}; + +/* + * Locking: no internal locks are used. To serialize access to shared members, + * external iicbus lock should be taken. That allows to make locking greatly + * simple at the cost of running front interrupt handlers with locked bus. + */ +struct iichid_softc { + device_t dev; + + bool probe_done; + int probe_result; + + struct hid_device_info hw; + uint16_t addr; /* Shifted left by 1 */ + struct i2c_hid_desc desc; + + hid_intr_t *intr_handler; + void *intr_ctx; + uint8_t *intr_buf; + iichid_size_t intr_bufsize; + + int irq_rid; + struct resource *irq_res; + void *irq_cookie; + +#ifdef IICHID_SAMPLING + int sampling_rate_slow; /* iicbus lock */ + int sampling_rate_fast; + int sampling_hysteresis; + int missing_samples; /* iicbus lock */ + struct timeout_task periodic_task; /* iicbus lock */ + bool callout_setup; /* iicbus lock */ + struct taskqueue *taskqueue; + struct task event_task; +#endif + + bool open; /* iicbus lock */ + bool suspend; /* iicbus lock */ + bool power_on; /* iicbus lock */ +}; + +static device_probe_t iichid_probe; +static device_attach_t iichid_attach; +static device_detach_t iichid_detach; +static device_resume_t iichid_resume; +static device_suspend_t iichid_suspend; + +#ifdef IICHID_SAMPLING +static int iichid_setup_callout(struct iichid_softc *); +static int iichid_reset_callout(struct iichid_softc *); +static void iichid_teardown_callout(struct iichid_softc *); +#endif + +static __inline bool +acpi_is_iichid(ACPI_HANDLE handle) +{ + char **ids; + UINT32 sta; + + for (ids = iichid_ids; *ids != NULL; ids++) { + if (acpi_MatchHid(handle, *ids)) + break; + } + if (*ids == NULL) + return (false); + + /* + * If no _STA method or if it failed, then assume that + * the device is present. + */ + if (ACPI_FAILURE(acpi_GetInteger(handle, "_STA", &sta)) || + ACPI_DEVICE_PRESENT(sta)) + return (true); + + return (false); +} + +static ACPI_STATUS +iichid_get_config_reg(ACPI_HANDLE handle, uint16_t *config_reg) +{ + ACPI_OBJECT *result; + ACPI_BUFFER acpi_buf; + ACPI_STATUS status; + + /* + * function (_DSM) to be evaluated to retrieve the address of + * the configuration register of the HID device. + */ + /* 3cdff6f7-4267-4555-ad05-b30a3d8938de */ + static uint8_t dsm_guid[ACPI_UUID_LENGTH] = { + 0xF7, 0xF6, 0xDF, 0x3C, 0x67, 0x42, 0x55, 0x45, + 0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE, + }; + + status = acpi_EvaluateDSMTyped(handle, dsm_guid, 1, 1, NULL, &acpi_buf, + ACPI_TYPE_INTEGER); + if (ACPI_FAILURE(status)) { + printf("%s: error evaluating _DSM\n", __func__); + return (status); + } + result = (ACPI_OBJECT *) acpi_buf.Pointer; + *config_reg = result->Integer.Value & 0xFFFF; + + AcpiOsFree(result); + return (status); +} + +static int +iichid_cmd_read(struct iichid_softc* sc, void *buf, iichid_size_t maxlen, + iichid_size_t *actual_len) +{ + /* + * 6.1.3 - Retrieval of Input Reports + * DEVICE returns the length (2 Bytes) and the entire Input Report. + */ + uint8_t actbuf[2] = { 0, 0 }; + /* Read actual input report length. */ + struct iic_msg msgs[] = { + { sc->addr, IIC_M_RD | IIC_M_NOSTOP, sizeof(actbuf), actbuf }, + }; + uint16_t actlen; + int error; + + error = iicbus_transfer(sc->dev, msgs, nitems(msgs)); + if (error != 0) + return (error); + + actlen = actbuf[0] | actbuf[1] << 8; + if (actlen <= 2 || actlen == 0xFFFF || maxlen == 0) { + /* Read and discard 1 byte to send I2C STOP condition. */ + msgs[0] = (struct iic_msg) + { sc->addr, IIC_M_RD | IIC_M_NOSTART, 1, actbuf }; + actlen = 0; + } else { + actlen -= 2; + if (actlen > maxlen) { + DPRINTF(sc, "input report too big. requested=%d " + "received=%d\n", maxlen, actlen); + actlen = maxlen; + } + /* Read input report itself. */ + msgs[0] = (struct iic_msg) + { sc->addr, IIC_M_RD | IIC_M_NOSTART, actlen, buf }; + } + + error = iicbus_transfer(sc->dev, msgs, 1); + if (error == 0 && actual_len != NULL) + *actual_len = actlen; + + DPRINTFN(sc, 5, + "%*D - %*D\n", 2, actbuf, " ", msgs[0].len, msgs[0].buf, " "); + + return (error); +} + +static int +iichid_cmd_write(struct iichid_softc *sc, const void *buf, iichid_size_t len) +{ + /* 6.2.3 - Sending Output Reports. */ + uint8_t *cmdreg = (uint8_t *)&sc->desc.wOutputRegister; + uint16_t replen = 2 + len; + uint8_t cmd[4] = { cmdreg[0], cmdreg[1], replen & 0xFF, replen >> 8 }; + struct iic_msg msgs[] = { + {sc->addr, IIC_M_WR | IIC_M_NOSTOP, sizeof(cmd), cmd}, + {sc->addr, IIC_M_WR | IIC_M_NOSTART, len, __DECONST(void *, buf)}, + }; + + if (le16toh(sc->desc.wMaxOutputLength) == 0) + return (IIC_ENOTSUPP); + if (len < 2) + return (IIC_ENOTSUPP); + + DPRINTF(sc, "HID command I2C_HID_CMD_WRITE (len %d): " + "%*D\n", len, len, buf, " "); + + return (iicbus_transfer(sc->dev, msgs, nitems(msgs))); +} + +static int +iichid_cmd_get_hid_desc(struct iichid_softc *sc, uint16_t config_reg, + struct i2c_hid_desc *hid_desc) +{ + /* + * 5.2.2 - HID Descriptor Retrieval + * register is passed from the controller. + */ + uint16_t cmd = htole16(config_reg); + struct iic_msg msgs[] = { + { sc->addr, IIC_M_WR | IIC_M_NOSTOP, 2, (uint8_t *)&cmd }, + { sc->addr, IIC_M_RD, sizeof(*hid_desc), (uint8_t *)hid_desc }, + }; + int error; + + DPRINTF(sc, "HID command I2C_HID_CMD_DESCR at 0x%x\n", config_reg); + + error = iicbus_transfer(sc->dev, msgs, nitems(msgs)); + if (error != 0) + return (error); + + DPRINTF(sc, "HID descriptor: %*D\n", + (int)sizeof(struct i2c_hid_desc), hid_desc, " "); + + return (0); +} + +static int +iichid_set_power(struct iichid_softc *sc, uint8_t param) +{ + uint8_t *cmdreg = (uint8_t *)&sc->desc.wCommandRegister; + uint8_t cmd[] = { cmdreg[0], cmdreg[1], param, I2C_HID_CMD_SET_POWER }; + struct iic_msg msgs[] = { + { sc->addr, IIC_M_WR, sizeof(cmd), cmd }, + }; + + DPRINTF(sc, "HID command I2C_HID_CMD_SET_POWER(%d)\n", param); + + return (iicbus_transfer(sc->dev, msgs, nitems(msgs))); +} + +static int +iichid_reset(struct iichid_softc *sc) +{ + uint8_t *cmdreg = (uint8_t *)&sc->desc.wCommandRegister; + uint8_t cmd[] = { cmdreg[0], cmdreg[1], 0, I2C_HID_CMD_RESET }; + struct iic_msg msgs[] = { + { sc->addr, IIC_M_WR, sizeof(cmd), cmd }, + }; + + DPRINTF(sc, "HID command I2C_HID_CMD_RESET\n"); + + return (iicbus_transfer(sc->dev, msgs, nitems(msgs))); +} + +static int +iichid_cmd_get_report_desc(struct iichid_softc* sc, void *buf, + iichid_size_t len) +{ + uint16_t cmd = sc->desc.wReportDescRegister; + struct iic_msg msgs[] = { + { sc->addr, IIC_M_WR | IIC_M_NOSTOP, 2, (uint8_t *)&cmd }, + { sc->addr, IIC_M_RD, len, buf }, + }; + int error; + + DPRINTF(sc, "HID command I2C_HID_REPORT_DESCR at 0x%x with size %d\n", + le16toh(cmd), len); + + error = iicbus_transfer(sc->dev, msgs, nitems(msgs)); + if (error != 0) + return (error); + + DPRINTF(sc, "HID report descriptor: %*D\n", len, buf, " "); + + return (0); +} + +static int +iichid_cmd_get_report(struct iichid_softc* sc, void *buf, iichid_size_t maxlen, + iichid_size_t *actual_len, uint8_t type, uint8_t id) +{ + /* + * 7.2.2.4 - "The protocol is optimized for Report < 15. If a + * report ID >= 15 is necessary, then the Report ID in the Low Byte + * must be set to 1111 and a Third Byte is appended to the protocol. + * This Third Byte contains the entire/actual report ID." + */ + uint8_t *dtareg = (uint8_t *)&sc->desc.wDataRegister; + uint8_t *cmdreg = (uint8_t *)&sc->desc.wCommandRegister; + uint8_t cmd[] = { /*________|______id>=15_____|______id<15______*/ + cmdreg[0] , + cmdreg[1] , + (id >= 15 ? 15 | (type << 4): id | (type << 4)), + I2C_HID_CMD_GET_REPORT , + (id >= 15 ? id : dtareg[0] ), + (id >= 15 ? dtareg[0] : dtareg[1] ), + (id >= 15 ? dtareg[1] : 0 ), + }; + int cmdlen = (id >= 15 ? 7 : 6 ); + uint8_t actbuf[2] = { 0, 0 }; + uint16_t actlen; + int d, error; + struct iic_msg msgs[] = { + { sc->addr, IIC_M_WR | IIC_M_NOSTOP, cmdlen, cmd }, + { sc->addr, IIC_M_RD | IIC_M_NOSTOP, 2, actbuf }, + { sc->addr, IIC_M_RD | IIC_M_NOSTART, maxlen, buf }, + }; + + if (maxlen == 0) + return (EINVAL); + + DPRINTF(sc, "HID command I2C_HID_CMD_GET_REPORT %d " + "(type %d, len %d)\n", id, type, maxlen); + + /* + * 7.2.2.2 - Response will be a 2-byte length value, the report + * id (1 byte, if defined in Report Descriptor), and then the report. + */ + error = iicbus_transfer(sc->dev, msgs, nitems(msgs)); + if (error != 0) + return (error); + + actlen = actbuf[0] | actbuf[1] << 8; + if (actlen != maxlen + 2) + DPRINTF(sc, "response size %d != expected length %d\n", + actlen, maxlen + 2); + + if (actlen <= 2 || actlen == 0xFFFF) + return (ENOMSG); + + d = id != 0 ? *(uint8_t *)buf : 0; + if (d != id) { + DPRINTF(sc, "response report id %d != %d\n", d, id); + return (EBADMSG); + } + + actlen -= 2; + if (actlen > maxlen) + actlen = maxlen; + if (actual_len != NULL) + *actual_len = actlen; + + DPRINTF(sc, "response: %*D %*D\n", 2, actbuf, " ", actlen, buf, " "); + + return (0); +} + +static int +iichid_cmd_set_report(struct iichid_softc* sc, const void *buf, + iichid_size_t len, uint8_t type, uint8_t id) +{ + /* + * 7.2.2.4 - "The protocol is optimized for Report < 15. If a + * report ID >= 15 is necessary, then the Report ID in the Low Byte + * must be set to 1111 and a Third Byte is appended to the protocol. + * This Third Byte contains the entire/actual report ID." + */ + uint8_t *dtareg = (uint8_t *)&sc->desc.wDataRegister; + uint8_t *cmdreg = (uint8_t *)&sc->desc.wCommandRegister; + uint16_t replen = 2 + len; + uint8_t cmd[] = { /*________|______id>=15_____|______id<15______*/ + cmdreg[0] , + cmdreg[1] , + (id >= 15 ? 15 | (type << 4): id | (type << 4)), + I2C_HID_CMD_SET_REPORT , + (id >= 15 ? id : dtareg[0] ), + (id >= 15 ? dtareg[0] : dtareg[1] ), + (id >= 15 ? dtareg[1] : replen & 0xff ), + (id >= 15 ? replen & 0xff : replen >> 8 ), + (id >= 15 ? replen >> 8 : 0 ), + }; + int cmdlen = (id >= 15 ? 9 : 8 ); + struct iic_msg msgs[] = { + {sc->addr, IIC_M_WR | IIC_M_NOSTOP, cmdlen, cmd}, + {sc->addr, IIC_M_WR | IIC_M_NOSTART, len, __DECONST(void *, buf)}, + }; + + DPRINTF(sc, "HID command I2C_HID_CMD_SET_REPORT %d (type %d, len %d): " + "%*D\n", id, type, len, len, buf, " "); + + return (iicbus_transfer(sc->dev, msgs, nitems(msgs))); +} + +#ifdef IICHID_SAMPLING +static void +iichid_event_task(void *context, int pending) +{ + struct iichid_softc *sc; + device_t parent; + iichid_size_t actual; + bool bus_requested; + int error; + + sc = context; + parent = device_get_parent(sc->dev); + + bus_requested = false; + if (iicbus_request_bus(parent, sc->dev, IIC_WAIT) != 0) + goto rearm; + bus_requested = true; + + if (!sc->power_on) + goto out; + + error = iichid_cmd_read(sc, sc->intr_buf, sc->intr_bufsize, &actual); + if (error == 0) { + if (actual > 0) { + sc->intr_handler(sc->intr_ctx, sc->intr_buf, actual); + sc->missing_samples = 0; + } else + ++sc->missing_samples; + } else + DPRINTF(sc, "read error occured: %d\n", error); + +rearm: + if (sc->callout_setup && sc->sampling_rate_slow > 0) { + if (sc->missing_samples == sc->sampling_hysteresis) + sc->intr_handler(sc->intr_ctx, sc->intr_buf, 0); + taskqueue_enqueue_timeout(sc->taskqueue, &sc->periodic_task, + hz / MAX(sc->missing_samples >= sc->sampling_hysteresis ? + sc->sampling_rate_slow : sc->sampling_rate_fast, 1)); + } +out: + if (bus_requested) + iicbus_release_bus(parent, sc->dev); +} +#endif /* IICHID_SAMPLING */ + +static void +iichid_intr(void *context) +{ + struct iichid_softc *sc; + device_t parent; + iichid_size_t maxlen, actual; + int error; + + sc = context; + parent = device_get_parent(sc->dev); + + /* + * Designware(IG4) driver-specific hack. + * Requesting of an I2C bus with IIC_DONTWAIT parameter enables polled + * mode in the driver, making possible iicbus_transfer execution from + * interrupt handlers and callouts. + */ + if (iicbus_request_bus(parent, sc->dev, IIC_DONTWAIT) != 0) + return; + + /* + * Reading of input reports of I2C devices residing in SLEEP state is + * not allowed and often returns a garbage. If a HOST needs to + * communicate with the DEVICE it MUST issue a SET POWER command + * (to ON) before any other command. As some hardware requires reads to + * acknoledge interrupts we fetch only length header and discard it. + */ + maxlen = sc->power_on ? sc->intr_bufsize : 0; + error = iichid_cmd_read(sc, sc->intr_buf, maxlen, &actual); + if (error == 0) { + if (sc->power_on) { + if (actual != 0) + sc->intr_handler(sc->intr_ctx, sc->intr_buf, + actual); + else + DPRINTF(sc, "no data received\n"); + } + } else + DPRINTF(sc, "read error occured: %d\n", error); + + iicbus_release_bus(parent, sc->dev); +} + +static int +iichid_set_power_state(struct iichid_softc *sc, + enum iichid_powerstate_how how_open, + enum iichid_powerstate_how how_suspend) +{ + device_t parent; + int error; + int how_request; + bool power_on; + + /* + * Request iicbus early as sc->suspend and sc->power_on + * are protected by iicbus internal lock. + */ + parent = device_get_parent(sc->dev); + /* Allow to interrupt open()/close() handlers by SIGINT */ + how_request = how_open == IICHID_PS_NULL ? IIC_WAIT : IIC_INTRWAIT; + error = iicbus_request_bus(parent, sc->dev, how_request); + if (error != 0) + return (error); + + switch (how_open) { + case IICHID_PS_ON: + sc->open = true; + break; + case IICHID_PS_OFF: + sc->open = false; + break; + case IICHID_PS_NULL: + default: + break; + } + + switch (how_suspend) { + case IICHID_PS_ON: + sc->suspend = false; + break; + case IICHID_PS_OFF: + sc->suspend = true; + break; + case IICHID_PS_NULL: + default: + break; + } + + power_on = sc->open & !sc->suspend; + + if (power_on != sc->power_on) { + error = iichid_set_power(sc, + power_on ? I2C_HID_POWER_ON : I2C_HID_POWER_OFF); + + sc->power_on = power_on; +#ifdef IICHID_SAMPLING + if (sc->sampling_rate_slow >= 0 && sc->intr_handler != NULL) { + if (power_on) { + iichid_setup_callout(sc); + iichid_reset_callout(sc); + } else + iichid_teardown_callout(sc); + } +#endif + } + + iicbus_release_bus(parent, sc->dev); + + return (error); +} + +static int +iichid_setup_interrupt(struct iichid_softc *sc) +{ + sc->irq_cookie = 0; + + int error = bus_setup_intr(sc->dev, sc->irq_res, + INTR_TYPE_TTY|INTR_MPSAFE, NULL, iichid_intr, sc, &sc->irq_cookie); + if (error != 0) + DPRINTF(sc, "Could not setup interrupt handler\n"); + else + DPRINTF(sc, "successfully setup interrupt\n"); + + return (error); +} + +static void +iichid_teardown_interrupt(struct iichid_softc *sc) +{ + if (sc->irq_cookie) + bus_teardown_intr(sc->dev, sc->irq_res, sc->irq_cookie); + + sc->irq_cookie = 0; +} + +#ifdef IICHID_SAMPLING +static int +iichid_setup_callout(struct iichid_softc *sc) +{ + + if (sc->sampling_rate_slow < 0) { + DPRINTF(sc, "sampling_rate is below 0, can't setup callout\n"); + return (EINVAL); + } + + sc->callout_setup = true; + DPRINTF(sc, "successfully setup callout\n"); + return (0); +} + +static int +iichid_reset_callout(struct iichid_softc *sc) +{ + + if (sc->sampling_rate_slow <= 0) { + DPRINTF(sc, "sampling_rate is below or equal to 0, " + "can't reset callout\n"); + return (EINVAL); + } + + if (!sc->callout_setup) + return (EINVAL); + + /* Start with slow sampling. */ + sc->missing_samples = sc->sampling_hysteresis; + taskqueue_enqueue(sc->taskqueue, &sc->event_task); + + return (0); +} + +static void +iichid_teardown_callout(struct iichid_softc *sc) +{ + + sc->callout_setup = false; + taskqueue_cancel_timeout(sc->taskqueue, &sc->periodic_task, NULL); + DPRINTF(sc, "tore callout down\n"); +} + +static int +iichid_sysctl_sampling_rate_handler(SYSCTL_HANDLER_ARGS) +{ + struct iichid_softc *sc; + device_t parent; + int error, oldval, value; + + sc = arg1; + + value = sc->sampling_rate_slow; + error = sysctl_handle_int(oidp, &value, 0, req); + + if (error != 0 || req->newptr == NULL || + value == sc->sampling_rate_slow) + return (error); + + /* Can't switch to interrupt mode if it is not supported. */ + if (sc->irq_res == NULL && value < 0) + return (EINVAL); + + parent = device_get_parent(sc->dev); + error = iicbus_request_bus(parent, sc->dev, IIC_WAIT); + if (error != 0) + return (iic2errno(error)); + + oldval = sc->sampling_rate_slow; + sc->sampling_rate_slow = value; + + if (oldval < 0 && value >= 0) { + iichid_teardown_interrupt(sc); + if (sc->power_on) + iichid_setup_callout(sc); + } else if (oldval >= 0 && value < 0) { + if (sc->power_on) + iichid_teardown_callout(sc); + iichid_setup_interrupt(sc); + } + + if (sc->power_on && value > 0) + iichid_reset_callout(sc); + + iicbus_release_bus(parent, sc->dev); + + DPRINTF(sc, "new sampling_rate value: %d\n", value); + + return (0); +} +#endif /* IICHID_SAMPLING */ + +static void +iichid_intr_setup(device_t dev, hid_intr_t intr, void *context, + struct hid_rdesc_info *rdesc) +{ + struct iichid_softc *sc; + + sc = device_get_softc(dev); + /* + * Do not rely on wMaxInputLength, as some devices may set it to + * a wrong length. Find the longest input report in report descriptor. *** 501 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1C55E4DE9C2; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@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 4DBj034b0Yz4SbK; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7058018F58; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpXR063272; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKptp063271; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKptp063271@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 961a3535db3c - main - hid: Import HID transport method definitions and helper functions. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 961a3535db3ca1d330e5ddf96419ef3904738ae6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:57 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=961a3535db3ca1d330e5ddf96419ef3904738ae6 commit 961a3535db3ca1d330e5ddf96419ef3904738ae6 Author: Vladimir Kondratyev AuthorDate: 2020-10-06 19:42:22 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:42 +0000 hid: Import HID transport method definitions and helper functions. Create an abstract HID interface that provides hardware independent access to HID capabilities and functions through the device tree. hid_if.m resembles existing USBHID KPI and consist of next methods: HID method USBHID variant ----------------------------------------------------------------------- hid_intr_setup usbd_transfer_setup (INTERRUPT IN xfer) hid_intr_unsetup usbd_transfer_unsetup (INTERRUPT IN xfer) hid_intr_start usbd_transfer_start (INTERRUPT IN xfer) hid_intr_stop usbd_transfer_drain (INTERRUPT IN xfer) hid_intr_poll usbd_transfer_poll (INTERRUPT IN xfer) hid_get_rdesc usbd_req_get_report_descriptor hid_read No direct analog. Not intended for common use. hid_write uhid(4) write() hid_get_report usbd_req_get_report hid_set_report usbd_req_set_report hid_set_idle usbd_req_set_idle hid_set_protocol usbd_req_set_protocol This change is part of D27888 --- sys/conf/files | 1 + sys/dev/hid/hid.c | 47 ++++++++++++ sys/dev/hid/hid.h | 9 +++ sys/dev/hid/hid_if.m | 165 +++++++++++++++++++++++++++++++++++++++++++ sys/modules/hid/hid/Makefile | 3 +- 5 files changed, 224 insertions(+), 1 deletion(-) diff --git a/sys/conf/files b/sys/conf/files index a192877d1e98..88ab9ce95e9e 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1816,6 +1816,7 @@ dev/gpio/gpiobus_if.m optional gpio dev/gpio/gpiopps.c optional gpiopps fdt dev/gpio/ofw_gpiobus.c optional fdt gpio dev/hid/hid.c optional hid +dev/hid/hid_if.m optional hid dev/hifn/hifn7751.c optional hifn dev/hptiop/hptiop.c optional hptiop scbus dev/hwpmc/hwpmc_logging.c optional hwpmc diff --git a/sys/dev/hid/hid.c b/sys/dev/hid/hid.c index 1bc50e84e56d..5a91692e1038 100644 --- a/sys/dev/hid/hid.c +++ b/sys/dev/hid/hid.c @@ -46,6 +46,8 @@ #include #include +#include "hid_if.h" + /* * Define this unconditionally in case a kernel module is loaded that * has been compiled with debugging options. @@ -1025,4 +1027,49 @@ hid_quirk_unload(void *arg) pause("WAIT", hz); } +int +hid_get_rdesc(device_t dev, void *data, hid_size_t len) +{ + return (HID_GET_RDESC(device_get_parent(dev), data, len)); +} + +int +hid_read(device_t dev, void *data, hid_size_t maxlen, hid_size_t *actlen) +{ + return (HID_READ(device_get_parent(dev), data, maxlen, actlen)); +} + +int +hid_write(device_t dev, const void *data, hid_size_t len) +{ + return (HID_WRITE(device_get_parent(dev), data, len)); +} + +int +hid_get_report(device_t dev, void *data, hid_size_t maxlen, hid_size_t *actlen, + uint8_t type, uint8_t id) +{ + return (HID_GET_REPORT(device_get_parent(dev), data, maxlen, actlen, + type, id)); +} + +int +hid_set_report(device_t dev, const void *data, hid_size_t len, uint8_t type, + uint8_t id) +{ + return (HID_SET_REPORT(device_get_parent(dev), data, len, type, id)); +} + +int +hid_set_idle(device_t dev, uint16_t duration, uint8_t id) +{ + return (HID_SET_IDLE(device_get_parent(dev), duration, id)); +} + +int +hid_set_protocol(device_t dev, uint16_t protocol) +{ + return (HID_SET_PROTOCOL(device_get_parent(dev), protocol)); +} + MODULE_VERSION(hid, 1); diff --git a/sys/dev/hid/hid.h b/sys/dev/hid/hid.h index 5855eeaa1802..cea33f7b4af8 100644 --- a/sys/dev/hid/hid.h +++ b/sys/dev/hid/hid.h @@ -331,5 +331,14 @@ bool hid_test_quirk(const struct hid_device_info *dev_info, uint16_t quirk); int hid_add_dynamic_quirk(struct hid_device_info *dev_info, uint16_t quirk); void hid_quirk_unload(void *arg); + +int hid_get_rdesc(device_t, void *, hid_size_t); +int hid_read(device_t, void *, hid_size_t, hid_size_t *); +int hid_write(device_t, const void *, hid_size_t); +int hid_get_report(device_t, void *, hid_size_t, hid_size_t *, uint8_t, + uint8_t); +int hid_set_report(device_t, const void *, hid_size_t, uint8_t, uint8_t); +int hid_set_idle(device_t, uint16_t, uint8_t); +int hid_set_protocol(device_t, uint16_t); #endif /* _KERNEL || _STANDALONE */ #endif /* _HID_HID_H_ */ diff --git a/sys/dev/hid/hid_if.m b/sys/dev/hid/hid_if.m new file mode 100644 index 000000000000..e33791ba24e8 --- /dev/null +++ b/sys/dev/hid/hid_if.m @@ -0,0 +1,165 @@ +#- +# Copyright (c) 2019 Vladimir Kondratyev +# +# 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 +#include +#include +#include +#include + +# Any function listed here can do unbound sleeps waiting for IO to complete. + +INTERFACE hid; + +# Interrupts interface + +# +# Allocate memory and initialise interrupt transfers. +# intr callback function which is called if input data is available. +# context is the private softc pointer, which will be used to callback. +# rdesc is pointer to structire containing requested maximal sizes of input, +# output and feature reports. It is used by hardware transport drivers +# to determine sizes of internal buffers. +# This function returns zero upon success. A non-zero return value indicates +# failure. +# +METHOD void intr_setup { + device_t dev; + hid_intr_t intr; + void *context; + struct hid_rdesc_info *rdesc; +}; + +# +# Release all allocated resources associated with interrupt transfers. +# +METHOD void intr_unsetup { + device_t dev; +}; + +# +# Start the interrupt transfers if not already started. +# +METHOD int intr_start { + device_t dev; +}; + +# +# Stop the interrupt transfers if not already stopped. +# +METHOD int intr_stop { + device_t dev; +}; + +# +# The following function gets called from the HID keyboard driver +# when the system has paniced. +# +METHOD void intr_poll { + device_t dev; +}; + +# HID interface + +# +# Read out an report descriptor from the HID device. +# +METHOD int get_rdesc { + device_t dev; + void *data; + hid_size_t len; +}; + +# +# Get input data from the device. Data should be read in chunks +# of the size prescribed by the report descriptor. +# This function interferes with interrupt transfers and should not be used. +# +METHOD int read { + device_t dev; + void *data; + hid_size_t maxlen; + hid_size_t *actlen; +}; + +# +# Send data to the device. Data should be written in +# chunks of the size prescribed by the report descriptor. +# +METHOD int write { + device_t dev; + const void *data; + hid_size_t len; +}; + +# +# Get a report from the device without waiting for data on the interrupt. +# Copies a maximum of len bytes of the report data into the memory specified +# by data. Upon return actlen is set to the number of bytes copied. The type +# field indicates which report is requested. It should be HID_INPUT_REPORT, +# HID_OUTPUT_REPORT, or HID_FEATURE_REPORT. This call may fail if the device +# does not support this feature. +# +METHOD int get_report { + device_t dev; + void *data; + hid_size_t maxlen; + hid_size_t *actlen; + uint8_t type; + uint8_t id; +}; + +# +# Set a report in the device. The type field indicates which report is to be +# set. It should be HID_INPUT_REPORT, HID_OUTPUT_REPORT, or HID_FEATURE_REPORT. +# The value of the report is specified by the data and the len fields. +# This call may fail if the device does not support this feature. +# +METHOD int set_report { + device_t dev; + const void *data; + hid_size_t len; + uint8_t type; + uint8_t id; +}; + +# +# Set duration between input reports (in mSec). +# +METHOD int set_idle { + device_t dev; + uint16_t duration; + uint8_t id; +}; + +# +# Switch between the boot protocol and the report protocol (or vice versa). +# +METHOD int set_protocol { + device_t dev; + uint16_t protocol; +}; diff --git a/sys/modules/hid/hid/Makefile b/sys/modules/hid/hid/Makefile index 1f84b277cda3..81fc6c671ed2 100644 --- a/sys/modules/hid/hid/Makefile +++ b/sys/modules/hid/hid/Makefile @@ -3,7 +3,8 @@ .PATH: ${SRCTOP}/sys/dev/hid KMOD= hid -SRCS= hid.c +SRCS= hid.c hid_if.c SRCS+= opt_hid.h +SRCS+= bus_if.h device_if.h hid_if.h .include From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2AA374DE8F5; Thu, 7 Jan 2021 23:20:53 +0000 (UTC) (envelope-from git@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 4DBj036Xv4z4Sql; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B06E61934C; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpIF063341; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKp3k063340; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKp3k063340@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 1ffa5c63f449 - main - Copy HID over USB support files to new sys/dev/hid directory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ffa5c63f449866e030b2130dfa5c633d9062074 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:57 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=1ffa5c63f449866e030b2130dfa5c633d9062074 commit 1ffa5c63f449866e030b2130dfa5c633d9062074 Author: Vladimir Kondratyev AuthorDate: 2020-10-06 14:58:31 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:42 +0000 Copy HID over USB support files to new sys/dev/hid directory --- sys/dev/hid/hid.c | 1015 ++++++++++++++++++++++++++++++++++++++++++++++++ sys/dev/hid/hid.h | 284 ++++++++++++++ sys/dev/hid/hidrdesc.h | 306 +++++++++++++++ 3 files changed, 1605 insertions(+) diff --git a/sys/dev/hid/hid.c b/sys/dev/hid/hid.c new file mode 100644 index 000000000000..22e5fb5446c3 --- /dev/null +++ b/sys/dev/hid/hid.c @@ -0,0 +1,1015 @@ +/* $FreeBSD$ */ +/* $NetBSD: hid.c,v 1.17 2001/11/13 06:24:53 lukem Exp $ */ +/*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Lennart Augustsson (lennart@augustsson.net) at + * Carlstedt Research & Technology. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#ifdef USB_GLOBAL_INCLUDE_FILE +#include USB_GLOBAL_INCLUDE_FILE +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define USB_DEBUG_VAR usb_debug + +#include +#include +#include +#include +#include +#endif /* USB_GLOBAL_INCLUDE_FILE */ + +static void hid_clear_local(struct hid_item *); +static uint8_t hid_get_byte(struct hid_data *s, const uint16_t wSize); + +#define MAXUSAGE 64 +#define MAXPUSH 4 +#define MAXID 16 +#define MAXLOCCNT 2048 + +struct hid_pos_data { + int32_t rid; + uint32_t pos; +}; + +struct hid_data { + const uint8_t *start; + const uint8_t *end; + const uint8_t *p; + struct hid_item cur[MAXPUSH]; + struct hid_pos_data last_pos[MAXID]; + int32_t usages_min[MAXUSAGE]; + int32_t usages_max[MAXUSAGE]; + int32_t usage_last; /* last seen usage */ + uint32_t loc_size; /* last seen size */ + uint32_t loc_count; /* last seen count */ + uint32_t ncount; /* end usage item count */ + uint32_t icount; /* current usage item count */ + uint8_t kindset; /* we have 5 kinds so 8 bits are enough */ + uint8_t pushlevel; /* current pushlevel */ + uint8_t nusage; /* end "usages_min/max" index */ + uint8_t iusage; /* current "usages_min/max" index */ + uint8_t ousage; /* current "usages_min/max" offset */ + uint8_t susage; /* usage set flags */ +}; + +/*------------------------------------------------------------------------* + * hid_clear_local + *------------------------------------------------------------------------*/ +static void +hid_clear_local(struct hid_item *c) +{ + + c->loc.count = 0; + c->loc.size = 0; + c->nusages = 0; + memset(c->usages, 0, sizeof(c->usages)); + c->usage_minimum = 0; + c->usage_maximum = 0; + c->designator_index = 0; + c->designator_minimum = 0; + c->designator_maximum = 0; + c->string_index = 0; + c->string_minimum = 0; + c->string_maximum = 0; + c->set_delimiter = 0; +} + +static void +hid_switch_rid(struct hid_data *s, struct hid_item *c, int32_t next_rID) +{ + uint8_t i; + + /* check for same report ID - optimise */ + + if (c->report_ID == next_rID) + return; + + /* save current position for current rID */ + + if (c->report_ID == 0) { + i = 0; + } else { + for (i = 1; i != MAXID; i++) { + if (s->last_pos[i].rid == c->report_ID) + break; + if (s->last_pos[i].rid == 0) + break; + } + } + if (i != MAXID) { + s->last_pos[i].rid = c->report_ID; + s->last_pos[i].pos = c->loc.pos; + } + + /* store next report ID */ + + c->report_ID = next_rID; + + /* lookup last position for next rID */ + + if (next_rID == 0) { + i = 0; + } else { + for (i = 1; i != MAXID; i++) { + if (s->last_pos[i].rid == next_rID) + break; + if (s->last_pos[i].rid == 0) + break; + } + } + if (i != MAXID) { + s->last_pos[i].rid = next_rID; + c->loc.pos = s->last_pos[i].pos; + } else { + DPRINTF("Out of RID entries, position is set to zero!\n"); + c->loc.pos = 0; + } +} + +/*------------------------------------------------------------------------* + * hid_start_parse + *------------------------------------------------------------------------*/ +struct hid_data * +hid_start_parse(const void *d, usb_size_t len, int kindset) +{ + struct hid_data *s; + + if ((kindset-1) & kindset) { + DPRINTFN(0, "Only one bit can be " + "set in the kindset\n"); + return (NULL); + } + + s = malloc(sizeof *s, M_TEMP, M_WAITOK | M_ZERO); + s->start = s->p = d; + s->end = ((const uint8_t *)d) + len; + s->kindset = kindset; + return (s); +} + +/*------------------------------------------------------------------------* + * hid_end_parse + *------------------------------------------------------------------------*/ +void +hid_end_parse(struct hid_data *s) +{ + if (s == NULL) + return; + + free(s, M_TEMP); +} + +/*------------------------------------------------------------------------* + * get byte from HID descriptor + *------------------------------------------------------------------------*/ +static uint8_t +hid_get_byte(struct hid_data *s, const uint16_t wSize) +{ + const uint8_t *ptr; + uint8_t retval; + + ptr = s->p; + + /* check if end is reached */ + if (ptr == s->end) + return (0); + + /* read out a byte */ + retval = *ptr; + + /* check if data pointer can be advanced by "wSize" bytes */ + if ((s->end - ptr) < wSize) + ptr = s->end; + else + ptr += wSize; + + /* update pointer */ + s->p = ptr; + + return (retval); +} + +/*------------------------------------------------------------------------* + * hid_get_item + *------------------------------------------------------------------------*/ +int +hid_get_item(struct hid_data *s, struct hid_item *h) +{ + struct hid_item *c; + unsigned int bTag, bType, bSize; + uint32_t oldpos; + int32_t mask; + int32_t dval; + + if (s == NULL) + return (0); + + c = &s->cur[s->pushlevel]; + + top: + /* check if there is an array of items */ + if (s->icount < s->ncount) { + /* get current usage */ + if (s->iusage < s->nusage) { + dval = s->usages_min[s->iusage] + s->ousage; + c->usage = dval; + s->usage_last = dval; + if (dval == s->usages_max[s->iusage]) { + s->iusage ++; + s->ousage = 0; + } else { + s->ousage ++; + } + } else { + DPRINTFN(1, "Using last usage\n"); + dval = s->usage_last; + } + c->nusages = 1; + /* array type HID item may have multiple usages */ + while ((c->flags & HIO_VARIABLE) == 0 && s->ousage == 0 && + s->iusage < s->nusage && c->nusages < HID_ITEM_MAXUSAGE) + c->usages[c->nusages++] = s->usages_min[s->iusage++]; + if ((c->flags & HIO_VARIABLE) == 0 && s->ousage == 0 && + s->iusage < s->nusage) + DPRINTFN(0, "HID_ITEM_MAXUSAGE should be increased " + "up to %hhu to parse the HID report descriptor\n", + s->nusage); + s->icount ++; + /* + * Only copy HID item, increment position and return + * if correct kindset! + */ + if (s->kindset & (1 << c->kind)) { + *h = *c; + DPRINTFN(1, "%u,%u,%u\n", h->loc.pos, + h->loc.size, h->loc.count); + c->loc.pos += c->loc.size * c->loc.count; + return (1); + } + } + + /* reset state variables */ + s->icount = 0; + s->ncount = 0; + s->iusage = 0; + s->nusage = 0; + s->susage = 0; + s->ousage = 0; + hid_clear_local(c); + + /* get next item */ + while (s->p != s->end) { + bSize = hid_get_byte(s, 1); + if (bSize == 0xfe) { + /* long item */ + bSize = hid_get_byte(s, 1); + bSize |= hid_get_byte(s, 1) << 8; + bTag = hid_get_byte(s, 1); + bType = 0xff; /* XXX what should it be */ + } else { + /* short item */ + bTag = bSize >> 4; + bType = (bSize >> 2) & 3; + bSize &= 3; + if (bSize == 3) + bSize = 4; + } + switch (bSize) { + case 0: + dval = 0; + mask = 0; + break; + case 1: + dval = (int8_t)hid_get_byte(s, 1); + mask = 0xFF; + break; + case 2: + dval = hid_get_byte(s, 1); + dval |= hid_get_byte(s, 1) << 8; + dval = (int16_t)dval; + mask = 0xFFFF; + break; + case 4: + dval = hid_get_byte(s, 1); + dval |= hid_get_byte(s, 1) << 8; + dval |= hid_get_byte(s, 1) << 16; + dval |= hid_get_byte(s, 1) << 24; + mask = 0xFFFFFFFF; + break; + default: + dval = hid_get_byte(s, bSize); + DPRINTFN(0, "bad length %u (data=0x%02x)\n", + bSize, dval); + continue; + } + + switch (bType) { + case 0: /* Main */ + switch (bTag) { + case 8: /* Input */ + c->kind = hid_input; + ret: + c->flags = dval; + c->loc.count = s->loc_count; + c->loc.size = s->loc_size; + + if (c->flags & HIO_VARIABLE) { + /* range check usage count */ + if (c->loc.count > MAXLOCCNT) { + DPRINTFN(0, "Number of " + "items(%u) truncated to %u\n", + (unsigned)(c->loc.count), + MAXLOCCNT); + s->ncount = MAXLOCCNT; + } else + s->ncount = c->loc.count; + + /* + * The "top" loop will return + * one and one item: + */ + c->loc.count = 1; + } else { + s->ncount = 1; + } + goto top; + + case 9: /* Output */ + c->kind = hid_output; + goto ret; + case 10: /* Collection */ + c->kind = hid_collection; + c->collection = dval; + c->collevel++; + c->usage = s->usage_last; + c->nusages = 1; + *h = *c; + return (1); + case 11: /* Feature */ + c->kind = hid_feature; + goto ret; + case 12: /* End collection */ + c->kind = hid_endcollection; + if (c->collevel == 0) { + DPRINTFN(0, "invalid end collection\n"); + return (0); + } + c->collevel--; + *h = *c; + return (1); + default: + DPRINTFN(0, "Main bTag=%d\n", bTag); + break; + } + break; + case 1: /* Global */ + switch (bTag) { + case 0: + c->_usage_page = dval << 16; + break; + case 1: + c->logical_minimum = dval; + break; + case 2: + c->logical_maximum = dval; + break; + case 3: + c->physical_minimum = dval; + break; + case 4: + c->physical_maximum = dval; + break; + case 5: + c->unit_exponent = dval; + break; + case 6: + c->unit = dval; + break; + case 7: + /* mask because value is unsigned */ + s->loc_size = dval & mask; + break; + case 8: + hid_switch_rid(s, c, dval & mask); + break; + case 9: + /* mask because value is unsigned */ + s->loc_count = dval & mask; + break; + case 10: /* Push */ + /* stop parsing, if invalid push level */ + if ((s->pushlevel + 1) >= MAXPUSH) { + DPRINTFN(0, "Cannot push item @ %d\n", s->pushlevel); + return (0); + } + s->pushlevel ++; + s->cur[s->pushlevel] = *c; + /* store size and count */ + c->loc.size = s->loc_size; + c->loc.count = s->loc_count; + /* update current item pointer */ + c = &s->cur[s->pushlevel]; + break; + case 11: /* Pop */ + /* stop parsing, if invalid push level */ + if (s->pushlevel == 0) { + DPRINTFN(0, "Cannot pop item @ 0\n"); + return (0); + } + s->pushlevel --; + /* preserve position */ + oldpos = c->loc.pos; + c = &s->cur[s->pushlevel]; + /* restore size and count */ + s->loc_size = c->loc.size; + s->loc_count = c->loc.count; + /* set default item location */ + c->loc.pos = oldpos; + c->loc.size = 0; + c->loc.count = 0; + break; + default: + DPRINTFN(0, "Global bTag=%d\n", bTag); + break; + } + break; + case 2: /* Local */ + switch (bTag) { + case 0: + if (bSize != 4) + dval = (dval & mask) | c->_usage_page; + + /* set last usage, in case of a collection */ + s->usage_last = dval; + + if (s->nusage < MAXUSAGE) { + s->usages_min[s->nusage] = dval; + s->usages_max[s->nusage] = dval; + s->nusage ++; + } else { + DPRINTFN(0, "max usage reached\n"); + } + + /* clear any pending usage sets */ + s->susage = 0; + break; + case 1: + s->susage |= 1; + + if (bSize != 4) + dval = (dval & mask) | c->_usage_page; + c->usage_minimum = dval; + + goto check_set; + case 2: + s->susage |= 2; + + if (bSize != 4) + dval = (dval & mask) | c->_usage_page; + c->usage_maximum = dval; + + check_set: + if (s->susage != 3) + break; + + /* sanity check */ + if ((s->nusage < MAXUSAGE) && + (c->usage_minimum <= c->usage_maximum)) { + /* add usage range */ + s->usages_min[s->nusage] = + c->usage_minimum; + s->usages_max[s->nusage] = + c->usage_maximum; + s->nusage ++; + } else { + DPRINTFN(0, "Usage set dropped\n"); + } + s->susage = 0; + break; + case 3: + c->designator_index = dval; + break; + case 4: + c->designator_minimum = dval; + break; + case 5: + c->designator_maximum = dval; + break; + case 7: + c->string_index = dval; + break; + case 8: + c->string_minimum = dval; + break; + case 9: + c->string_maximum = dval; + break; + case 10: + c->set_delimiter = dval; + break; + default: + DPRINTFN(0, "Local bTag=%d\n", bTag); + break; + } + break; + default: + DPRINTFN(0, "default bType=%d\n", bType); + break; + } + } + return (0); +} + +/*------------------------------------------------------------------------* + * hid_report_size + *------------------------------------------------------------------------*/ +int +hid_report_size(const void *buf, usb_size_t len, enum hid_kind k, uint8_t *id) +{ + struct hid_data *d; + struct hid_item h; + uint32_t temp; + uint32_t hpos; + uint32_t lpos; + uint8_t any_id; + + any_id = 0; + hpos = 0; + lpos = 0xFFFFFFFF; + + for (d = hid_start_parse(buf, len, 1 << k); hid_get_item(d, &h);) { + if (h.kind == k) { + /* check for ID-byte presence */ + if ((h.report_ID != 0) && !any_id) { + if (id != NULL) + *id = h.report_ID; + any_id = 1; + } + /* compute minimum */ + if (lpos > h.loc.pos) + lpos = h.loc.pos; + /* compute end position */ + temp = h.loc.pos + (h.loc.size * h.loc.count); + /* compute maximum */ + if (hpos < temp) + hpos = temp; + } + } + hid_end_parse(d); + + /* safety check - can happen in case of currupt descriptors */ + if (lpos > hpos) + temp = 0; + else + temp = hpos - lpos; + + /* check for ID byte */ + if (any_id) + temp += 8; + else if (id != NULL) + *id = 0; + + /* return length in bytes rounded up */ + return ((temp + 7) / 8); +} + +/*------------------------------------------------------------------------* + * hid_locate + *------------------------------------------------------------------------*/ +int +hid_locate(const void *desc, usb_size_t size, int32_t u, enum hid_kind k, + uint8_t index, struct hid_location *loc, uint32_t *flags, uint8_t *id) +{ + struct hid_data *d; + struct hid_item h; + int i; + + for (d = hid_start_parse(desc, size, 1 << k); hid_get_item(d, &h);) { + for (i = 0; i < h.nusages; i++) { + if (h.kind == k && h.usages[i] == u) { + if (index--) + break; + if (loc != NULL) + *loc = h.loc; + if (flags != NULL) + *flags = h.flags; + if (id != NULL) + *id = h.report_ID; + hid_end_parse(d); + return (1); + } + } + } + if (loc != NULL) + loc->size = 0; + if (flags != NULL) + *flags = 0; + if (id != NULL) + *id = 0; + hid_end_parse(d); + return (0); +} + +/*------------------------------------------------------------------------* + * hid_get_data + *------------------------------------------------------------------------*/ +static uint32_t +hid_get_data_sub(const uint8_t *buf, usb_size_t len, struct hid_location *loc, + int is_signed) +{ + uint32_t hpos = loc->pos; + uint32_t hsize = loc->size; + uint32_t data; + uint32_t rpos; + uint8_t n; + + DPRINTFN(11, "hid_get_data: loc %d/%d\n", hpos, hsize); + + /* Range check and limit */ + if (hsize == 0) + return (0); + if (hsize > 32) + hsize = 32; + + /* Get data in a safe way */ + data = 0; + rpos = (hpos / 8); + n = (hsize + 7) / 8; + rpos += n; + while (n--) { + rpos--; + if (rpos < len) + data |= buf[rpos] << (8 * n); + } + + /* Correctly shift down data */ + data = (data >> (hpos % 8)); + n = 32 - hsize; + + /* Mask and sign extend in one */ + if (is_signed != 0) + data = (int32_t)((int32_t)data << n) >> n; + else + data = (uint32_t)((uint32_t)data << n) >> n; + + DPRINTFN(11, "hid_get_data: loc %d/%d = %lu\n", + loc->pos, loc->size, (long)data); + return (data); +} + +int32_t +hid_get_data(const uint8_t *buf, usb_size_t len, struct hid_location *loc) +{ + return (hid_get_data_sub(buf, len, loc, 1)); +} + +uint32_t +hid_get_data_unsigned(const uint8_t *buf, usb_size_t len, struct hid_location *loc) +{ + return (hid_get_data_sub(buf, len, loc, 0)); +} + +/*------------------------------------------------------------------------* + * hid_put_data + *------------------------------------------------------------------------*/ +void +hid_put_data_unsigned(uint8_t *buf, usb_size_t len, + struct hid_location *loc, unsigned int value) +{ + uint32_t hpos = loc->pos; + uint32_t hsize = loc->size; + uint64_t data; + uint64_t mask; + uint32_t rpos; + uint8_t n; + + DPRINTFN(11, "hid_put_data: loc %d/%d = %u\n", hpos, hsize, value); + + /* Range check and limit */ + if (hsize == 0) + return; + if (hsize > 32) + hsize = 32; + + /* Put data in a safe way */ + rpos = (hpos / 8); + n = (hsize + 7) / 8; + data = ((uint64_t)value) << (hpos % 8); + mask = ((1ULL << hsize) - 1ULL) << (hpos % 8); + rpos += n; + while (n--) { + rpos--; + if (rpos < len) { + buf[rpos] &= ~(mask >> (8 * n)); + buf[rpos] |= (data >> (8 * n)); + } + } +} + +/*------------------------------------------------------------------------* + * hid_is_collection + *------------------------------------------------------------------------*/ +int +hid_is_collection(const void *desc, usb_size_t size, int32_t usage) +{ + struct hid_data *hd; + struct hid_item hi; + int err; + + hd = hid_start_parse(desc, size, hid_input); + if (hd == NULL) + return (0); + + while ((err = hid_get_item(hd, &hi))) { + if (hi.kind == hid_collection && + hi.usage == usage) + break; + } + hid_end_parse(hd); + return (err); +} + +/*------------------------------------------------------------------------* + * hid_get_descriptor_from_usb + * + * This function will search for a HID descriptor between two USB + * interface descriptors. + * + * Return values: + * NULL: No more HID descriptors. + * Else: Pointer to HID descriptor. + *------------------------------------------------------------------------*/ +struct usb_hid_descriptor * +hid_get_descriptor_from_usb(struct usb_config_descriptor *cd, + struct usb_interface_descriptor *id) +{ + struct usb_descriptor *desc = (void *)id; + + if (desc == NULL) { + return (NULL); + } + while ((desc = usb_desc_foreach(cd, desc))) { + if ((desc->bDescriptorType == UDESC_HID) && + (desc->bLength >= USB_HID_DESCRIPTOR_SIZE(0))) { + return (void *)desc; + } + if (desc->bDescriptorType == UDESC_INTERFACE) { + break; + } + } + return (NULL); +} + +/*------------------------------------------------------------------------* + * usbd_req_get_hid_desc + * + * This function will read out an USB report descriptor from the USB + * device. + * + * Return values: + * NULL: Failure. + * Else: Success. The pointer should eventually be passed to free(). + *------------------------------------------------------------------------*/ +usb_error_t +usbd_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx, + void **descp, uint16_t *sizep, + struct malloc_type *mem, uint8_t iface_index) +{ + struct usb_interface *iface = usbd_get_iface(udev, iface_index); + struct usb_hid_descriptor *hid; + usb_error_t err; + + if ((iface == NULL) || (iface->idesc == NULL)) { + return (USB_ERR_INVAL); + } + hid = hid_get_descriptor_from_usb + (usbd_get_config_descriptor(udev), iface->idesc); + + if (hid == NULL) { + return (USB_ERR_IOERROR); + } + *sizep = UGETW(hid->descrs[0].wDescriptorLength); + if (*sizep == 0) { + return (USB_ERR_IOERROR); + } + if (mtx) + mtx_unlock(mtx); + + *descp = malloc(*sizep, mem, M_ZERO | M_WAITOK); + + if (mtx) + mtx_lock(mtx); + + if (*descp == NULL) { + return (USB_ERR_NOMEM); + } + err = usbd_req_get_report_descriptor + (udev, mtx, *descp, *sizep, iface_index); + + if (err) { + free(*descp, mem); + *descp = NULL; + return (err); + } + return (USB_ERR_NORMAL_COMPLETION); +} + +/*------------------------------------------------------------------------* + * calculate HID item resolution. unit/mm for distances, unit/rad for angles + *------------------------------------------------------------------------*/ +int32_t +hid_item_resolution(struct hid_item *hi) +{ + /* + * hid unit scaling table according to HID Usage Table Review + * Request 39 Tbl 17 http://www.usb.org/developers/hidpage/HUTRR39b.pdf + */ + static const int64_t scale[0x10][2] = { + [0x00] = { 1, 1 }, + [0x01] = { 1, 10 }, + [0x02] = { 1, 100 }, + [0x03] = { 1, 1000 }, + [0x04] = { 1, 10000 }, + [0x05] = { 1, 100000 }, + [0x06] = { 1, 1000000 }, + [0x07] = { 1, 10000000 }, + [0x08] = { 100000000, 1 }, + [0x09] = { 10000000, 1 }, + [0x0A] = { 1000000, 1 }, + [0x0B] = { 100000, 1 }, + [0x0C] = { 10000, 1 }, + [0x0D] = { 1000, 1 }, + [0x0E] = { 100, 1 }, + [0x0F] = { 10, 1 }, + }; + int64_t logical_size; + int64_t physical_size; + int64_t multiplier; + int64_t divisor; + int64_t resolution; + + switch (hi->unit) { + case HUM_CENTIMETER: + multiplier = 1; + divisor = 10; + break; + case HUM_INCH: + multiplier = 10; + divisor = 254; + break; + case HUM_RADIAN: + multiplier = 1; + divisor = 1; + break; + case HUM_DEGREE: + multiplier = 573; + divisor = 10; + break; + default: + return (0); + } + + if ((hi->logical_maximum <= hi->logical_minimum) || + (hi->physical_maximum <= hi->physical_minimum) || + (hi->unit_exponent < 0) || (hi->unit_exponent >= nitems(scale))) + return (0); + + logical_size = (int64_t)hi->logical_maximum - + (int64_t)hi->logical_minimum; + physical_size = (int64_t)hi->physical_maximum - + (int64_t)hi->physical_minimum; + /* Round to ceiling */ + resolution = logical_size * multiplier * scale[hi->unit_exponent][0] / + (physical_size * divisor * scale[hi->unit_exponent][1]); + + if (resolution > INT32_MAX) + return (0); + + return (resolution); +} + +/*------------------------------------------------------------------------* + * hid_is_mouse + * + * This function will decide if a USB descriptor belongs to a USB mouse. + * + * Return values: + * Zero: Not a USB mouse. + * Else: Is a USB mouse. + *------------------------------------------------------------------------*/ +int +hid_is_mouse(const void *d_ptr, uint16_t d_len) +{ + struct hid_data *hd; + struct hid_item hi; + int mdepth; + int found; + + hd = hid_start_parse(d_ptr, d_len, 1 << hid_input); + if (hd == NULL) + return (0); + + mdepth = 0; + found = 0; + *** 653 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9CAF44DE9C3; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@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 4DBj036FXWz4ShQ; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CF1519349; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKp8W063290; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpV3063289; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpV3063289@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: eead9017d283 - main - hid: Chase for HID function name changes in existing USB HID drivers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eead9017d28366016dece0dbc027c5baefcf2cfe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:57 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=eead9017d28366016dece0dbc027c5baefcf2cfe commit eead9017d28366016dece0dbc027c5baefcf2cfe Author: Vladimir Kondratyev AuthorDate: 2021-01-01 18:23:01 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:42 +0000 hid: Chase for HID function name changes in existing USB HID drivers Also hide shim code added in a previous commit under COMPAT_USBHID12. Note: it is enough to add -DCOMPAT_USBHID12 to CFLAGS to compile old code with new HID subsystem, but it is not enough to link it at runtime. HID dependency has to be added explicitly with MODULE_DEPEND macro. Reviewed by: manu, hselasky (as part of D27887) --- sys/dev/sound/usb/uaudio.c | 4 ++- sys/dev/usb/input/atp.c | 4 ++- sys/dev/usb/input/uhid.c | 8 +++--- sys/dev/usb/input/ukbd.c | 14 +++++----- sys/dev/usb/input/ums.c | 4 ++- sys/dev/usb/input/wmt.c | 65 +++++++++------------------------------------ sys/dev/usb/input/wsp.c | 5 +++- sys/dev/usb/misc/ugold.c | 4 ++- sys/dev/usb/serial/ucycom.c | 8 +++--- sys/dev/usb/usbhid.h | 2 ++ 10 files changed, 49 insertions(+), 69 deletions(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 126f0494bac2..c2a7e328b49e 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -69,6 +69,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include "usbdevs.h" #include #include @@ -6145,7 +6147,7 @@ uaudio_hid_probe(struct uaudio_softc *sc, } /* check if there is an ID byte */ - hid_report_size(d_ptr, d_len, hid_input, &id); + hid_report_size_max(d_ptr, d_len, hid_input, &id); if (id != 0) sc->sc_hid.flags |= UAUDIO_HID_HAS_ID; diff --git a/sys/dev/usb/input/atp.c b/sys/dev/usb/input/atp.c index 7b9b1eb04c9c..3515c08a1a6d 100644 --- a/sys/dev/usb/input/atp.c +++ b/sys/dev/usb/input/atp.c @@ -79,6 +79,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -2204,7 +2206,7 @@ atp_attach(device_t dev) return (ENXIO); /* Get HID report descriptor length */ - sc->sc_expected_sensor_data_len = hid_report_size(descriptor_ptr, + sc->sc_expected_sensor_data_len = hid_report_size_max(descriptor_ptr, descriptor_len, hid_input, NULL); free(descriptor_ptr, M_TEMP); diff --git a/sys/dev/usb/input/uhid.c b/sys/dev/usb/input/uhid.c index 97c27608049c..0f87264b7033 100644 --- a/sys/dev/usb/input/uhid.c +++ b/sys/dev/usb/input/uhid.c @@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include "usbdevs.h" #include #include @@ -828,13 +830,13 @@ uhid_attach(device_t dev) DPRINTF("set idle failed, error=%s (ignored)\n", usbd_errstr(error)); } - sc->sc_isize = hid_report_size + sc->sc_isize = hid_report_size_max (sc->sc_repdesc_ptr, sc->sc_repdesc_size, hid_input, &sc->sc_iid); - sc->sc_osize = hid_report_size + sc->sc_osize = hid_report_size_max (sc->sc_repdesc_ptr, sc->sc_repdesc_size, hid_output, &sc->sc_oid); - sc->sc_fsize = hid_report_size + sc->sc_fsize = hid_report_size_max (sc->sc_repdesc_ptr, sc->sc_repdesc_size, hid_feature, &sc->sc_fid); if (sc->sc_isize > UHID_BSIZE) { diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index 261a4b5aef95..3314a3b3e70f 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -62,6 +62,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -717,7 +719,7 @@ ukbd_intr_callback(struct usb_xfer *xfer, usb_error_t error) tmp_loc.count = UKBD_NKEYCODE; while (tmp_loc.count--) { uint32_t key = - hid_get_data_unsigned(sc->sc_buffer, len, &tmp_loc); + hid_get_udata(sc->sc_buffer, len, &tmp_loc); /* advance to next location */ tmp_loc.pos += tmp_loc.size; if (modifiers & MOD_FN) @@ -816,7 +818,7 @@ ukbd_set_leds_callback(struct usb_xfer *xfer, usb_error_t error) if (sc->sc_flags & UKBD_FLAG_NUMLOCK) { if (sc->sc_leds & NLKED) { - hid_put_data_unsigned(sc->sc_buffer + 1, UKBD_BUFFER_SIZE - 1, + hid_put_udata(sc->sc_buffer + 1, UKBD_BUFFER_SIZE - 1, &sc->sc_loc_numlock, 1); } id = sc->sc_id_numlock; @@ -825,7 +827,7 @@ ukbd_set_leds_callback(struct usb_xfer *xfer, usb_error_t error) if (sc->sc_flags & UKBD_FLAG_SCROLLLOCK) { if (sc->sc_leds & SLKED) { - hid_put_data_unsigned(sc->sc_buffer + 1, UKBD_BUFFER_SIZE - 1, + hid_put_udata(sc->sc_buffer + 1, UKBD_BUFFER_SIZE - 1, &sc->sc_loc_scrolllock, 1); } id = sc->sc_id_scrolllock; @@ -834,7 +836,7 @@ ukbd_set_leds_callback(struct usb_xfer *xfer, usb_error_t error) if (sc->sc_flags & UKBD_FLAG_CAPSLOCK) { if (sc->sc_leds & CLKED) { - hid_put_data_unsigned(sc->sc_buffer + 1, UKBD_BUFFER_SIZE - 1, + hid_put_udata(sc->sc_buffer + 1, UKBD_BUFFER_SIZE - 1, &sc->sc_loc_capslock, 1); } id = sc->sc_id_capslock; @@ -983,7 +985,7 @@ ukbd_parse_hid(struct ukbd_softc *sc, const uint8_t *ptr, uint32_t len) memset(sc->sc_loc_key_valid, 0, sizeof(sc->sc_loc_key_valid)); /* check if there is an ID byte */ - sc->sc_kbd_size = hid_report_size(ptr, len, + sc->sc_kbd_size = hid_report_size_max(ptr, len, hid_input, &sc->sc_kbd_id); /* investigate if this is an Apple Keyboard */ @@ -1033,7 +1035,7 @@ ukbd_parse_hid(struct ukbd_softc *sc, const uint8_t *ptr, uint32_t len) } /* figure out leds on keyboard */ - sc->sc_led_size = hid_report_size(ptr, len, + sc->sc_led_size = hid_report_size_max(ptr, len, hid_output, NULL); if (hid_locate(ptr, len, diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c index 038ed8121df1..6b7c3d526ad0 100644 --- a/sys/dev/usb/input/ums.c +++ b/sys/dev/usb/input/ums.c @@ -61,6 +61,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -614,7 +616,7 @@ ums_attach(device_t dev) goto detach; } - isize = hid_report_size(d_ptr, d_len, hid_input, &sc->sc_iid); + isize = hid_report_size_max(d_ptr, d_len, hid_input, &sc->sc_iid); /* * The Microsoft Wireless Notebook Optical Mouse seems to be in worse diff --git a/sys/dev/usb/input/wmt.c b/sys/dev/usb/input/wmt.c index 056c2c3cb0cc..8191c6ff9369 100644 --- a/sys/dev/usb/input/wmt.c +++ b/sys/dev/usb/input/wmt.c @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include "usbdevs.h" #include #include @@ -352,7 +354,7 @@ wmt_attach(device_t dev) sc->cont_max_rlen, uaa->info.bIfaceIndex, UHID_FEATURE_REPORT, sc->cont_max_rid); if (err == USB_ERR_NORMAL_COMPLETION) { - cont_count_max = hid_get_data_unsigned(sc->buf + 1, + cont_count_max = hid_get_udata(sc->buf + 1, sc->cont_max_rlen - 1, &sc->cont_max_loc); /* * Feature report is a primary source of @@ -377,7 +379,7 @@ wmt_attach(device_t dev) } if (sc->btn_type_rlen > 1) { if (err == 0) - sc->is_clickpad = hid_get_data_unsigned(sc->buf + 1, + sc->is_clickpad = hid_get_udata(sc->buf + 1, sc->btn_type_rlen - 1, &sc->btn_type_loc) == 0; else DPRINTF("usbd_req_get_report error=%d\n", err); @@ -522,7 +524,7 @@ wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) * report with contactid=0 but contactids are zero-based, find * contactcount first. */ - cont_count = hid_get_data_unsigned(buf, len, &sc->cont_count_loc); + cont_count = hid_get_udata(buf, len, &sc->cont_count_loc); /* * "In Hybrid mode, the number of contacts that can be reported in one * report is less than the maximum number of contacts that the device @@ -559,7 +561,7 @@ wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) bzero(slot_data, sizeof(sc->slot_data)); WMT_FOREACH_USAGE(sc->caps, usage) { if (sc->locs[cont][usage].size > 0) - slot_data[usage] = hid_get_data_unsigned( + slot_data[usage] = hid_get_udata( buf, len, &sc->locs[cont][usage]); } @@ -611,8 +613,7 @@ wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) sc->nconts_todo -= cont_count; if (sc->do_timestamps && sc->nconts_todo == 0) { /* HUD_SCAN_TIME is measured in 100us, convert to us. */ - scan_time = - hid_get_data_unsigned(buf, len, &sc->scan_time_loc); + scan_time = hid_get_udata(buf, len, &sc->scan_time_loc); if (sc->prev_touch) { delta = scan_time - sc->scan_time; if (delta < 0) @@ -747,46 +748,6 @@ wmt_ev_open(struct evdev_dev *evdev) } #endif -/* port of userland hid_report_size() from usbhid(3) to kernel */ -static int -wmt_hid_report_size(const void *buf, uint16_t len, enum hid_kind k, uint8_t id) -{ - struct hid_data *d; - struct hid_item h; - uint32_t temp; - uint32_t hpos; - uint32_t lpos; - int report_id = 0; - - hpos = 0; - lpos = 0xFFFFFFFF; - - for (d = hid_start_parse(buf, len, 1 << k); hid_get_item(d, &h);) { - if (h.kind == k && h.report_ID == id) { - /* compute minimum */ - if (lpos > h.loc.pos) - lpos = h.loc.pos; - /* compute end position */ - temp = h.loc.pos + (h.loc.size * h.loc.count); - /* compute maximum */ - if (hpos < temp) - hpos = temp; - if (h.report_ID != 0) - report_id = 1; - } - } - hid_end_parse(d); - - /* safety check - can happen in case of currupt descriptors */ - if (lpos > hpos) - temp = 0; - else - temp = hpos - lpos; - - /* return length in bytes rounded up */ - return ((temp + 7) / 8 + report_id); -} - static enum wmt_type wmt_hid_parse(struct wmt_softc *sc, const void *d_ptr, uint16_t d_len) { @@ -1000,16 +961,16 @@ wmt_hid_parse(struct wmt_softc *sc, const void *d_ptr, uint16_t d_len) sc->ai[WMT_ORIENTATION].max = 1; } - sc->isize = hid_report_size(d_ptr, d_len, hid_input, NULL); - sc->report_len = wmt_hid_report_size(d_ptr, d_len, hid_input, + sc->isize = hid_report_size_max(d_ptr, d_len, hid_input, NULL); + sc->report_len = hid_report_size(d_ptr, d_len, hid_input, report_id); - sc->cont_max_rlen = wmt_hid_report_size(d_ptr, d_len, hid_feature, + sc->cont_max_rlen = hid_report_size(d_ptr, d_len, hid_feature, sc->cont_max_rid); if (sc->btn_type_rid > 0) - sc->btn_type_rlen = wmt_hid_report_size(d_ptr, d_len, + sc->btn_type_rlen = hid_report_size(d_ptr, d_len, hid_feature, sc->btn_type_rid); if (sc->thqa_cert_rid > 0) - sc->thqa_cert_rlen = wmt_hid_report_size(d_ptr, d_len, + sc->thqa_cert_rlen = hid_report_size(d_ptr, d_len, hid_feature, sc->thqa_cert_rid); sc->report_id = report_id; @@ -1039,7 +1000,7 @@ wmt_set_input_mode(struct wmt_softc *sc, enum wmt_input_mode mode) bzero(sc->buf + 1, sc->input_mode_rlen - 1); sc->buf[0] = sc->input_mode_rid; - hid_put_data_unsigned(sc->buf + 1, sc->input_mode_rlen - 1, + hid_put_udata(sc->buf + 1, sc->input_mode_rlen - 1, &sc->input_mode_loc, mode); err = usbd_req_set_report(uaa->device, NULL, sc->buf, sc->input_mode_rlen, uaa->info.bIfaceIndex, diff --git a/sys/dev/usb/input/wsp.c b/sys/dev/usb/input/wsp.c index 29eaa34cdfdc..a25539e7b939 100644 --- a/sys/dev/usb/input/wsp.c +++ b/sys/dev/usb/input/wsp.c @@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -733,7 +735,8 @@ wsp_attach(device_t dev) if (err == USB_ERR_NORMAL_COMPLETION) { /* Get HID report descriptor length */ - sc->tp_datalen = hid_report_size(d_ptr, d_len, hid_input, NULL); + sc->tp_datalen = hid_report_size_max(d_ptr, d_len, hid_input, + NULL); free(d_ptr, M_TEMP); if (sc->tp_datalen <= 0 || sc->tp_datalen > WSP_BUFFER_MAX) { diff --git a/sys/dev/usb/misc/ugold.c b/sys/dev/usb/misc/ugold.c index f09bd629af28..b5fb9591857f 100644 --- a/sys/dev/usb/misc/ugold.c +++ b/sys/dev/usb/misc/ugold.c @@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -227,7 +229,7 @@ ugold_attach(device_t dev) if (error) goto detach; - (void)hid_report_size(d_ptr, d_len, hid_input, &sc->sc_report_id); + (void)hid_report_size_max(d_ptr, d_len, hid_input, &sc->sc_report_id); free(d_ptr, M_TEMP); diff --git a/sys/dev/usb/serial/ucycom.c b/sys/dev/usb/serial/ucycom.c index 7870d9c88227..06ef6480f27c 100644 --- a/sys/dev/usb/serial/ucycom.c +++ b/sys/dev/usb/serial/ucycom.c @@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -249,9 +251,9 @@ ucycom_attach(device_t dev) } /* get report sizes */ - sc->sc_flen = hid_report_size(urd_ptr, urd_len, hid_feature, &sc->sc_fid); - sc->sc_ilen = hid_report_size(urd_ptr, urd_len, hid_input, &sc->sc_iid); - sc->sc_olen = hid_report_size(urd_ptr, urd_len, hid_output, &sc->sc_oid); + sc->sc_flen = hid_report_size_max(urd_ptr, urd_len, hid_feature, &sc->sc_fid); + sc->sc_ilen = hid_report_size_max(urd_ptr, urd_len, hid_input, &sc->sc_iid); + sc->sc_olen = hid_report_size_max(urd_ptr, urd_len, hid_output, &sc->sc_oid); if ((sc->sc_ilen > UCYCOM_MAX_IOLEN) || (sc->sc_ilen < 1) || (sc->sc_olen > UCYCOM_MAX_IOLEN) || (sc->sc_olen < 2) || diff --git a/sys/dev/usb/usbhid.h b/sys/dev/usb/usbhid.h index 9e87e8226abf..9ceb3d147af2 100644 --- a/sys/dev/usb/usbhid.h +++ b/sys/dev/usb/usbhid.h @@ -70,6 +70,7 @@ struct usb_hid_descriptor { #if defined(_KERNEL) || defined(_STANDALONE) struct usb_config_descriptor; +#ifdef COMPAT_USBHID12 /* FreeBSD <= 12 compat shims */ #define hid_report_size(buf, len, kind, id) \ hid_report_size_max(buf, len, kind, id) @@ -85,6 +86,7 @@ hid_put_data_unsigned(uint8_t *buf, hid_size_t len, struct hid_location *loc, { return (hid_put_udata(buf, len, loc, value)); } +#endif struct usb_hid_descriptor *hid_get_descriptor_from_usb( struct usb_config_descriptor *cd, From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 61D874DE8F6; Thu, 7 Jan 2021 23:20:53 +0000 (UTC) (envelope-from git@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 4DBj04361tz4ShT; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C208F19655; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKp7B063358; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpuv063357; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpuv063357@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: bc861033357e - main - libkern/strcasestr.c: Drop xlocale support and connect to build. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc861033357ef2d2eeaf5d85d70bb4b638961b2d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:57 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=bc861033357ef2d2eeaf5d85d70bb4b638961b2d commit bc861033357ef2d2eeaf5d85d70bb4b638961b2d Author: Vladimir Kondratyev AuthorDate: 2020-10-06 14:50:52 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:42 +0000 libkern/strcasestr.c: Drop xlocale support and connect to build. Reviewed by: markj, hselasky Differential revision: https://reviews.freebsd.org/D27866 --- sys/conf/files | 1 + sys/libkern/strcasestr.c | 22 ++++++++-------------- sys/sys/libkern.h | 1 + 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 0258fca24836..7cfb32560af6 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4058,6 +4058,7 @@ libkern/qsort_r.c standard libkern/random.c standard libkern/scanc.c standard libkern/strcasecmp.c standard +libkern/strcasestr.c standard libkern/strcat.c standard libkern/strchr.c standard libkern/strchrnul.c optional gdb diff --git a/sys/libkern/strcasestr.c b/sys/libkern/strcasestr.c index b70c2195a94e..c0418cfaeb3d 100644 --- a/sys/libkern/strcasestr.c +++ b/sys/libkern/strcasestr.c @@ -40,35 +40,29 @@ #include __FBSDID("$FreeBSD$"); -#include -#include -#include "xlocale_private.h" +#include +#include +#include /* * Find the first occurrence of find in s, ignore case. */ char * -strcasestr_l(const char *s, const char *find, locale_t locale) +strcasestr(const char *s, const char *find) { char c, sc; size_t len; - FIX_LOCALE(locale); if ((c = *find++) != 0) { - c = tolower_l((unsigned char)c, locale); + c = tolower((unsigned char)c); len = strlen(find); do { do { if ((sc = *s++) == 0) return (NULL); - } while ((char)tolower_l((unsigned char)sc, locale) != c); - } while (strncasecmp_l(s, find, len, locale) != 0); + } while ((char)tolower((unsigned char)sc) != c); + } while (strncasecmp(s, find, len) != 0); s--; } - return ((char *)s); -} -char * -strcasestr(const char *s, const char *find) -{ - return strcasestr_l(s, find, __get_locale()); + return (__DECONST(char *, s)); } diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index 7385df139297..3874ef9ec4bd 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -168,6 +168,7 @@ void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, u_long random(void); int scanc(u_int, const u_char *, const u_char *, int); int strcasecmp(const char *, const char *); +char *strcasestr(const char *, const char *); char *strcat(char * __restrict, const char * __restrict); char *strchr(const char *, int); char *strchrnul(const char *, int); From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:21:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9B0D94DEBB3; Thu, 7 Jan 2021 23:20:54 +0000 (UTC) (envelope-from git@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 4DBj044vXTz4Sw9; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 111D61934D; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpjN063443; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpQM063442; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpQM063442@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 95e1f0d68470 - main - Allow HID report descriptor parser to return more then 1 usage per item MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95e1f0d6847060f9c7d90b6b7655b64029929efd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:21:01 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=95e1f0d6847060f9c7d90b6b7655b64029929efd commit 95e1f0d6847060f9c7d90b6b7655b64029929efd Author: Vladimir Kondratyev AuthorDate: 2020-12-24 11:46:24 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:41 +0000 Allow HID report descriptor parser to return more then 1 usage per item This handles parsing of following descriptor, containing array of usages: 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 0x09, 0x80, // Usage (Sys Control) 0xA1, 0x01, // Collection (Application) 0x75, 0x02, // Report Size (2) 0x95, 0x01, // Report Count (1) 0x15, 0x01, // Logical Minimum (1) 0x25, 0x03, // Logical Maximum (3) 0x09, 0x82, // Usage (Sys Sleep) 0x09, 0x81, // Usage (Sys Power Down) 0x09, 0x83, // Usage (Sys Wake Up) 0x81, 0x60, // Input (Data,Array,Abs) 0x75, 0x06, // Report Size (6) 0x81, 0x03, // Input (Const,Var,Abs) 0xC0, // End Collection Our current parser returns only first usage (Sys Sleep) and loses next two. Set HID_ITEM_MAXUSAGE limit relatively low as existing code usually allocates hid_item on stack. Also tweak hid_locate() to support hid items with multiple usages. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D27748 --- sys/dev/usb/usb_hid.c | 39 +++++++++++++++++++++++++++------------ sys/dev/usb/usbhid.h | 8 +++++++- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/sys/dev/usb/usb_hid.c b/sys/dev/usb/usb_hid.c index dd0c8d4b42ac..22e5fb5446c3 100644 --- a/sys/dev/usb/usb_hid.c +++ b/sys/dev/usb/usb_hid.c @@ -111,7 +111,8 @@ hid_clear_local(struct hid_item *c) c->loc.count = 0; c->loc.size = 0; - c->usage = 0; + c->nusages = 0; + memset(c->usages, 0, sizeof(c->usages)); c->usage_minimum = 0; c->usage_maximum = 0; c->designator_index = 0; @@ -273,6 +274,16 @@ hid_get_item(struct hid_data *s, struct hid_item *h) DPRINTFN(1, "Using last usage\n"); dval = s->usage_last; } + c->nusages = 1; + /* array type HID item may have multiple usages */ + while ((c->flags & HIO_VARIABLE) == 0 && s->ousage == 0 && + s->iusage < s->nusage && c->nusages < HID_ITEM_MAXUSAGE) + c->usages[c->nusages++] = s->usages_min[s->iusage++]; + if ((c->flags & HIO_VARIABLE) == 0 && s->ousage == 0 && + s->iusage < s->nusage) + DPRINTFN(0, "HID_ITEM_MAXUSAGE should be increased " + "up to %hhu to parse the HID report descriptor\n", + s->nusage); s->icount ++; /* * Only copy HID item, increment position and return @@ -381,6 +392,7 @@ hid_get_item(struct hid_data *s, struct hid_item *h) c->collection = dval; c->collevel++; c->usage = s->usage_last; + c->nusages = 1; *h = *c; return (1); case 11: /* Feature */ @@ -620,19 +632,22 @@ hid_locate(const void *desc, usb_size_t size, int32_t u, enum hid_kind k, { struct hid_data *d; struct hid_item h; + int i; for (d = hid_start_parse(desc, size, 1 << k); hid_get_item(d, &h);) { - if (h.kind == k && h.usage == u) { - if (index--) - continue; - if (loc != NULL) - *loc = h.loc; - if (flags != NULL) - *flags = h.flags; - if (id != NULL) - *id = h.report_ID; - hid_end_parse(d); - return (1); + for (i = 0; i < h.nusages; i++) { + if (h.kind == k && h.usages[i] == u) { + if (index--) + break; + if (loc != NULL) + *loc = h.loc; + if (flags != NULL) + *flags = h.flags; + if (id != NULL) + *id = h.report_ID; + hid_end_parse(d); + return (1); + } } } if (loc != NULL) diff --git a/sys/dev/usb/usbhid.h b/sys/dev/usb/usbhid.h index 30949ea9a62a..926c404dca55 100644 --- a/sys/dev/usb/usbhid.h +++ b/sys/dev/usb/usbhid.h @@ -208,6 +208,8 @@ struct usb_hid_descriptor { #if defined(_KERNEL) || defined(_STANDALONE) struct usb_config_descriptor; +#define HID_ITEM_MAXUSAGE 4 + enum hid_kind { hid_input, hid_output, hid_feature, hid_collection, hid_endcollection }; @@ -229,7 +231,11 @@ struct hid_item { int32_t unit; int32_t report_ID; /* Local */ - int32_t usage; + int nusages; + union { + int32_t usage; + int32_t usages[HID_ITEM_MAXUSAGE]; + }; int32_t usage_minimum; int32_t usage_maximum; int32_t designator_index; From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6F7884DE9C5; Thu, 7 Jan 2021 23:20:53 +0000 (UTC) (envelope-from git@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 4DBj044rNrz4Sqn; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAE9619277; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpcP063409; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpnl063408; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpnl063408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: d276eae674d2 - main - evdev: Make open(2) and close(3) handlers sleepable. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d276eae674d22214d6a58d1f4871053ceb0cb9f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:58 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=d276eae674d22214d6a58d1f4871053ceb0cb9f5 commit d276eae674d22214d6a58d1f4871053ceb0cb9f5 Author: Vladimir Kondratyev AuthorDate: 2020-04-21 10:26:58 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:41 +0000 evdev: Make open(2) and close(3) handlers sleepable. At the beginning of evdev there was a LOR between hardware driver's and evdev client list locks as they were taken in different order at driver's interrupt and evdev open()/close() handlers. The LOR was fixed with introduction of evdev_register_mtx() function which allowed to use a hardware driver's lock as evdev client list lock. While this works good with PS/2 and USB, this does not work with I2C. Unlike PS/2 and USB, I2C open()/close() handlers do unbound sleeps while waiting for I2C bus to release and while performing IO. This change uses epoch(9) for traversing evdev client list in interrupt handler to avoid the LOR thus making possible to convert evdev client list lock to sleepable sx. While here add brief locking protocol description. Reviewed by: markj Differential revision: https://reviews.freebsd.org/D27865 --- sys/dev/evdev/cdev.c | 23 ++++----- sys/dev/evdev/evdev.c | 83 ++++++++++++++++++++++-------- sys/dev/evdev/evdev.h | 3 ++ sys/dev/evdev/evdev_private.h | 114 +++++++++++++++++++++++++++++------------- 4 files changed, 156 insertions(+), 67 deletions(-) diff --git a/sys/dev/evdev/cdev.c b/sys/dev/evdev/cdev.c index cd40d1f218a7..c4550362ebce 100644 --- a/sys/dev/evdev/cdev.c +++ b/sys/dev/evdev/cdev.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -126,7 +127,7 @@ evdev_open(struct cdev *dev, int oflags, int devtype, struct thread *td) knlist_init_mtx(&client->ec_selp.si_note, &client->ec_buffer_mtx); /* Avoid race with evdev_unregister */ - EVDEV_LOCK(evdev); + EVDEV_LIST_LOCK(evdev); if (dev->si_drv1 == NULL) ret = ENODEV; else @@ -134,13 +135,9 @@ evdev_open(struct cdev *dev, int oflags, int devtype, struct thread *td) if (ret != 0) evdev_revoke_client(client); - /* - * Unlock evdev here because non-sleepable lock held - * while calling devfs_set_cdevpriv upsets WITNESS - */ - EVDEV_UNLOCK(evdev); + EVDEV_LIST_UNLOCK(evdev); - if (!ret) + if (ret == 0) ret = devfs_set_cdevpriv(client, evdev_dtor); if (ret != 0) { @@ -156,11 +153,13 @@ evdev_dtor(void *data) { struct evdev_client *client = (struct evdev_client *)data; - EVDEV_LOCK(client->ec_evdev); + EVDEV_LIST_LOCK(client->ec_evdev); if (!client->ec_revoked) evdev_dispose_client(client->ec_evdev, client); - EVDEV_UNLOCK(client->ec_evdev); + EVDEV_LIST_UNLOCK(client->ec_evdev); + if (client->ec_evdev->ev_lock_type != EV_LOCK_MTX) + epoch_wait_preempt(INPUT_EPOCH); knlist_clear(&client->ec_selp.si_note, 0); seldrain(&client->ec_selp); knlist_destroy(&client->ec_selp.si_note); @@ -547,12 +546,12 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, if (*(int *)data != 0) return (EINVAL); - EVDEV_LOCK(evdev); + EVDEV_LIST_LOCK(evdev); if (dev->si_drv1 != NULL && !client->ec_revoked) { evdev_dispose_client(evdev, client); evdev_revoke_client(client); } - EVDEV_UNLOCK(evdev); + EVDEV_LIST_UNLOCK(evdev); return (0); case EVIOCSCLOCKID: @@ -717,7 +716,7 @@ void evdev_revoke_client(struct evdev_client *client) { - EVDEV_LOCK_ASSERT(client->ec_evdev); + EVDEV_LIST_LOCK_ASSERT(client->ec_evdev); client->ec_revoked = true; } diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index 8d520e3ac09e..e76abbc816d3 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -31,12 +31,15 @@ #include #include +#include #include +#include #include #include #include #include #include +#include #include #include @@ -295,12 +298,14 @@ evdev_register_common(struct evdev_dev *evdev) evdev->ev_shortname, evdev->ev_name, evdev->ev_serial); /* Initialize internal structures */ - LIST_INIT(&evdev->ev_clients); + CK_SLIST_INIT(&evdev->ev_clients); + sx_init(&evdev->ev_list_lock, "evsx"); if (evdev_event_supported(evdev, EV_REP) && bit_test(evdev->ev_flags, EVDEV_FLAG_SOFTREPEAT)) { /* Initialize callout */ - callout_init_mtx(&evdev->ev_rep_callout, evdev->ev_lock, 0); + callout_init_mtx(&evdev->ev_rep_callout, + evdev->ev_state_lock, 0); if (evdev->ev_rep[REP_DELAY] == 0 && evdev->ev_rep[REP_PERIOD] == 0) { @@ -332,6 +337,8 @@ evdev_register_common(struct evdev_dev *evdev) evdev_sysctl_create(evdev); bail_out: + if (ret != 0) + sx_destroy(&evdev->ev_list_lock); return (ret); } @@ -340,8 +347,11 @@ evdev_register(struct evdev_dev *evdev) { int ret; - evdev->ev_lock_type = EV_LOCK_INTERNAL; - evdev->ev_lock = &evdev->ev_mtx; + if (bit_test(evdev->ev_flags, EVDEV_FLAG_EXT_EPOCH)) + evdev->ev_lock_type = EV_LOCK_EXT_EPOCH; + else + evdev->ev_lock_type = EV_LOCK_INTERNAL; + evdev->ev_state_lock = &evdev->ev_mtx; mtx_init(&evdev->ev_mtx, "evmtx", NULL, MTX_DEF); ret = evdev_register_common(evdev); @@ -356,7 +366,7 @@ evdev_register_mtx(struct evdev_dev *evdev, struct mtx *mtx) { evdev->ev_lock_type = EV_LOCK_MTX; - evdev->ev_lock = mtx; + evdev->ev_state_lock = mtx; return (evdev_register_common(evdev)); } @@ -370,22 +380,23 @@ evdev_unregister(struct evdev_dev *evdev) sysctl_ctx_free(&evdev->ev_sysctl_ctx); - EVDEV_LOCK(evdev); + EVDEV_LIST_LOCK(evdev); evdev->ev_cdev->si_drv1 = NULL; /* Wake up sleepers */ - LIST_FOREACH_SAFE(client, &evdev->ev_clients, ec_link, tmp) { + CK_SLIST_FOREACH_SAFE(client, &evdev->ev_clients, ec_link, tmp) { evdev_revoke_client(client); evdev_dispose_client(evdev, client); EVDEV_CLIENT_LOCKQ(client); evdev_notify_event(client); EVDEV_CLIENT_UNLOCKQ(client); } - EVDEV_UNLOCK(evdev); + EVDEV_LIST_UNLOCK(evdev); - /* destroy_dev can sleep so release lock */ + /* release lock to avoid deadlock with evdev_dtor */ ret = evdev_cdev_destroy(evdev); evdev->ev_cdev = NULL; - if (ret == 0 && evdev->ev_lock_type == EV_LOCK_INTERNAL) + sx_destroy(&evdev->ev_list_lock); + if (ret == 0 && evdev->ev_lock_type != EV_LOCK_MTX) mtx_destroy(&evdev->ev_mtx); evdev_free_absinfo(evdev->ev_absinfo); @@ -689,7 +700,7 @@ evdev_modify_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, } else { /* Start/stop callout for evdev repeats */ if (bit_test(evdev->ev_key_states, code) == !*value && - !LIST_EMPTY(&evdev->ev_clients)) { + !CK_SLIST_EMPTY(&evdev->ev_clients)) { if (*value == KEY_EVENT_DOWN) evdev_start_repeat(evdev, code); else @@ -817,6 +828,7 @@ static void evdev_propagate_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, int32_t value) { + struct epoch_tracker et; struct evdev_client *client; debugf(evdev, "%s pushed event %d/%d/%d", @@ -825,7 +837,14 @@ evdev_propagate_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, EVDEV_LOCK_ASSERT(evdev); /* Propagate event through all clients */ - LIST_FOREACH(client, &evdev->ev_clients, ec_link) { + if (evdev->ev_lock_type == EV_LOCK_INTERNAL) + epoch_enter_preempt(INPUT_EPOCH, &et); + + KASSERT( + evdev->ev_lock_type == EV_LOCK_MTX || in_epoch(INPUT_EPOCH) != 0, + ("Input epoch has not been entered\n")); + + CK_SLIST_FOREACH(client, &evdev->ev_clients, ec_link) { if (evdev->ev_grabber != NULL && evdev->ev_grabber != client) continue; @@ -835,6 +854,8 @@ evdev_propagate_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, evdev_notify_event(client); EVDEV_CLIENT_UNLOCKQ(client); } + if (evdev->ev_lock_type == EV_LOCK_INTERNAL) + epoch_exit_preempt(INPUT_EPOCH, &et); evdev->ev_event_count++; } @@ -932,6 +953,7 @@ int evdev_inject_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, int32_t value) { + struct epoch_tracker et; int ret = 0; switch (type) { @@ -962,11 +984,16 @@ evdev_inject_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, case EV_ABS: case EV_SW: push: - if (evdev->ev_lock_type != EV_LOCK_INTERNAL) + if (evdev->ev_lock_type == EV_LOCK_MTX) EVDEV_LOCK(evdev); + else if (evdev->ev_lock_type == EV_LOCK_EXT_EPOCH) + epoch_enter_preempt(INPUT_EPOCH, &et); ret = evdev_push_event(evdev, type, code, value); - if (evdev->ev_lock_type != EV_LOCK_INTERNAL) + if (evdev->ev_lock_type == EV_LOCK_MTX) EVDEV_UNLOCK(evdev); + else if (evdev->ev_lock_type == EV_LOCK_EXT_EPOCH) + epoch_exit_preempt(INPUT_EPOCH, &et); + break; default: @@ -983,16 +1010,16 @@ evdev_register_client(struct evdev_dev *evdev, struct evdev_client *client) debugf(evdev, "adding new client for device %s", evdev->ev_shortname); - EVDEV_LOCK_ASSERT(evdev); + EVDEV_LIST_LOCK_ASSERT(evdev); - if (LIST_EMPTY(&evdev->ev_clients) && evdev->ev_methods != NULL && + if (CK_SLIST_EMPTY(&evdev->ev_clients) && evdev->ev_methods != NULL && evdev->ev_methods->ev_open != NULL) { debugf(evdev, "calling ev_open() on device %s", evdev->ev_shortname); ret = evdev->ev_methods->ev_open(evdev); } if (ret == 0) - LIST_INSERT_HEAD(&evdev->ev_clients, client, ec_link); + CK_SLIST_INSERT_HEAD(&evdev->ev_clients, client, ec_link); return (ret); } @@ -1001,18 +1028,27 @@ evdev_dispose_client(struct evdev_dev *evdev, struct evdev_client *client) { debugf(evdev, "removing client for device %s", evdev->ev_shortname); - EVDEV_LOCK_ASSERT(evdev); + EVDEV_LIST_LOCK_ASSERT(evdev); - LIST_REMOVE(client, ec_link); - if (LIST_EMPTY(&evdev->ev_clients)) { + CK_SLIST_REMOVE(&evdev->ev_clients, client, evdev_client, ec_link); + if (CK_SLIST_EMPTY(&evdev->ev_clients)) { if (evdev->ev_methods != NULL && evdev->ev_methods->ev_close != NULL) (void)evdev->ev_methods->ev_close(evdev); if (evdev_event_supported(evdev, EV_REP) && - bit_test(evdev->ev_flags, EVDEV_FLAG_SOFTREPEAT)) + bit_test(evdev->ev_flags, EVDEV_FLAG_SOFTREPEAT)) { + if (evdev->ev_lock_type != EV_LOCK_MTX) + EVDEV_LOCK(evdev); evdev_stop_repeat(evdev); + if (evdev->ev_lock_type != EV_LOCK_MTX) + EVDEV_UNLOCK(evdev); + } } + if (evdev->ev_lock_type != EV_LOCK_MTX) + EVDEV_LOCK(evdev); evdev_release_client(evdev, client); + if (evdev->ev_lock_type != EV_LOCK_MTX) + EVDEV_UNLOCK(evdev); } int @@ -1046,10 +1082,15 @@ evdev_release_client(struct evdev_dev *evdev, struct evdev_client *client) static void evdev_repeat_callout(void *arg) { + struct epoch_tracker et; struct evdev_dev *evdev = (struct evdev_dev *)arg; + if (evdev->ev_lock_type == EV_LOCK_EXT_EPOCH) + epoch_enter_preempt(INPUT_EPOCH, &et); evdev_send_event(evdev, EV_KEY, evdev->ev_rep_key, KEY_EVENT_REPEAT); evdev_send_event(evdev, EV_SYN, SYN_REPORT, 1); + if (evdev->ev_lock_type == EV_LOCK_EXT_EPOCH) + epoch_exit_preempt(INPUT_EPOCH, &et); if (evdev->ev_rep[REP_PERIOD]) callout_reset(&evdev->ev_rep_callout, diff --git a/sys/dev/evdev/evdev.h b/sys/dev/evdev/evdev.h index f584e52fc8e4..30d6a106d8b3 100644 --- a/sys/dev/evdev/evdev.h +++ b/sys/dev/evdev/evdev.h @@ -30,6 +30,7 @@ #define _DEV_EVDEV_EVDEV_H #include +#include #include #include #include @@ -87,6 +88,8 @@ extern int evdev_sysmouse_t_axis; * for MT protocol type B reports */ #define EVDEV_FLAG_MT_AUTOREL 0x02 /* Autorelease MT-slots not listed in * current MT protocol type B report */ +#define EVDEV_FLAG_EXT_EPOCH 0x03 /* evdev_push_* is allways called with + * input (global) epoch entered */ #define EVDEV_FLAG_MAX 0x1F #define EVDEV_FLAG_CNT (EVDEV_FLAG_MAX + 1) diff --git a/sys/dev/evdev/evdev_private.h b/sys/dev/evdev/evdev_private.h index d7f0b4eab62f..66a059c763bc 100644 --- a/sys/dev/evdev/evdev_private.h +++ b/sys/dev/evdev/evdev_private.h @@ -31,12 +31,15 @@ #define _DEV_EVDEV_EVDEV_PRIVATE_H #include +#include +#include #include #include #include #include #include #include +#include #include #include @@ -75,10 +78,33 @@ enum evdev_clock_id EV_CLOCK_BOOTTIME /* monotonic, suspend-awared */ }; +/* + * Locking. + * + * Internal evdev structures are protected with next locks: + * State lock (s) - Internal state. The data it protects is changed + * by incoming evdev events and some ioctls. + * Client list epoch (l) - Read access to client list. + * Client list lock (l) - Write access to client list. + * Client queue locks (q) - One lock per client to serialize access to data + * available through character device node. + * + * Depending on evdev_register_() suffix evdev can run in following modes: + * 1. Internal epoch. evdev_register(). All locks are internal. + * 2. External epoch. Evdev expects to be run under input epoch entered by + * parent driver. The mode is enabled with EVDEV_FLAG_EXT_EPOCH flag. + * 3. External mutex. evdev_register_mtx(). Evdev uses mutex provided by parent + * driver as both "State lock" and "Client list lock". This mode is + * deprecated as it causes ev_open and ev_close handlers to be called with + * parent driver mutex taken. + */ +#define INPUT_EPOCH global_epoch_preempt + enum evdev_lock_type { - EV_LOCK_INTERNAL = 0, /* Internal evdev mutex */ + EV_LOCK_INTERNAL = 0, /* Internal epoch */ EV_LOCK_MTX, /* Driver`s mutex */ + EV_LOCK_EXT_EPOCH, /* External epoch */ }; struct evdev_dev @@ -89,10 +115,11 @@ struct evdev_dev struct cdev * ev_cdev; int ev_unit; enum evdev_lock_type ev_lock_type; - struct mtx * ev_lock; - struct mtx ev_mtx; + struct mtx * ev_state_lock; /* State lock */ + struct mtx ev_mtx; /* Internal state lock */ + struct sx ev_list_lock; /* Client list lock */ struct input_id ev_id; - struct evdev_client * ev_grabber; + struct evdev_client * ev_grabber; /* (s) */ size_t ev_report_size; /* Supported features: */ @@ -105,31 +132,31 @@ struct evdev_dev bitstr_t bit_decl(ev_led_flags, LED_CNT); bitstr_t bit_decl(ev_snd_flags, SND_CNT); bitstr_t bit_decl(ev_sw_flags, SW_CNT); - struct input_absinfo * ev_absinfo; + struct input_absinfo * ev_absinfo; /* (s) */ bitstr_t bit_decl(ev_flags, EVDEV_FLAG_CNT); /* Repeat parameters & callout: */ - int ev_rep[REP_CNT]; - struct callout ev_rep_callout; - uint16_t ev_rep_key; + int ev_rep[REP_CNT]; /* (s) */ + struct callout ev_rep_callout; /* (s) */ + uint16_t ev_rep_key; /* (s) */ /* State: */ - bitstr_t bit_decl(ev_key_states, KEY_CNT); - bitstr_t bit_decl(ev_led_states, LED_CNT); - bitstr_t bit_decl(ev_snd_states, SND_CNT); - bitstr_t bit_decl(ev_sw_states, SW_CNT); - bool ev_report_opened; + bitstr_t bit_decl(ev_key_states, KEY_CNT); /* (s) */ + bitstr_t bit_decl(ev_led_states, LED_CNT); /* (s) */ + bitstr_t bit_decl(ev_snd_states, SND_CNT); /* (s) */ + bitstr_t bit_decl(ev_sw_states, SW_CNT); /* (s) */ + bool ev_report_opened; /* (s) */ /* KDB state: */ bool ev_kdb_active; bitstr_t bit_decl(ev_kdb_led_states, LED_CNT); /* Multitouch protocol type B state: */ - struct evdev_mt * ev_mt; + struct evdev_mt * ev_mt; /* (s) */ /* Counters: */ - uint64_t ev_event_count; - uint64_t ev_report_count; + uint64_t ev_event_count; /* (s) */ + uint64_t ev_report_count; /* (s) */ /* Parent driver callbacks: */ const struct evdev_methods * ev_methods; @@ -139,47 +166,66 @@ struct evdev_dev struct sysctl_ctx_list ev_sysctl_ctx; LIST_ENTRY(evdev_dev) ev_link; - LIST_HEAD(, evdev_client) ev_clients; + CK_SLIST_HEAD(, evdev_client) ev_clients; /* (l) */ }; #define SYSTEM_CONSOLE_LOCK &Giant -#define EVDEV_LOCK(evdev) mtx_lock((evdev)->ev_lock) -#define EVDEV_UNLOCK(evdev) mtx_unlock((evdev)->ev_lock) +#define EVDEV_LOCK(evdev) mtx_lock((evdev)->ev_state_lock) +#define EVDEV_UNLOCK(evdev) mtx_unlock((evdev)->ev_state_lock) #define EVDEV_LOCK_ASSERT(evdev) do { \ - if ((evdev)->ev_lock != SYSTEM_CONSOLE_LOCK) \ - mtx_assert((evdev)->ev_lock, MA_OWNED); \ + if ((evdev)->ev_state_lock != SYSTEM_CONSOLE_LOCK) \ + mtx_assert((evdev)->ev_state_lock, MA_OWNED); \ } while (0) #define EVDEV_ENTER(evdev) do { \ - if ((evdev)->ev_lock_type == EV_LOCK_INTERNAL) \ + if ((evdev)->ev_lock_type != EV_LOCK_MTX) \ EVDEV_LOCK(evdev); \ else \ EVDEV_LOCK_ASSERT(evdev); \ } while (0) #define EVDEV_EXIT(evdev) do { \ - if ((evdev)->ev_lock_type == EV_LOCK_INTERNAL) \ + if ((evdev)->ev_lock_type != EV_LOCK_MTX) \ EVDEV_UNLOCK(evdev); \ } while (0) +#define EVDEV_LIST_LOCK(evdev) do { \ + if ((evdev)->ev_lock_type == EV_LOCK_MTX) \ + EVDEV_LOCK(evdev); \ + else \ + sx_xlock(&(evdev)->ev_list_lock); \ +} while (0) +#define EVDEV_LIST_UNLOCK(evdev) do { \ + if ((evdev)->ev_lock_type == EV_LOCK_MTX) \ + EVDEV_UNLOCK(evdev); \ + else \ + sx_unlock(&(evdev)->ev_list_lock); \ +} while (0) +#define EVDEV_LIST_LOCK_ASSERT(evdev) do { \ + if ((evdev)->ev_lock_type == EV_LOCK_MTX) \ + EVDEV_LOCK_ASSERT(evdev); \ + else \ + sx_assert(&(evdev)->ev_list_lock, MA_OWNED); \ +} while (0) + struct evdev_client { struct evdev_dev * ec_evdev; - struct mtx ec_buffer_mtx; + struct mtx ec_buffer_mtx; /* Client queue lock */ size_t ec_buffer_size; - size_t ec_buffer_head; - size_t ec_buffer_tail; - size_t ec_buffer_ready; + size_t ec_buffer_head; /* (q) */ + size_t ec_buffer_tail; /* (q) */ + size_t ec_buffer_ready; /* (q) */ enum evdev_clock_id ec_clock_id; - struct selinfo ec_selp; + struct selinfo ec_selp; /* (q) */ struct sigio * ec_sigio; - bool ec_async; - bool ec_revoked; - bool ec_blocked; - bool ec_selected; + bool ec_async; /* (q) */ + bool ec_revoked; /* (l) */ + bool ec_blocked; /* (q) */ + bool ec_selected; /* (q) */ - LIST_ENTRY(evdev_client) ec_link; + CK_SLIST_ENTRY(evdev_client) ec_link; /* (l) */ - struct input_event ec_buffer[]; + struct input_event ec_buffer[]; /* (q) */ }; #define EVDEV_CLIENT_LOCKQ(client) mtx_lock(&(client)->ec_buffer_mtx) From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 79B134DEC19; Thu, 7 Jan 2021 23:20:53 +0000 (UTC) (envelope-from git@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 4DBj045Ztcz4Sdy; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 008DB18F59; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpNP063426; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKp3b063425; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKp3b063425@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 5af73ad51b8c - main - evdev: Remove useless "initial value" parameter from evdev_support_abs() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5af73ad51b8c2e640608af0b7a1982be5c204b96 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:59 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=5af73ad51b8c2e640608af0b7a1982be5c204b96 commit 5af73ad51b8c2e640608af0b7a1982be5c204b96 Author: Vladimir Kondratyev AuthorDate: 2020-11-30 15:10:41 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:41 +0000 evdev: Remove useless "initial value" parameter from evdev_support_abs() It can not be used for setting of state of multitouch events. If necessary, use evdev_push_event() instead of it. --- sys/arm/broadcom/bcm2835/bcm2835_ft5406.c | 8 ++++---- sys/arm/ti/ti_adc.c | 4 ++-- sys/dev/atkbdc/psm.c | 4 ++-- sys/dev/cyapa/cyapa.c | 14 +++++++------- sys/dev/evdev/evdev.c | 7 +++---- sys/dev/evdev/evdev.h | 2 +- sys/dev/evdev/evdev_mt.c | 1 - sys/dev/evdev/uinput.c | 7 +++---- sys/dev/usb/input/uep.c | 4 ++-- sys/dev/usb/input/wmt.c | 2 +- 10 files changed, 25 insertions(+), 28 deletions(-) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c b/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c index 48fa702f5c46..d9a01b4a929a 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_ft5406.c @@ -246,13 +246,13 @@ ft5406ts_init(void *arg) evdev_support_event(sc->sc_evdev, EV_SYN); evdev_support_event(sc->sc_evdev, EV_ABS); - evdev_support_abs(sc->sc_evdev, ABS_MT_SLOT, 0, 0, + evdev_support_abs(sc->sc_evdev, ABS_MT_SLOT, 0, MAX_TOUCH_ID, 0, 0, 0); - evdev_support_abs(sc->sc_evdev, ABS_MT_TRACKING_ID, 0, -1, + evdev_support_abs(sc->sc_evdev, ABS_MT_TRACKING_ID, -1, MAX_TOUCH_ID, 0, 0, 0); - evdev_support_abs(sc->sc_evdev, ABS_MT_POSITION_X, 0, 0, + evdev_support_abs(sc->sc_evdev, ABS_MT_POSITION_X, 0, SCREEN_WIDTH, 0, 0, SCREEN_RES_X); - evdev_support_abs(sc->sc_evdev, ABS_MT_POSITION_Y, 0, 0, + evdev_support_abs(sc->sc_evdev, ABS_MT_POSITION_Y, 0, SCREEN_HEIGHT, 0, 0, SCREEN_RES_Y); err = evdev_register_mtx(sc->sc_evdev, &sc->sc_mtx); diff --git a/sys/arm/ti/ti_adc.c b/sys/arm/ti/ti_adc.c index 6254fddde5fa..a0091aebf417 100644 --- a/sys/arm/ti/ti_adc.c +++ b/sys/arm/ti/ti_adc.c @@ -890,9 +890,9 @@ ti_adc_attach(device_t dev) evdev_support_event(sc->sc_evdev, EV_ABS); evdev_support_event(sc->sc_evdev, EV_KEY); - evdev_support_abs(sc->sc_evdev, ABS_X, 0, 0, + evdev_support_abs(sc->sc_evdev, ABS_X, 0, ADC_MAX_VALUE, 0, 0, 0); - evdev_support_abs(sc->sc_evdev, ABS_Y, 0, 0, + evdev_support_abs(sc->sc_evdev, ABS_Y, 0, ADC_MAX_VALUE, 0, 0, 0); evdev_support_key(sc->sc_evdev, BTN_TOUCH); diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 3774b0a3b734..43d19b5174d3 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -1698,7 +1698,7 @@ psm_support_abs_bulk(struct evdev_dev *evdev, const uint16_t info[][4]) size_t i; for (i = 0; info[i][0] != ABS_CNT; i++) - evdev_support_abs(evdev, info[i][0], 0, info[i][1], info[i][2], + evdev_support_abs(evdev, info[i][0], info[i][1], info[i][2], 0, 0, info[i][3]); } @@ -1858,7 +1858,7 @@ psm_register_synaptics(device_t dev) if (sc->synhw.capAdvancedGestures || sc->synhw.capReportsV) psm_support_abs_bulk(evdev_a, synaptics_absinfo_mt); if (sc->synhw.capPalmDetect) - evdev_support_abs(evdev_a, ABS_TOOL_WIDTH, 0, 0, 15, 0, 0, 0); + evdev_support_abs(evdev_a, ABS_TOOL_WIDTH, 0, 15, 0, 0, 0); evdev_support_key(evdev_a, BTN_LEFT); if (!sc->synhw.capClickPad) { evdev_support_key(evdev_a, BTN_RIGHT); diff --git a/sys/dev/cyapa/cyapa.c b/sys/dev/cyapa/cyapa.c index caad161cb56a..517ce8d1bab7 100644 --- a/sys/dev/cyapa/cyapa.c +++ b/sys/dev/cyapa/cyapa.c @@ -594,13 +594,13 @@ cyapa_attach(device_t dev) evdev_support_prop(sc->evdev, INPUT_PROP_BUTTONPAD); evdev_support_abs(sc->evdev, ABS_MT_SLOT, - 0, 0, CYAPA_MAX_MT - 1, 0, 0, 0); - evdev_support_abs(sc->evdev, ABS_MT_TRACKING_ID, 0, -1, 15, 0, 0, 0); - evdev_support_abs(sc->evdev, ABS_MT_POSITION_X, 0, 0, sc->cap_resx, - 0, 0, sc->cap_phyx != 0 ? sc->cap_resx / sc->cap_phyx : 0); - evdev_support_abs(sc->evdev, ABS_MT_POSITION_Y, 0, 0, sc->cap_resy, - 0, 0, sc->cap_phyy != 0 ? sc->cap_resy / sc->cap_phyy : 0); - evdev_support_abs(sc->evdev, ABS_MT_PRESSURE, 0, 0, 255, 0, 0, 0); + 0, CYAPA_MAX_MT - 1, 0, 0, 0); + evdev_support_abs(sc->evdev, ABS_MT_TRACKING_ID, -1, 15, 0, 0, 0); + evdev_support_abs(sc->evdev, ABS_MT_POSITION_X, 0, sc->cap_resx, 0, 0, + sc->cap_phyx != 0 ? sc->cap_resx / sc->cap_phyx : 0); + evdev_support_abs(sc->evdev, ABS_MT_POSITION_Y, 0, sc->cap_resy, 0, 0, + sc->cap_phyy != 0 ? sc->cap_resy / sc->cap_phyy : 0); + evdev_support_abs(sc->evdev, ABS_MT_PRESSURE, 0, 255, 0, 0, 0); if (evdev_register(sc->evdev) != 0) { mtx_destroy(&sc->mutex); diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index 33db241da27d..8d520e3ac09e 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -477,16 +477,15 @@ evdev_support_rel(struct evdev_dev *evdev, uint16_t code) } inline void -evdev_support_abs(struct evdev_dev *evdev, uint16_t code, int32_t value, - int32_t minimum, int32_t maximum, int32_t fuzz, int32_t flat, - int32_t resolution) +evdev_support_abs(struct evdev_dev *evdev, uint16_t code, int32_t minimum, + int32_t maximum, int32_t fuzz, int32_t flat, int32_t resolution) { struct input_absinfo absinfo; KASSERT(code < ABS_CNT, ("invalid evdev abs property")); absinfo = (struct input_absinfo) { - .value = value, + .value = 0, .minimum = minimum, .maximum = maximum, .fuzz = fuzz, diff --git a/sys/dev/evdev/evdev.h b/sys/dev/evdev/evdev.h index b897a465b338..f584e52fc8e4 100644 --- a/sys/dev/evdev/evdev.h +++ b/sys/dev/evdev/evdev.h @@ -117,7 +117,7 @@ void evdev_support_event(struct evdev_dev *, uint16_t); void evdev_support_key(struct evdev_dev *, uint16_t); void evdev_support_rel(struct evdev_dev *, uint16_t); void evdev_support_abs(struct evdev_dev *, uint16_t, int32_t, int32_t, int32_t, - int32_t, int32_t, int32_t); + int32_t, int32_t); void evdev_support_msc(struct evdev_dev *, uint16_t); void evdev_support_led(struct evdev_dev *, uint16_t); void evdev_support_snd(struct evdev_dev *, uint16_t); diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index fc19e497c691..1f9c9756db02 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -185,7 +185,6 @@ evdev_support_mt_compat(struct evdev_dev *evdev) for (i = 0; i < nitems(evdev_mtstmap); i++) if (bit_test(evdev->ev_abs_flags, evdev_mtstmap[i][0])) evdev_support_abs(evdev, evdev_mtstmap[i][1], - evdev->ev_absinfo[evdev_mtstmap[i][0]].value, evdev->ev_absinfo[evdev_mtstmap[i][0]].minimum, evdev->ev_absinfo[evdev_mtstmap[i][0]].maximum, evdev->ev_absinfo[evdev_mtstmap[i][0]].fuzz, diff --git a/sys/dev/evdev/uinput.c b/sys/dev/evdev/uinput.c index 3edf14284a1f..ceecee652ac3 100644 --- a/sys/dev/evdev/uinput.c +++ b/sys/dev/evdev/uinput.c @@ -525,10 +525,9 @@ uinput_ioctl_sub(struct uinput_cdev_state *state, u_long cmd, caddr_t data) if (uabs->code > ABS_MAX) return (EINVAL); - evdev_support_abs(state->ucs_evdev, uabs->code, - uabs->absinfo.value, uabs->absinfo.minimum, - uabs->absinfo.maximum, uabs->absinfo.fuzz, - uabs->absinfo.flat, uabs->absinfo.resolution); + evdev_set_abs_bit(state->ucs_evdev, uabs->code); + evdev_set_absinfo(state->ucs_evdev, uabs->code, + &uabs->absinfo); return (0); case UI_SET_EVBIT: diff --git a/sys/dev/usb/input/uep.c b/sys/dev/usb/input/uep.c index 7a65f2875448..5b96a31b1dee 100644 --- a/sys/dev/usb/input/uep.c +++ b/sys/dev/usb/input/uep.c @@ -381,8 +381,8 @@ uep_attach(device_t dev) evdev_support_event(sc->evdev, EV_ABS); evdev_support_event(sc->evdev, EV_KEY); evdev_support_key(sc->evdev, BTN_TOUCH); - evdev_support_abs(sc->evdev, ABS_X, 0, 0, UEP_MAX_X, 0, 0, 0); - evdev_support_abs(sc->evdev, ABS_Y, 0, 0, UEP_MAX_Y, 0, 0, 0); + evdev_support_abs(sc->evdev, ABS_X, 0, UEP_MAX_X, 0, 0, 0); + evdev_support_abs(sc->evdev, ABS_Y, 0, UEP_MAX_Y, 0, 0, 0); error = evdev_register_mtx(sc->evdev, &sc->mtx); if (error) { diff --git a/sys/dev/usb/input/wmt.c b/sys/dev/usb/input/wmt.c index 62e56fe026ca..d65318fee326 100644 --- a/sys/dev/usb/input/wmt.c +++ b/sys/dev/usb/input/wmt.c @@ -456,7 +456,7 @@ wmt_attach(device_t dev) } WMT_FOREACH_USAGE(sc->caps, i) { if (wmt_hid_map[i].code != WMT_NO_CODE) - evdev_support_abs(sc->evdev, wmt_hid_map[i].code, 0, + evdev_support_abs(sc->evdev, wmt_hid_map[i].code, sc->ai[i].min, sc->ai[i].max, 0, 0, sc->ai[i].res); } From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2B38E4DEC8C; Thu, 7 Jan 2021 23:20:53 +0000 (UTC) (envelope-from git@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 4DBj036Hhxz4ShR; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9FF41934B; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpXS063324; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpWA063323; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpWA063323@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 67de2db2623a - main - Factor-out hardware-independent part of USB HID support to new module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 67de2db2623a10dc4edec1642b2f8685d5587d7f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:57 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=67de2db2623a10dc4edec1642b2f8685d5587d7f commit 67de2db2623a10dc4edec1642b2f8685d5587d7f Author: Vladimir Kondratyev AuthorDate: 2020-10-04 22:21:08 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:42 +0000 Factor-out hardware-independent part of USB HID support to new module It will be used by the upcoming HID-over-i2C implementation. Should be no-op, except hid.ko module dependency is to be added to affected drivers. Reviewed by: hselasky, manu Differential revision: https://reviews.freebsd.org/D27867 --- etc/mtree/BSD.include.dist | 2 + include/Makefile | 11 +- share/man/man4/atp.4 | 1 + share/man/man4/ucycom.4 | 1 + share/man/man4/ugold.4 | 1 + share/man/man4/uhid.4 | 2 + share/man/man4/ukbd.4 | 2 + share/man/man4/ums.4 | 1 + share/man/man4/wmt.4 | 1 + share/man/man4/wsp.4 | 1 + sys/amd64/conf/GENERIC | 3 + sys/arm/conf/EFIKA_MX | 3 + sys/arm/conf/GENERIC | 3 + sys/arm/conf/IMX53 | 3 + sys/arm/conf/IMX6 | 3 + sys/arm/conf/RPI-B | 3 + sys/arm/conf/TEGRA124 | 3 + sys/arm/conf/VYBRID | 3 + sys/arm64/conf/GENERIC | 3 + sys/conf/files | 1 + sys/dev/hid/hid.c | 87 +---- sys/dev/hid/hid.h | 43 +-- sys/dev/hid/hidrdesc.h | 72 +++- sys/dev/sound/usb/uaudio.c | 1 + sys/dev/usb/input/atp.c | 1 + sys/dev/usb/input/uhid.c | 1 + sys/dev/usb/input/ukbd.c | 1 + sys/dev/usb/input/ums.c | 1 + sys/dev/usb/input/usb_rdesc.h | 285 +------------- sys/dev/usb/input/wmt.c | 1 + sys/dev/usb/input/wsp.c | 1 + sys/dev/usb/misc/ugold.c | 1 + sys/dev/usb/serial/ucycom.c | 1 + sys/dev/usb/usb_hid.c | 861 ------------------------------------------ sys/dev/usb/usbhid.h | 212 +---------- sys/i386/conf/GENERIC | 3 + sys/mips/conf/ERL | 3 + sys/mips/conf/JZ4780 | 3 + sys/mips/conf/OCTEON1 | 3 + sys/modules/Makefile | 1 + sys/modules/hid/Makefile | 6 + sys/modules/hid/hid/Makefile | 9 + sys/powerpc/conf/GENERIC | 2 + sys/powerpc/conf/GENERIC64 | 2 + sys/powerpc/conf/GENERIC64LE | 2 + sys/powerpc/conf/MPC85XX | 3 + sys/powerpc/conf/MPC85XXSPE | 3 + sys/powerpc/conf/QORIQ64 | 3 + 48 files changed, 185 insertions(+), 1478 deletions(-) diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist index 071fba7e87ac..e7784cbb0a47 100644 --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -54,6 +54,8 @@ .. firewire .. + hid + .. hwpmc .. hyperv diff --git a/include/Makefile b/include/Makefile index d374ce739cf4..7e19f66edf71 100644 --- a/include/Makefile +++ b/include/Makefile @@ -94,6 +94,10 @@ EVDEV= input.h \ uinput.h EVDEVDIR= ${INCLUDEDIR}/dev/evdev +.PATH: ${SRCTOP}/sys/dev/hid +HID= hid.h +HIDDIR= ${INCLUDEDIR}/dev/hid + .PATH: ${SRCTOP}/sys/dev/hyperv/include ${SRCTOP}/sys/dev/hyperv/utilities HYPERV= hv_snapshot.h \ hyperv.h @@ -172,6 +176,7 @@ INCSGROUPS= INCS \ CRYPTO \ EVDEV \ FS9660 \ + HID \ HYPERV \ OPENCRYPTO \ PCI \ @@ -287,7 +292,7 @@ copies: .PHONY .META done; \ fi .endfor -.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} +.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${SDESTDIR}${INCLUDEDIR}/$i @@ -323,7 +328,7 @@ symlinks: .PHONY .META cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i .endfor -.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hyperv:Ndev/pci:Ndev/veriexec} +.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i .endfor @@ -335,6 +340,8 @@ symlinks: .PHONY .META ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ ${SDESTDIR}${INCLUDEDIR}/dev/evdev; + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hid/hid.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ diff --git a/share/man/man4/atp.4 b/share/man/man4/atp.4 index c32618815d22..b622bb0b6380 100644 --- a/share/man/man4/atp.4 +++ b/share/man/man4/atp.4 @@ -38,6 +38,7 @@ To compile this driver into the kernel, place the following lines into your kernel configuration file: .Bd -ragged -offset indent .Cd "device atp" +.Cd "device hid" .Cd "device usb" .Ed .Pp diff --git a/share/man/man4/ucycom.4 b/share/man/man4/ucycom.4 index c5764cbe9a58..ec410ab0ff78 100644 --- a/share/man/man4/ucycom.4 +++ b/share/man/man4/ucycom.4 @@ -39,6 +39,7 @@ place the following line in your kernel configuration file: .Bd -ragged -offset indent .Cd "device usb" +.Cd "device hid" .Cd "device ucom" .Cd "device ucycom" .Ed diff --git a/share/man/man4/ugold.4 b/share/man/man4/ugold.4 index f75440de2134..79d2e5749f2d 100644 --- a/share/man/man4/ugold.4 +++ b/share/man/man4/ugold.4 @@ -28,6 +28,7 @@ To compile this driver into the kernel, place the following lines into your kernel configuration file: .Bd -ragged -offset indent .Cd "device usb" +.Cd "device hid" .Cd "device ugold" .Ed .Pp diff --git a/share/man/man4/uhid.4 b/share/man/man4/uhid.4 index bcb1b78fdd12..491a2e871e76 100644 --- a/share/man/man4/uhid.4 +++ b/share/man/man4/uhid.4 @@ -41,6 +41,8 @@ place the following line in your kernel configuration file: .Bd -ragged -offset indent .Cd "device uhid" +.Cd "device hid" +.Cd "device usb" .Ed .Pp Alternatively, to load the driver as a diff --git a/share/man/man4/ukbd.4 b/share/man/man4/ukbd.4 index 0b58446fcb77..f443f51ce8e1 100644 --- a/share/man/man4/ukbd.4 +++ b/share/man/man4/ukbd.4 @@ -36,6 +36,8 @@ place the following line in your kernel configuration file: .Bd -ragged -offset indent .Cd "device ukbd" +.Cd "device hid" +.Cd "device usb" .Ed .Pp Alternatively, to load the driver as a diff --git a/share/man/man4/ums.4 b/share/man/man4/ums.4 index cbc94160b260..b27c55cef738 100644 --- a/share/man/man4/ums.4 +++ b/share/man/man4/ums.4 @@ -36,6 +36,7 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device ums" +.Cd "device hid" .Cd "device uhci" .Cd "device ohci" .Cd "device usb" diff --git a/share/man/man4/wmt.4 b/share/man/man4/wmt.4 index ddea0a6b45d3..e09fc5286fe2 100644 --- a/share/man/man4/wmt.4 +++ b/share/man/man4/wmt.4 @@ -36,6 +36,7 @@ your kernel configuration file: .Bd -ragged -offset indent .Cd "device wmt" .Cd "device usb" +.Cd "device hid" .Cd "device evdev" .Ed .Pp diff --git a/share/man/man4/wsp.4 b/share/man/man4/wsp.4 index 0a8cc0fe410b..70a1219533dc 100644 --- a/share/man/man4/wsp.4 +++ b/share/man/man4/wsp.4 @@ -35,6 +35,7 @@ To compile this driver into the kernel, place the following lines into your kernel configuration file: .Bd -ragged -offset indent .Cd "device wsp" +.Cd "device hid" .Cd "device usb" .Ed .Pp diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 9b1fb0182e72..c7802969ba4b 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -380,3 +380,6 @@ device netmap # netmap(4) support options EVDEV_SUPPORT # evdev support in legacy drivers device evdev # input event device support device uinput # install /dev/uinput cdev + +# HID support +device hid # Generic HID support diff --git a/sys/arm/conf/EFIKA_MX b/sys/arm/conf/EFIKA_MX index be5f5f35570d..724d742e03af 100644 --- a/sys/arm/conf/EFIKA_MX +++ b/sys/arm/conf/EFIKA_MX @@ -116,6 +116,9 @@ device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm +# HID support +device hid # Generic HID support + # Flattened Device Tree options FDT # Configure using FDT/DTB data options FDT_DTB_STATIC diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index 35056f7640dc..0f0522eb9802 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -280,6 +280,9 @@ device aw_sid # Allwinner Secure ID EFUSE # Thermal sensors device aw_thermal # Allwinner Thermal Sensor Controller +# HID support +device hid # Generic HID support + # Flattened Device Tree options FDT # Configure using FDT/DTB data makeoptions MODULES_EXTRA+="dtb/allwinner" diff --git a/sys/arm/conf/IMX53 b/sys/arm/conf/IMX53 index be18afda6094..0372cb62088d 100644 --- a/sys/arm/conf/IMX53 +++ b/sys/arm/conf/IMX53 @@ -113,6 +113,9 @@ device wlan_amrr # AMRR transmit rate control algorithm #device mmc # SD/MMC protocol #device mmcsd # SDCard disk device +# HID support +device hid # Generic HID support + # Flattened Device Tree options FDT # Configure using FDT/DTB data diff --git a/sys/arm/conf/IMX6 b/sys/arm/conf/IMX6 index 808dac4bf910..6d8388ff0d60 100644 --- a/sys/arm/conf/IMX6 +++ b/sys/arm/conf/IMX6 @@ -106,6 +106,9 @@ device u3g # USB modems #device wlan_tkip # 802.11 TKIP support #device wlan_amrr # AMRR transmit rate control algorithm +# HID support +device hid # Generic HID support + device vt device kbdmux device ukbd diff --git a/sys/arm/conf/RPI-B b/sys/arm/conf/RPI-B index e456d33742b8..36eaff0c0f28 100644 --- a/sys/arm/conf/RPI-B +++ b/sys/arm/conf/RPI-B @@ -89,6 +89,9 @@ device sound device fdt_pinctrl +# HID support +device hid # Generic HID support + # Flattened Device Tree options FDT # Configure using FDT/DTB data # Note: DTB is normally loaded and modified by RPi boot loader, then diff --git a/sys/arm/conf/TEGRA124 b/sys/arm/conf/TEGRA124 index a6c731dedcf2..68d7bf037525 100644 --- a/sys/arm/conf/TEGRA124 +++ b/sys/arm/conf/TEGRA124 @@ -130,6 +130,9 @@ device drm2 #device sound #device snd_hda +# HID support +device hid # Generic HID support + # Flattened Device Tree options FDT # Configure using FDT/DTB data device fdt_pinctrl diff --git a/sys/arm/conf/VYBRID b/sys/arm/conf/VYBRID index 856fe41bb3f3..e7ded5f42d82 100644 --- a/sys/arm/conf/VYBRID +++ b/sys/arm/conf/VYBRID @@ -103,5 +103,8 @@ device vt device kbdmux device ukbd +# HID support +device hid # Generic HID support + # Flattened Device Tree options FDT # Configure using FDT/DTB data diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index f7f446c6c881..dc9278a998e2 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -380,3 +380,6 @@ device acpi # DTBs makeoptions MODULES_EXTRA="dtb/allwinner dtb/freescale dtb/imx8 dtb/nvidia dtb/mv dtb/rockchip dtb/rpi" + +# HID support +device hid # Generic HID support diff --git a/sys/conf/files b/sys/conf/files index 7cfb32560af6..a192877d1e98 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1815,6 +1815,7 @@ dev/gpio/gpio_if.m optional gpio dev/gpio/gpiobus_if.m optional gpio dev/gpio/gpiopps.c optional gpiopps fdt dev/gpio/ofw_gpiobus.c optional fdt gpio +dev/hid/hid.c optional hid dev/hifn/hifn7751.c optional hifn dev/hptiop/hptiop.c optional hptiop scbus dev/hwpmc/hwpmc_logging.c optional hwpmc diff --git a/sys/dev/hid/hid.c b/sys/dev/hid/hid.c index 22e5fb5446c3..61b7587a6c62 100644 --- a/sys/dev/hid/hid.c +++ b/sys/dev/hid/hid.c @@ -779,91 +779,6 @@ hid_is_collection(const void *desc, usb_size_t size, int32_t usage) return (err); } -/*------------------------------------------------------------------------* - * hid_get_descriptor_from_usb - * - * This function will search for a HID descriptor between two USB - * interface descriptors. - * - * Return values: - * NULL: No more HID descriptors. - * Else: Pointer to HID descriptor. - *------------------------------------------------------------------------*/ -struct usb_hid_descriptor * -hid_get_descriptor_from_usb(struct usb_config_descriptor *cd, - struct usb_interface_descriptor *id) -{ - struct usb_descriptor *desc = (void *)id; - - if (desc == NULL) { - return (NULL); - } - while ((desc = usb_desc_foreach(cd, desc))) { - if ((desc->bDescriptorType == UDESC_HID) && - (desc->bLength >= USB_HID_DESCRIPTOR_SIZE(0))) { - return (void *)desc; - } - if (desc->bDescriptorType == UDESC_INTERFACE) { - break; - } - } - return (NULL); -} - -/*------------------------------------------------------------------------* - * usbd_req_get_hid_desc - * - * This function will read out an USB report descriptor from the USB - * device. - * - * Return values: - * NULL: Failure. - * Else: Success. The pointer should eventually be passed to free(). - *------------------------------------------------------------------------*/ -usb_error_t -usbd_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx, - void **descp, uint16_t *sizep, - struct malloc_type *mem, uint8_t iface_index) -{ - struct usb_interface *iface = usbd_get_iface(udev, iface_index); - struct usb_hid_descriptor *hid; - usb_error_t err; - - if ((iface == NULL) || (iface->idesc == NULL)) { - return (USB_ERR_INVAL); - } - hid = hid_get_descriptor_from_usb - (usbd_get_config_descriptor(udev), iface->idesc); - - if (hid == NULL) { - return (USB_ERR_IOERROR); - } - *sizep = UGETW(hid->descrs[0].wDescriptorLength); - if (*sizep == 0) { - return (USB_ERR_IOERROR); - } - if (mtx) - mtx_unlock(mtx); - - *descp = malloc(*sizep, mem, M_ZERO | M_WAITOK); - - if (mtx) - mtx_lock(mtx); - - if (*descp == NULL) { - return (USB_ERR_NOMEM); - } - err = usbd_req_get_report_descriptor - (udev, mtx, *descp, *sizep, iface_index); - - if (err) { - free(*descp, mem); - *descp = NULL; - return (err); - } - return (USB_ERR_NORMAL_COMPLETION); -} - /*------------------------------------------------------------------------* * calculate HID item resolution. unit/mm for distances, unit/rad for angles *------------------------------------------------------------------------*/ @@ -1013,3 +928,5 @@ hid_is_keyboard(const void *d_ptr, uint16_t d_len) return (1); return (0); } + +MODULE_VERSION(hid, 1); diff --git a/sys/dev/hid/hid.h b/sys/dev/hid/hid.h index 926c404dca55..b1829318bda1 100644 --- a/sys/dev/hid/hid.h +++ b/sys/dev/hid/hid.h @@ -28,38 +28,8 @@ * SUCH DAMAGE. */ -#ifndef _USB_HID_H_ -#define _USB_HID_H_ - -#ifndef USB_GLOBAL_INCLUDE_FILE -#include -#endif - -#define UR_GET_HID_DESCRIPTOR 0x06 -#define UDESC_HID 0x21 -#define UDESC_REPORT 0x22 -#define UDESC_PHYSICAL 0x23 -#define UR_SET_HID_DESCRIPTOR 0x07 -#define UR_GET_REPORT 0x01 -#define UR_SET_REPORT 0x09 -#define UR_GET_IDLE 0x02 -#define UR_SET_IDLE 0x0a -#define UR_GET_PROTOCOL 0x03 -#define UR_SET_PROTOCOL 0x0b - -struct usb_hid_descriptor { - uByte bLength; - uByte bDescriptorType; - uWord bcdHID; - uByte bCountryCode; - uByte bNumDescriptors; - struct { - uByte bDescriptorType; - uWord wDescriptorLength; - } descrs[1]; -} __packed; - -#define USB_HID_DESCRIPTOR_SIZE(n) (9+((n)*3)) +#ifndef _HID_HID_H_ +#define _HID_HID_H_ /* Usage pages */ #define HUP_UNDEFINED 0x0000 @@ -206,7 +176,6 @@ struct usb_hid_descriptor { #define HUM_DEGREE 0x14 #if defined(_KERNEL) || defined(_STANDALONE) -struct usb_config_descriptor; #define HID_ITEM_MAXUSAGE 4 @@ -271,14 +240,8 @@ uint32_t hid_get_data_unsigned(const uint8_t *buf, usb_size_t len, void hid_put_data_unsigned(uint8_t *buf, usb_size_t len, struct hid_location *loc, unsigned int value); int hid_is_collection(const void *desc, usb_size_t size, int32_t usage); -struct usb_hid_descriptor *hid_get_descriptor_from_usb( - struct usb_config_descriptor *cd, - struct usb_interface_descriptor *id); -usb_error_t usbd_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx, - void **descp, uint16_t *sizep, struct malloc_type *mem, - uint8_t iface_index); int32_t hid_item_resolution(struct hid_item *hi); int hid_is_mouse(const void *d_ptr, uint16_t d_len); int hid_is_keyboard(const void *d_ptr, uint16_t d_len); #endif /* _KERNEL || _STANDALONE */ -#endif /* _USB_HID_H_ */ +#endif /* _HID_HID_H_ */ diff --git a/sys/dev/hid/hidrdesc.h b/sys/dev/hid/hidrdesc.h index 889381e82c15..f6cbb755cd24 100644 --- a/sys/dev/hid/hidrdesc.h +++ b/sys/dev/hid/hidrdesc.h @@ -33,7 +33,7 @@ * This file contains replacements for broken HID report descriptors. */ -#define UHID_GRAPHIRE_REPORT_DESCR(...) \ +#define HID_GRAPHIRE_REPORT_DESCR(...) \ 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ 0x09, 0x01, /* USAGE (Digitizer) */\ 0xa1, 0x01, /* COLLECTION (Application) */\ @@ -97,7 +97,7 @@ 0xb1, 0x02, /* FEATURE (Data,Var,Abs) */\ 0xc0, /* END_COLLECTION */\ -#define UHID_GRAPHIRE3_4X5_REPORT_DESCR(...) \ +#define HID_GRAPHIRE3_4X5_REPORT_DESCR(...) \ 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */\ 0x09, 0x02, /* USAGE (Mouse) */\ 0xa1, 0x01, /* COLLECTION (Application) */\ @@ -184,7 +184,7 @@ * The descriptor has no output report format, thus preventing you from * controlling the LEDs and the built-in rumblers. */ -#define UHID_XB360GP_REPORT_DESCR(...) \ +#define HID_XB360GP_REPORT_DESCR(...) \ 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ 0x09, 0x05, /* USAGE (Gamepad) */\ 0xa1, 0x01, /* COLLECTION (Application) */\ @@ -277,7 +277,7 @@ 0xc0 /* END COLLECTION */\ /* Fixed report descriptor for Super Nintendo gamepads */ -#define UHID_SNES_REPORT_DESCR(...) \ +#define HID_SNES_REPORT_DESCR(...) \ 0x05, 0x01, /* Usage Page (Desktop), */\ 0x09, 0x04, /* Usage (Joystik), */\ 0xA1, 0x01, /* Collection (Application), */\ @@ -304,3 +304,67 @@ 0x81, 0x01, /* Input (Constant), */\ 0xC0, /* End Collection, */\ 0xC0 /* End Collection */ + +/* HID mouse boot protocol descriptor */ +#define HID_MOUSE_BOOTPROTO_DESCR(...) \ + 0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */\ + 0x09, 0x02, /* Usage (Mouse) */\ + 0xA1, 0x01, /* Collection (Application) */\ + 0x09, 0x01, /* Usage (Pointer) */\ + 0xA1, 0x00, /* Collection (Physical) */\ + 0x95, 0x03, /* Report Count (3) */\ + 0x75, 0x01, /* Report Size (1) */\ + 0x05, 0x09, /* Usage Page (Button) */\ + 0x19, 0x01, /* Usage Minimum (0x01) */\ + 0x29, 0x03, /* Usage Maximum (0x03) */\ + 0x15, 0x00, /* Logical Minimum (0) */\ + 0x25, 0x01, /* Logical Maximum (1) */\ + 0x81, 0x02, /* Input (Data,Var,Abs) */\ + 0x95, 0x01, /* Report Count (1) */\ + 0x75, 0x05, /* Report Size (5) */\ + 0x81, 0x03, /* Input (Const) */\ + 0x75, 0x08, /* Report Size (8) */\ + 0x95, 0x02, /* Report Count (2) */\ + 0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */\ + 0x09, 0x30, /* Usage (X) */\ + 0x09, 0x31, /* Usage (Y) */\ + 0x15, 0x81, /* Logical Minimum (-127) */\ + 0x25, 0x7F, /* Logical Maximum (127) */\ + 0x81, 0x06, /* Input (Data,Var,Rel) */\ + 0xC0, /* End Collection */\ + 0xC0, /* End Collection */ + +/* HID keyboard boot protocol descriptor */ +#define HID_KBD_BOOTPROTO_DESCR(...) \ + 0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */\ + 0x09, 0x06, /* Usage (Keyboard) */\ + 0xA1, 0x01, /* Collection (Application) */\ + 0x05, 0x07, /* Usage Page (Kbrd/Keypad) */\ + 0x19, 0xE0, /* Usage Minimum (0xE0) */\ + 0x29, 0xE7, /* Usage Maximum (0xE7) */\ + 0x15, 0x00, /* Logical Minimum (0) */\ + 0x25, 0x01, /* Logical Maximum (1) */\ + 0x75, 0x01, /* Report Size (1) */\ + 0x95, 0x08, /* Report Count (8) */\ + 0x81, 0x02, /* Input (Data,Var,Abs) */\ + 0x95, 0x01, /* Report Count (1) */\ + 0x75, 0x08, /* Report Size (8) */\ + 0x81, 0x01, /* Input (Const,Array,Abs) */\ + 0x95, 0x03, /* Report Count (3) */\ + 0x75, 0x01, /* Report Size (1) */\ + 0x05, 0x08, /* Usage Page (LEDs) */\ + 0x19, 0x01, /* Usage Minimum (Num Lock) */\ + 0x29, 0x03, /* Usage Maximum (Scroll Lock) */\ + 0x91, 0x02, /* Output (Data,Var,Abs) */\ + 0x95, 0x05, /* Report Count (5) */\ + 0x75, 0x01, /* Report Size (1) */\ + 0x91, 0x01, /* Output (Const,Array,Abs) */\ + 0x95, 0x06, /* Report Count (6) */\ + 0x75, 0x08, /* Report Size (8) */\ + 0x15, 0x00, /* Logical Minimum (0) */\ + 0x26, 0xFF, 0x00, /* Logical Maximum (255) */\ + 0x05, 0x07, /* Usage Page (Kbrd/Keypad) */\ + 0x19, 0x00, /* Usage Minimum (0x00) */\ + 0x2A, 0xFF, 0x00, /* Usage Maximum (0xFF) */\ + 0x81, 0x00, /* Input (Data,Array,Abs) */\ + 0xC0, /* End Collection */ diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index cfad299dc313..126f0494bac2 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -6210,6 +6210,7 @@ uaudio_hid_detach(struct uaudio_softc *sc) DRIVER_MODULE_ORDERED(uaudio, uhub, uaudio_driver, uaudio_devclass, NULL, 0, SI_ORDER_ANY); MODULE_DEPEND(uaudio, usb, 1, 1, 1); MODULE_DEPEND(uaudio, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER); +MODULE_DEPEND(uaudio, hid, 1, 1, 1); MODULE_VERSION(uaudio, 1); USB_PNP_HOST_INFO(uaudio_devs); USB_PNP_HOST_INFO(uaudio_vendor_midi); diff --git a/sys/dev/usb/input/atp.c b/sys/dev/usb/input/atp.c index 4fbdb06dd167..7b9b1eb04c9c 100644 --- a/sys/dev/usb/input/atp.c +++ b/sys/dev/usb/input/atp.c @@ -2633,6 +2633,7 @@ static driver_t atp_driver = { DRIVER_MODULE(atp, uhub, atp_driver, atp_devclass, NULL, 0); MODULE_DEPEND(atp, usb, 1, 1, 1); +MODULE_DEPEND(atp, hid, 1, 1, 1); MODULE_VERSION(atp, 1); USB_PNP_HOST_INFO(fg_devs); USB_PNP_HOST_INFO(wsp_devs); diff --git a/sys/dev/usb/input/uhid.c b/sys/dev/usb/input/uhid.c index a8a3bcb2f6c2..97c27608049c 100644 --- a/sys/dev/usb/input/uhid.c +++ b/sys/dev/usb/input/uhid.c @@ -907,5 +907,6 @@ static driver_t uhid_driver = { DRIVER_MODULE(uhid, uhub, uhid_driver, uhid_devclass, NULL, 0); MODULE_DEPEND(uhid, usb, 1, 1, 1); +MODULE_DEPEND(uhid, hid, 1, 1, 1); MODULE_VERSION(uhid, 1); USB_PNP_HOST_INFO(uhid_devs); diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index 4f27bf95b948..261a4b5aef95 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -2185,6 +2185,7 @@ static driver_t ukbd_driver = { DRIVER_MODULE(ukbd, uhub, ukbd_driver, ukbd_devclass, ukbd_driver_load, 0); MODULE_DEPEND(ukbd, usb, 1, 1, 1); +MODULE_DEPEND(ukbd, hid, 1, 1, 1); #ifdef EVDEV_SUPPORT MODULE_DEPEND(ukbd, evdev, 1, 1, 1); #endif diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c index 69d177d62bc4..038ed8121df1 100644 --- a/sys/dev/usb/input/ums.c +++ b/sys/dev/usb/input/ums.c @@ -1213,6 +1213,7 @@ static driver_t ums_driver = { DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass, NULL, 0); MODULE_DEPEND(ums, usb, 1, 1, 1); +MODULE_DEPEND(ums, hid, 1, 1, 1); #ifdef EVDEV_SUPPORT MODULE_DEPEND(ums, evdev, 1, 1, 1); #endif diff --git a/sys/dev/usb/input/usb_rdesc.h b/sys/dev/usb/input/usb_rdesc.h index 889381e82c15..5dbfdb91f3f2 100644 --- a/sys/dev/usb/input/usb_rdesc.h +++ b/sys/dev/usb/input/usb_rdesc.h @@ -1,11 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2000 Nick Hibma - * All rights reserved. - * - * Copyright (c) 2005 Ed Schouten - * All rights reserved. + * Copyright (c) 2020 Vladimir Kondratyev * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,277 +26,14 @@ * * $FreeBSD$ * - * This file contains replacements for broken HID report descriptors. + * This a proxy file for replacements for broken HID report descriptors. */ -#define UHID_GRAPHIRE_REPORT_DESCR(...) \ - 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ - 0x09, 0x01, /* USAGE (Digitizer) */\ - 0xa1, 0x01, /* COLLECTION (Application) */\ - 0x85, 0x02, /* REPORT_ID (2) */\ - 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ - 0x09, 0x01, /* USAGE (Digitizer) */\ - 0xa1, 0x00, /* COLLECTION (Physical) */\ - 0x15, 0x00, /* LOGICAL_MINIMUM (0) */\ - 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */\ - 0x09, 0x33, /* USAGE (Touch) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0x75, 0x01, /* REPORT_SIZE (1) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0x09, 0x44, /* USAGE (Barrel Switch) */\ - 0x95, 0x02, /* REPORT_COUNT (2) */\ - 0x75, 0x01, /* REPORT_SIZE (1) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0x09, 0x00, /* USAGE (Undefined) */\ - 0x95, 0x02, /* REPORT_COUNT (2) */\ - 0x75, 0x01, /* REPORT_SIZE (1) */\ - 0x81, 0x03, /* INPUT (Cnst,Var,Abs) */\ - 0x09, 0x3c, /* USAGE (Invert) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0x75, 0x01, /* REPORT_SIZE (1) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0x09, 0x38, /* USAGE (Transducer Index) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0x75, 0x01, /* REPORT_SIZE (1) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0x09, 0x32, /* USAGE (In Range) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0x75, 0x01, /* REPORT_SIZE (1) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */\ - 0x09, 0x30, /* USAGE (X) */\ - 0x15, 0x00, /* LOGICAL_MINIMUM (0) */\ - 0x26, 0xde, 0x27, /* LOGICAL_MAXIMUM (10206) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0x75, 0x10, /* REPORT_SIZE (16) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0x09, 0x31, /* USAGE (Y) */\ - 0x26, 0xfe, 0x1c, /* LOGICAL_MAXIMUM (7422) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0x75, 0x10, /* REPORT_SIZE (16) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ - 0x09, 0x30, /* USAGE (Tip Pressure) */\ - 0x26, 0xff, 0x01, /* LOGICAL_MAXIMUM (511) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0x75, 0x10, /* REPORT_SIZE (16) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0xc0, /* END_COLLECTION */\ - 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ - 0x09, 0x00, /* USAGE (Undefined) */\ - 0x85, 0x02, /* REPORT_ID (2) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0xb1, 0x02, /* FEATURE (Data,Var,Abs) */\ - 0x09, 0x00, /* USAGE (Undefined) */\ - 0x85, 0x03, /* REPORT_ID (3) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0xb1, 0x02, /* FEATURE (Data,Var,Abs) */\ - 0xc0, /* END_COLLECTION */\ - -#define UHID_GRAPHIRE3_4X5_REPORT_DESCR(...) \ - 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */\ - 0x09, 0x02, /* USAGE (Mouse) */\ - 0xa1, 0x01, /* COLLECTION (Application) */\ - 0x85, 0x01, /* REPORT_ID (1) */\ - 0x09, 0x01, /* USAGE (Pointer) */\ - 0xa1, 0x00, /* COLLECTION (Physical) */\ - 0x05, 0x09, /* USAGE_PAGE (Button) */\ - 0x19, 0x01, /* USAGE_MINIMUM (Button 1) */\ - 0x29, 0x03, /* USAGE_MAXIMUM (Button 3) */\ - 0x15, 0x00, /* LOGICAL_MINIMUM (0) */\ - 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */\ - 0x95, 0x03, /* REPORT_COUNT (3) */\ - 0x75, 0x01, /* REPORT_SIZE (1) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0x75, 0x05, /* REPORT_SIZE (5) */\ - 0x81, 0x01, /* INPUT (Cnst,Ary,Abs) */\ - 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */\ - 0x09, 0x30, /* USAGE (X) */\ - 0x09, 0x31, /* USAGE (Y) */\ - 0x09, 0x38, /* USAGE (Wheel) */\ - 0x15, 0x81, /* LOGICAL_MINIMUM (-127) */\ - 0x25, 0x7f, /* LOGICAL_MAXIMUM (127) */\ - 0x75, 0x08, /* REPORT_SIZE (8) */\ - 0x95, 0x03, /* REPORT_COUNT (3) */\ - 0x81, 0x06, /* INPUT (Data,Var,Rel) */\ - 0xc0, /* END_COLLECTION */\ - 0xc0, /* END_COLLECTION */\ - 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ - 0x09, 0x01, /* USAGE (Pointer) */\ - 0xa1, 0x01, /* COLLECTION (Applicaption) */\ - 0x85, 0x02, /* REPORT_ID (2) */\ - 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ - 0x09, 0x01, /* USAGE (Digitizer) */\ - 0xa1, 0x00, /* COLLECTION (Physical) */\ - 0x09, 0x33, /* USAGE (Touch) */\ - 0x09, 0x44, /* USAGE (Barrel Switch) */\ - 0x09, 0x44, /* USAGE (Barrel Switch) */\ - 0x15, 0x00, /* LOGICAL_MINIMUM (0) */\ - 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */\ - 0x75, 0x01, /* REPORT_SIZE (1) */\ - 0x95, 0x03, /* REPORT_COUNT (3) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0x75, 0x01, /* REPORT_SIZE (1) */\ - 0x95, 0x02, /* REPORT_COUNT (2) */\ - 0x81, 0x01, /* INPUT (Cnst,Ary,Abs) */\ - 0x09, 0x3c, /* USAGE (Invert) */\ - 0x09, 0x38, /* USAGE (Transducer Index) */\ - 0x09, 0x32, /* USAGE (In Range) */\ - 0x75, 0x01, /* REPORT_SIZE (1) */\ - 0x95, 0x03, /* REPORT_COUNT (3) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */\ - 0x09, 0x30, /* USAGE (X) */\ - 0x15, 0x00, /* LOGICAL_MINIMUM (0) */\ - 0x26, 0xde, 0x27, /* LOGICAL_MAXIMUM (10206) */\ - 0x75, 0x10, /* REPORT_SIZE (16) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0x09, 0x31, /* USAGE (Y) */\ - 0x26, 0xfe, 0x1c, /* LOGICAL_MAXIMUM (7422) */\ - 0x75, 0x10, /* REPORT_SIZE (16) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ - 0x09, 0x30, /* USAGE (Tip Pressure) */\ - 0x26, 0xff, 0x01, /* LOGICAL_MAXIMUM (511) */\ - 0x75, 0x10, /* REPORT_SIZE (16) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ - 0xc0, /* END_COLLECTION */\ - 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ - 0x09, 0x00, /* USAGE (Undefined) */\ - 0x85, 0x02, /* REPORT_ID (2) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0xb1, 0x02, /* FEATURE (Data,Var,Abs) */\ - 0x09, 0x00, /* USAGE (Undefined) */\ - 0x85, 0x03, /* REPORT_ID (3) */\ - 0x95, 0x01, /* REPORT_COUNT (1) */\ - 0xb1, 0x02, /* FEATURE (Data,Var,Abs) */\ - 0xc0 /* END_COLLECTION */\ - -/* - * The descriptor has no output report format, thus preventing you from - * controlling the LEDs and the built-in rumblers. - */ -#define UHID_XB360GP_REPORT_DESCR(...) \ - 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ - 0x09, 0x05, /* USAGE (Gamepad) */\ - 0xa1, 0x01, /* COLLECTION (Application) */\ - /* Unused */\ - 0x75, 0x08, /* REPORT SIZE (8) */\ - 0x95, 0x01, /* REPORT COUNT (1) */\ - 0x81, 0x01, /* INPUT (Constant) */\ - /* Byte count */\ - 0x75, 0x08, /* REPORT SIZE (8) */\ - 0x95, 0x01, /* REPORT COUNT (1) */\ - 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ - 0x09, 0x3b, /* USAGE (Byte Count) */\ - 0x81, 0x01, /* INPUT (Constant) */\ - /* D-Pad */\ - 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ - 0x09, 0x01, /* USAGE (Pointer) */\ - 0xa1, 0x00, /* COLLECTION (Physical) */\ - 0x75, 0x01, /* REPORT SIZE (1) */\ - 0x15, 0x00, /* LOGICAL MINIMUM (0) */\ - 0x25, 0x01, /* LOGICAL MAXIMUM (1) */\ - 0x35, 0x00, /* PHYSICAL MINIMUM (0) */\ - 0x45, 0x01, /* PHYSICAL MAXIMUM (1) */\ - 0x95, 0x04, /* REPORT COUNT (4) */\ - 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ - 0x09, 0x90, /* USAGE (D-Pad Up) */\ - 0x09, 0x91, /* USAGE (D-Pad Down) */\ - 0x09, 0x93, /* USAGE (D-Pad Left) */\ - 0x09, 0x92, /* USAGE (D-Pad Right) */\ - 0x81, 0x02, /* INPUT (Data, Variable, Absolute) */\ - 0xc0, /* END COLLECTION */\ - /* Buttons 5-11 */\ - 0x75, 0x01, /* REPORT SIZE (1) */\ - 0x15, 0x00, /* LOGICAL MINIMUM (0) */\ - 0x25, 0x01, /* LOGICAL MAXIMUM (1) */\ - 0x35, 0x00, /* PHYSICAL MINIMUM (0) */\ - 0x45, 0x01, /* PHYSICAL MAXIMUM (1) */\ - 0x95, 0x07, /* REPORT COUNT (7) */\ - 0x05, 0x09, /* USAGE PAGE (Button) */\ - 0x09, 0x08, /* USAGE (Button 8) */\ - 0x09, 0x07, /* USAGE (Button 7) */\ - 0x09, 0x09, /* USAGE (Button 9) */\ - 0x09, 0x0a, /* USAGE (Button 10) */\ - 0x09, 0x05, /* USAGE (Button 5) */\ - 0x09, 0x06, /* USAGE (Button 6) */\ - 0x09, 0x0b, /* USAGE (Button 11) */\ - 0x81, 0x02, /* INPUT (Data, Variable, Absolute) */\ - /* Unused */\ - 0x75, 0x01, /* REPORT SIZE (1) */\ - 0x95, 0x01, /* REPORT COUNT (1) */\ - 0x81, 0x01, /* INPUT (Constant) */\ - /* Buttons 1-4 */\ - 0x75, 0x01, /* REPORT SIZE (1) */\ - 0x15, 0x00, /* LOGICAL MINIMUM (0) */\ - 0x25, 0x01, /* LOGICAL MAXIMUM (1) */\ - 0x35, 0x00, /* PHYSICAL MINIMUM (0) */\ - 0x45, 0x01, /* PHYSICAL MAXIMUM (1) */\ - 0x95, 0x04, /* REPORT COUNT (4) */\ - 0x05, 0x09, /* USAGE PAGE (Button) */\ - 0x19, 0x01, /* USAGE MINIMUM (Button 1) */\ - 0x29, 0x04, /* USAGE MAXIMUM (Button 4) */\ - 0x81, 0x02, /* INPUT (Data, Variable, Absolute) */\ - /* Triggers */\ - 0x75, 0x08, /* REPORT SIZE (8) */\ - 0x15, 0x00, /* LOGICAL MINIMUM (0) */\ - 0x26, 0xff, 0x00, /* LOGICAL MAXIMUM (255) */\ - 0x35, 0x00, /* PHYSICAL MINIMUM (0) */\ - 0x46, 0xff, 0x00, /* PHYSICAL MAXIMUM (255) */\ - 0x95, 0x02, /* REPORT SIZE (2) */\ - 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ - 0x09, 0x32, /* USAGE (Z) */\ - 0x09, 0x35, /* USAGE (Rz) */\ - 0x81, 0x02, /* INPUT (Data, Variable, Absolute) */\ - /* Sticks */\ - 0x75, 0x10, /* REPORT SIZE (16) */\ - 0x16, 0x00, 0x80, /* LOGICAL MINIMUM (-32768) */\ - 0x26, 0xff, 0x7f, /* LOGICAL MAXIMUM (32767) */\ - 0x36, 0x00, 0x80, /* PHYSICAL MINIMUM (-32768) */\ - 0x46, 0xff, 0x7f, /* PHYSICAL MAXIMUM (32767) */\ - 0x95, 0x04, /* REPORT COUNT (4) */\ - 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ - 0x09, 0x30, /* USAGE (X) */\ - 0x09, 0x31, /* USAGE (Y) */\ - 0x09, 0x33, /* USAGE (Rx) */\ - 0x09, 0x34, /* USAGE (Ry) */\ - 0x81, 0x02, /* INPUT (Data, Variable, Absolute) */\ - /* Unused */\ - 0x75, 0x30, /* REPORT SIZE (48) */\ - 0x95, 0x01, /* REPORT COUNT (1) */\ - 0x81, 0x01, /* INPUT (Constant) */\ - 0xc0 /* END COLLECTION */\ +#include -/* Fixed report descriptor for Super Nintendo gamepads */ -#define UHID_SNES_REPORT_DESCR(...) \ - 0x05, 0x01, /* Usage Page (Desktop), */\ - 0x09, 0x04, /* Usage (Joystik), */\ - 0xA1, 0x01, /* Collection (Application), */\ - 0xA1, 0x02, /* Collection (Logical), */\ - 0x14, /* Logical Minimum (0), */\ - 0x75, 0x08, /* Report Size (8), */\ - 0x95, 0x03, /* Report Count (3), */\ - 0x81, 0x01, /* Input (Constant), */\ - 0x26, 0xFF, 0x00, /* Logical Maximum (255), */\ - 0x95, 0x02, /* Report Count (2), */\ - 0x09, 0x30, /* Usage (X), */\ - 0x09, 0x31, /* Usage (Y), */\ - 0x81, 0x02, /* Input (Variable), */\ - 0x75, 0x01, /* Report Size (1), */\ - 0x95, 0x04, /* Report Count (4), */\ - 0x81, 0x01, /* Input (Constant), */\ - 0x25, 0x01, /* Logical Maximum (1), */\ - 0x95, 0x0A, /* Report Count (10), */\ *** 1323 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:21:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8C0914DE9CF; Thu, 7 Jan 2021 23:20:54 +0000 (UTC) (envelope-from git@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 4DBj050s1nz4SwB; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B960193DF; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKqlW063460; Thu, 7 Jan 2021 23:20:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKqlU063459; Thu, 7 Jan 2021 23:20:52 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:52 GMT Message-Id: <202101072320.107NKqlU063459@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 3f2709285421 - main - hid_locate: do not ignore constant items. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f270928542192dd1cb14429290ef97ab3f7fa94 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:21:01 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=3f270928542192dd1cb14429290ef97ab3f7fa94 commit 3f270928542192dd1cb14429290ef97ab3f7fa94 Author: Vladimir Kondratyev AuthorDate: 2020-12-24 11:46:24 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:41 +0000 hid_locate: do not ignore constant items. hid_locate() currently ignores all HID items which tagged as constant, i.e. bit 0 of main item data is set to 1. See p.6.2.2.4 of hid1_11.pdf [1]. Such an items are unconditionally treated as byte-alignment padding. While that may be right decision for input and output reports that is wrong for features reports. Feature reports can contain constant capabilities e.g. 'Contact Count Maximum'. See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232040 Remove check for constant from hid_locate() to make possible parsing of such a reports. [1] https://www.usb.org/sites/default/files/documents/hid1_11.pdf Reviewed by: hselasky Obtained from: sysutils/iichid Differential Revision: https://reviews.freebsd.org/D27747 --- sys/dev/usb/usb_hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/usb/usb_hid.c b/sys/dev/usb/usb_hid.c index adba8e812417..dd0c8d4b42ac 100644 --- a/sys/dev/usb/usb_hid.c +++ b/sys/dev/usb/usb_hid.c @@ -622,7 +622,7 @@ hid_locate(const void *desc, usb_size_t size, int32_t u, enum hid_kind k, struct hid_item h; for (d = hid_start_parse(desc, size, 1 << k); hid_get_item(d, &h);) { - if (h.kind == k && !(h.flags & HIO_CONST) && h.usage == u) { + if (h.kind == k && h.usage == u) { if (index--) continue; if (loc != NULL) From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7EA164DEB4C; Thu, 7 Jan 2021 23:20:53 +0000 (UTC) (envelope-from git@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 4DBj044pjXz4ShW; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA68719276; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpgI063392; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpIK063391; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpIK063391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 3b8c8b35de3a - main - evdev: Allow open() handler to be interrupted by a signal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b8c8b35de3a1a8a24169d144189b6a4db82ce10 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:21:00 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=3b8c8b35de3a1a8a24169d144189b6a4db82ce10 commit 3b8c8b35de3a1a8a24169d144189b6a4db82ce10 Author: Vladimir Kondratyev AuthorDate: 2020-04-21 22:38:14 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:42 +0000 evdev: Allow open() handler to be interrupted by a signal It is possible that the client list lock is taken by other process for too long due to e.g. IO timeouts. Allow user to terminate open() in this case. Reviewed by: markj (as part of D27865) --- sys/dev/evdev/cdev.c | 11 ++++++----- sys/dev/evdev/evdev_private.h | 9 +++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/sys/dev/evdev/cdev.c b/sys/dev/evdev/cdev.c index c4550362ebce..ec60a12dbf2d 100644 --- a/sys/dev/evdev/cdev.c +++ b/sys/dev/evdev/cdev.c @@ -126,19 +126,20 @@ evdev_open(struct cdev *dev, int oflags, int devtype, struct thread *td) mtx_init(&client->ec_buffer_mtx, "evclient", "evdev", MTX_DEF); knlist_init_mtx(&client->ec_selp.si_note, &client->ec_buffer_mtx); + ret = EVDEV_LIST_LOCK_SIG(evdev); + if (ret != 0) + goto out; /* Avoid race with evdev_unregister */ - EVDEV_LIST_LOCK(evdev); if (dev->si_drv1 == NULL) ret = ENODEV; else ret = evdev_register_client(evdev, client); - - if (ret != 0) - evdev_revoke_client(client); EVDEV_LIST_UNLOCK(evdev); - +out: if (ret == 0) ret = devfs_set_cdevpriv(client, evdev_dtor); + else + client->ec_revoked = true; if (ret != 0) { debugf(client, "cannot register evdev client"); diff --git a/sys/dev/evdev/evdev_private.h b/sys/dev/evdev/evdev_private.h index 66a059c763bc..19636823b804 100644 --- a/sys/dev/evdev/evdev_private.h +++ b/sys/dev/evdev/evdev_private.h @@ -206,6 +206,15 @@ struct evdev_dev else \ sx_assert(&(evdev)->ev_list_lock, MA_OWNED); \ } while (0) +static inline int +EVDEV_LIST_LOCK_SIG(struct evdev_dev *evdev) +{ + if (evdev->ev_lock_type == EV_LOCK_MTX) { + EVDEV_LOCK(evdev); + return (0); + } + return (sx_xlock_sig(&evdev->ev_list_lock)); +} struct evdev_client { From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:20:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6926F4DE8F7; Thu, 7 Jan 2021 23:20:53 +0000 (UTC) (envelope-from git@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 4DBj044rLPz4SbM; Thu, 7 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E44771952A; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKptM063375; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpMS063374; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpMS063374@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92cf602e3809f2bcb0490b3895025b0185e2daa9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:20:58 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=92cf602e3809f2bcb0490b3895025b0185e2daa9 commit 92cf602e3809f2bcb0490b3895025b0185e2daa9 Author: Vladimir Kondratyev AuthorDate: 2020-04-21 22:38:14 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:42 +0000 Copy strcasestr.c from libc to libkern. --- sys/libkern/strcasestr.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/sys/libkern/strcasestr.c b/sys/libkern/strcasestr.c new file mode 100644 index 000000000000..b70c2195a94e --- /dev/null +++ b/sys/libkern/strcasestr.c @@ -0,0 +1,74 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Copyright (c) 2011 The FreeBSD Foundation + * All rights reserved. + * Portions of this software were developed by David Chisnall + * 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. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include "xlocale_private.h" + +/* + * Find the first occurrence of find in s, ignore case. + */ +char * +strcasestr_l(const char *s, const char *find, locale_t locale) +{ + char c, sc; + size_t len; + FIX_LOCALE(locale); + + if ((c = *find++) != 0) { + c = tolower_l((unsigned char)c, locale); + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while ((char)tolower_l((unsigned char)sc, locale) != c); + } while (strncasecmp_l(s, find, len, locale) != 0); + s--; + } + return ((char *)s); +} +char * +strcasestr(const char *s, const char *find) +{ + return strcasestr_l(s, find, __get_locale()); +} From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:21:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8BF824DEC1B; Thu, 7 Jan 2021 23:20:53 +0000 (UTC) (envelope-from git@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 4DBj036Pc0z4SSp; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8ECB1934A; Thu, 7 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NKpNI063307; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NKpjc063306; Thu, 7 Jan 2021 23:20:51 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:20:51 GMT Message-Id: <202101072320.107NKpjc063306@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 197587867321 - main - hid: Import functions and constants required by new subsystem MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 197587867321ebde6c32228eac85c98ad19da95d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:21:00 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=197587867321ebde6c32228eac85c98ad19da95d commit 197587867321ebde6c32228eac85c98ad19da95d Author: Vladimir Kondratyev AuthorDate: 2020-10-05 09:38:11 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-07 23:18:42 +0000 hid: Import functions and constants required by new subsystem This does an import of quirk stubs, debugging macros from USB code and numerous usage constants used by dependent drivers. Besides, this change renames some functions to get a better matching with userland library and NetBSD/OpenBSD HID code. Namely: - Old hid_report_size() renamed to hid_report_size_max() - New hid_report_size() calculates size of given report rather than maximum size of all reports. - hid_get_data_unsigned() renamed to hid_get_udata() - hid_put_data_unsigned() renamed to hid_put_udata() Compat shim functions are provided in usbhid.h to make possible compile of legacy code unmodified after this change. Reviewed by: manu, hselasky Differential revision: https://reviews.freebsd.org/D27887 --- sys/amd64/conf/GENERIC | 1 + sys/arm64/conf/GENERIC | 1 + sys/arm64/conf/GENERIC-NODEBUG | 1 + sys/conf/options | 3 + sys/dev/hid/hid.c | 168 ++++++++++++++++++++++++++++++++--------- sys/dev/hid/hid.h | 110 ++++++++++++++++++++++++--- sys/dev/hid/hidquirk.h | 74 ++++++++++++++++++ sys/dev/usb/usbhid.h | 20 +++++ sys/i386/conf/GENERIC | 1 + sys/mips/conf/ERL | 1 + sys/mips/conf/JZ4780 | 1 + sys/mips/conf/OCTEON1 | 1 + sys/modules/hid/hid/Makefile | 2 +- sys/powerpc/conf/GENERIC | 1 + sys/powerpc/conf/GENERIC64 | 1 + sys/powerpc/conf/GENERIC64LE | 1 + sys/powerpc/conf/MPC85XX | 1 + sys/powerpc/conf/MPC85XXSPE | 1 + sys/powerpc/conf/QORIQ64 | 1 + 19 files changed, 342 insertions(+), 48 deletions(-) diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index c7802969ba4b..98535be6133b 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -382,4 +382,5 @@ device evdev # input event device support device uinput # install /dev/uinput cdev # HID support +options HID_DEBUG # enable debug msgs device hid # Generic HID support diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index dc9278a998e2..280a5efeeb0b 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -382,4 +382,5 @@ device acpi makeoptions MODULES_EXTRA="dtb/allwinner dtb/freescale dtb/imx8 dtb/nvidia dtb/mv dtb/rockchip dtb/rpi" # HID support +options HID_DEBUG # enable debug msgs device hid # Generic HID support diff --git a/sys/arm64/conf/GENERIC-NODEBUG b/sys/arm64/conf/GENERIC-NODEBUG index ccd519734180..7d23884ef90b 100644 --- a/sys/arm64/conf/GENERIC-NODEBUG +++ b/sys/arm64/conf/GENERIC-NODEBUG @@ -36,6 +36,7 @@ nooptions WITNESS nooptions WITNESS_SKIPSPIN nooptions DEADLKRES nooptions USB_DEBUG +nooptions HID_DEBUG nooptions COVERAGE nooptions KCOV nooptions MALLOC_DEBUG_MAXZONES diff --git a/sys/conf/options b/sys/conf/options index 68c8a2e0d3ca..797fa67f1a92 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -1013,3 +1013,6 @@ AMDSBWD_DEBUG opt_amdsbwd.h # gcov support GCOV opt_global.h LINDEBUGFS + +# options for HID support +HID_DEBUG opt_hid.h diff --git a/sys/dev/hid/hid.c b/sys/dev/hid/hid.c index 61b7587a6c62..1bc50e84e56d 100644 --- a/sys/dev/hid/hid.c +++ b/sys/dev/hid/hid.c @@ -32,45 +32,36 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifdef USB_GLOBAL_INCLUDE_FILE -#include USB_GLOBAL_INCLUDE_FILE -#else -#include -#include +#include "opt_hid.h" + #include -#include -#include -#include -#include #include +#include +#include +#include #include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#define HID_DEBUG_VAR hid_debug +#include +#include -#define USB_DEBUG_VAR usb_debug +/* + * Define this unconditionally in case a kernel module is loaded that + * has been compiled with debugging options. + */ +int hid_debug = 0; -#include -#include -#include -#include -#include -#endif /* USB_GLOBAL_INCLUDE_FILE */ +SYSCTL_NODE(_hw, OID_AUTO, hid, CTLFLAG_RW, 0, "HID debugging"); +SYSCTL_INT(_hw_hid, OID_AUTO, debug, CTLFLAG_RWTUN, + &hid_debug, 0, "Debug level"); static void hid_clear_local(struct hid_item *); static uint8_t hid_get_byte(struct hid_data *s, const uint16_t wSize); +static hid_test_quirk_t hid_test_quirk_w; +hid_test_quirk_t *hid_test_quirk_p = &hid_test_quirk_w; + #define MAXUSAGE 64 #define MAXPUSH 4 #define MAXID 16 @@ -180,7 +171,7 @@ hid_switch_rid(struct hid_data *s, struct hid_item *c, int32_t next_rID) * hid_start_parse *------------------------------------------------------------------------*/ struct hid_data * -hid_start_parse(const void *d, usb_size_t len, int kindset) +hid_start_parse(const void *d, hid_size_t len, int kindset) { struct hid_data *s; @@ -574,7 +565,47 @@ hid_get_item(struct hid_data *s, struct hid_item *h) * hid_report_size *------------------------------------------------------------------------*/ int -hid_report_size(const void *buf, usb_size_t len, enum hid_kind k, uint8_t *id) +hid_report_size(const void *buf, hid_size_t len, enum hid_kind k, uint8_t id) +{ + struct hid_data *d; + struct hid_item h; + uint32_t temp; + uint32_t hpos; + uint32_t lpos; + int report_id = 0; + + hpos = 0; + lpos = 0xFFFFFFFF; + + for (d = hid_start_parse(buf, len, 1 << k); hid_get_item(d, &h);) { + if (h.kind == k && h.report_ID == id) { + /* compute minimum */ + if (lpos > h.loc.pos) + lpos = h.loc.pos; + /* compute end position */ + temp = h.loc.pos + (h.loc.size * h.loc.count); + /* compute maximum */ + if (hpos < temp) + hpos = temp; + if (h.report_ID != 0) + report_id = 1; + } + } + hid_end_parse(d); + + /* safety check - can happen in case of currupt descriptors */ + if (lpos > hpos) + temp = 0; + else + temp = hpos - lpos; + + /* return length in bytes rounded up */ + return ((temp + 7) / 8 + report_id); +} + +int +hid_report_size_max(const void *buf, hid_size_t len, enum hid_kind k, + uint8_t *id) { struct hid_data *d; struct hid_item h; @@ -627,7 +658,7 @@ hid_report_size(const void *buf, usb_size_t len, enum hid_kind k, uint8_t *id) * hid_locate *------------------------------------------------------------------------*/ int -hid_locate(const void *desc, usb_size_t size, int32_t u, enum hid_kind k, +hid_locate(const void *desc, hid_size_t size, int32_t u, enum hid_kind k, uint8_t index, struct hid_location *loc, uint32_t *flags, uint8_t *id) { struct hid_data *d; @@ -664,7 +695,7 @@ hid_locate(const void *desc, usb_size_t size, int32_t u, enum hid_kind k, * hid_get_data *------------------------------------------------------------------------*/ static uint32_t -hid_get_data_sub(const uint8_t *buf, usb_size_t len, struct hid_location *loc, +hid_get_data_sub(const uint8_t *buf, hid_size_t len, struct hid_location *loc, int is_signed) { uint32_t hpos = loc->pos; @@ -708,13 +739,13 @@ hid_get_data_sub(const uint8_t *buf, usb_size_t len, struct hid_location *loc, } int32_t -hid_get_data(const uint8_t *buf, usb_size_t len, struct hid_location *loc) +hid_get_data(const uint8_t *buf, hid_size_t len, struct hid_location *loc) { return (hid_get_data_sub(buf, len, loc, 1)); } uint32_t -hid_get_data_unsigned(const uint8_t *buf, usb_size_t len, struct hid_location *loc) +hid_get_udata(const uint8_t *buf, hid_size_t len, struct hid_location *loc) { return (hid_get_data_sub(buf, len, loc, 0)); } @@ -723,7 +754,7 @@ hid_get_data_unsigned(const uint8_t *buf, usb_size_t len, struct hid_location *l * hid_put_data *------------------------------------------------------------------------*/ void -hid_put_data_unsigned(uint8_t *buf, usb_size_t len, +hid_put_udata(uint8_t *buf, hid_size_t len, struct hid_location *loc, unsigned int value) { uint32_t hpos = loc->pos; @@ -760,7 +791,7 @@ hid_put_data_unsigned(uint8_t *buf, usb_size_t len, * hid_is_collection *------------------------------------------------------------------------*/ int -hid_is_collection(const void *desc, usb_size_t size, int32_t usage) +hid_is_collection(const void *desc, hid_size_t size, int32_t usage) { struct hid_data *hd; struct hid_item hi; @@ -929,4 +960,69 @@ hid_is_keyboard(const void *d_ptr, uint16_t d_len) return (0); } +/*------------------------------------------------------------------------* + * hid_test_quirk - test a device for a given quirk + * + * Return values: + * false: The HID device does not have the given quirk. + * true: The HID device has the given quirk. + *------------------------------------------------------------------------*/ +bool +hid_test_quirk(const struct hid_device_info *dev_info, uint16_t quirk) +{ + bool found; + uint8_t x; + + if (quirk == HQ_NONE) + return (false); + + /* search the automatic per device quirks first */ + for (x = 0; x != HID_MAX_AUTO_QUIRK; x++) { + if (dev_info->autoQuirk[x] == quirk) + return (true); + } + + /* search global quirk table, if any */ + found = (hid_test_quirk_p) (dev_info, quirk); + + return (found); +} + +static bool +hid_test_quirk_w(const struct hid_device_info *dev_info, uint16_t quirk) +{ + return (false); /* no match */ +} + +int +hid_add_dynamic_quirk(struct hid_device_info *dev_info, uint16_t quirk) +{ + uint8_t x; + + for (x = 0; x != HID_MAX_AUTO_QUIRK; x++) { + if (dev_info->autoQuirk[x] == 0 || + dev_info->autoQuirk[x] == quirk) { + dev_info->autoQuirk[x] = quirk; + return (0); /* success */ + } + } + return (ENOSPC); +} + +void +hid_quirk_unload(void *arg) +{ + /* reset function pointer */ + hid_test_quirk_p = &hid_test_quirk_w; +#ifdef NOT_YET + hidquirk_ioctl_p = &hidquirk_ioctl_w; +#endif + + /* wait for CPU to exit the loaded functions, if any */ + + /* XXX this is a tradeoff */ + + pause("WAIT", hz); +} + MODULE_VERSION(hid, 1); diff --git a/sys/dev/hid/hid.h b/sys/dev/hid/hid.h index b1829318bda1..5855eeaa1802 100644 --- a/sys/dev/hid/hid.h +++ b/sys/dev/hid/hid.h @@ -67,6 +67,7 @@ #define HUG_GAME_PAD 0x0005 #define HUG_KEYBOARD 0x0006 #define HUG_KEYPAD 0x0007 +#define HUG_MULTIAXIS_CNTROLLER 0x0008 #define HUG_X 0x0030 #define HUG_Y 0x0031 #define HUG_Z 0x0032 @@ -102,6 +103,12 @@ #define HUG_SYSTEM_MENU_LEFT 0x008b #define HUG_SYSTEM_MENU_UP 0x008c #define HUG_SYSTEM_MENU_DOWN 0x008d +#define HUG_SYSTEM_POWER_UP 0x008e +#define HUG_SYSTEM_RESTART 0x008f +#define HUG_D_PAD_UP 0x0090 +#define HUG_D_PAD_DOWN 0x0091 +#define HUG_D_PAD_RIGHT 0x0092 +#define HUG_D_PAD_LEFT 0x0093 #define HUG_APPLE_EJECT 0x00b8 /* Usages Digitizers */ @@ -147,16 +154,21 @@ #define HUD_SURFACE_SWITCH 0x0057 #define HUD_BUTTONS_SWITCH 0x0058 #define HUD_BUTTON_TYPE 0x0059 +#define HUD_SEC_BARREL_SWITCH 0x005a #define HUD_LATENCY_MODE 0x0060 /* Usages, Consumer */ +#define HUC_CONTROL 0x0001 +#define HUC_HEADPHONE 0x0005 #define HUC_AC_PAN 0x0238 -#define HID_USAGE2(p,u) (((p) << 16) | (u)) +#define HID_USAGE2(p,u) (((p) << 16) | (u)) +#define HID_GET_USAGE(u) ((u) & 0xffff) +#define HID_GET_USAGE_PAGE(u) (((u) >> 16) & 0xffff) -#define UHID_INPUT_REPORT 0x01 -#define UHID_OUTPUT_REPORT 0x02 -#define UHID_FEATURE_REPORT 0x03 +#define HID_INPUT_REPORT 0x01 +#define HID_OUTPUT_REPORT 0x02 +#define HID_FEATURE_REPORT 0x03 /* Bits in the input/output/feature items */ #define HIO_CONST 0x001 @@ -178,6 +190,36 @@ #if defined(_KERNEL) || defined(_STANDALONE) #define HID_ITEM_MAXUSAGE 4 +#define HID_MAX_AUTO_QUIRK 8 /* maximum number of dynamic quirks */ +#define HID_PNP_ID_SIZE 20 /* includes null terminator */ + +/* Declare global HID debug variable. */ +extern int hid_debug; + +/* Check if HID debugging is enabled. */ +#ifdef HID_DEBUG_VAR +#ifdef HID_DEBUG +#define DPRINTFN(n,fmt,...) do { \ + if ((HID_DEBUG_VAR) >= (n)) { \ + printf("%s: " fmt, \ + __FUNCTION__ ,##__VA_ARGS__); \ + } \ +} while (0) +#define DPRINTF(...) DPRINTFN(1, __VA_ARGS__) +#else +#define DPRINTF(...) do { } while (0) +#define DPRINTFN(...) do { } while (0) +#endif +#endif + +/* Declare parent SYSCTL HID node. */ +#ifdef SYSCTL_DECL +SYSCTL_DECL(_hw_hid); +#endif + +typedef uint32_t hid_size_t; + +#define HID_IN_POLLING_MODE() (SCHEDULER_STOPPED() || kdb_active) enum hid_kind { hid_input, hid_output, hid_feature, hid_collection, hid_endcollection @@ -223,25 +265,71 @@ struct hid_item { struct hid_location loc; }; +struct hid_absinfo { + int32_t min; + int32_t max; + int32_t res; +}; + +struct hid_device_info { + char name[80]; + char serial[80]; + char idPnP[HID_PNP_ID_SIZE]; + uint16_t idBus; + uint16_t idVendor; + uint16_t idProduct; + uint16_t idVersion; + hid_size_t rdescsize; /* Report descriptor size */ + uint8_t autoQuirk[HID_MAX_AUTO_QUIRK]; +}; + +struct hid_rdesc_info { + void *data; + hid_size_t len; + hid_size_t isize; + hid_size_t osize; + hid_size_t fsize; + uint8_t iid; + uint8_t oid; + uint8_t fid; + /* Max sizes for HID requests supported by transport backend */ + hid_size_t rdsize; + hid_size_t wrsize; + hid_size_t grsize; + hid_size_t srsize; +}; + +typedef void hid_intr_t(void *context, void *data, hid_size_t len); +typedef bool hid_test_quirk_t(const struct hid_device_info *dev_info, + uint16_t quirk); + +extern hid_test_quirk_t *hid_test_quirk_p; + /* prototypes from "usb_hid.c" */ -struct hid_data *hid_start_parse(const void *d, usb_size_t len, int kindset); +struct hid_data *hid_start_parse(const void *d, hid_size_t len, int kindset); void hid_end_parse(struct hid_data *s); int hid_get_item(struct hid_data *s, struct hid_item *h); -int hid_report_size(const void *buf, usb_size_t len, enum hid_kind k, +int hid_report_size(const void *buf, hid_size_t len, enum hid_kind k, + uint8_t id); +int hid_report_size_max(const void *buf, hid_size_t len, enum hid_kind k, uint8_t *id); -int hid_locate(const void *desc, usb_size_t size, int32_t usage, +int hid_locate(const void *desc, hid_size_t size, int32_t usage, enum hid_kind kind, uint8_t index, struct hid_location *loc, uint32_t *flags, uint8_t *id); -int32_t hid_get_data(const uint8_t *buf, usb_size_t len, +int32_t hid_get_data(const uint8_t *buf, hid_size_t len, struct hid_location *loc); -uint32_t hid_get_data_unsigned(const uint8_t *buf, usb_size_t len, +uint32_t hid_get_udata(const uint8_t *buf, hid_size_t len, struct hid_location *loc); -void hid_put_data_unsigned(uint8_t *buf, usb_size_t len, +void hid_put_udata(uint8_t *buf, hid_size_t len, struct hid_location *loc, unsigned int value); -int hid_is_collection(const void *desc, usb_size_t size, int32_t usage); +int hid_is_collection(const void *desc, hid_size_t size, int32_t usage); int32_t hid_item_resolution(struct hid_item *hi); int hid_is_mouse(const void *d_ptr, uint16_t d_len); int hid_is_keyboard(const void *d_ptr, uint16_t d_len); +bool hid_test_quirk(const struct hid_device_info *dev_info, uint16_t quirk); +int hid_add_dynamic_quirk(struct hid_device_info *dev_info, + uint16_t quirk); +void hid_quirk_unload(void *arg); #endif /* _KERNEL || _STANDALONE */ #endif /* _HID_HID_H_ */ diff --git a/sys/dev/hid/hidquirk.h b/sys/dev/hid/hidquirk.h new file mode 100644 index 000000000000..0201f2f0746c --- /dev/null +++ b/sys/dev/hid/hidquirk.h @@ -0,0 +1,74 @@ +/* $FreeBSD$ */ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2020 Vladimir Kondratyev + * + * 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. + */ + +/* + * Screening of all content of this file except HID_QUIRK_LIST is a kind of + * hack that allows multiple HID_QUIRK_LIST inclusion with different HQ() + * wrappers. That save us splitting hidquirk.h on two header files. + */ +#ifndef HQ +#ifndef _HID_QUIRK_H_ +#define _HID_QUIRK_H_ +#endif + +/* + * Keep in sync with share/man/man4/hidquirk.4 + */ +#define HID_QUIRK_LIST(...) \ + HQ(NONE), /* not a valid quirk */ \ + \ + HQ(MATCH_VENDOR_ONLY), /* match quirk on vendor only */ \ + \ + /* Autoquirks */ \ + HQ(HAS_KBD_BOOTPROTO), /* device supports keyboard boot protocol */ \ + HQ(HAS_MS_BOOTPROTO), /* device supports mouse boot protocol */ \ + HQ(IS_XBOX360GP), /* device is XBox 360 GamePad */ \ + HQ(NOWRITE), /* device does not support writes */ \ + HQ(IICHID_SAMPLING), /* IIC backend runs in sampling mode */ \ + \ + /* Various quirks */ \ + HQ(HID_IGNORE), /* device should be ignored by hid class */ \ + HQ(KBD_BOOTPROTO), /* device should set the boot protocol */ \ + HQ(MS_BOOTPROTO), /* device should set the boot protocol */ \ + HQ(MS_BAD_CLASS), /* doesn't identify properly */ \ + HQ(MS_LEADING_BYTE), /* mouse sends an unknown leading byte */ \ + HQ(MS_REVZ), /* mouse has Z-axis reversed */ \ + HQ(SPUR_BUT_UP), /* spurious mouse button up events */ \ + HQ(MT_TIMESTAMP) /* Multitouch device exports HW timestamps */ + +#ifndef HQ +#define HQ(x) HQ_##x +enum { + HID_QUIRK_LIST(), + HID_QUIRK_MAX +}; +#undef HQ + +#endif /* _HID_QUIRK_H_ */ +#endif /* HQ */ diff --git a/sys/dev/usb/usbhid.h b/sys/dev/usb/usbhid.h index 4fbbe96114f8..9e87e8226abf 100644 --- a/sys/dev/usb/usbhid.h +++ b/sys/dev/usb/usbhid.h @@ -63,9 +63,29 @@ struct usb_hid_descriptor { #define USB_HID_DESCRIPTOR_SIZE(n) (9+((n)*3)) +#define UHID_INPUT_REPORT HID_INPUT_REPORT +#define UHID_OUTPUT_REPORT HID_OUTPUT_REPORT +#define UHID_FEATURE_REPORT HID_FEATURE_REPORT + #if defined(_KERNEL) || defined(_STANDALONE) struct usb_config_descriptor; +/* FreeBSD <= 12 compat shims */ +#define hid_report_size(buf, len, kind, id) \ + hid_report_size_max(buf, len, kind, id) +static __inline uint32_t +hid_get_data_unsigned(const uint8_t *buf, hid_size_t len, + struct hid_location *loc) +{ + return (hid_get_udata(buf, len, loc)); +} +static __inline void +hid_put_data_unsigned(uint8_t *buf, hid_size_t len, struct hid_location *loc, + unsigned int value) +{ + return (hid_put_udata(buf, len, loc, value)); +} + struct usb_hid_descriptor *hid_get_descriptor_from_usb( struct usb_config_descriptor *cd, struct usb_interface_descriptor *id); diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index 61c35291e10c..dabb0575ae3d 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -350,4 +350,5 @@ device evdev # input event device support device uinput # install /dev/uinput cdev # HID support +options HID_DEBUG # enable debug msgs device hid # Generic HID support diff --git a/sys/mips/conf/ERL b/sys/mips/conf/ERL index 40fabc71fad1..d0bb25455fa4 100644 --- a/sys/mips/conf/ERL +++ b/sys/mips/conf/ERL @@ -214,4 +214,5 @@ device cryptocteon # Octeon coprocessor 2 crypto offload #device hwpmc # HID support +options HID_DEBUG # enable debug msgs device hid # Generic HID support diff --git a/sys/mips/conf/JZ4780 b/sys/mips/conf/JZ4780 index f22a506571ab..962334eeffda 100644 --- a/sys/mips/conf/JZ4780 +++ b/sys/mips/conf/JZ4780 @@ -110,6 +110,7 @@ device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse # HID support +options HID_DEBUG # enable debug msgs device hid # Generic HID support # FDT support diff --git a/sys/mips/conf/OCTEON1 b/sys/mips/conf/OCTEON1 index ce9b2babab98..99a839ac8b28 100644 --- a/sys/mips/conf/OCTEON1 +++ b/sys/mips/conf/OCTEON1 @@ -239,4 +239,5 @@ device cryptocteon # Octeon coprocessor 2 crypto offload #device hwpmc # HID support +options HID_DEBUG # enable debug msgs device hid # Generic HID support diff --git a/sys/modules/hid/hid/Makefile b/sys/modules/hid/hid/Makefile index 87e987ca4e4d..1f84b277cda3 100644 --- a/sys/modules/hid/hid/Makefile +++ b/sys/modules/hid/hid/Makefile @@ -4,6 +4,6 @@ KMOD= hid SRCS= hid.c -SRCS+= opt_usb.h +SRCS+= opt_hid.h .include diff --git a/sys/powerpc/conf/GENERIC b/sys/powerpc/conf/GENERIC index d59d3a93f03e..dc3484d7f614 100644 --- a/sys/powerpc/conf/GENERIC +++ b/sys/powerpc/conf/GENERIC @@ -241,4 +241,5 @@ device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device # HID support +options HID_DEBUG # enable debug msgs device hid # Generic HID support diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64 index 61bad50b7388..16a33160aa34 100644 --- a/sys/powerpc/conf/GENERIC64 +++ b/sys/powerpc/conf/GENERIC64 @@ -271,4 +271,5 @@ device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device # HID support +options HID_DEBUG # enable debug msgs device hid # Generic HID support diff --git a/sys/powerpc/conf/GENERIC64LE b/sys/powerpc/conf/GENERIC64LE index ad41c756d207..bafa8df52f4e 100644 --- a/sys/powerpc/conf/GENERIC64LE +++ b/sys/powerpc/conf/GENERIC64LE @@ -252,4 +252,5 @@ device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device # HID support +options HID_DEBUG # enable debug msgs device hid # Generic HID support diff --git a/sys/powerpc/conf/MPC85XX b/sys/powerpc/conf/MPC85XX index 03fecead1448..f68f3e6f5f75 100644 --- a/sys/powerpc/conf/MPC85XX +++ b/sys/powerpc/conf/MPC85XX @@ -119,4 +119,5 @@ device vt device fbd # HID support +options HID_DEBUG # enable debug msgs device hid # Generic HID support diff --git a/sys/powerpc/conf/MPC85XXSPE b/sys/powerpc/conf/MPC85XXSPE index 281c24b96adf..553a616bb707 100644 --- a/sys/powerpc/conf/MPC85XXSPE +++ b/sys/powerpc/conf/MPC85XXSPE @@ -120,4 +120,5 @@ device vt device fbd # HID support +options HID_DEBUG # enable debug msgs device hid # Generic HID support diff --git a/sys/powerpc/conf/QORIQ64 b/sys/powerpc/conf/QORIQ64 index 6ee2af259c0d..4131ed5935b5 100644 --- a/sys/powerpc/conf/QORIQ64 +++ b/sys/powerpc/conf/QORIQ64 @@ -122,4 +122,5 @@ device ukbd device ums # HID support +options HID_DEBUG # enable debug msgs device hid # Generic HID support From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:22:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 70E154DF21F for ; Thu, 7 Jan 2021 23:22:12 +0000 (UTC) (envelope-from git@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 4DBj1b1jfkz4TkC; Thu, 7 Jan 2021 23:22:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 501AD1969D; Thu, 7 Jan 2021 23:22:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NM70Q063894; Thu, 7 Jan 2021 23:22:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NM66R063892; Thu, 7 Jan 2021 23:22:06 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:22:06 GMT Message-Id: <202101072322.107NM66R063892@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Matt Macy Subject: git: 42385c279bad - vendor/openzfs - Update OpenZFS to master-f11b09 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmacy X-Git-Repository: src X-Git-Refname: refs/heads/vendor/openzfs X-Git-Reftype: branch X-Git-Commit: 42385c279bad198701badabdab661df49f2acb9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:22:14 -0000 The branch vendor/openzfs has been updated by mmacy: URL: https://cgit.FreeBSD.org/src/commit/?id=42385c279bad198701badabdab661df49f2acb9a commit 42385c279bad198701badabdab661df49f2acb9a Author: Matt Macy AuthorDate: 2021-01-07 23:19:59 +0000 Commit: Matt Macy CommitDate: 2021-01-07 23:19:59 +0000 Update OpenZFS to master-f11b09 --- .github/CONTRIBUTING.md | 68 +- .github/ISSUE_TEMPLATE/bug_report.md | 53 + .github/ISSUE_TEMPLATE/config.yml | 14 + .github/ISSUE_TEMPLATE/feature_request.md | 33 + .github/codecov.yml | 25 + .github/no-response.yml | 13 + .github/stale.yml | 26 + .github/workflows/checkstyle.yaml | 36 + .github/workflows/zfs-tests.yml | 58 + .github/workflows/zloop.yml | 67 + META | 4 +- Makefile.am | 10 +- cmd/Makefile.am | 1 + cmd/arc_summary/arc_summary2 | 108 +- cmd/arc_summary/arc_summary3 | 77 +- cmd/arcstat/arcstat.in | 76 +- cmd/dbufstat/dbufstat.in | 4 +- cmd/mount_zfs/mount_zfs.c | 91 +- cmd/raidz_test/raidz_bench.c | 25 +- cmd/raidz_test/raidz_test.c | 330 +- cmd/raidz_test/raidz_test.h | 9 +- cmd/zdb/zdb.c | 33 +- cmd/zed/agents/zfs_agents.c | 2 + cmd/zed/agents/zfs_mod.c | 10 +- cmd/zed/agents/zfs_retire.c | 11 +- cmd/zed/zed.d/all-syslog.sh | 44 +- cmd/zed/zed.d/history_event-zfs-list-cacher.sh.in | 2 +- cmd/zed/zed.d/zed.rc | 7 +- cmd/zfs/zfs_main.c | 166 +- cmd/zfs_ids_to_path/zfs_ids_to_path.c | 2 +- cmd/zgenhostid/zgenhostid.c | 10 +- cmd/zhack/zhack.c | 1 + cmd/zpool/zpool_iter.c | 16 +- cmd/zpool/zpool_main.c | 155 +- cmd/zpool/zpool_util.h | 4 +- cmd/zpool/zpool_vdev.c | 393 +- cmd/zpool_influxdb/.gitignore | 1 + cmd/zpool_influxdb/Makefile.am | 11 + cmd/zpool_influxdb/README.md | 294 ++ cmd/zpool_influxdb/dashboards/README.md | 3 + .../ZFS-pool-latency-heatmaps-influxdb.json | 1667 +++++++ cmd/zpool_influxdb/telegraf.d/README.md | 7 + .../telegraf.d/exec_zpool_influxdb.conf | 15 + .../telegraf.d/execd_zpool_influxdb.conf | 23 + cmd/zpool_influxdb/zpool_influxdb.c | 843 ++++ cmd/zstream/zstream_redup.c | 2 +- cmd/ztest/ztest.c | 293 +- config/Abigail.am | 29 + config/always-python.m4 | 2 +- config/always-pyzfs.m4 | 2 +- config/always-sed.m4 | 2 +- config/deb.am | 14 +- config/kernel-acl.m4 | 4 +- config/kernel-bio.m4 | 4 +- config/kernel-blk-queue.m4 | 4 +- config/kernel-blkdev.m4 | 137 +- config/kernel-config-defined.m4 | 2 +- config/kernel-fpu.m4 | 4 +- config/kernel-generic_io_acct.m4 | 47 +- config/kernel-get-disk-and-module.m4 | 24 - config/kernel-hotplug.m4 | 26 + config/kernel-make-request-fn.m4 | 73 +- config/kernel-objtool.m4 | 25 + config/kernel-percpu.m4 | 26 + config/kernel-revalidate-disk-size.m4 | 46 + config/kernel-rwsem.m4 | 28 - config/kernel-vfs-iov_iter.m4 | 206 + config/kernel.m4 | 50 +- config/mount-helper.m4 | 2 +- config/user-dracut.m4 | 2 +- config/user-libexec.m4 | 2 +- config/user-makedev.m4 | 14 +- config/user-systemd.m4 | 10 +- config/user-sysvinit.m4 | 2 +- config/user-udev.m4 | 4 +- config/zfs-build.m4 | 2 +- configure.ac | 9 +- contrib/dracut/90zfs/export-zfs.sh.in | 2 +- contrib/dracut/90zfs/module-setup.sh.in | 8 +- contrib/dracut/90zfs/mount-zfs.sh.in | 4 +- contrib/dracut/90zfs/parse-zfs.sh.in | 2 +- contrib/dracut/90zfs/zfs-generator.sh.in | 23 +- contrib/dracut/90zfs/zfs-lib.sh.in | 4 +- contrib/dracut/90zfs/zfs-load-key.sh.in | 14 +- contrib/dracut/90zfs/zfs-needshutdown.sh.in | 4 +- contrib/initramfs/hooks/zfsunlock.in | 2 +- contrib/pam_zfs_key/pam_zfs_key.c | 54 + etc/systemd/system/zfs-share.service.in | 1 + etc/systemd/system/zfs-volume-wait.service.in | 1 + etc/systemd/system/zfs-zed.service.in | 1 + include/libzfs.h | 7 +- include/os/freebsd/spl/sys/ccompile.h | 32 +- include/os/freebsd/spl/sys/misc.h | 8 +- include/os/freebsd/spl/sys/mod_os.h | 12 + include/os/freebsd/spl/sys/policy.h | 3 +- include/os/freebsd/spl/sys/sysmacros.h | 1 + include/os/freebsd/spl/sys/types.h | 2 +- include/os/freebsd/spl/sys/uio.h | 23 +- include/os/freebsd/zfs/sys/Makefile.am | 2 +- include/os/freebsd/zfs/sys/zfs_context_os.h | 1 - include/os/freebsd/zfs/sys/zfs_vnops.h | 5 +- include/os/freebsd/zfs/sys/zfs_znode_impl.h | 7 +- include/os/linux/kernel/linux/blkdev_compat.h | 117 +- include/os/linux/kernel/linux/mod_compat.h | 14 + include/os/linux/spl/sys/sysmacros.h | 1 + include/os/linux/spl/sys/taskq.h | 5 + include/os/linux/spl/sys/uio.h | 115 +- include/os/linux/spl/sys/vnode.h | 6 + include/os/linux/zfs/sys/Makefile.am | 2 +- include/os/linux/zfs/sys/policy.h | 4 +- include/os/linux/zfs/sys/trace_acl.h | 6 +- include/os/linux/zfs/sys/zfs_vnops.h | 13 +- include/os/linux/zfs/sys/zfs_znode_impl.h | 13 +- include/os/linux/zfs/sys/zpl.h | 9 - include/sys/Makefile.am | 2 + include/sys/arc.h | 6 + include/sys/arc_impl.h | 20 + include/sys/dbuf.h | 35 +- include/sys/dmu.h | 12 - include/sys/dmu_impl.h | 7 - include/sys/dmu_objset.h | 4 +- include/sys/dmu_zfetch.h | 16 +- include/sys/dsl_dataset.h | 1 + include/sys/dsl_scan.h | 1 + include/sys/frame.h | 4 + include/sys/fs/zfs.h | 17 +- include/sys/metaslab.h | 1 + include/sys/metaslab_impl.h | 52 +- include/sys/spa_impl.h | 7 +- include/sys/txg.h | 1 + include/sys/vdev.h | 16 +- include/sys/vdev_draid.h | 110 + include/sys/vdev_impl.h | 55 +- include/sys/vdev_raidz.h | 17 +- include/sys/vdev_raidz_impl.h | 61 +- include/sys/vdev_rebuild.h | 4 + include/sys/zfs_context.h | 1 + include/sys/zfs_vnops.h | 55 + include/sys/zfs_znode.h | 1 - include/sys/zio.h | 1 + include/sys/zstd/zstd.h | 6 +- include/sys/zvol_impl.h | 2 + include/zfeature_common.h | 1 + lib/Makefile.am | 19 +- lib/libnvpair/Makefile.am | 10 +- lib/libnvpair/libnvpair.abi | 2805 +++++++++++ lib/libnvpair/libnvpair.suppr | 2 + lib/libspl/include/sys/uio.h | 41 - lib/libuutil/Makefile.am | 10 +- lib/libuutil/libuutil.abi | 1608 +++++++ lib/libuutil/libuutil.suppr | 2 + lib/libzfs/Makefile.am | 14 +- lib/libzfs/libzfs.abi | 4879 ++++++++++++++++++++ lib/libzfs/libzfs.suppr | 13 + lib/libzfs/libzfs_dataset.c | 93 +- lib/libzfs/libzfs_import.c | 1 - lib/libzfs/libzfs_pool.c | 117 +- lib/libzfs/libzfs_util.c | 10 +- lib/libzfs/os/freebsd/libzfs_compat.c | 2 +- lib/libzfs_core/Makefile.am | 11 +- lib/libzfs_core/libzfs_core.abi | 2820 +++++++++++ lib/libzfs_core/libzfs_core.suppr | 5 + lib/libzfsbootenv/Makefile.am | 6 + lib/libzfsbootenv/libzfsbootenv.abi | 212 + lib/libzfsbootenv/libzfsbootenv.pc.in | 2 +- lib/libzfsbootenv/libzfsbootenv.suppr | 2 + lib/libzpool/Makefile.am | 10 +- lib/libzutil/os/freebsd/zutil_compat.c | 4 +- lib/libzutil/zutil_import.c | 7 +- man/man1/arcstat.1 | 112 +- man/man1/raidz_test.1 | 9 + man/man1/ztest.1 | 23 +- man/man5/zfs-module-parameters.5 | 136 +- man/man5/zpool-features.5 | 34 +- man/man8/Makefile.am | 3 +- man/man8/zfs-allow.8 | 36 +- man/man8/zfs-bookmark.8 | 4 +- man/man8/zfs-clone.8 | 6 +- man/man8/zfs-create.8 | 20 +- man/man8/zfs-destroy.8 | 14 +- man/man8/zfs-diff.8 | 8 +- man/man8/zfs-hold.8 | 14 +- man/man8/zfs-jail.8 | 10 +- man/man8/zfs-list.8 | 6 +- man/man8/zfs-load-key.8 | 18 +- man/man8/zfs-mount.8 | 14 +- man/man8/zfs-program.8 | 5 +- man/man8/zfs-project.8 | 18 +- man/man8/zfs-promote.8 | 6 +- man/man8/zfs-receive.8 | 18 +- man/man8/zfs-rename.8 | 18 +- man/man8/zfs-rollback.8 | 6 +- man/man8/zfs-send.8 | 26 +- man/man8/zfs-set.8 | 14 +- man/man8/zfs-share.8 | 10 +- man/man8/zfs-snapshot.8 | 6 +- man/man8/zfs-upgrade.8 | 14 +- man/man8/zfs-userspace.8 | 14 +- man/man8/zfs-wait.8 | 6 +- man/man8/zgenhostid.8 | 3 +- man/man8/zpool-add.8 | 6 +- man/man8/zpool-attach.8 | 6 +- man/man8/zpool-checkpoint.8 | 6 +- man/man8/zpool-clear.8 | 6 +- man/man8/zpool-create.8 | 8 +- man/man8/zpool-destroy.8 | 6 +- man/man8/zpool-detach.8 | 6 +- man/man8/zpool-events.8 | 6 +- man/man8/zpool-export.8 | 8 +- man/man8/zpool-get.8 | 10 +- man/man8/zpool-history.8 | 6 +- man/man8/zpool-import.8 | 14 +- man/man8/zpool-initialize.8 | 6 +- man/man8/zpool-iostat.8 | 6 +- man/man8/zpool-labelclear.8 | 6 +- man/man8/zpool-list.8 | 8 +- man/man8/zpool-offline.8 | 10 +- man/man8/zpool-reguid.8 | 6 +- man/man8/zpool-remove.8 | 10 +- man/man8/zpool-reopen.8 | 6 +- man/man8/zpool-replace.8 | 6 +- man/man8/zpool-resilver.8 | 6 +- man/man8/zpool-scrub.8 | 8 +- man/man8/zpool-split.8 | 6 +- man/man8/zpool-status.8 | 6 +- man/man8/zpool-sync.8 | 6 +- man/man8/zpool-trim.8 | 6 +- man/man8/zpool-upgrade.8 | 14 +- man/man8/zpool-wait.8 | 6 +- man/man8/zpool_influxdb.8 | 93 + man/man8/zpoolconcepts.8 | 78 +- man/man8/zpoolprops.8 | 15 +- module/Makefile.bsd | 39 +- module/icp/algs/modes/gcm.c | 54 +- module/icp/algs/modes/modes.c | 8 + module/icp/asm-x86_64/modes/aesni-gcm-x86_64.S | 24 +- module/icp/core/kcf_sched.c | 4 +- module/icp/include/modes/modes.h | 8 +- module/icp/io/aes.c | 18 + module/lua/lapi.c | 2 +- module/lua/ldo.c | 10 +- module/os/freebsd/spl/spl_kstat.c | 8 +- module/os/freebsd/spl/spl_policy.c | 5 +- module/os/freebsd/zfs/abd_os.c | 43 +- module/os/freebsd/zfs/arc_os.c | 10 + module/os/freebsd/zfs/sysctl_os.c | 12 +- module/os/freebsd/zfs/vdev_file.c | 70 +- module/os/freebsd/zfs/vdev_geom.c | 36 +- module/os/freebsd/zfs/zfs_file_os.c | 6 +- module/os/freebsd/zfs/zfs_onexit_os.c | 70 - module/os/freebsd/zfs/zfs_vfsops.c | 14 +- module/os/freebsd/zfs/zfs_vnops.c | 892 +--- module/os/freebsd/zfs/zfs_znode.c | 39 +- module/os/freebsd/zfs/zio_crypt.c | 15 +- module/os/freebsd/zfs/zvol_os.c | 251 +- module/os/linux/spl/spl-taskq.c | 132 +- module/os/linux/zfs/Makefile.in | 3 +- module/os/linux/zfs/abd_os.c | 2 +- module/os/linux/zfs/arc_os.c | 88 +- module/os/linux/zfs/policy.c | 5 +- module/os/linux/zfs/vdev_disk.c | 31 +- module/os/linux/zfs/vdev_file.c | 18 + module/os/linux/zfs/zfs_ctldir.c | 1 - module/os/linux/zfs/zfs_vfsops.c | 4 +- module/os/linux/zfs/zfs_vnops.c | 1091 +---- module/os/linux/zfs/zfs_znode.c | 5 +- module/os/linux/zfs/zio_crypt.c | 15 +- module/os/linux/zfs/zpl_ctldir.c | 25 +- module/os/linux/zfs/zpl_file.c | 354 +- module/os/linux/zfs/zpl_inode.c | 10 +- module/os/linux/zfs/zpl_super.c | 23 +- module/os/linux/zfs/zpl_xattr.c | 24 +- module/os/linux/zfs/zvol_os.c | 177 +- module/zcommon/Makefile.in | 1 - module/zcommon/zfeature_common.c | 6 +- module/zcommon/zfs_fletcher.c | 69 +- module/zcommon/zfs_namecheck.c | 4 +- module/zcommon/zfs_prop.c | 6 +- module/zcommon/zfs_uio.c | 173 +- module/zfs/Makefile.in | 3 + module/zfs/abd.c | 14 +- module/zfs/aggsum.c | 9 +- module/zfs/arc.c | 307 +- module/zfs/dbuf.c | 371 +- module/zfs/dmu.c | 226 +- module/zfs/dmu_object.c | 4 +- module/zfs/dmu_objset.c | 206 +- module/zfs/dmu_recv.c | 294 +- module/zfs/dmu_redact.c | 2 +- module/zfs/dmu_send.c | 6 +- module/zfs/dmu_tx.c | 3 - module/zfs/dmu_zfetch.c | 122 +- module/zfs/dnode.c | 13 +- module/zfs/dnode_sync.c | 6 +- module/zfs/dsl_bookmark.c | 114 +- module/zfs/dsl_crypt.c | 11 +- module/zfs/dsl_dataset.c | 6 +- module/zfs/dsl_pool.c | 49 +- module/zfs/dsl_scan.c | 13 +- module/zfs/metaslab.c | 238 +- module/zfs/mmp.c | 11 +- module/zfs/multilist.c | 9 +- module/zfs/spa.c | 158 +- module/zfs/spa_history.c | 2 +- module/zfs/spa_misc.c | 20 +- module/zfs/txg.c | 9 +- module/zfs/vdev.c | 387 +- module/zfs/vdev_draid.c | 2984 ++++++++++++ module/zfs/vdev_draid_rand.c | 40 + module/zfs/vdev_indirect.c | 39 +- module/zfs/vdev_initialize.c | 141 +- module/zfs/vdev_label.c | 62 +- module/zfs/vdev_mirror.c | 137 +- module/zfs/vdev_missing.c | 18 + module/zfs/vdev_queue.c | 134 +- module/zfs/vdev_raidz.c | 1864 +++++--- module/zfs/vdev_raidz_math.c | 14 +- module/zfs/vdev_raidz_math_impl.h | 313 +- module/zfs/vdev_rebuild.c | 231 +- module/zfs/vdev_removal.c | 100 +- module/zfs/vdev_root.c | 9 + module/zfs/vdev_trim.c | 153 +- module/zfs/zcp.c | 7 +- module/zfs/zfs_fm.c | 4 +- module/zfs/zfs_ioctl.c | 77 +- module/zfs/zfs_vnops.c | 895 ++++ module/zfs/zio.c | 76 +- module/zfs/zio_inject.c | 6 + module/zfs/zvol.c | 22 +- module/zstd/zfs_zstd.c | 63 +- rpm/generic/zfs-kmod.spec.in | 4 - rpm/generic/zfs.spec.in | 77 +- scripts/Makefile.am | 3 + scripts/commitcheck.sh | 113 +- scripts/common.sh.in | 1 + scripts/dkms.mkconf | 1 + scripts/zfs-tests.sh | 12 +- scripts/zfs.sh | 3 + scripts/zloop.sh | 54 +- tests/runfiles/Makefile.am | 1 + tests/runfiles/common.run | 54 +- tests/runfiles/linux.run | 3 +- tests/runfiles/sanity.run | 618 +++ tests/test-runner/bin/zts-report.py.in | 3 +- tests/zfs-tests/cmd/Makefile.am | 1 + tests/zfs-tests/cmd/btree_test/btree_test.c | 2 +- tests/zfs-tests/cmd/draid/.gitignore | 1 + tests/zfs-tests/cmd/draid/Makefile.am | 15 + tests/zfs-tests/cmd/draid/draid.c | 1414 ++++++ .../cmd/libzfs_input_check/libzfs_input_check.c | 2 +- tests/zfs-tests/include/blkdev.shlib | 89 +- tests/zfs-tests/include/commands.cfg | 5 +- tests/zfs-tests/include/libtest.shlib | 41 +- tests/zfs-tests/include/tunables.cfg | 3 + tests/zfs-tests/tests/functional/Makefile.am | 3 +- .../functional/alloc_class/alloc_class_012_pos.ksh | 5 +- .../tests/functional/checksum/Makefile.am | 3 +- .../tests/functional/checksum/filetest_001_pos.ksh | 5 +- .../tests/functional/checksum/filetest_002_pos.ksh | 91 + .../cli_root/zdb/zdb_block_size_histogram.ksh | 8 +- .../cli_root/zfs_copies/zfs_copies_002_pos.ksh | 2 +- .../functional/cli_root/zfs_create/Makefile.am | 1 + .../cli_root/zfs_create/zfs_create_001_pos.ksh | 6 + .../cli_root/zfs_create/zfs_create_nomount.ksh | 51 + .../functional/cli_root/zfs_mount/Makefile.am | 2 + .../functional/cli_root/zfs_mount/zfs_mount.kshlib | 3 +- .../cli_root/zfs_mount/zfs_mount_013_pos.ksh | 78 + .../cli_root/zfs_mount/zfs_mount_014_neg.ksh | 68 + .../zfs_mount/zfs_mount_all_mountpoints.ksh | 2 + .../zfs_share/zfs_share_concurrent_shares.ksh | 12 +- .../cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh | 17 + .../functional/cli_root/zpool_add/Makefile.am | 3 +- .../cli_root/zpool_add/zpool_add_001_pos.ksh | 20 +- .../cli_root/zpool_add/zpool_add_003_pos.ksh | 4 +- .../cli_root/zpool_add/zpool_add_dryrun_output.ksh | 175 + .../functional/cli_root/zpool_create/Makefile.am | 8 +- .../cli_root/zpool_create/zpool_create_001_pos.ksh | 4 +- .../cli_root/zpool_create/zpool_create_005_pos.ksh | 8 +- .../cli_root/zpool_create/zpool_create_006_pos.ksh | 22 + .../cli_root/zpool_create/zpool_create_007_neg.ksh | 9 +- .../cli_root/zpool_create/zpool_create_009_neg.ksh | 2 +- .../cli_root/zpool_create/zpool_create_010_neg.ksh | 7 +- .../cli_root/zpool_create/zpool_create_011_neg.ksh | 14 +- .../zpool_create/zpool_create_draid_001_pos.ksh | 75 + .../zpool_create/zpool_create_draid_002_pos.ksh | 82 + .../zpool_create/zpool_create_draid_003_pos.ksh | 112 + .../zpool_create/zpool_create_draid_004_pos.ksh | 43 + .../zpool_create/zpool_create_dryrun_output.ksh | 138 + .../cli_root/zpool_expand/zpool_expand_001_pos.ksh | 12 +- .../cli_root/zpool_expand/zpool_expand_002_pos.ksh | 27 +- .../cli_root/zpool_expand/zpool_expand_003_neg.ksh | 2 +- .../cli_root/zpool_expand/zpool_expand_004_pos.ksh | 2 +- .../functional/cli_root/zpool_get/zpool_get.cfg | 1 + .../functional/cli_root/zpool_import/Makefile.am | 2 + .../zpool_import/import_cachefile_device_added.ksh | 2 + .../import_cachefile_device_replaced.ksh | 6 + .../import_cachefile_shared_device.ksh | 1 + .../cli_root/zpool_import/import_paths_changed.ksh | 2 + .../zpool_import/import_rewind_config_changed.ksh | 1 + .../zpool_import/import_rewind_device_replaced.ksh | 5 + .../functional/cli_root/zpool_import/setup.ksh | 2 +- .../cli_root/zpool_import/zpool_import.cfg | 3 +- .../cli_root/zpool_import/zpool_import.kshlib | 16 +- .../cli_root/zpool_import/zpool_import_007_pos.ksh | 2 +- .../cli_root/zpool_import/zpool_import_008_pos.ksh | 2 +- .../cli_root/zpool_import/zpool_import_010_pos.ksh | 4 +- .../cli_root/zpool_import/zpool_import_016_pos.ksh | 91 + .../cli_root/zpool_import/zpool_import_017_pos.ksh | 92 + .../zpool_import/zpool_import_missing_001_pos.ksh | 21 +- .../zpool_import/zpool_import_missing_002_pos.ksh | 23 +- .../zpool_import/zpool_import_missing_003_pos.ksh | 5 +- .../zpool_initialize_verify_initialized.ksh | 49 +- .../functional/cli_root/zpool_split/Makefile.am | 3 +- .../zpool_split/zpool_split_dryrun_output.ksh | 152 + .../cli_root/zpool_trim/zpool_trim.kshlib | 17 + .../zpool_trim/zpool_trim_online_offline.ksh | 8 +- .../zpool_trim/zpool_trim_start_and_cancel_neg.ksh | 6 +- .../zpool_wait/scan/zpool_wait_replace_cancel.ksh | 1 + .../tests/functional/events/events_001_pos.ksh | 26 +- .../tests/functional/events/events_002_pos.ksh | 2 +- .../tests/functional/events/events_common.kshlib | 69 +- .../functional/fault/auto_offline_001_pos.ksh | 10 +- .../tests/functional/fault/auto_spare_001_pos.ksh | 47 +- .../tests/functional/fault/auto_spare_002_pos.ksh | 7 +- .../tests/functional/fault/auto_spare_ashift.ksh | 4 +- .../tests/functional/fault/auto_spare_multiple.ksh | 102 +- .../tests/functional/fault/auto_spare_shared.ksh | 4 +- .../tests/functional/l2arc/l2arc_arcstats_pos.ksh | 107 + .../tests/functional/l2arc/l2arc_l2miss_pos.ksh | 94 + .../tests/functional/l2arc/l2arc_mfuonly_pos.ksh | 94 + .../tests/functional/persist_l2arc/Makefile.am | 7 +- .../tests/functional/persist_l2arc/cleanup.ksh | 6 +- .../functional/persist_l2arc/persist_l2arc.cfg | 5 +- .../persist_l2arc/persist_l2arc_001_pos.ksh | 21 +- .../persist_l2arc/persist_l2arc_002_pos.ksh | 19 +- .../persist_l2arc/persist_l2arc_003_neg.ksh | 6 +- .../persist_l2arc/persist_l2arc_004_pos.ksh | 19 +- .../persist_l2arc/persist_l2arc_005_pos.ksh | 19 +- .../persist_l2arc/persist_l2arc_006_pos.ksh | 21 +- .../persist_l2arc/persist_l2arc_007_pos.ksh | 26 +- .../persist_l2arc/persist_l2arc_008_pos.ksh | 48 +- .../tests/functional/persist_l2arc/setup.ksh | 3 +- tests/zfs-tests/tests/functional/raidz/Makefile.am | 4 +- .../tests/functional/raidz/raidz_003_pos.ksh | 41 + .../tests/functional/raidz/raidz_004_pos.ksh | 41 + .../tests/functional/redundancy/Makefile.am | 15 +- .../tests/functional/redundancy/redundancy.kshlib | 49 +- .../functional/redundancy/redundancy_001_pos.ksh | 4 +- .../functional/redundancy/redundancy_002_pos.ksh | 4 +- .../functional/redundancy/redundancy_draid1.ksh | 78 + .../functional/redundancy/redundancy_draid2.ksh | 85 + .../functional/redundancy/redundancy_draid3.ksh | 85 + .../redundancy/redundancy_draid_spare1.ksh | 107 + .../redundancy/redundancy_draid_spare2.ksh | 80 + .../redundancy/redundancy_draid_spare3.ksh | 197 + .../functional/redundancy/redundancy_raidz3.ksh | 84 + .../zfs-tests/tests/functional/removal/Makefile.am | 3 +- .../functional/removal/remove_attach_mirror.ksh | 73 + .../functional/replacement/attach_rebuild.ksh | 4 +- .../functional/replacement/attach_resilver.ksh | 4 +- .../tests/functional/replacement/detach.ksh | 4 +- .../tests/functional/replacement/rebuild_raidz.ksh | 7 +- .../functional/replacement/replace_rebuild.ksh | 4 +- .../functional/replacement/replace_resilver.ksh | 4 +- .../tests/functional/trim/autotrim_config.ksh | 10 +- .../tests/functional/trim/autotrim_integrity.ksh | 2 +- .../functional/trim/autotrim_trim_integrity.ksh | 2 +- .../tests/functional/trim/trim_config.ksh | 10 +- .../tests/functional/trim/trim_integrity.ksh | 2 +- .../tests/functional/userquota/Makefile.am | 3 +- .../functional/userquota/userspace_encrypted.ksh | 85 + .../userquota/userspace_send_encrypted.ksh | 108 + .../tests/functional/xattr/xattr_004_pos.ksh | 34 +- .../tests/functional/zpool_influxdb/Makefile.am | 5 + .../tests/functional/zpool_influxdb/cleanup.ksh | 29 + .../tests/functional/zpool_influxdb/setup.ksh | 29 + .../functional/zpool_influxdb/zpool_influxdb.ksh | 71 + 477 files changed, 34166 insertions(+), 6758 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 9bc2e7ef0684..f28a747e82c4 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -126,8 +126,8 @@ feature needed? What problem does it solve? #### General -* All pull requests must be based on the current master branch and apply -without conflicts. +* All pull requests, except backports and releases, must be based on the current master branch +and should apply without conflicts. * Please attempt to limit pull requests to a single commit which resolves one specific issue. * Make sure your commit messages are in the correct format. See the @@ -230,70 +230,6 @@ attempting to solve. Signed-off-by: Contributor ``` -#### OpenZFS Patch Ports -If you are porting OpenZFS patches, the commit message must meet -the following guidelines: -* The first line must be the summary line from the most important OpenZFS commit being ported. -It must begin with `OpenZFS dddd, dddd - ` where `dddd` are OpenZFS issue numbers. -* Provides a `Authored by:` line to attribute each patch for each original author. -* Provides the `Reviewed by:` and `Approved by:` lines from each original -OpenZFS commit. -* Provides a `Ported-by:` line with the developer's name followed by -their email for each OpenZFS commit. -* Provides a `OpenZFS-issue:` line with link for each original illumos -issue. -* Provides a `OpenZFS-commit:` line with link for each original OpenZFS commit. -* If necessary, provide some porting notes to describe any deviations from -the original OpenZFS commits. - -An example OpenZFS patch port commit message for a single patch is provided -below. -``` -OpenZFS 1234 - Summary from the original OpenZFS commit - -Authored by: Original Author -Reviewed by: Reviewer One -Reviewed by: Reviewer Two -Approved by: Approver One -Ported-by: ZFS Contributor - -Provide some porting notes here if necessary. - -OpenZFS-issue: https://www.illumos.org/issues/1234 -OpenZFS-commit: https://github.com/openzfs/openzfs/commit/abcd1234 -``` - -If necessary, multiple OpenZFS patches can be combined in a single port. -This is useful when you are porting a new patch and its subsequent bug -fixes. An example commit message is provided below. -``` -OpenZFS 1234, 5678 - Summary of most important OpenZFS commit - -1234 Summary from original OpenZFS commit for 1234 - -Authored by: Original Author -Reviewed by: Reviewer Two -Approved by: Approver One -Ported-by: ZFS Contributor - -Provide some porting notes here for 1234 if necessary. - -OpenZFS-issue: https://www.illumos.org/issues/1234 -OpenZFS-commit: https://github.com/openzfs/openzfs/commit/abcd1234 - -5678 Summary from original OpenZFS commit for 5678 - -Authored by: Original Author2 -Reviewed by: Reviewer One -Approved by: Approver Two -Ported-by: ZFS Contributor - -Provide some porting notes here for 5678 if necessary. - -OpenZFS-issue: https://www.illumos.org/issues/5678 -OpenZFS-commit: https://github.com/openzfs/openzfs/commit/efgh5678 -``` - #### Coverity Defect Fixes If you are submitting a fix to a [Coverity defect](https://scan.coverity.com/projects/zfsonlinux-zfs), diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000000..1dbb5f6edb55 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,53 @@ +--- +name: Bug report +about: Create a report to help us improve OpenZFS +title: '' +labels: 'Type: Defect, Status: Triage Needed' +assignees: '' + +--- + + + + + +### System information + +Type | Version/Name + --- | --- +Distribution Name | +Distribution Version | +Linux Kernel | +Architecture | +ZFS Version | +SPL Version | + + +### Describe the problem you're observing + +### Describe how to reproduce the problem + +### Include any warning/errors/backtraces from the system logs + + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000000..dd8f0557a30c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,14 @@ +blank_issues_enabled: false +contact_links: + - name: OpenZFS Questions + url: https://github.com/openzfs/zfs/discussions/new + about: Ask the community for help + - name: OpenZFS Community Support Mailing list (Linux) + url: https://zfsonlinux.topicbox.com/groups/zfs-discuss + about: Get community support for OpenZFS on Linux + - name: FreeBSD Community Support Mailing list + url: https://lists.freebsd.org/mailman/listinfo/freebsd-fs + about: Get community support for OpenZFS on FreeBSD + - name: OpenZFS on IRC + url: https://webchat.freenode.net/#openzfs + about: Use IRC to get community support for OpenZFS diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000000..9b50a4a3d96e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,33 @@ +--- +name: Feature request +about: Suggest a feature for OpenZFS +title: '' +labels: 'Type: Feature' +assignees: '' + +--- + + + +### Describe the feature would like to see added to OpenZFS + + + +### How will this feature improve OpenZFS? + + + +### Additional context + + diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 000000000000..6d4932680e5c --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,25 @@ +codecov: + notify: + require_ci_to_pass: false # always post + after_n_builds: 2 # user and kernel + +coverage: + precision: 0 # 0 decimals of precision + round: nearest # Round to nearest precision point + range: "50...90" # red -> yellow -> green + + status: + project: + default: + threshold: 1% # allow 1% coverage variance + + patch: + default: + threshold: 1% # allow 1% coverage variance + +comment: + layout: "reach, diff, flags, footer" + behavior: once # update if exists; post new; skip if deleted + require_changes: yes # only post when coverage changes + +# ignore: Please place any ignores in config/ax_code_coverage.m4 instead diff --git a/.github/no-response.yml b/.github/no-response.yml new file mode 100644 index 000000000000..ef2656ec96ef --- /dev/null +++ b/.github/no-response.yml @@ -0,0 +1,13 @@ +# Configuration for probot-no-response - https://github.com/probot/no-response + +# Number of days of inactivity before an Issue is closed for lack of response +daysUntilClose: 31 +# Label requiring a response +responseRequiredLabel: "Status: Feedback requested" +# Comment to post when closing an Issue for lack of response. Set to `false` to disable +closeComment: > + This issue has been automatically closed because there has been no response + to our request for more information from the original author. With only the + information that is currently in the issue, we don't have enough information + to take action. Please reach out if you have or find the answers we need so + that we can investigate further. diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000000..895cc8e803b2 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,26 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 365 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 90 +# Limit to only `issues` or `pulls` +only: issues +# Issues with these labels will never be considered stale +exemptLabels: + - "Type: Feature" + - "Bot: Not Stale" + - "Status: Work in Progress" +# Set to true to ignore issues in a project (defaults to false) +exemptProjects: true +# Set to true to ignore issues in a milestone (defaults to false) +exemptMilestones: true +# Set to true to ignore issues with an assignee (defaults to false) +exemptAssignees: true +# Label to use when marking an issue as stale +staleLabel: "Status: Stale" +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as "stale" because it has not had + any activity for a while. It will be closed in 90 days if no further activity occurs. + Thank you for your contributions. +# Limit the number of actions per hour, from 1-30. Default is 30 +limitPerRun: 6 diff --git a/.github/workflows/checkstyle.yaml b/.github/workflows/checkstyle.yaml new file mode 100644 index 000000000000..1707f5bb21db --- /dev/null +++ b/.github/workflows/checkstyle.yaml @@ -0,0 +1,36 @@ +name: checkstyle + +on: + push: + pull_request: + +jobs: + checkstyle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install --yes -qq build-essential autoconf libtool gawk alien fakeroot linux-headers-$(uname -r) + sudo apt-get install --yes -qq zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev python-dev python-setuptools python-cffi python3 python3-dev python3-setuptools python3-cffi + # packages for tests + sudo apt-get install --yes -qq parted lsscsi ksh attr acl nfs-kernel-server fio + sudo apt-get install --yes -qq mandoc cppcheck pax-utils devscripts abigail-tools + sudo -E pip --quiet install flake8 + - name: Prepare + run: | + sh ./autogen.sh + ./configure + make -j$(nproc) + - name: Checkstyle + run: | + make checkstyle + - name: Lint + run: | + make lint + - name: CheckABI + run: | + make checkabi diff --git a/.github/workflows/zfs-tests.yml b/.github/workflows/zfs-tests.yml new file mode 100644 index 000000000000..b075a78c7729 --- /dev/null +++ b/.github/workflows/zfs-tests.yml @@ -0,0 +1,58 @@ +name: zfs-tests-sanity + +on: + push: + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install --yes -qq build-essential autoconf libtool gdb lcov \ + git alien fakeroot wget curl bc fio acl \ + sysstat mdadm lsscsi parted gdebi attr dbench watchdog ksh \ + nfs-kernel-server samba rng-tools xz-utils \ + zlib1g-dev uuid-dev libblkid-dev libselinux-dev \ + xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ + libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ + libpam0g-dev pamtester python-dev python-setuptools python-cffi \ + python3 python3-dev python3-setuptools python3-cffi + - name: Autogen.sh + run: | + sh autogen.sh + - name: Configure + run: | + ./configure --enable-debug --enable-debuginfo + - name: Make + run: | + make --no-print-directory -s pkg-utils pkg-kmod + - name: Install + run: | + sudo dpkg -i *.deb + # Update order of directories to search for modules, otherwise + # Ubuntu will load kernel-shipped ones. + sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf + sudo depmod + sudo modprobe zfs + - name: Tests + run: | + /usr/share/zfs/zfs-tests.sh -v -s 3G -r sanity + - name: Prepare artifacts + if: failure() + run: | + RESULTS_PATH=$(readlink -f /var/tmp/test_results/current) + sudo dmesg > $RESULTS_PATH/dmesg + sudo cp /var/log/syslog $RESULTS_PATH/ + sudo chmod +r $RESULTS_PATH/* + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: Test logs + path: /var/tmp/test_results/20*/ + if-no-files-found: ignore diff --git a/.github/workflows/zloop.yml b/.github/workflows/zloop.yml new file mode 100644 index 000000000000..30785b14507a --- /dev/null +++ b/.github/workflows/zloop.yml @@ -0,0 +1,67 @@ +name: zloop + +on: + push: + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + env: + TEST_DIR: /var/tmp/zloop + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install --yes -qq build-essential autoconf libtool gdb \ + git alien fakeroot \ + zlib1g-dev uuid-dev libblkid-dev libselinux-dev \ + xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ + libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ + libpam0g-dev \ + python-dev python-setuptools python-cffi \ + python3 python3-dev python3-setuptools python3-cffi + - name: Autogen.sh + run: | + sh autogen.sh + - name: Configure + run: | + ./configure --enable-debug --enable-debuginfo + - name: Make + run: | + make --no-print-directory -s pkg-utils pkg-kmod + - name: Install + run: | + sudo dpkg -i *.deb + # Update order of directories to search for modules, otherwise + # Ubuntu will load kernel-shipped ones. + sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf + sudo depmod + sudo modprobe zfs + - name: Tests + run: | + sudo mkdir -p $TEST_DIR + # run for 20 minutes to have a total runner time of 30 minutes + sudo /usr/share/zfs/zloop.sh -t 1200 -l -m1 + - name: Prepare artifacts + if: failure() + run: | + sudo chmod +r -R $TEST_DIR/ + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: Logs + path: | + /var/tmp/zloop/*/ + !/var/tmp/zloop/*/vdev/ + if-no-files-found: ignore + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: Pool files + path: | + /var/tmp/zloop/*/vdev/ + if-no-files-found: ignore diff --git a/META b/META index 87ffae5f4c09..886da443357d 100644 --- a/META +++ b/META @@ -2,9 +2,9 @@ Meta: 1 Name: zfs Branch: 1.0 Version: 2.0.0 -Release: rc3 +Release: rc1 Release-Tags: relext License: CDDL Author: OpenZFS -Linux-Maximum: 5.9 +Linux-Maximum: 5.10 Linux-Minimum: 3.10 diff --git a/Makefile.am b/Makefile.am index b409d2196f86..436b78d76282 100644 --- a/Makefile.am +++ b/Makefile.am @@ -136,6 +136,13 @@ shellcheck: echo "skipping shellcheck because shellcheck is not installed"; \ fi +PHONY += checkabi storeabi +checkabi: lib + $(MAKE) -C lib checkabi + +storeabi: lib + $(MAKE) -C lib storeabi + *** 56703 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:22:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4E26D4DEFE4 for ; Thu, 7 Jan 2021 23:22:13 +0000 (UTC) (envelope-from git@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 4DBj1b2mfTz4TbV; Thu, 7 Jan 2021 23:22:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D99E19544; Thu, 7 Jan 2021 23:22:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NM7FY063915; Thu, 7 Jan 2021 23:22:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NM7bp063914; Thu, 7 Jan 2021 23:22:07 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:22:07 GMT Message-Id: <202101072322.107NM7bp063914@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Matt Macy Subject: git: a82985c9a676 - Create tag vendor/openzfs/20210107 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmacy X-Git-Repository: src X-Git-Refname: refs/tags/vendor/openzfs/20210107 X-Git-Reftype: annotated tag X-Git-Commit: a82985c9a676ab7cbee16df211e356a4535f7792 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:22:14 -0000 The annotated tag vendor/openzfs/20210107 has been created by mmacy: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/openzfs/20210107 tag vendor/openzfs/20210107 Tagger: Matt Macy TaggerDate: 2021-01-07 23:21:19 +0000 Update to master-f11b09 commit 42385c279bad198701badabdab661df49f2acb9a Author: Matt Macy AuthorDate: 2021-01-07 23:19:59 +0000 Commit: Matt Macy CommitDate: 2021-01-07 23:19:59 +0000 Update OpenZFS to master-f11b09 From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:24:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DC9F74DF1EC; Thu, 7 Jan 2021 23:24:45 +0000 (UTC) (envelope-from git@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 4DBj4X2mZdz4WGX; Thu, 7 Jan 2021 23:24:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E7F391990B; Thu, 7 Jan 2021 23:24:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NOfdp067566; Thu, 7 Jan 2021 23:24:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NOfRn067565; Thu, 7 Jan 2021 23:24:41 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:24:41 GMT Message-Id: <202101072324.107NOfRn067565@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 20fb2ea2c7c9 - main - loader: really use bold font for vga text mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20fb2ea2c7c9834d6ca5ab2664961afaba6a8596 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:24:46 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=20fb2ea2c7c9834d6ca5ab2664961afaba6a8596 commit 20fb2ea2c7c9834d6ca5ab2664961afaba6a8596 Author: Toomas Soome AuthorDate: 2021-01-07 18:11:31 +0000 Commit: Toomas Soome CommitDate: 2021-01-07 23:24:30 +0000 loader: really use bold font for vga text mode 8x16v turns out to be too thin and hard to read, use bold font instead. --- stand/common/gfx_fb.c | 2 +- stand/fonts/Makefile | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index f73899c50525..76fd8855a5be 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -49,7 +49,7 @@ /* VGA text mode does use bold font. */ #if !defined(VGA_8X16_FONT) -#define VGA_8X16_FONT "/boot/fonts/8x16v.fnt" +#define VGA_8X16_FONT "/boot/fonts/8x16b.fnt" #endif #if !defined(DEFAULT_8X16_FONT) #define DEFAULT_8X16_FONT "/boot/fonts/8x16.fnt" diff --git a/stand/fonts/Makefile b/stand/fonts/Makefile index b7b2ea7a0f0d..cf45c7ce5e30 100644 --- a/stand/fonts/Makefile +++ b/stand/fonts/Makefile @@ -9,6 +9,7 @@ FONTS= \ 8x14.fnt.gz \ 8x14v.fnt.gz \ 8x16.fnt.gz \ + 8x16b.fnt.gz \ 8x16v.fnt.gz \ 10x18.fnt.gz \ 10x20.fnt.gz \ @@ -30,6 +31,8 @@ CLEANFILES+= ${FONTS} ${FONTS:T:S/${COMPRESS_EXT}//g} ${COMPRESS_CMD} ${.ALLSRC} > ${.TARGET} 8x16.fnt.gz: 8x16.fnt ${COMPRESS_CMD} ${.ALLSRC} > ${.TARGET} +8x16b.fnt.gz: 8x16b.fnt + ${COMPRESS_CMD} ${.ALLSRC} > ${.TARGET} 8x16v.fnt.gz: 8x16v.fnt ${COMPRESS_CMD} ${.ALLSRC} > ${.TARGET} 10x18.fnt.gz: 10x18.fnt @@ -57,6 +60,9 @@ CLEANFILES+= ${FONTS} ${FONTS:T:S/${COMPRESS_EXT}//g} 8x16.fnt: ter-u16n.bdf ter-u16b.bdf vtfontcvt -o ${.TARGET} ${.ALLSRC} +8x16b.fnt: ter-u16b.bdf + vtfontcvt -o ${.TARGET} ${.ALLSRC} + 8x16v.fnt: ter-u16v.bdf vtfontcvt -o ${.TARGET} ${.ALLSRC} From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:27:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4BB954DFCCC for ; Thu, 7 Jan 2021 23:27:30 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 4DBj7j72yLz4YCv for ; Thu, 7 Jan 2021 23:27:29 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f47.google.com with SMTP id e25so6948271wme.0 for ; Thu, 07 Jan 2021 15:27:29 -0800 (PST) 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=xhOHbDDd4jYJ7+Oj4M01Ujvhp5kaqTCK0FTDxjgwQ+4=; b=PzeTBkEcwT7jmnlSoBW04DYzYxBWTH3Osanx5msimytj8UwH8X/+D0fsNRvIRknKCI FlR5vNT99hVPrLjiBE0cSRjTUCVQDq2G08/tb6rq0r7mTietDo46I4doKRHkbHmvRsvp 1ReE4iVLjgXAk3zSkCYs8sF8A9fpirJSKgS1HVQTQxGa8mlFnpIxmmhVfP62IlzQlQ/4 UuVwt34BsfQLNnHGtLG3v+hJnwrsBNyvMV9cbL/kfINP3b31mo4kgXLP2wRAvl38TnUx IbN9i8/JFedsBzswVZhd+0B/a5RDsz0v7TETj9qQKhA8TWiBRpvSfIXR3p2Qj9YVRDeT MLdA== X-Gm-Message-State: AOAM532HGPukvRSUSqqNLFdsgoN/pherI+i/bt0ZWZkfW19nadW12Pab DfhzA/8JDVGYECkgqpxLBtocyb0la4zQZ45/ X-Google-Smtp-Source: ABdhPJy3EXmWAkToTdyQPcmVQsQy3anwPAOA+uV9G2GNwhJ5ZewSnFr480i9uskP8EfSgu5IwuISfQ== X-Received: by 2002:a1c:4604:: with SMTP id t4mr620928wma.17.1610062048361; Thu, 07 Jan 2021 15:27:28 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id l1sm10733767wrq.64.2021.01.07.15.27.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jan 2021 15:27:27 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. From: Jessica Clarke In-Reply-To: <202101072320.107NKpMS063374@gitrepo.freebsd.org> Date: Thu, 7 Jan 2021 23:27:25 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: 7bit Message-Id: References: <202101072320.107NKpMS063374@gitrepo.freebsd.org> To: Vladimir Kondratyev X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DBj7j72yLz4YCv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:27:30 -0000 On 7 Jan 2021, at 23:20, Vladimir Kondratyev wrote: > +#include > +#include > +#include "xlocale_private.h" > + > +/* > + * Find the first occurrence of find in s, ignore case. > + */ > +char * > +strcasestr_l(const char *s, const char *find, locale_t locale) Locales in the kernel? This feels wrong. Jess From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:30:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3BF3D4E0104; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@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 4DBjC21DxRz4YLB; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D4F919369; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NUMsq075825; Thu, 7 Jan 2021 23:30:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NUMMc075824; Thu, 7 Jan 2021 23:30:22 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:30:22 GMT Message-Id: <202101072330.107NUMMc075824@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 71bd18d37359 - main - fd: use seqc_read_notmodify when translating fds MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71bd18d37359bbd7d5923898d40fd9993d5c15f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:30:22 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=71bd18d37359bbd7d5923898d40fd9993d5c15f7 commit 71bd18d37359bbd7d5923898d40fd9993d5c15f7 Author: Mateusz Guzik AuthorDate: 2021-01-07 06:34:14 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-07 23:30:04 +0000 fd: use seqc_read_notmodify when translating fds --- sys/kern/kern_descrip.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index e1ffdc3baf01..ad1916e87b68 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2921,9 +2921,7 @@ fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsear fdt = fdp->fd_files; if (__predict_false((u_int)fd >= fdt->fdt_nfiles)) return (EBADF); - seq = seqc_read_any(fd_seqc(fdt, fd)); - if (__predict_false(seqc_in_modify(seq))) - return (EAGAIN); + seq = seqc_read_notmodify(fd_seqc(fdt, fd)); fde = &fdt->fdt_ofiles[fd]; haverights = cap_rights_fde_inline(fde); fp = fde->fde_file; @@ -3032,7 +3030,7 @@ fget_unlocked_seq(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, */ for (;;) { #ifdef CAPABILITIES - seq = seqc_read(fd_seqc(fdt, fd)); + seq = seqc_read_notmodify(fd_seqc(fdt, fd)); fde = &fdt->fdt_ofiles[fd]; haverights = *cap_rights_fde_inline(fde); fp = fde->fde_file; @@ -3105,9 +3103,7 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, if (__predict_false((u_int)fd >= fdt->fdt_nfiles)) return (EBADF); #ifdef CAPABILITIES - seq = seqc_read_any(fd_seqc(fdt, fd)); - if (__predict_false(seqc_in_modify(seq))) - goto out_fallback; + seq = seqc_read_notmodify(fd_seqc(fdt, fd)); fde = &fdt->fdt_ofiles[fd]; haverights = cap_rights_fde_inline(fde); fp = fde->fde_file; From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:30:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9057B4E0045; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@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 4DBjC225zKz4YVg; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3535819894; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NUMRY075859; Thu, 7 Jan 2021 23:30:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NUMZE075858; Thu, 7 Jan 2021 23:30:22 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:30:22 GMT Message-Id: <202101072330.107NUMZE075858@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: fee405e057a2 - main - cache: stop checkpointing cn_flags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fee405e057a2d333e64916e8273923444ef3de60 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:30:22 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=fee405e057a2d333e64916e8273923444ef3de60 commit fee405e057a2d333e64916e8273923444ef3de60 Author: Mateusz Guzik AuthorDate: 2021-01-07 05:35:56 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-07 23:29:52 +0000 cache: stop checkpointing cn_flags They are only modified, if ever, for the last component. --- sys/kern/vfs_cache.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 7d774466be53..811aeb91d9c9 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3614,12 +3614,15 @@ SYSCTL_PROC(_vfs, OID_AUTO, cache_fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MP * Components of nameidata (or objects it can point to) which may * need restoring in case fast path lookup fails. */ +struct nameidata_outer { + int cn_flags; +}; + struct nameidata_saved { #ifdef INVARIANTS char *cn_nameptr; size_t ni_pathlen; #endif - int cn_flags; }; #ifdef INVARIANTS @@ -3638,7 +3641,7 @@ struct cache_fpl { seqc_t dvp_seqc; seqc_t tvp_seqc; struct nameidata_saved snd; - struct nameidata_saved snd_orig; + struct nameidata_outer snd_outer; int line; enum cache_fpl_status status:8; bool in_smr; @@ -3692,31 +3695,37 @@ cache_fpl_handle_root(struct cache_fpl *fpl) } static void -cache_fpl_checkpoint(struct cache_fpl *fpl, struct nameidata_saved *snd) +cache_fpl_checkpoint_outer(struct cache_fpl *fpl) +{ + + fpl->snd_outer.cn_flags = fpl->ndp->ni_cnd.cn_flags; +} + +static void +cache_fpl_checkpoint(struct cache_fpl *fpl) { - snd->cn_flags = fpl->ndp->ni_cnd.cn_flags; #ifdef INVARIANTS - snd->cn_nameptr = fpl->ndp->ni_cnd.cn_nameptr; - snd->ni_pathlen = fpl->debug.ni_pathlen; + fpl->snd.cn_nameptr = fpl->ndp->ni_cnd.cn_nameptr; + fpl->snd.ni_pathlen = fpl->debug.ni_pathlen; #endif } static void -cache_fpl_restore_partial(struct cache_fpl *fpl, struct nameidata_saved *snd) +cache_fpl_restore_partial(struct cache_fpl *fpl) { - fpl->ndp->ni_cnd.cn_flags = snd->cn_flags; + fpl->ndp->ni_cnd.cn_flags = fpl->snd_outer.cn_flags; #ifdef INVARIANTS - fpl->debug.ni_pathlen = snd->ni_pathlen; + fpl->debug.ni_pathlen = fpl->snd.ni_pathlen; #endif } static void -cache_fpl_restore_abort(struct cache_fpl *fpl, struct nameidata_saved *snd) +cache_fpl_restore_abort(struct cache_fpl *fpl) { - cache_fpl_restore_partial(fpl, snd); + cache_fpl_restore_partial(fpl); /* * It is 0 on entry by API contract. */ @@ -3805,7 +3814,7 @@ cache_fpl_aborted_impl(struct cache_fpl *fpl, int line) fpl->line = line; if (fpl->in_smr) cache_fpl_smr_exit(fpl); - cache_fpl_restore_abort(fpl, &fpl->snd_orig); + cache_fpl_restore_abort(fpl); return (CACHE_FPL_FAILED); } @@ -4017,7 +4026,7 @@ cache_fplookup_partial_setup(struct cache_fpl *fpl) return (cache_fpl_aborted(fpl)); } - cache_fpl_restore_partial(fpl, &fpl->snd); + cache_fpl_restore_partial(fpl); #ifdef INVARIANTS if (cnp->cn_nameptr != fpl->snd.cn_nameptr) { panic("%s: cn_nameptr mismatch (%p != %p) full [%s]\n", __func__, @@ -5219,7 +5228,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) ndp = fpl->ndp; cnp = fpl->cnp; - cache_fpl_checkpoint(fpl, &fpl->snd); + cache_fpl_checkpoint(fpl); /* * The vnode at hand is almost always stable, skip checking for it. @@ -5276,7 +5285,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) fpl->dvp_seqc = fpl->tvp_seqc; cache_fplookup_parse_advance(fpl); - cache_fpl_checkpoint(fpl, &fpl->snd); + cache_fpl_checkpoint(fpl); } return (error); @@ -5388,7 +5397,7 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, return (EOPNOTSUPP); } - cache_fpl_checkpoint(&fpl, &fpl.snd_orig); + cache_fpl_checkpoint_outer(&fpl); cache_fpl_smr_enter_initial(&fpl); #ifdef INVARIANTS From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:30:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 913354E0099; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@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 4DBjC23K5Jz4YQF; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 631041936C; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NUMgJ075893; Thu, 7 Jan 2021 23:30:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NUMkv075892; Thu, 7 Jan 2021 23:30:22 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:30:22 GMT Message-Id: <202101072330.107NUMkv075892@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 0f1fc3a31fd3 - main - cache: stop manipulating pathlen MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f1fc3a31fd309ee6d8f9269fa2ab2fdde9c50c8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:30:22 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=0f1fc3a31fd309ee6d8f9269fa2ab2fdde9c50c8 commit 0f1fc3a31fd309ee6d8f9269fa2ab2fdde9c50c8 Author: Mateusz Guzik AuthorDate: 2021-01-01 09:29:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-07 23:26:53 +0000 cache: stop manipulating pathlen It is a copy-pasto from regular lookup. Add debug to ensure the result is the same. --- sys/kern/vfs_cache.c | 120 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 100 insertions(+), 20 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 43c44aa60afc..b6f97e55746b 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3616,13 +3616,22 @@ SYSCTL_PROC(_vfs, OID_AUTO, cache_fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MP */ struct nameidata_saved { char *cn_nameptr; +#ifdef INVARIANTS size_t ni_pathlen; +#endif int cn_flags; }; +#ifdef INVARIANTS +struct cache_fpl_debug { + size_t ni_pathlen; +}; +#endif + struct cache_fpl { struct nameidata *ndp; struct componentname *cnp; + char *nulchar; struct pwd **pwd; struct vnode *dvp; struct vnode *tvp; @@ -3635,12 +3644,18 @@ struct cache_fpl { bool in_smr; bool fsearch; bool savename; +#ifdef INVARIANTS + struct cache_fpl_debug debug; +#endif }; static bool cache_fplookup_is_mp(struct cache_fpl *fpl); static int cache_fplookup_cross_mount(struct cache_fpl *fpl); static int cache_fplookup_partial_setup(struct cache_fpl *fpl); static int cache_fplookup_skip_slashes(struct cache_fpl *fpl); +static void cache_fpl_pathlen_dec(struct cache_fpl *fpl); +static void cache_fpl_pathlen_inc(struct cache_fpl *fpl); +static void cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n); static void cache_fpl_cleanup_cnp(struct componentname *cnp) @@ -3664,12 +3679,12 @@ cache_fpl_handle_root(struct cache_fpl *fpl) MPASS(*(cnp->cn_nameptr) == '/'); cnp->cn_nameptr++; - ndp->ni_pathlen--; + cache_fpl_pathlen_dec(fpl); if (__predict_false(*(cnp->cn_nameptr) == '/')) { do { cnp->cn_nameptr++; - ndp->ni_pathlen--; + cache_fpl_pathlen_dec(fpl); } while (*(cnp->cn_nameptr) == '/'); } @@ -3682,7 +3697,9 @@ cache_fpl_checkpoint(struct cache_fpl *fpl, struct nameidata_saved *snd) snd->cn_flags = fpl->ndp->ni_cnd.cn_flags; snd->cn_nameptr = fpl->ndp->ni_cnd.cn_nameptr; - snd->ni_pathlen = fpl->ndp->ni_pathlen; +#ifdef INVARIANTS + snd->ni_pathlen = fpl->debug.ni_pathlen; +#endif } static void @@ -3691,7 +3708,9 @@ cache_fpl_restore_partial(struct cache_fpl *fpl, struct nameidata_saved *snd) fpl->ndp->ni_cnd.cn_flags = snd->cn_flags; fpl->ndp->ni_cnd.cn_nameptr = snd->cn_nameptr; - fpl->ndp->ni_pathlen = snd->ni_pathlen; +#ifdef INVARIANTS + fpl->debug.ni_pathlen = snd->ni_pathlen; +#endif } static void @@ -4014,10 +4033,18 @@ cache_fplookup_partial_setup(struct cache_fpl *fpl) if (__predict_false(*(cnp->cn_nameptr) == '/')) { do { cnp->cn_nameptr++; - ndp->ni_pathlen--; + cache_fpl_pathlen_dec(fpl); } while (*(cnp->cn_nameptr) == '/'); } + ndp->ni_pathlen = fpl->nulchar - cnp->cn_nameptr + 1; +#ifdef INVARIANTS + if (ndp->ni_pathlen != fpl->debug.ni_pathlen) { + panic("%s: mismatch (%zu != %zu) nulchar %p nameptr %p [%s] ; full string [%s]\n", + __func__, ndp->ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, + cnp->cn_nameptr, cnp->cn_nameptr, cnp->cn_pnbuf); + } +#endif return (0); } @@ -4876,6 +4903,50 @@ cache_fplookup_is_mp(struct cache_fpl *fpl) * must take into account that in case off fallback the resulting * nameidata state has to be compatible with the original. */ + +/* + * Debug ni_pathlen tracking. + */ +#ifdef INVARIANTS +static void +cache_fpl_pathlen_dec(struct cache_fpl *fpl) +{ + + cache_fpl_pathlen_sub(fpl, 1); +} + +static void +cache_fpl_pathlen_inc(struct cache_fpl *fpl) +{ + + fpl->debug.ni_pathlen++; +} + +static void +cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) +{ + + fpl->debug.ni_pathlen -= n; + KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, + ("%s: pathlen underflow to %zd\n", __func__, fpl->debug.ni_pathlen)); +} +#else +static void __always_inline +cache_fpl_pathlen_dec(struct cache_fpl *fpl) +{ +} + +static void __always_inline +cache_fpl_pathlen_inc(struct cache_fpl *fpl) +{ +} + +static void +cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) +{ +} +#endif + static int cache_fplookup_preparse(struct cache_fpl *fpl) { @@ -4893,10 +4964,13 @@ cache_fplookup_preparse(struct cache_fpl *fpl) * By this point the shortest possible pathname is one character + nul * terminator, hence 2. */ - KASSERT(ndp->ni_pathlen >= 2, ("%s: ni_pathlen %zu\n", __func__, - ndp->ni_pathlen)); - - if (__predict_false(cnp->cn_nameptr[ndp->ni_pathlen - 2] == '/')) { + KASSERT(fpl->debug.ni_pathlen >= 2, ("%s: pathlen %zu\n", __func__, + fpl->debug.ni_pathlen)); + KASSERT(&cnp->cn_nameptr[fpl->debug.ni_pathlen - 2] == fpl->nulchar - 1, + ("%s: mismatch on string (%p != %p) [%s]\n", __func__, + &cnp->cn_nameptr[fpl->debug.ni_pathlen - 2], fpl->nulchar - 1, + cnp->cn_pnbuf)); + if (__predict_false(*(fpl->nulchar - 1) == '/')) { /* * TODO * Regular lookup performs the following: @@ -4931,22 +5005,24 @@ cache_fplookup_parse(struct cache_fpl *fpl) * to test for. Pathnames tend to be short so this should not be * resulting in cache misses. */ - KASSERT(cnp->cn_nameptr[ndp->ni_pathlen - 1] == '\0', - ("%s: expected nul at %p + %zu; string [%s]\n", __func__, - cnp->cn_nameptr, ndp->ni_pathlen - 1, cnp->cn_nameptr)); - cnp->cn_nameptr[ndp->ni_pathlen - 1] = '/'; + KASSERT(&cnp->cn_nameptr[fpl->debug.ni_pathlen - 1] == fpl->nulchar, + ("%s: mismatch between pathlen (%zu) and nulchar (%p != %p), string [%s]\n", + __func__, fpl->debug.ni_pathlen, &cnp->cn_nameptr[fpl->debug.ni_pathlen - 1], + fpl->nulchar, cnp->cn_pnbuf)); + KASSERT(*fpl->nulchar == '\0', + ("%s: expected nul at %p; string [%s]\n", __func__, fpl->nulchar, + cnp->cn_pnbuf)); + *fpl->nulchar = '/'; for (cp = cnp->cn_nameptr; *cp != '/'; cp++) { KASSERT(*cp != '\0', ("%s: encountered unexpected nul; string [%s]\n", __func__, cnp->cn_nameptr)); continue; } - cnp->cn_nameptr[ndp->ni_pathlen - 1] = '\0'; + *fpl->nulchar = '\0'; cnp->cn_namelen = cp - cnp->cn_nameptr; - ndp->ni_pathlen -= cnp->cn_namelen; - KASSERT(ndp->ni_pathlen <= PATH_MAX, - ("%s: ni_pathlen underflow to %zd\n", __func__, ndp->ni_pathlen)); + cache_fpl_pathlen_sub(fpl, cnp->cn_namelen); /* * Hack: we have to check if the found path component's length exceeds * NAME_MAX. However, the condition is very rarely true and check can @@ -4992,7 +5068,7 @@ cache_fplookup_parse_advance(struct cache_fpl *fpl) ("%s: should have seen slash at %p ; buf %p [%s]\n", __func__, cnp->cn_nameptr, cnp->cn_pnbuf, cnp->cn_pnbuf)); cnp->cn_nameptr++; - ndp->ni_pathlen--; + cache_fpl_pathlen_dec(fpl); } /* @@ -5016,7 +5092,7 @@ cache_fplookup_skip_slashes(struct cache_fpl *fpl) MPASS(*(cnp->cn_nameptr) == '/'); do { cnp->cn_nameptr++; - ndp->ni_pathlen--; + cache_fpl_pathlen_dec(fpl); } while (*(cnp->cn_nameptr) == '/'); /* @@ -5024,7 +5100,7 @@ cache_fplookup_skip_slashes(struct cache_fpl *fpl) * something to skip. */ cnp->cn_nameptr--; - ndp->ni_pathlen++; + cache_fpl_pathlen_inc(fpl); /* * cache_fplookup_parse_advance starts from ndp->ni_next @@ -5309,6 +5385,10 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, cache_fpl_checkpoint(&fpl, &fpl.snd_orig); cache_fpl_smr_enter_initial(&fpl); +#ifdef INVARIANTS + fpl.debug.ni_pathlen = ndp->ni_pathlen; +#endif + fpl.nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; fpl.fsearch = false; fpl.savename = (cnp->cn_flags & SAVENAME) != 0; fpl.pwd = pwdp; From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:30:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4405B4DFE6B; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@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 4DBjC21WZMz4Yb8; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 232951936A; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NUMkA075842; Thu, 7 Jan 2021 23:30:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NUM8u075841; Thu, 7 Jan 2021 23:30:22 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:30:22 GMT Message-Id: <202101072330.107NUM8u075841@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 20ac5cda965e - main - fd: make fd/fp mandatory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20ac5cda965eccc34f975674c6efc97c3615a234 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:30:22 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=20ac5cda965eccc34f975674c6efc97c3615a234 commit 20ac5cda965eccc34f975674c6efc97c3615a234 Author: Mateusz Guzik AuthorDate: 2020-12-23 13:50:34 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-07 23:30:04 +0000 fd: make fd/fp mandatory They are both always passed anyway. --- sys/kern/kern_descrip.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index ff11ae4f1a61..e1ffdc3baf01 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1976,6 +1976,9 @@ falloc_caps(struct thread *td, struct file **resultfp, int *resultfd, int flags, struct file *fp; int error, fd; + MPASS(resultfp != NULL); + MPASS(resultfd != NULL); + error = falloc_noinstall(td, &fp); if (error) return (error); /* no reference held on error */ @@ -1986,13 +1989,8 @@ falloc_caps(struct thread *td, struct file **resultfp, int *resultfd, int flags, return (error); } - if (resultfp != NULL) - *resultfp = fp; /* copy out result */ - else - fdrop(fp, td); /* release local reference */ - - if (resultfd != NULL) - *resultfd = fd; + *resultfp = fp; + *resultfd = fd; return (0); } From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:30:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8EB4E4DFDF2; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@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 4DBjC22Zdzz4YMf; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 478F91936B; Thu, 7 Jan 2021 23:30:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NUMQl075876; Thu, 7 Jan 2021 23:30:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NUMYH075875; Thu, 7 Jan 2021 23:30:22 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:30:22 GMT Message-Id: <202101072330.107NUMYH075875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: ac7715471ca4 - main - cache: stop checkpointing cn_nameptr MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac7715471ca438f128cec36ae440fea4d21b8ff4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:30:22 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ac7715471ca438f128cec36ae440fea4d21b8ff4 commit ac7715471ca438f128cec36ae440fea4d21b8ff4 Author: Mateusz Guzik AuthorDate: 2021-01-07 04:40:05 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-07 23:29:38 +0000 cache: stop checkpointing cn_nameptr For aborts cn_nameptr is the same as cn_pnbuf. For partial results the same cn_nameptr is to be used. --- sys/kern/vfs_cache.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index b6f97e55746b..7d774466be53 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3615,8 +3615,8 @@ SYSCTL_PROC(_vfs, OID_AUTO, cache_fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MP * need restoring in case fast path lookup fails. */ struct nameidata_saved { - char *cn_nameptr; #ifdef INVARIANTS + char *cn_nameptr; size_t ni_pathlen; #endif int cn_flags; @@ -3696,8 +3696,8 @@ cache_fpl_checkpoint(struct cache_fpl *fpl, struct nameidata_saved *snd) { snd->cn_flags = fpl->ndp->ni_cnd.cn_flags; - snd->cn_nameptr = fpl->ndp->ni_cnd.cn_nameptr; #ifdef INVARIANTS + snd->cn_nameptr = fpl->ndp->ni_cnd.cn_nameptr; snd->ni_pathlen = fpl->debug.ni_pathlen; #endif } @@ -3707,7 +3707,6 @@ cache_fpl_restore_partial(struct cache_fpl *fpl, struct nameidata_saved *snd) { fpl->ndp->ni_cnd.cn_flags = snd->cn_flags; - fpl->ndp->ni_cnd.cn_nameptr = snd->cn_nameptr; #ifdef INVARIANTS fpl->debug.ni_pathlen = snd->ni_pathlen; #endif @@ -3722,6 +3721,7 @@ cache_fpl_restore_abort(struct cache_fpl *fpl, struct nameidata_saved *snd) * It is 0 on entry by API contract. */ fpl->ndp->ni_resflags = 0; + fpl->ndp->ni_cnd.cn_nameptr = fpl->ndp->ni_cnd.cn_pnbuf; } #ifdef INVARIANTS @@ -4018,6 +4018,12 @@ cache_fplookup_partial_setup(struct cache_fpl *fpl) } cache_fpl_restore_partial(fpl, &fpl->snd); +#ifdef INVARIANTS + if (cnp->cn_nameptr != fpl->snd.cn_nameptr) { + panic("%s: cn_nameptr mismatch (%p != %p) full [%s]\n", __func__, + cnp->cn_nameptr, fpl->snd.cn_nameptr, cnp->cn_pnbuf); + } +#endif ndp->ni_startdir = dvp; cnp->cn_flags |= MAKEENTRY; From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:33:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8D9364E01DC; Thu, 7 Jan 2021 23:33:41 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp.infotel.ru (corp.infotel.ru [195.170.219.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4DBjGs2mN6z4ZTk; Thu, 7 Jan 2021 23:33:41 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp (corp.infotel.ru [195.170.219.3]) by corp.infotel.ru (Postfix) with ESMTP id B9458178BD2; Fri, 8 Jan 2021 02:33:32 +0300 (MSK) X-Virus-Scanned: amavisd-new at corp.infotel.ru Received: from corp.infotel.ru ([195.170.219.3]) by corp (corp.infotel.ru [195.170.219.3]) (amavisd-new, port 10024) with ESMTP id gxuZvEz0T7fP; Fri, 8 Jan 2021 02:33:27 +0300 (MSK) Received: from mail.cicgroup.ru (unknown [195.170.219.74]) by corp.infotel.ru (Postfix) with ESMTP id 3AE9E178BC3; Fri, 8 Jan 2021 02:33:27 +0300 (MSK) Received: from mail.cicgroup.ru (localhost [127.0.0.1]) by mail.cicgroup.ru (Postfix) with ESMTP id 7749042211F; Fri, 8 Jan 2021 02:33:24 +0300 (MSK) Received: from mail.cicgroup.ru ([127.0.0.1]) by mail.cicgroup.ru (mail.cicgroup.ru [127.0.0.1]) (amavisd-new, port 10024) with SMTP id lZoHFwnaCVfk; Fri, 8 Jan 2021 02:33:22 +0300 (MSK) Received: from [192.168.0.30] (gateway [10.0.2.2]) by mail.cicgroup.ru (Postfix) with ESMTPA id 39C1B42211C; Fri, 8 Jan 2021 02:33:22 +0300 (MSK) Subject: Re: git: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. To: Jessica Clarke , Vladimir Kondratyev Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202101072320.107NKpMS063374@gitrepo.freebsd.org> From: Vladimir Kondratyev Message-ID: <7a7fa0fb-51c2-1b14-6d37-2c400f69d7dd@kondratyev.su> Date: Fri, 8 Jan 2021 02:33:16 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DBjGs2mN6z4ZTk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:33:41 -0000 On 08.01.2021 02:27, Jessica Clarke wrote: > On 7 Jan 2021, at 23:20, Vladimir Kondratyev wrote: >> +#include >> +#include >> +#include "xlocale_private.h" >> + >> +/* >> + * Find the first occurrence of find in s, ignore case. >> + */ >> +char * >> +strcasestr_l(const char *s, const char *find, locale_t locale) > > Locales in the kernel? This feels wrong. > > Jess > strcasestr.c was copied from userland unmodified just to allow "git log --follow" to work. Next commit removed locale support from this file and connected it to build. From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:41:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 28F804E05AD for ; Thu, 7 Jan 2021 23:41:20 +0000 (UTC) (envelope-from git@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 4DBjRh0lZnz4ZWT; Thu, 7 Jan 2021 23:41:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C90919CE1; Thu, 7 Jan 2021 23:41:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NfJ8x092050; Thu, 7 Jan 2021 23:41:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NfJfu092049; Thu, 7 Jan 2021 23:41:19 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:41:19 GMT Message-Id: <202101072341.107NfJfu092049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Matt Macy Subject: git: 80ce10ca2fe0 - vendor/openzfs - missed header rename MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmacy X-Git-Repository: src X-Git-Refname: refs/heads/vendor/openzfs X-Git-Reftype: branch X-Git-Commit: 80ce10ca2fe0627ce9283350a9167666a4313121 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:41:20 -0000 The branch vendor/openzfs has been updated by mmacy: URL: https://cgit.FreeBSD.org/src/commit/?id=80ce10ca2fe0627ce9283350a9167666a4313121 commit 80ce10ca2fe0627ce9283350a9167666a4313121 Author: Matt Macy AuthorDate: 2021-01-07 23:40:55 +0000 Commit: Matt Macy CommitDate: 2021-01-07 23:40:55 +0000 missed header rename --- include/os/freebsd/zfs/sys/{zfs_vnops.h => zfs_vnops_os.h} | 0 include/os/linux/zfs/sys/{zfs_vnops.h => zfs_vnops_os.h} | 0 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/include/os/freebsd/zfs/sys/zfs_vnops.h b/include/os/freebsd/zfs/sys/zfs_vnops_os.h similarity index 100% rename from include/os/freebsd/zfs/sys/zfs_vnops.h rename to include/os/freebsd/zfs/sys/zfs_vnops_os.h diff --git a/include/os/linux/zfs/sys/zfs_vnops.h b/include/os/linux/zfs/sys/zfs_vnops_os.h similarity index 100% rename from include/os/linux/zfs/sys/zfs_vnops.h rename to include/os/linux/zfs/sys/zfs_vnops_os.h From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:41:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 87B194E089F; Thu, 7 Jan 2021 23:41:53 +0000 (UTC) (envelope-from rpokala@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 4DBjSK3SWmz4b4c; Thu, 7 Jan 2021 23:41:53 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (c-98-207-126-143.hsd1.ca.comcast.net [98.207.126.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id B7BE9293F1; Thu, 7 Jan 2021 23:41:52 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.44.20121301 Date: Thu, 07 Jan 2021 15:41:48 -0800 Subject: Re: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. From: Ravi Pokala To: Vladimir Kondratyev , Jessica Clarke , Vladimir Kondratyev CC: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Message-ID: <3EA011C9-2EEC-4693-B36D-69E74DF8473C@panasas.com> Thread-Topic: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. References: <202101072320.107NKpMS063374@gitrepo.freebsd.org> <7a7fa0fb-51c2-1b14-6d37-2c400f69d7dd@kondratyev.su> In-Reply-To: <7a7fa0fb-51c2-1b14-6d37-2c400f69d7dd@kondratyev.su> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:41:53 -0000 -----Original Message----- From: on behalf of Vladimir Kondratyev Date: 2021-01-07, Thursday at 15:33 To: Jessica Clarke , Vladimir Kondratyev Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. On 08.01.2021 02:27, Jessica Clarke wrote: > On 7 Jan 2021, at 23:20, Vladimir Kondratyev wrote: >> +#include >> +#include >> +#include "xlocale_private.h" >> + >> +/* >> + * Find the first occurrence of find in s, ignore case. >> + */ >> +char * >> +strcasestr_l(const char *s, const char *find, locale_t locale) > > Locales in the kernel? This feels wrong. > > Jess > strcasestr.c was copied from userland unmodified just to allow "git log --follow" to work. Next commit removed locale support from this file and connected it to build. Unfortunately, about two-dozen commit messages from you arrived at the same time, and some were out of order; without incrementing change numbers in the subject line, figuring out the actual ordering is non-trivial. :-p -Ravi (rpokala@) From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:46:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0B39D4E05D7 for ; Thu, 7 Jan 2021 23:46:56 +0000 (UTC) (envelope-from git@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 4DBjZ76xw1z4b8F; Thu, 7 Jan 2021 23:46:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCBCF196DF; Thu, 7 Jan 2021 23:46:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107Nkt3N094562; Thu, 7 Jan 2021 23:46:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NktLE094561; Thu, 7 Jan 2021 23:46:55 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:46:55 GMT Message-Id: <202101072346.107NktLE094561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Matt Macy Subject: git: 90705d70c482 - vendor/openzfs - missed source rename MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmacy X-Git-Repository: src X-Git-Refname: refs/heads/vendor/openzfs X-Git-Reftype: branch X-Git-Commit: 90705d70c482c1fea055b97773fae14b218344db Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:46:56 -0000 The branch vendor/openzfs has been updated by mmacy: URL: https://cgit.FreeBSD.org/src/commit/?id=90705d70c482c1fea055b97773fae14b218344db commit 90705d70c482c1fea055b97773fae14b218344db Author: Matt Macy AuthorDate: 2021-01-07 23:46:35 +0000 Commit: Matt Macy CommitDate: 2021-01-07 23:46:35 +0000 missed source rename --- module/os/freebsd/zfs/{zfs_vnops.c => zfs_vnops_os.c} | 0 module/os/linux/zfs/{zfs_vnops.c => zfs_vnops_os.c} | 0 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/module/os/freebsd/zfs/zfs_vnops.c b/module/os/freebsd/zfs/zfs_vnops_os.c similarity index 100% rename from module/os/freebsd/zfs/zfs_vnops.c rename to module/os/freebsd/zfs/zfs_vnops_os.c diff --git a/module/os/linux/zfs/zfs_vnops.c b/module/os/linux/zfs/zfs_vnops_os.c similarity index 100% rename from module/os/linux/zfs/zfs_vnops.c rename to module/os/linux/zfs/zfs_vnops_os.c From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:49:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C5C354E0959; Thu, 7 Jan 2021 23:49:49 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp.infotel.ru (corp.infotel.ru [195.170.219.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4DBjdT47xdz4bQJ; Thu, 7 Jan 2021 23:49:49 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp (corp.infotel.ru [195.170.219.3]) by corp.infotel.ru (Postfix) with ESMTP id 12F83178C3C; Fri, 8 Jan 2021 02:49:48 +0300 (MSK) X-Virus-Scanned: amavisd-new at corp.infotel.ru Received: from corp.infotel.ru ([195.170.219.3]) by corp (corp.infotel.ru [195.170.219.3]) (amavisd-new, port 10024) with ESMTP id WF1KNA9JZgaO; Fri, 8 Jan 2021 02:49:42 +0300 (MSK) Received: from mail.cicgroup.ru (unknown [195.170.219.74]) by corp.infotel.ru (Postfix) with ESMTP id BD824178C2F; Fri, 8 Jan 2021 02:49:42 +0300 (MSK) Received: from mail.cicgroup.ru (localhost [127.0.0.1]) by mail.cicgroup.ru (Postfix) with ESMTP id 11D1242211F; Fri, 8 Jan 2021 02:49:40 +0300 (MSK) Received: from mail.cicgroup.ru ([127.0.0.1]) by mail.cicgroup.ru (mail.cicgroup.ru [127.0.0.1]) (amavisd-new, port 10024) with SMTP id UnnPMMeMc6AH; Fri, 8 Jan 2021 02:49:37 +0300 (MSK) Received: from [192.168.0.30] (gateway [10.0.2.2]) by mail.cicgroup.ru (Postfix) with ESMTPA id 9864242211C; Fri, 8 Jan 2021 02:49:37 +0300 (MSK) Subject: Re: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. To: Ravi Pokala , Jessica Clarke , Vladimir Kondratyev Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202101072320.107NKpMS063374@gitrepo.freebsd.org> <7a7fa0fb-51c2-1b14-6d37-2c400f69d7dd@kondratyev.su> <3EA011C9-2EEC-4693-B36D-69E74DF8473C@panasas.com> From: Vladimir Kondratyev Message-ID: Date: Fri, 8 Jan 2021 02:49:31 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <3EA011C9-2EEC-4693-B36D-69E74DF8473C@panasas.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DBjdT47xdz4bQJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:49:49 -0000 On 08.01.2021 02:41, Ravi Pokala wrote: > -----Original Message----- > From: on behalf of Vladimir Kondratyev > Date: 2021-01-07, Thursday at 15:33 > To: Jessica Clarke , Vladimir Kondratyev > Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" > Subject: Re: git: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. > > On 08.01.2021 02:27, Jessica Clarke wrote: > > On 7 Jan 2021, at 23:20, Vladimir Kondratyev wrote: > >> +#include > >> +#include > >> +#include "xlocale_private.h" > >> + > >> +/* > >> + * Find the first occurrence of find in s, ignore case. > >> + */ > >> +char * > >> +strcasestr_l(const char *s, const char *find, locale_t locale) > > > > Locales in the kernel? This feels wrong. > > > > Jess > > > > strcasestr.c was copied from userland unmodified just to allow > "git log --follow" to work. Next commit removed locale support from this > file and connected it to build. > > Unfortunately, about two-dozen commit messages from you arrived at the same time, and some were out of order; without incrementing change numbers in the subject line, figuring out the actual ordering is non-trivial. :-p > > -Ravi (rpokala@) > I hope, commit hook will be improved some day. Pushing of two-dozen commits one by one is too boring. From owner-dev-commits-src-all@freebsd.org Thu Jan 7 23:50:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1CE374E07C3; Thu, 7 Jan 2021 23:50:41 +0000 (UTC) (envelope-from git@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 4DBjfT0NS1z4bP0; Thu, 7 Jan 2021 23:50:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F403019BA1; Thu, 7 Jan 2021 23:50:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 107NoeaW002687; Thu, 7 Jan 2021 23:50:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 107NoeXO002686; Thu, 7 Jan 2021 23:50:40 GMT (envelope-from git) Date: Thu, 7 Jan 2021 23:50:40 GMT Message-Id: <202101072350.107NoeXO002686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 10cc3e39d6ea - main - Retire obsolete a.out rtld MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 10cc3e39d6eaf8acd8bd7ba4156fdcef96cbc927 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jan 2021 23:50:41 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=10cc3e39d6eaf8acd8bd7ba4156fdcef96cbc927 commit 10cc3e39d6eaf8acd8bd7ba4156fdcef96cbc927 Author: Ed Maste AuthorDate: 2021-01-07 22:39:49 +0000 Commit: Ed Maste CommitDate: 2021-01-07 23:50:01 +0000 Retire obsolete a.out rtld This was disconnected from the build in 2001 in commit 66422f5b7a1a with a comment that it was long overdue even then. Sponsored by: The FreeBSD Foundation --- libexec/rtld-aout/shlib.c | 327 -------------------------------------------- libexec/rtld-aout/shlib.h | 45 ------ libexec/rtld-aout/support.c | 84 ------------ libexec/rtld-aout/support.h | 37 ----- 4 files changed, 493 deletions(-) diff --git a/libexec/rtld-aout/shlib.c b/libexec/rtld-aout/shlib.c deleted file mode 100644 index c9724a2203af..000000000000 --- a/libexec/rtld-aout/shlib.c +++ /dev/null @@ -1,327 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (c) 1993 Paul Kranenburg - * 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Paul Kranenburg. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "shlib.h" -#include "support.h" - -/* - * Standard directories to search for files specified by -l. - */ -#ifndef STANDARD_SEARCH_DIRS -#define STANDARD_SEARCH_DIRS "/usr/lib/aout" -#endif - -/* - * Actual vector of library search directories, - * including `-L'ed and LD_LIBRARY_PATH spec'd ones. - */ -char **search_dirs; -int n_search_dirs; - -static const char *standard_search_dirs[] = { - STANDARD_SEARCH_DIRS -}; - - -void -add_search_dir(const char *name) -{ - int n; - - for (n = 0; n < n_search_dirs; n++) - if (strcmp(search_dirs[n], name) == 0) - return; - n_search_dirs++; - search_dirs = (char **) - xrealloc(search_dirs, n_search_dirs * sizeof search_dirs[0]); - search_dirs[n_search_dirs - 1] = strdup(name); -} - -void -add_search_path(char *path) -{ - register char *cp, *dup; - - if (path == NULL) - return; - - /* Add search directories from `path' */ - path = dup = strdup(path); - while ((cp = strsep(&path, ":")) != NULL) - add_search_dir(cp); - free(dup); -} - -void -std_search_path(void) -{ - int i, n; - - /* Append standard search directories */ - n = sizeof standard_search_dirs / sizeof standard_search_dirs[0]; - for (i = 0; i < n; i++) - add_search_dir(standard_search_dirs[i]); -} - -/* - * Return true if CP points to a valid dewey number. - * Decode and leave the result in the array DEWEY. - * Return the number of decoded entries in DEWEY. - */ - -int -getdewey(int dewey[], char *cp) -{ - int i, n; - - for (n = 0, i = 0; i < MAXDEWEY; i++) { - if (*cp == '\0') - break; - - if (*cp == '.') cp++; - if (!isdigit(*cp)) - return 0; - - dewey[n++] = strtol(cp, &cp, 10); - } - - return n; -} - -/* - * Compare two dewey arrays. - * Return -1 if `d1' represents a smaller value than `d2'. - * Return 1 if `d1' represents a greater value than `d2'. - * Return 0 if equal. - */ -int -cmpndewey(int d1[], int n1, int d2[], int n2) -{ - register int i; - - for (i = 0; i < n1 && i < n2; i++) { - if (d1[i] < d2[i]) - return -1; - if (d1[i] > d2[i]) - return 1; - } - - if (n1 == n2) - return 0; - - if (i == n1) - return -1; - - if (i == n2) - return 1; - - errx(1, "cmpndewey: can't happen"); - return 0; -} - -/* - * Search directories for a shared library matching the given - * major and minor version numbers. See search_lib_dir() below for - * the detailed matching rules. - * - * As soon as a directory with an acceptable match is found, the search - * terminates. Subsequent directories are not searched for a better - * match. This is in conformance with the SunOS searching rules. Also, - * it avoids a lot of directory searches that are virtually guaranteed to - * be fruitless. - * - * The return value is a full pathname to the matching library. The - * string is dynamically allocated. If no matching library is found, the - * function returns NULL. - */ - -char * -findshlib(char *name, int *majorp, int *minorp, int do_dot_a) -{ - int i; - - for (i = 0; i < n_search_dirs; i++) { - char *path; - - path = search_lib_dir(search_dirs[i], name, majorp, minorp, - do_dot_a); - if(path != NULL) - return path; - } - - return NULL; -} - -/* - * Search library directories for a file with the given name. The - * return value is a full pathname to the matching file. The string - * is dynamically allocated. If no matching file is found, the function - * returns NULL. - */ - -char * -find_lib_file(const char *name) -{ - int i; - - for (i = 0; i < n_search_dirs; i++) { - char *path = concat(search_dirs[i], "/", name); - struct stat sb; - - if (lstat(path, &sb) != -1) /* We found it */ - return path; - - free(path); - } - - return NULL; -} - -/* - * Search a given directory for a library (preferably shared) satisfying - * the given criteria. - * - * The matching rules are as follows: - * - * if(*majorp == -1) - * find the library with the highest major version; - * else - * insist on a major version identical to *majorp; - * - * Always find the library with the highest minor version; - * if(*minorp != -1) - * insist on a minor version >= *minorp; - * - * It is invalid to specify a specific minor number while wildcarding - * the major number. - * - * The actual major and minor numbers found are returned via the pointer - * arguments. - * - * A suitable shared library is always preferred over a static (.a) library. - * If do_dot_a is false, then a static library will not be accepted in - * any case. - * - * The return value is a full pathname to the matching library. The - * string is dynamically allocated. If no matching library is found, the - * function returns NULL. - */ - -char * -search_lib_dir(char *dir, char *name, int *majorp, int *minorp, int do_dot_a) -{ - size_t namelen; - DIR *dd; - struct dirent *dp; - int best_dewey[MAXDEWEY]; - int best_ndewey; - char dot_a_name[MAXNAMLEN+1]; - char dot_so_name[MAXNAMLEN+1]; - - if((dd = opendir(dir)) == NULL) - return NULL; - - namelen = strlen(name); - best_ndewey = 0; - dot_a_name[0] = '\0'; - dot_so_name[0] = '\0'; - - while((dp = readdir(dd)) != NULL) { - char *extension; - - if(strlen(dp->d_name) < 3 + namelen + 2 || /* lib+xxx+.a */ - strncmp(dp->d_name, "lib", 3) != 0 || - strncmp(dp->d_name + 3, name, namelen) != 0 || - dp->d_name[3+namelen] != '.') - continue; - - extension = dp->d_name + 3 + namelen + 1; /* a or so.* */ - - if(strncmp(extension, "so.", 3) == 0) { - int cur_dewey[MAXDEWEY]; - int cur_ndewey; - - cur_ndewey = getdewey(cur_dewey, extension+3); - if(cur_ndewey < 2) /* Too few version numbers */ - continue; - - if(*majorp != -1) { /* Need exact match on major */ - if(cur_dewey[0] != *majorp) - continue; - if(*minorp != -1) { /* Need minor >= minimum */ - if(cur_dewey[1] < *minorp) - continue; - } - } - - if(cmpndewey(cur_dewey, cur_ndewey, best_dewey, - best_ndewey) <= 0) /* No better than prior match */ - continue; - - /* We found a better match */ - strcpy(dot_so_name, dp->d_name); - bcopy(cur_dewey, best_dewey, - cur_ndewey * sizeof best_dewey[0]); - best_ndewey = cur_ndewey; - } else if(do_dot_a && strcmp(extension, "a") == 0) - strcpy(dot_a_name, dp->d_name); - } - closedir(dd); - - if(dot_so_name[0] != '\0') { - *majorp = best_dewey[0]; - *minorp = best_dewey[1]; - return concat(dir, "/", dot_so_name); - } - - if(dot_a_name[0] != '\0') - return concat(dir, "/", dot_a_name); - - return NULL; -} diff --git a/libexec/rtld-aout/shlib.h b/libexec/rtld-aout/shlib.h deleted file mode 100644 index 7c42a29e6084..000000000000 --- a/libexec/rtld-aout/shlib.h +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * Copyright (C) 1996 - * Peter Wemm. All rights reserved. - * - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * 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$ - */ - -/* - * prototypes for shlib.c. Big deal. - */ - -extern char **search_dirs; -extern int n_search_dirs; - -void add_search_dir __P((const char *)); -void add_search_path __P((char *)); -void std_search_path __P((void)); -int getdewey __P((int[], char *)); -int cmpndewey __P((int[], int, int[], int)); -char *findshlib __P((char *, int *, int *, int)); -char *find_lib_file __P((const char *)); -char *search_lib_dir __P((char *, char *, int *, int *, int)); diff --git a/libexec/rtld-aout/support.c b/libexec/rtld-aout/support.c deleted file mode 100644 index 034935d893fb..000000000000 --- a/libexec/rtld-aout/support.c +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * Generic "support" routines to replace those obtained from libiberty for ld. - * - * I've collected these from random bits of (published) code I've written - * over the years, not that they are a big deal. peter@freebsd.org - * - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (C) 1996 - * Peter Wemm. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - *- - * $FreeBSD$ - */ -#include -#include -#include -#include - -#include "support.h" - -char * -concat(const char *s1, const char *s2, const char *s3) -{ - int len = 1; - char *s; - if (s1) - len += strlen(s1); - if (s2) - len += strlen(s2); - if (s3) - len += strlen(s3); - s = xmalloc(len); - s[0] = '\0'; - if (s1) - strcat(s, s1); - if (s2) - strcat(s, s2); - if (s3) - strcat(s, s3); - return s; -} - -void * -xmalloc(size_t n) -{ - char *p = malloc(n); - - if (p == NULL) - errx(1, "Could not allocate memory"); - - return p; -} - -void * -xrealloc(void *p, size_t n) -{ - p = realloc(p, n); - - if (p == NULL) - errx(1, "Could not allocate memory"); - - return p; -} diff --git a/libexec/rtld-aout/support.h b/libexec/rtld-aout/support.h deleted file mode 100644 index dd38959df6ee..000000000000 --- a/libexec/rtld-aout/support.h +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (C) 1996 - * Peter Wemm. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - *- - * $FreeBSD$ - */ - -/* - * prototypes for support.c. Big deal. - */ - -void *xmalloc __P((size_t)); -void *xrealloc __P((void *, size_t)); -char *concat __P((const char *, const char *, const char *)); From owner-dev-commits-src-all@freebsd.org Fri Jan 8 00:07:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F399E4E0AEC; Fri, 8 Jan 2021 00:07:49 +0000 (UTC) (envelope-from git@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 4DBk2F6c0Bz4c56; Fri, 8 Jan 2021 00:07:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5B1719FB7; Fri, 8 Jan 2021 00:07:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10807n8t020511; Fri, 8 Jan 2021 00:07:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10807nqq020510; Fri, 8 Jan 2021 00:07:49 GMT (envelope-from git) Date: Fri, 8 Jan 2021 00:07:49 GMT Message-Id: <202101080007.10807nqq020510@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 149c9220e63b - main - pccard: remove pccbb_isa MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 149c9220e63b5dea79862fa9e8acb515c3d41fc5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 00:07:50 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=149c9220e63b5dea79862fa9e8acb515c3d41fc5 commit 149c9220e63b5dea79862fa9e8acb515c3d41fc5 Author: Warner Losh AuthorDate: 2021-01-07 23:52:36 +0000 Commit: Warner Losh CommitDate: 2021-01-08 00:05:30 +0000 pccard: remove pccbb_isa It was never used and quite stale. --- sys/dev/pccbb/pccbb_isa.c | 257 ---------------------------------------------- 1 file changed, 257 deletions(-) diff --git a/sys/dev/pccbb/pccbb_isa.c b/sys/dev/pccbb/pccbb_isa.c deleted file mode 100644 index 919365ad146d..000000000000 --- a/sys/dev/pccbb/pccbb_isa.c +++ /dev/null @@ -1,257 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2002-2004 M. Warner Losh - * - * 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. - */ - -/* - * Driver for ISA to PCMCIA bridges compliant with the Intel ExCA - * specification. - */ - -#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 -#include - -#include "power_if.h" -#include "card_if.h" - -/***************************************************************************** - * Configurable parameters. - *****************************************************************************/ - -/* sysctl vars */ -static SYSCTL_NODE(_hw, OID_AUTO, pcic, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, - "PCIC parameters"); - -static int isa_intr_mask = EXCA_INT_MASK_ALLOWED; -SYSCTL_INT(_hw_pcic, OID_AUTO, intr_mask, CTLFLAG_RDTUN, &isa_intr_mask, 0, - "Mask of allowable interrupts for this laptop. The default is generally" - " correct, but some laptops do not route all the IRQ pins to the bridge to" - " save wires. Sometimes you need a more restrictive mask because some of" - " the hardware in your laptop may not have a driver so its IRQ might not be" - " allocated."); - -/* - * CL-PD6722's VSENSE method - * 0: NO VSENSE (assume a 5.0V card always) - * 1: 6710's method (default) - * 2: 6729's method - */ -int pcic_pd6722_vsense = 1; -SYSCTL_INT(_hw_pcic, OID_AUTO, pd6722_vsense, CTLFLAG_RDTUN, - &pcic_pd6722_vsense, 1, - "Select CL-PD6722's VSENSE method. VSENSE is used to determine the" - " voltage of inserted cards. The CL-PD6722 has two methods to determine" - " the voltage of the card. 0 means assume a 5.0V card and do not check. 1" - " means use the same method that the CL-PD6710 uses (default). 2 means use" - " the same method as the CL-PD6729. 2 is documented in the datasheet as" - " being the correct way, but 1 seems to give better results on more" - " laptops."); -/***************************************************************************** - * End of configurable parameters. - *****************************************************************************/ - -#define DPRINTF(x) do { if (cbb_debug) printf x; } while (0) -#define DEVPRINTF(x) do { if (cbb_debug) device_printf x; } while (0) - -static struct isa_pnp_id pcic_ids[] = { - {EXCA_PNP_ACTIONTEC, NULL}, /* AEI0218 */ - {EXCA_PNP_IBM3765, NULL}, /* IBM3765 */ - {EXCA_PNP_82365, NULL}, /* PNP0E00 */ - {EXCA_PNP_CL_PD6720, NULL}, /* PNP0E01 */ - {EXCA_PNP_VLSI_82C146, NULL}, /* PNP0E02 */ - {EXCA_PNP_82365_CARDBUS, NULL}, /* PNP0E03 */ - {EXCA_PNP_SCM_SWAPBOX, NULL}, /* SCM0469 */ - {0} -}; - -/************************************************************************/ -/* Probe/Attach */ -/************************************************************************/ - -static int -cbb_isa_activate(device_t dev) -{ - struct cbb_softc *sc = device_get_softc(dev); - struct resource *res; - int rid; - int i; - - /* A little bogus, but go ahead and get the irq for CSC events */ - rid = 0; - res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); - if (res == NULL) { - /* - * No IRQ specified, find one. This can be due to the PnP - * data not specifying any IRQ, or the default kernel not - * assinging an IRQ. - */ - for (i = 0; i < 16 && res == NULL; i++) { - if (((1 << i) & isa_intr_mask) == 0) - continue; - res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, i, i, - 1, RF_ACTIVE); - } - } - if (res == NULL) - return (ENXIO); - sc->irq_res = res; - rid = 0; - res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); - if (res == NULL) { - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); - sc->irq_res = NULL; - device_printf(dev, "Cannot allocate I/O\n"); - return (ENOMEM); - } - sc->bst = rman_get_bustag(res); - sc->bsh = rman_get_bushandle(res); - sc->base_res = res; - return (0); -} - -static void -cbb_isa_deactivate(device_t dev) -{ - struct cbb_softc *sc = device_get_softc(dev); - - if (sc->irq_res) - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); - sc->irq_res = NULL; - if (sc->base_res) - bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->base_res); - sc->base_res = NULL; -} - -static int -cbb_isa_probe(device_t dev) -{ - int error; - struct cbb_softc *sc = device_get_softc(dev); - - /* Check isapnp ids */ - error = ISA_PNP_PROBE(device_get_parent(dev), dev, pcic_ids); - if (error != 0 && error != ENOENT) - return (error); - - error = cbb_isa_activate(dev); - if (error != 0) - return (error); - - /* Check to make sure that we have actual hardware */ - error = exca_probe_slots(dev, &sc->exca[0], sc->bst, sc->bsh); - cbb_isa_deactivate(dev); - return (error); -} - -static int -cbb_isa_attach(device_t dev) -{ - return (ENOMEM); -} - -static int -cbb_isa_suspend(device_t dev) -{ - return (0); -} - -static int -cbb_isa_resume(device_t dev) -{ - return (0); -} - -static device_method_t cbb_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, cbb_isa_probe), - DEVMETHOD(device_attach, cbb_isa_attach), - DEVMETHOD(device_detach, cbb_detach), - DEVMETHOD(device_suspend, cbb_isa_suspend), - DEVMETHOD(device_resume, cbb_isa_resume), - - /* bus methods */ - DEVMETHOD(bus_read_ivar, cbb_read_ivar), - DEVMETHOD(bus_write_ivar, cbb_write_ivar), - DEVMETHOD(bus_alloc_resource, cbb_alloc_resource), - DEVMETHOD(bus_release_resource, cbb_release_resource), - DEVMETHOD(bus_activate_resource, cbb_activate_resource), - DEVMETHOD(bus_deactivate_resource, cbb_deactivate_resource), - DEVMETHOD(bus_driver_added, cbb_driver_added), - DEVMETHOD(bus_child_detached, cbb_child_detached), - DEVMETHOD(bus_setup_intr, cbb_setup_intr), - DEVMETHOD(bus_teardown_intr, cbb_teardown_intr), - DEVMETHOD(bus_child_present, cbb_child_present), - - /* 16-bit card interface */ - DEVMETHOD(card_set_res_flags, cbb_pcic_set_res_flags), - DEVMETHOD(card_set_memory_offset, cbb_pcic_set_memory_offset), - - /* power interface */ - DEVMETHOD(power_enable_socket, cbb_power_enable_socket), - DEVMETHOD(power_disable_socket, cbb_power_disable_socket), - - DEVMETHOD_END -}; - -static driver_t cbb_isa_driver = { - "cbb", - cbb_methods, - sizeof(struct cbb_softc) -}; - -DRIVER_MODULE(cbb, isa, cbb_isa_driver, cbb_devclass, 0, 0); -MODULE_DEPEND(cbb, exca, 1, 1, 1); -ISA_PNP_INFO(pcic_ids); From owner-dev-commits-src-all@freebsd.org Fri Jan 8 00:07:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1DC6D4E0F50; Fri, 8 Jan 2021 00:07:50 +0000 (UTC) (envelope-from git@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 4DBk2G0MgPz4c7Y; Fri, 8 Jan 2021 00:07:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0E831A015; Fri, 8 Jan 2021 00:07:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10807nDF020530; Fri, 8 Jan 2021 00:07:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10807nlU020529; Fri, 8 Jan 2021 00:07:49 GMT (envelope-from git) Date: Fri, 8 Jan 2021 00:07:49 GMT Message-Id: <202101080007.10807nlU020529@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: cabbfa3e0723 - main - pccard: Move power_if.m from pccard to cardbus MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cabbfa3e072392e6e105d733547a07ced449a044 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 00:07:50 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cabbfa3e072392e6e105d733547a07ced449a044 commit cabbfa3e072392e6e105d733547a07ced449a044 Author: Warner Losh AuthorDate: 2021-01-08 00:00:23 +0000 Commit: Warner Losh CommitDate: 2021-01-08 00:05:29 +0000 pccard: Move power_if.m from pccard to cardbus power_if.m is used by both pccard and cardbus. Move it into cardbus. --- sys/conf/files | 2 +- sys/dev/{pccard => cardbus}/power_if.m | 0 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/files b/sys/conf/files index 6597d9e471a4..4a5421936558 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1408,6 +1408,7 @@ dev/cadence/if_cgem.c optional cgem fdt dev/cardbus/cardbus.c optional cardbus dev/cardbus/cardbus_cis.c optional cardbus dev/cardbus/cardbus_device.c optional cardbus +dev/cardbus/power_if.m standard dev/cas/if_cas.c optional cas dev/cfi/cfi_bus_fdt.c optional cfi fdt dev/cfi/cfi_bus_nexus.c optional cfi @@ -2623,7 +2624,6 @@ dev/pccard/pccard.c optional pccard dev/pccard/pccard_cis.c optional pccard dev/pccard/pccard_cis_quirks.c optional pccard dev/pccard/pccard_device.c optional pccard -dev/pccard/power_if.m standard dev/pccbb/pccbb.c optional cbb dev/pccbb/pccbb_pci.c optional cbb pci dev/pcf/pcf.c optional pcf diff --git a/sys/dev/pccard/power_if.m b/sys/dev/cardbus/power_if.m similarity index 100% rename from sys/dev/pccard/power_if.m rename to sys/dev/cardbus/power_if.m From owner-dev-commits-src-all@freebsd.org Fri Jan 8 00:14:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4266C4E1340; Fri, 8 Jan 2021 00:14:09 +0000 (UTC) (envelope-from git@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 4DBk9Y0yZdz4cwy; Fri, 8 Jan 2021 00:14:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 146351A290; Fri, 8 Jan 2021 00:14:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1080E9gN033394; Fri, 8 Jan 2021 00:14:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1080E9CU033393; Fri, 8 Jan 2021 00:14:09 GMT (envelope-from git) Date: Fri, 8 Jan 2021 00:14:09 GMT Message-Id: <202101080014.1080E9CU033393@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 76b4234537b2 - main - BSD.usr.dist: remove aout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 76b4234537b29095e23d11cbde9f01e93e773f5c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 00:14:09 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=76b4234537b29095e23d11cbde9f01e93e773f5c commit 76b4234537b29095e23d11cbde9f01e93e773f5c Author: Ed Maste AuthorDate: 2021-01-08 00:14:01 +0000 Commit: Ed Maste CommitDate: 2021-01-08 00:14:01 +0000 BSD.usr.dist: remove aout Userland a.out support has been removed; kernel aout(5) is unchanged. Sponsored by: The FreeBSD Foundation --- ObsoleteFiles.inc | 4 ++++ etc/mtree/BSD.usr.dist | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 638b27b530f0..eb5a7785b69e 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20210107: retire a.out support +OLD_DIRS+=usr/lib/aout +OLD_DIRS+=usr/lib/compat/aout + # 20210105: remove non widechar version of clang OLD_LIBS+=lib/libncurses.so.9 # 20210103: new clang import which bumps version from 11.0.0 to 11.0.1. diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index f643d5ad269f..375cf3a96447 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -34,8 +34,6 @@ .. .. lib - aout - .. clang 11.0.1 include @@ -61,8 +59,6 @@ .. .. compat - aout - .. .. dtrace .. From owner-dev-commits-src-all@freebsd.org Fri Jan 8 00:14:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 420134E133F; Fri, 8 Jan 2021 00:14:09 +0000 (UTC) (envelope-from git@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 4DBk9Y1D2Vz4cm3; Fri, 8 Jan 2021 00:14:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CE411A291; Fri, 8 Jan 2021 00:14:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1080E97d033411; Fri, 8 Jan 2021 00:14:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1080E9JH033410; Fri, 8 Jan 2021 00:14:09 GMT (envelope-from git) Date: Fri, 8 Jan 2021 00:14:09 GMT Message-Id: <202101080014.1080E9JH033410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 0713c7b88cf0 - main - ldd: Retire aout support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0713c7b88cf08df95a2a2102f81d84b090afb510 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 00:14:09 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=0713c7b88cf08df95a2a2102f81d84b090afb510 commit 0713c7b88cf08df95a2a2102f81d84b090afb510 Author: Ed Maste AuthorDate: 2021-01-08 00:14:01 +0000 Commit: Ed Maste CommitDate: 2021-01-08 00:14:01 +0000 ldd: Retire aout support Userland aout support has not been required since FreeBSD 2.x. If someone needs to use FreeBSD 2 shared libraries they will be best served by using a FreeBSD 2 ldd, perhaps as part of a jail with a full FreeBSD 2.x install. Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27478 --- usr.bin/ldd/Makefile | 3 - usr.bin/ldd/extern.h | 32 --- usr.bin/ldd/ldd.c | 38 ---- usr.bin/ldd/sods.c | 573 --------------------------------------------------- 4 files changed, 646 deletions(-) diff --git a/usr.bin/ldd/Makefile b/usr.bin/ldd/Makefile index fd2b7b4d9ccb..5d2beb7bb6c0 100644 --- a/usr.bin/ldd/Makefile +++ b/usr.bin/ldd/Makefile @@ -2,8 +2,5 @@ PROG?= ldd SRCS= ldd.c -.if ${MACHINE_CPUARCH} == "i386" -SRCS+= sods.c -.endif .include diff --git a/usr.bin/ldd/extern.h b/usr.bin/ldd/extern.h deleted file mode 100644 index 840ca0ea52db..000000000000 --- a/usr.bin/ldd/extern.h +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2002 FreeBSD, Inc - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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$ - */ - -extern void dump_file(const char *); -extern int error_count; - diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index f4e76368b31e..892cf9bb3cc5 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -48,14 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "extern.h" - -/* We don't support a.out executables on arm64 and riscv */ -#if !defined(__aarch64__) && !defined(__riscv) -#include -#define AOUT_SUPPORTED -#endif - /* * 32-bit ELF data structures can only be used if the system header[s] declare * them. There is no official macro for determining whether they are declared, @@ -80,7 +72,6 @@ static int is_executable(const char *fname, int fd, int *is_shlib, static void usage(void); #define TYPE_UNKNOWN 0 -#define TYPE_AOUT 1 #define TYPE_ELF 2 /* Architecture default */ #if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) #define TYPE_ELF32 3 /* Explicit 32 bits on architectures >32 bits */ @@ -178,14 +169,6 @@ main(int argc, char *argv[]) /* NOTREACHED */ } -#ifdef __i386__ - if (vflag) { - for (c = 0; c < argc; c++) - dump_file(argv[c]); - exit(error_count == 0 ? EXIT_SUCCESS : EXIT_FAILURE); - } -#endif - rval = 0; for (; argc > 0; argc--, argv++) { int fd, status, is_shlib, rv, type; @@ -204,7 +187,6 @@ main(int argc, char *argv[]) switch (type) { case TYPE_ELF: - case TYPE_AOUT: break; #if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) case TYPE_ELF32: @@ -281,9 +263,6 @@ static int is_executable(const char *fname, int fd, int *is_shlib, int *type) { union { -#ifdef AOUT_SUPPORTED - struct exec aout; -#endif #if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) Elf32_Ehdr elf32; #endif @@ -307,23 +286,6 @@ is_executable(const char *fname, int fd, int *is_shlib, int *type) return (0); } -#ifdef AOUT_SUPPORTED - if ((size_t)n >= sizeof(hdr.aout) && !N_BADMAG(hdr.aout)) { - /* a.out file */ - if ((N_GETFLAG(hdr.aout) & EX_DPMASK) != EX_DYNAMIC -#if 1 /* Compatibility */ - || hdr.aout.a_entry < __LDPGSZ -#endif - ) { - warnx("%s: not a dynamic executable", fname); - return (0); - } - *type = TYPE_AOUT; - warnx("%s: aout support is deprecated", fname); - return (1); - } -#endif - #if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) if ((size_t)n >= sizeof(hdr.elf32) && IS_ELF(hdr.elf32) && hdr.elf32.e_ident[EI_CLASS] == ELFCLASS32) { diff --git a/usr.bin/ldd/sods.c b/usr.bin/ldd/sods.c deleted file mode 100644 index d65b0c82899d..000000000000 --- a/usr.bin/ldd/sods.c +++ /dev/null @@ -1,573 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (C) 1996-1997 John D. Polstra. 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 JOHN D. POLSTRA 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 JOHN D. POLSTRA 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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "extern.h" - -#define PAGE_SIZE 4096 /* i386 specific */ - -#ifndef N_SETA -#define N_SETA 0x14 /* Absolute set element symbol */ -#endif /* This is input to LD, in a .o file. */ - -#ifndef N_SETT -#define N_SETT 0x16 /* Text set element symbol */ -#endif /* This is input to LD, in a .o file. */ - -#ifndef N_SETD -#define N_SETD 0x18 /* Data set element symbol */ -#endif /* This is input to LD, in a .o file. */ - -#ifndef N_SETB -#define N_SETB 0x1A /* Bss set element symbol */ -#endif /* This is input to LD, in a .o file. */ - -#ifndef N_SETV -#define N_SETV 0x1C /* Pointer to set vector in data area. */ -#endif /* This is output from LD. */ - -#ifdef STANDALONE -static -#endif - -static void dump_rels(const char *, const struct relocation_info *, - unsigned long, const char *(*)(unsigned long), unsigned char *); -static void dump_segs(void); -static void dump_sods(void); -static void dump_sym(const struct nlist *); -static void dump_syms(void); - -static void dump_rtsyms(void); - -static const char *rtsym_name(unsigned long); -static const char *sym_name(unsigned long); - -#ifdef STANDALONE -static -#endif -int error_count; - -/* - * Variables ending in _base are pointers to things in our address space, - * i.e., in the file itself. - * - * Variables ending in _addr are adjusted according to where things would - * actually appear in memory if the file were loaded. - */ -static const char *file_base; -static const char *text_base; -static const char *data_base; -static const struct relocation_info *rel_base; -static const struct nlist *sym_base; -static const char *str_base; - -static const struct relocation_info *rtrel_base; -static const struct nzlist *rtsym_base; -static const char *rtstr_base; - -static const struct exec *ex; -static const struct _dynamic *dyn; -static const struct section_dispatch_table *sdt; - -static const char *text_addr; -static const char *data_addr; - -static unsigned long rel_count; -static unsigned long sym_count; - -static unsigned long rtrel_count; -static unsigned long rtsym_count; - -/* Dynamically allocated flags, 1 byte per symbol, to record whether each - symbol was referenced by a relocation entry. */ -static unsigned char *sym_used; -static unsigned char *rtsym_used; - -static unsigned long origin; /* What values are relocated relative to */ - -#ifdef STANDALONE -int -main(int argc, char *argv[]) -{ - int i; - - for (i = 1; i < argc; ++i) - dump_file(argv[i]); - - return error_count == 0 ? EXIT_SUCCESS : EXIT_FAILURE; -} -#endif - -static inline const void *align_struct(const void *expr) -{ - assert(!(((int)expr) & 3)); - return expr; -} - -static inline const void *align_long(const void *expr) -{ - assert(!(((int)expr) & 3)); - return expr; -} - -static inline const void *align_short(const void *expr) -{ - assert(!(((int)expr) & 1)); - return expr; -} - -#ifdef STANDALONE -static -#endif -void -dump_file(const char *fname) -{ - int fd; - struct stat sb; - caddr_t objbase; - - if (stat(fname, &sb) == -1) { - warnx("cannot stat \"%s\"", fname); - ++error_count; - return; - } - - if ((sb.st_mode & S_IFMT) != S_IFREG) { - warnx("\"%s\" is not a regular file", fname); - ++error_count; - return; - } - - if ((fd = open(fname, O_RDONLY, 0)) == -1) { - warnx("cannot open \"%s\"", fname); - ++error_count; - return; - } - - objbase = mmap(0, sb.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (objbase == (caddr_t) -1) { - warnx("cannot mmap \"%s\"", fname); - ++error_count; - close(fd); - return; - } - - close(fd); - - file_base = (const char *) objbase; /* Makes address arithmetic easier */ - - if (IS_ELF(*(const Elf32_Ehdr*) align_struct(file_base))) { - warnx("%s: this is an ELF program; use readelf to examine", fname); - ++error_count; - munmap(objbase, sb.st_size); - return; - } - - ex = (const struct exec *) align_struct(file_base); - - printf("%s: a_midmag = 0x%lx\n", fname, (long)ex->a_midmag); - printf(" magic = 0x%lx = 0%lo, netmagic = 0x%lx = 0%lo\n", - (long)N_GETMAGIC(*ex), (long)N_GETMAGIC(*ex), - (long)N_GETMAGIC_NET(*ex), (long)N_GETMAGIC_NET(*ex)); - - if (N_BADMAG(*ex)) { - warnx("%s: bad magic number", fname); - ++error_count; - munmap(objbase, sb.st_size); - return; - } - - printf(" a_text = 0x%lx\n", (long)ex->a_text); - printf(" a_data = 0x%lx\n", (long)ex->a_data); - printf(" a_bss = 0x%lx\n", (long)ex->a_bss); - printf(" a_syms = 0x%lx\n", (long)ex->a_syms); - printf(" a_entry = 0x%lx\n", (long)ex->a_entry); - printf(" a_trsize = 0x%lx\n", (long)ex->a_trsize); - printf(" a_drsize = 0x%lx\n", (long)ex->a_drsize); - - text_base = file_base + N_TXTOFF(*ex); - data_base = file_base + N_DATOFF(*ex); - rel_base = (const struct relocation_info *) - align_struct(file_base + N_RELOFF(*ex)); - sym_base = (const struct nlist *) align_struct(file_base + N_SYMOFF(*ex)); - str_base = file_base + N_STROFF(*ex); - - rel_count = (ex->a_trsize + ex->a_drsize) / sizeof rel_base[0]; - assert(rel_count * sizeof rel_base[0] == ex->a_trsize + ex->a_drsize); - sym_count = ex->a_syms / sizeof sym_base[0]; - assert(sym_count * sizeof sym_base[0] == ex->a_syms); - - if (sym_count != 0) { - sym_used = (unsigned char *) calloc(sym_count, sizeof(unsigned char)); - assert(sym_used != NULL); - } - - printf(" Entry = 0x%lx\n", (long)ex->a_entry); - printf(" Text offset = %x, address = %lx\n", N_TXTOFF(*ex), - (long)N_TXTADDR(*ex)); - printf(" Data offset = %lx, address = %lx\n", (long)N_DATOFF(*ex), - (long)N_DATADDR(*ex)); - - /* - * In an executable program file, everything is relocated relative to - * the assumed run-time load address, i.e., N_TXTADDR(*ex), i.e., 0x1000. - * - * In a shared library file, everything is relocated relative to the - * start of the file, i.e., N_TXTOFF(*ex), i.e., 0. - * - * The way to tell the difference is by looking at ex->a_entry. If it - * is >= 0x1000, then we have an executable program. Otherwise, we - * have a shared library. - * - * When a program is executed, the entire file is mapped into memory, - * including the a.out header and so forth. But it is not mapped at - * address 0; rather it is mapped at address 0x1000. The first page - * of the user's address space is left unmapped in order to catch null - * pointer dereferences. - * - * In this program, when we map in an executable program, we have to - * simulate the empty page by decrementing our assumed base address by - * a pagesize. - */ - - text_addr = text_base; - data_addr = data_base; - origin = 0; - - if (ex->a_entry >= PAGE_SIZE) { /* Executable, not a shared library */ - /* - * The fields in the object have already been relocated on the - * assumption that the object will be loaded at N_TXTADDR(*ex). - * We have to compensate for that. - */ - text_addr -= PAGE_SIZE; - data_addr -= PAGE_SIZE; - origin = PAGE_SIZE; - printf(" Program, origin = %lx\n", origin); - } else if (N_GETFLAG(*ex) & EX_DYNAMIC) - printf(" Shared library, origin = %lx\n", origin); - else - printf(" Object file, origin = %lx\n", origin); - - if (N_GETFLAG(*ex) & EX_DYNAMIC) { - dyn = (const struct _dynamic *) align_struct(data_base); - printf(" Dynamic version = %d\n", dyn->d_version); - - sdt = (const struct section_dispatch_table *) - align_struct(text_addr + (unsigned long) dyn->d_un.d_sdt); - - rtrel_base = (const struct relocation_info *) - align_struct(text_addr + sdt->sdt_rel); - rtrel_count = (sdt->sdt_hash - sdt->sdt_rel) / sizeof rtrel_base[0]; - assert(rtrel_count * sizeof rtrel_base[0] == - (size_t)(sdt->sdt_hash - sdt->sdt_rel)); - - rtsym_base = (const struct nzlist *) - align_struct(text_addr + sdt->sdt_nzlist); - rtsym_count = (sdt->sdt_strings - sdt->sdt_nzlist) / - sizeof rtsym_base[0]; - assert(rtsym_count * sizeof rtsym_base[0] == - (size_t)(sdt->sdt_strings - sdt->sdt_nzlist)); - - if (rtsym_count != 0) { - rtsym_used = (unsigned char *) calloc(rtsym_count, - sizeof(unsigned char)); - assert(rtsym_used != NULL); - } - - rtstr_base = text_addr + sdt->sdt_strings; - } - - dump_segs(); - dump_sods(); - dump_rels("Relocations", rel_base, rel_count, sym_name, sym_used); - dump_syms(); - - dump_rels("Run-time relocations", rtrel_base, rtrel_count, rtsym_name, - rtsym_used); - dump_rtsyms(); - - if (rtsym_used != NULL) { - free(rtsym_used); - rtsym_used = NULL; - } - if (sym_used != NULL) { - free(sym_used); - sym_used = NULL; - } - munmap(objbase, sb.st_size); -} - -static void -dump_rels(const char *label, const struct relocation_info *base, - unsigned long count, const char *(*name)(unsigned long), - unsigned char *sym_used_flags) -{ - unsigned long i; - - printf(" %s:\n", label); - for (i = 0; i < count; ++i) { - const struct relocation_info *r = &base[i]; - unsigned int size; - char contents[16]; - - size = 1u << r->r_length; - - if (origin <= (unsigned long)r->r_address - && (unsigned long)r->r_address < origin + ex->a_text + ex->a_data - && 1 <= size && size <= 4) { - /* - * XXX - This can cause unaligned accesses. OK for the - * i386, not so for other architectures. - */ - switch (size) { - case 1: - snprintf(contents, sizeof contents, " [%02x]", - *(unsigned const char *)(text_addr + r->r_address)); - break; - case 2: - snprintf(contents, sizeof contents, " [%04x]", - *(unsigned const short *) - align_short(text_addr + r->r_address)); - break; - case 4: - snprintf(contents, sizeof contents, "[%08lx]", - *(unsigned const long *) - align_long(text_addr + r->r_address)); - break; - } - } else - snprintf(contents, sizeof contents, " "); - - printf(" %6lu %8x/%u %s %c%c%c%c%c%c", i, - r->r_address, size, - contents, - r->r_extern ? 'e' : '-', - r->r_jmptable ? 'j' : '-', - r->r_relative ? 'r' : '-', - r->r_baserel ? 'b' : '-', - r->r_pcrel ? 'p' : '-', - r->r_copy ? 'c' : '-'); - - if (r->r_extern || r->r_baserel || r->r_jmptable || r->r_copy) { - printf(" %4u %s", r->r_symbolnum, name(r->r_symbolnum)); - sym_used_flags[r->r_symbolnum] = 1; - } - - printf("\n"); - } -} - -static void -dump_rtsyms(void) -{ - unsigned long i; - - printf(" Run-time symbols:\n"); - for (i = 0; i < rtsym_count; ++i) { - printf(" %6lu%c ", i, rtsym_used[i] ? '*' : ' '); - dump_sym(&rtsym_base[i].nlist); - printf("/%-5ld %s\n", rtsym_base[i].nz_size, rtsym_name(i)); - } -} - -static void -dump_segs(void) -{ - printf(" Text segment starts at address %lx\n", origin + N_TXTOFF(*ex)); - if (N_GETFLAG(*ex) & EX_DYNAMIC) { - printf(" rel starts at %lx\n", sdt->sdt_rel); - printf(" hash starts at %lx\n", sdt->sdt_hash); - printf(" nzlist starts at %lx\n", sdt->sdt_nzlist); - printf(" strings starts at %lx\n", sdt->sdt_strings); - } - - printf(" Data segment starts at address %lx\n", origin + N_DATOFF(*ex)); - if (N_GETFLAG(*ex) & EX_DYNAMIC) { - printf(" _dynamic starts at %lx\n", origin + N_DATOFF(*ex)); - printf(" so_debug starts at %lx\n", (unsigned long) dyn->d_debug); - printf(" sdt starts at %lx\n", (unsigned long) dyn->d_un.d_sdt); - printf(" got starts at %lx\n", sdt->sdt_got); - printf(" plt starts at %lx\n", sdt->sdt_plt); - printf(" rest of stuff starts at %lx\n", - sdt->sdt_plt + sdt->sdt_plt_sz); - } -} - -static void -dump_sods(void) -{ - long sod_offset; - long paths_offset; - - if (dyn == NULL) /* Not a shared object */ - return; - - sod_offset = sdt->sdt_sods; - printf(" Shared object dependencies:\n"); - while (sod_offset != 0) { - const struct sod *sodp = (const struct sod *) align_struct((text_addr + sod_offset)); - const char *name = (const char *) (text_addr + sodp->sod_name); - - if (sodp->sod_library) - printf(" -l%-16s version %d.%d\n", name, sodp->sod_major, - sodp->sod_minor); - else - printf(" %s\n", name); - sod_offset = sodp->sod_next; - } - paths_offset = sdt->sdt_paths; - printf(" Shared object additional paths:\n"); - if (paths_offset != 0) { - printf(" %s\n", (const char *)(text_addr + paths_offset)); - } else { - printf(" (none)\n"); - } -} - -static void -dump_sym(const struct nlist *np) -{ - char type[8]; - char aux[8]; - char weak; - char *p; - - switch (np->n_type & ~N_EXT) { - case N_UNDF: strcpy(type, "undf"); break; - case N_ABS: strcpy(type, "abs"); break; - case N_TEXT: strcpy(type, "text"); break; - case N_DATA: strcpy(type, "data"); break; - case N_BSS: strcpy(type, "bss"); break; - case N_INDR: strcpy(type, "indr"); break; - case N_SIZE: strcpy(type, "size"); break; - case N_COMM: strcpy(type, "comm"); break; - case N_SETA: strcpy(type, "seta"); break; - case N_SETT: strcpy(type, "sett"); break; - case N_SETD: strcpy(type, "setd"); break; - case N_SETB: strcpy(type, "setb"); break; - case N_SETV: strcpy(type, "setv"); break; - case N_FN: strcpy(type, np->n_type&N_EXT ? "fn" : "warn"); break; - case N_GSYM: strcpy(type, "gsym"); break; - case N_FNAME: strcpy(type, "fname"); break; - case N_FUN: strcpy(type, "fun"); break; - case N_STSYM: strcpy(type, "stsym"); break; - case N_LCSYM: strcpy(type, "lcsym"); break; - case N_MAIN: strcpy(type, "main"); break; - case N_PC: strcpy(type, "pc"); break; - case N_RSYM: strcpy(type, "rsym"); break; - case N_SLINE: strcpy(type, "sline"); break; - case N_DSLINE: strcpy(type, "dsline"); break; - case N_BSLINE: strcpy(type, "bsline"); break; - case N_SSYM: strcpy(type, "ssym"); break; - case N_SO: strcpy(type, "so"); break; - case N_LSYM: strcpy(type, "lsym"); break; - case N_BINCL: strcpy(type, "bincl"); break; - case N_SOL: strcpy(type, "sol"); break; - case N_PSYM: strcpy(type, "psym"); break; - case N_EINCL: strcpy(type, "eincl"); break; - case N_ENTRY: strcpy(type, "entry"); break; - case N_LBRAC: strcpy(type, "lbrac"); break; - case N_EXCL: strcpy(type, "excl"); break; - case N_RBRAC: strcpy(type, "rbrac"); break; - case N_BCOMM: strcpy(type, "bcomm"); break; - case N_ECOMM: strcpy(type, "ecomm"); break; - case N_ECOML: strcpy(type, "ecoml"); break; - case N_LENG: strcpy(type, "leng"); break; - default: - snprintf(type, sizeof type, "%#02x", np->n_type); - break; - } - - if (np->n_type & N_EXT && type[0] != '0') - for (p = type; *p != '\0'; ++p) - *p = toupper(*p); - - switch (N_AUX(np)) { - case 0: strcpy(aux, ""); break; - case AUX_OBJECT: strcpy(aux, "objt"); break; - case AUX_FUNC: strcpy(aux, "func"); break; - default: snprintf(aux, sizeof aux, "%#01x", N_AUX(np)); break; - } - - weak = N_BIND(np) == BIND_WEAK ? 'w' : ' '; - - printf("%c%-6s %-4s %8lx", weak, type, aux, np->n_value); -} - -static void -dump_syms(void) -{ - unsigned long i; - - printf(" Symbols:\n"); - for (i = 0; i < sym_count; ++i) { - printf(" %6lu%c ", i, sym_used[i] ? '*' : ' '); - dump_sym(&sym_base[i]); - printf(" %s\n", sym_name(i)); - } -} - -static const char * -rtsym_name(unsigned long n) -{ - assert(n < rtsym_count); - if (rtsym_base[n].nz_strx == 0) - return ""; - return rtstr_base + rtsym_base[n].nz_strx; -} - -static const char * -sym_name(unsigned long n) -{ - assert(n < sym_count); - if (sym_base[n].n_un.n_strx == 0) - return ""; - return str_base + sym_base[n].n_un.n_strx; -} From owner-dev-commits-src-all@freebsd.org Fri Jan 8 00:15:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4D89D4E136C; Fri, 8 Jan 2021 00:15:26 +0000 (UTC) (envelope-from git@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 4DBkC21jMHz4dFW; Fri, 8 Jan 2021 00:15:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D6B719F68; Fri, 8 Jan 2021 00:15:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1080FQTr033730; Fri, 8 Jan 2021 00:15:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1080FQfT033729; Fri, 8 Jan 2021 00:15:26 GMT (envelope-from git) Date: Fri, 8 Jan 2021 00:15:26 GMT Message-Id: <202101080015.1080FQfT033729@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 81098ca81dd0 - main - Set current date in to placeholders. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 81098ca81dd09514f702f8087d01f66b6156f95c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 00:15:26 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=81098ca81dd09514f702f8087d01f66b6156f95c commit 81098ca81dd09514f702f8087d01f66b6156f95c Author: Vladimir Kondratyev AuthorDate: 2021-01-08 00:13:11 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-08 00:15:07 +0000 Set current date in to placeholders. --- UPDATING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 77b4bacdc6c0..a2647870235f 100644 --- a/UPDATING +++ b/UPDATING @@ -26,7 +26,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) -2021XXXX: +20210107: Transport-independent parts of HID support have been split off the USB code in to separate subsystem. Kernel configs which include one of ums, ukbd, uhid, atp, wsp, wmt, uaudio, ugold or ucycom drivers should From owner-dev-commits-src-all@freebsd.org Fri Jan 8 00:16:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AC5D44E179D; Fri, 8 Jan 2021 00:16:58 +0000 (UTC) (envelope-from git@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 4DBkDp4Vc1z4dHs; Fri, 8 Jan 2021 00:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CB3619FDD; Fri, 8 Jan 2021 00:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1080Gw1h034078; Fri, 8 Jan 2021 00:16:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1080GwQo034077; Fri, 8 Jan 2021 00:16:58 GMT (envelope-from git) Date: Fri, 8 Jan 2021 00:16:58 GMT Message-Id: <202101080016.1080GwQo034077@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Thomas Munro Subject: git: 801ac943ea08 - main - aio_fsync(2): Support O_DSYNC. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tmunro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 801ac943ea0821bbb34c69688a7e7bb126d8cf8d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 00:16:58 -0000 The branch main has been updated by tmunro: URL: https://cgit.FreeBSD.org/src/commit/?id=801ac943ea0821bbb34c69688a7e7bb126d8cf8d commit 801ac943ea0821bbb34c69688a7e7bb126d8cf8d Author: Thomas Munro AuthorDate: 2021-01-07 11:11:38 +0000 Commit: Thomas Munro CommitDate: 2021-01-08 00:15:56 +0000 aio_fsync(2): Support O_DSYNC. aio_fsync(O_DSYNC, ...) is the asynchronous version of fdatasync(2). Reviewed by: kib, asomers, jhb Differential Review: https://reviews.freebsd.org/D25071 --- lib/libc/sys/aio_fsync.2 | 18 ++++++++++++++---- sys/kern/vfs_aio.c | 37 ++++++++++++++++++++++++++++--------- sys/sys/aio.h | 1 + tests/sys/aio/aio_test.c | 23 ++++++++++++++++++----- 4 files changed, 61 insertions(+), 18 deletions(-) diff --git a/lib/libc/sys/aio_fsync.2 b/lib/libc/sys/aio_fsync.2 index 9d5d143416b3..0ce47edfb33f 100644 --- a/lib/libc/sys/aio_fsync.2 +++ b/lib/libc/sys/aio_fsync.2 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 19, 2016 +.Dd January 6, 2021 .Dt AIO_FSYNC 2 .Os .Sh NAME @@ -49,11 +49,15 @@ completed at the time the call returns. .Pp The .Fa op -argument can only be set to +argument can be set to .Dv O_SYNC to cause all currently queued I/O operations to be completed as if by a call to -.Xr fsync 2 . +.Xr fsync 2 , +or +.Dv O_DSYNC +for the behavior of +.Xr fdatasync 2 . .Pp If _POSIX_PRIORITIZED_IO is defined, and the descriptor supports it, then the enqueued operation is submitted at a priority equal to that @@ -112,7 +116,9 @@ are unsafe and unsafe asynchronous I/O operations are disabled. A value of the .Fa op argument is not set to -.Dv O_SYNC . +.Dv O_SYNC +or +.Dv O_DSYNC . .El .Pp The following conditions may be synchronously detected when the @@ -176,3 +182,7 @@ The .Fn aio_fsync system call first appeared in .Fx 7.0 . +The +.Dv O_DSYNC +option appeared in +.Fx 13.0 . diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index d83c9d725e68..8666d6ea4217 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -718,10 +718,10 @@ restart: /* * Move all data to a permanent storage device. This code - * simulates the fsync syscall. + * simulates the fsync and fdatasync syscalls. */ static int -aio_fsync_vnode(struct thread *td, struct vnode *vp) +aio_fsync_vnode(struct thread *td, struct vnode *vp, int op) { struct mount *mp; int error; @@ -734,7 +734,10 @@ aio_fsync_vnode(struct thread *td, struct vnode *vp) vm_object_page_clean(vp->v_object, 0, 0, 0); VM_OBJECT_WUNLOCK(vp->v_object); } - error = VOP_FSYNC(vp, MNT_WAIT, td); + if (op == LIO_DSYNC) + error = VOP_FDATASYNC(vp, td); + else + error = VOP_FSYNC(vp, MNT_WAIT, td); VOP_UNLOCK(vp); vn_finished_write(mp); @@ -838,12 +841,15 @@ aio_process_sync(struct kaiocb *job) struct file *fp = job->fd_file; int error = 0; - KASSERT(job->uaiocb.aio_lio_opcode == LIO_SYNC, + KASSERT(job->uaiocb.aio_lio_opcode == LIO_SYNC || + job->uaiocb.aio_lio_opcode == LIO_DSYNC, ("%s: opcode %d", __func__, job->uaiocb.aio_lio_opcode)); td->td_ucred = job->cred; - if (fp->f_vnode != NULL) - error = aio_fsync_vnode(td, fp->f_vnode); + if (fp->f_vnode != NULL) { + error = aio_fsync_vnode(td, fp->f_vnode, + job->uaiocb.aio_lio_opcode); + } td->td_ucred = td_savedcred; if (error) aio_complete(job, -1, error); @@ -1579,6 +1585,7 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj, error = fget_read(td, fd, &cap_pread_rights, &fp); break; case LIO_SYNC: + case LIO_DSYNC: error = fget(td, fd, &cap_fsync_rights, &fp); break; case LIO_MLOCK: @@ -1592,7 +1599,7 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj, if (error) goto err3; - if (opcode == LIO_SYNC && fp->f_vnode == NULL) { + if ((opcode == LIO_SYNC || opcode == LIO_DSYNC) && fp->f_vnode == NULL) { error = EINVAL; goto err3; } @@ -1805,10 +1812,12 @@ aio_queue_file(struct file *fp, struct kaiocb *job) error = 0; break; case LIO_SYNC: + case LIO_DSYNC: AIO_LOCK(ki); TAILQ_FOREACH(job2, &ki->kaio_jobqueue, plist) { if (job2->fd_file == job->fd_file && job2->uaiocb.aio_lio_opcode != LIO_SYNC && + job2->uaiocb.aio_lio_opcode != LIO_DSYNC && job2->seqno < job->seqno) { job2->jobflags |= KAIOCB_CHECKSYNC; job->pending++; @@ -2587,10 +2596,20 @@ static int kern_aio_fsync(struct thread *td, int op, struct aiocb *ujob, struct aiocb_ops *ops) { + int listop; - if (op != O_SYNC) /* XXX lack of O_DSYNC */ + switch (op) { + case O_SYNC: + listop = LIO_SYNC; + break; + case O_DSYNC: + listop = LIO_DSYNC; + break; + default: return (EINVAL); - return (aio_aqueue(td, ujob, NULL, LIO_SYNC, ops)); + } + + return (aio_aqueue(td, ujob, NULL, listop, ops)); } int diff --git a/sys/sys/aio.h b/sys/sys/aio.h index c0e2b4eaaaf6..dbfbadcd1254 100644 --- a/sys/sys/aio.h +++ b/sys/sys/aio.h @@ -48,6 +48,7 @@ #define LIO_MLOCK 0x4 #define LIO_WRITEV 0x5 #define LIO_READV 0x6 +#define LIO_DSYNC 0x7 #endif /* diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c index 891892e5e757..f563ec5fa5d9 100644 --- a/tests/sys/aio/aio_test.c +++ b/tests/sys/aio/aio_test.c @@ -1259,7 +1259,7 @@ ATF_TC_BODY(aio_fsync_errors, tc) ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); unlink(FILE_PATHNAME); - /* aio_fsync should return EINVAL unless op is O_SYNC */ + /* aio_fsync should return EINVAL unless op is O_SYNC or O_DSYNC */ memset(&iocb, 0, sizeof(iocb)); iocb.aio_fildes = fd; ATF_CHECK_EQ(-1, aio_fsync(666, &iocb)); @@ -1282,8 +1282,8 @@ ATF_TC_BODY(aio_fsync_errors, tc) /* * This test just performs a basic test of aio_fsync(). */ -ATF_TC_WITHOUT_HEAD(aio_fsync_test); -ATF_TC_BODY(aio_fsync_test, tc) +static void +aio_fsync_test(int op) { struct aiocb synccb, *iocbp; struct { @@ -1328,7 +1328,7 @@ ATF_TC_BODY(aio_fsync_test, tc) /* Queue the aio_fsync request. */ memset(&synccb, 0, sizeof(synccb)); synccb.aio_fildes = fd; - ATF_REQUIRE(aio_fsync(O_SYNC, &synccb) == 0); + ATF_REQUIRE(aio_fsync(op, &synccb) == 0); /* Wait for requests to complete. */ for (;;) { @@ -1359,6 +1359,18 @@ ATF_TC_BODY(aio_fsync_test, tc) close(fd); } +ATF_TC_WITHOUT_HEAD(aio_fsync_sync_test); +ATF_TC_BODY(aio_fsync_sync_test, tc) +{ + aio_fsync_test(O_SYNC); +} + +ATF_TC_WITHOUT_HEAD(aio_fsync_dsync_test); +ATF_TC_BODY(aio_fsync_dsync_test, tc) +{ + aio_fsync_test(O_DSYNC); +} + /* * We shouldn't be able to DoS the system by setting iov_len to an insane * value @@ -1782,7 +1794,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, md_thread); ATF_TP_ADD_TC(tp, md_waitcomplete); ATF_TP_ADD_TC(tp, aio_fsync_errors); - ATF_TP_ADD_TC(tp, aio_fsync_test); + ATF_TP_ADD_TC(tp, aio_fsync_sync_test); + ATF_TP_ADD_TC(tp, aio_fsync_dsync_test); ATF_TP_ADD_TC(tp, aio_large_read_test); ATF_TP_ADD_TC(tp, aio_socket_two_reads); ATF_TP_ADD_TC(tp, aio_socket_blocking_short_write); From owner-dev-commits-src-all@freebsd.org Fri Jan 8 00:16:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DA56E4E1805; Fri, 8 Jan 2021 00:16:58 +0000 (UTC) (envelope-from git@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 4DBkDp5tvrz4dHt; Fri, 8 Jan 2021 00:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B190819F69; Fri, 8 Jan 2021 00:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1080Gwb4034112; Fri, 8 Jan 2021 00:16:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1080Gwu5034111; Fri, 8 Jan 2021 00:16:58 GMT (envelope-from git) Date: Fri, 8 Jan 2021 00:16:58 GMT Message-Id: <202101080016.1080Gwu5034111@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Thomas Munro Subject: git: a5e284038edc - main - open(2): Add O_DSYNC flag. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tmunro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a5e284038edc36b0447f1e6337419a3c0ea1788d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 00:16:58 -0000 The branch main has been updated by tmunro: URL: https://cgit.FreeBSD.org/src/commit/?id=a5e284038edc36b0447f1e6337419a3c0ea1788d commit a5e284038edc36b0447f1e6337419a3c0ea1788d Author: Thomas Munro AuthorDate: 2021-01-07 10:46:51 +0000 Commit: Thomas Munro CommitDate: 2021-01-08 00:15:56 +0000 open(2): Add O_DSYNC flag. POSIX O_DSYNC means that writes include an implicit fdatasync(2), just as O_SYNC implies fsync(2). VOP_WRITE() functions that understand the new IO_DATASYNC flag can act accordingly, but we'll still pass down IO_SYNC so that file systems that don't understand it will continue to provide the stronger O_SYNC behaviour. Flag also applies to fcntl(2). Reviewed by: kib, delphij Differential Revision: https://reviews.freebsd.org/D25090 --- lib/libc/sys/fcntl.2 | 19 +++++++++++++++++-- lib/libc/sys/open.2 | 20 +++++++++++++------- .../openzfs/include/os/freebsd/spl/sys/ccompile.h | 1 - .../openzfs/include/os/freebsd/spl/sys/vnode.h | 2 ++ sys/kern/vfs_vnops.c | 7 +++++++ sys/sys/fcntl.h | 15 +++++++++------ sys/sys/vnode.h | 1 + 7 files changed, 49 insertions(+), 16 deletions(-) diff --git a/lib/libc/sys/fcntl.2 b/lib/libc/sys/fcntl.2 index 9793024f48ed..33ad7a5673e1 100644 --- a/lib/libc/sys/fcntl.2 +++ b/lib/libc/sys/fcntl.2 @@ -28,7 +28,7 @@ .\" @(#)fcntl.2 8.2 (Berkeley) 1/12/94 .\" $FreeBSD$ .\" -.Dd January 17, 2020 +.Dd January 6, 2021 .Dt FCNTL 2 .Os .Sh NAME @@ -196,7 +196,7 @@ The flags for the .Dv F_GETFL and .Dv F_SETFL -flags are as follows: +commands are as follows: .Bl -tag -width O_NONBLOCKX .It Dv O_NONBLOCK Non-blocking I/O; if no data is available to a @@ -225,6 +225,21 @@ Enable the signal to be sent to the process group when I/O is possible, e.g., upon availability of data to be read. +.It Dv O_SYNC +Enable synchronous writes. +Corresponds to the +.Dv O_SYNC +flag of +.Xr open 2 . +.Dv O_FSYNC +is an historical synonym for +.Dv O_SYNC . +.It Dv O_DSYNC +Enable synchronous data writes. +Corresponds to the +.Dv O_DSYNC +flag of +.Xr open 2 . .El .Pp The seals that may be applied with diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index d0918fb02eee..e43d012770df 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -181,8 +181,9 @@ O_EXCL error if create and file exists O_SHLOCK atomically obtain a shared lock O_EXLOCK atomically obtain an exclusive lock O_DIRECT eliminate or reduce cache effects -O_FSYNC synchronous writes +O_FSYNC synchronous writes (historical synonym for O_SYNC) O_SYNC synchronous writes +O_DSYNC synchronous data writes O_NOFOLLOW do not follow symlinks O_NOCTTY ignored O_TTY_INIT ignored @@ -230,15 +231,18 @@ returns immediately. The descriptor remains in non-blocking mode for subsequent operations. .Pp If -.Dv O_FSYNC +.Dv O_SYNC is used in the mask, all writes will immediately and synchronously be written to disk. -.Pp -.Dv O_SYNC -is a synonym for .Dv O_FSYNC -required by -.Tn POSIX . +is an historical synonym for +.Dv O_SYNC . +.Pp +If +.Dv O_DSYNC +is used in the mask, all data and metadata required to read the data will be +synchronously written to disk, but changes to metadata such as file access and +modification timestamps may be written later. .Pp If .Dv O_NOFOLLOW @@ -651,6 +655,8 @@ The .Fn openat function was introduced in .Fx 8.0 . +.Dv O_DSYNC +appeared in 13.0. .Sh BUGS The Open Group Extended API Set 2 specification requires that the test for whether diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h index a02e8f098540..524b81e68e61 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h @@ -168,7 +168,6 @@ extern "C" { #define O_LARGEFILE 0 #define O_RSYNC 0 -#define O_DSYNC 0 #ifndef LOCORE #ifndef HAVE_RPC_TYPES diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h index 6a6146132765..fa7bbd88c6c8 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/vnode.h @@ -127,7 +127,9 @@ vn_is_readonly(vnode_t *vp) #define FCREAT O_CREAT #define FTRUNC O_TRUNC #define FEXCL O_EXCL +#ifndef FDSYNC #define FDSYNC FFSYNC +#endif #define FRSYNC FFSYNC #define FSYNC FFSYNC #define FOFFMAX 0x00 diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 2ca2cf124c23..de5cd68501a7 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1066,6 +1066,13 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, if ((fp->f_flag & O_FSYNC) || (vp->v_mount && (vp->v_mount->mnt_flag & MNT_SYNCHRONOUS))) ioflag |= IO_SYNC; + /* + * For O_DSYNC we set both IO_SYNC and IO_DATASYNC, so that VOP_WRITE() + * implementations that don't understand IO_DATASYNC fall back to full + * O_SYNC behavior. + */ + if (fp->f_flag & O_DSYNC) + ioflag |= IO_SYNC | IO_DATASYNC; mp = NULL; if (vp->v_type != VCHR && (error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h index 2f424d173949..e2597726c53b 100644 --- a/sys/sys/fcntl.h +++ b/sys/sys/fcntl.h @@ -141,8 +141,10 @@ typedef __pid_t pid_t; return back */ #endif +#define O_DSYNC 0x00800000 /* POSIX data sync */ + /* - * XXX missing O_DSYNC, O_RSYNC. + * XXX missing O_RSYNC. */ #ifdef _KERNEL @@ -158,9 +160,9 @@ typedef __pid_t pid_t; #define OFLAGS(fflags) ((fflags) & O_EXEC ? (fflags) : (fflags) - 1) /* bits to save after open */ -#define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT|FEXEC) +#define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FDSYNC|FNONBLOCK|O_DIRECT|FEXEC) /* bits settable by fcntl(F_SETFL, ...) */ -#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FRDAHEAD|O_DIRECT) +#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FDSYNC|FNONBLOCK|FRDAHEAD|O_DIRECT) #if defined(COMPAT_FREEBSD7) || defined(COMPAT_FREEBSD6) || \ defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) @@ -185,15 +187,16 @@ typedef __pid_t pid_t; #define FAPPEND O_APPEND /* kernel/compat */ #define FASYNC O_ASYNC /* kernel/compat */ #define FFSYNC O_FSYNC /* kernel */ +#define FDSYNC O_DSYNC /* kernel */ #define FNONBLOCK O_NONBLOCK /* kernel */ #define FNDELAY O_NONBLOCK /* compat */ #define O_NDELAY O_NONBLOCK /* compat */ #endif /* - * We are out of bits in f_flag (which is a short). However, - * the flag bits not set in FMASK are only meaningful in the - * initial open syscall. Those bits can thus be given a + * Historically, we ran out of bits in f_flag (which was once a short). + * However, the flag bits not set in FMASK are only meaningful in the + * initial open syscall. Those bits were thus given a * different meaning for fcntl(2). */ #if __BSD_VISIBLE diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index ff1323cb8719..0eadfec02313 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -326,6 +326,7 @@ struct vattr { #define IO_NOMACCHECK 0x1000 /* MAC checks unnecessary */ #define IO_BUFLOCKED 0x2000 /* ffs flag; indir buf is locked */ #define IO_RANGELOCKED 0x4000 /* range locked */ +#define IO_DATASYNC 0x8000 /* do only data I/O synchronously */ #define IO_SEQMAX 0x7F /* seq heuristic max value */ #define IO_SEQSHIFT 16 /* seq heuristic in upper 16 bits */ From owner-dev-commits-src-all@freebsd.org Fri Jan 8 00:16:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BEE474E16C7; Fri, 8 Jan 2021 00:16:58 +0000 (UTC) (envelope-from git@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 4DBkDp55ZZz4dDW; Fri, 8 Jan 2021 00:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DFF919DF5; Fri, 8 Jan 2021 00:16:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1080GwBk034095; Fri, 8 Jan 2021 00:16:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1080GwWF034094; Fri, 8 Jan 2021 00:16:58 GMT (envelope-from git) Date: Fri, 8 Jan 2021 00:16:58 GMT Message-Id: <202101080016.1080GwWF034094@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Thomas Munro Subject: git: e7347be9e34d - main - ffs: Support O_DSYNC. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tmunro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e7347be9e34d05130df878d6af2ff847227610b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 00:16:58 -0000 The branch main has been updated by tmunro: URL: https://cgit.FreeBSD.org/src/commit/?id=e7347be9e34d05130df878d6af2ff847227610b6 commit e7347be9e34d05130df878d6af2ff847227610b6 Author: Thomas Munro AuthorDate: 2021-01-07 10:50:59 +0000 Commit: Thomas Munro CommitDate: 2021-01-08 00:15:56 +0000 ffs: Support O_DSYNC. Respect the new IO_DATASYNC flag when performing synchronous writes. Compared to O_SYNC, O_DSYNC lets us skip updating the inode in some cases, matching the behaviour of fdatasync(2). Reviewed by: kib Differential Review: https://reviews.freebsd.org/D25160 --- sys/ufs/ffs/ffs_vnops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index f7a1084d2838..6ca98a84869d 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1001,7 +1001,9 @@ ffs_write(ap) uio->uio_resid = resid; } } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) { - error = ffs_update(vp, 1); + if (!(ioflag & IO_DATASYNC) || + (ip->i_flags & (IN_SIZEMOD | IN_IBLKDATA))) + error = ffs_update(vp, 1); if (ffs_fsfail_cleanup(VFSTOUFS(vp->v_mount), error)) error = ENXIO; } From owner-dev-commits-src-all@freebsd.org Fri Jan 8 00:28:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9D69E4E1E3C; Fri, 8 Jan 2021 00:28:01 +0000 (UTC) (envelope-from git@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 4DBkTY45Pwz4fJy; Fri, 8 Jan 2021 00:28:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AED419D64; Fri, 8 Jan 2021 00:28:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1080S1s4047049; Fri, 8 Jan 2021 00:28:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1080S1nv047048; Fri, 8 Jan 2021 00:28:01 GMT (envelope-from git) Date: Fri, 8 Jan 2021 00:28:01 GMT Message-Id: <202101080028.1080S1nv047048@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 84089de83e79 - main - ObsoleteFiles.inc: add newlines between some recent entries MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84089de83e79a0f748c6e22b1aacb59156e153d2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 00:28:01 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=84089de83e79a0f748c6e22b1aacb59156e153d2 commit 84089de83e79a0f748c6e22b1aacb59156e153d2 Author: Ed Maste AuthorDate: 2021-01-08 00:27:15 +0000 Commit: Ed Maste CommitDate: 2021-01-08 00:27:15 +0000 ObsoleteFiles.inc: add newlines between some recent entries --- ObsoleteFiles.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index eb5a7785b69e..35b8f88bd009 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -42,6 +42,7 @@ OLD_DIRS+=usr/lib/compat/aout # 20210105: remove non widechar version of clang OLD_LIBS+=lib/libncurses.so.9 + # 20210103: new clang import which bumps version from 11.0.0 to 11.0.1. OLD_FILES+=usr/lib/clang/11.0.0/include/cuda_wrappers/algorithm OLD_FILES+=usr/lib/clang/11.0.0/include/cuda_wrappers/complex @@ -333,6 +334,7 @@ OLD_FILES+=usr/libexec/kgdb # 20201211: hme(4) removed OLD_FILES+=usr/share/man/man4/hme.4.gz OLD_FILES+=usr/share/man/man4/if_hme.4.gz + # 20201124: ping6(8) was merged into ping(8) OLD_FILES+=usr/lib/debug/sbin/ping6.debug OLD_FILES+=usr/share/man/man8/ping6.8.gz From owner-dev-commits-src-all@freebsd.org Fri Jan 8 00:56:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DFABE4E21D2; Fri, 8 Jan 2021 00:56:07 +0000 (UTC) (envelope-from git@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 4DBl5z5tr4z4gPv; Fri, 8 Jan 2021 00:56:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8ACD1A2F4; Fri, 8 Jan 2021 00:56:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1080u7Yk085637; Fri, 8 Jan 2021 00:56:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1080u6Ie085632; Fri, 8 Jan 2021 00:56:06 GMT (envelope-from git) Date: Fri, 8 Jan 2021 00:56:06 GMT Message-Id: <202101080056.1080u6Ie085632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Matt Macy Subject: git: 7877fdebeeb3 - main - OpenZFS merge main-gf11b09 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmacy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7877fdebeeb35fad1cbbafce22598b1bdf97c786 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 00:56:07 -0000 The branch main has been updated by mmacy: URL: https://cgit.FreeBSD.org/src/commit/?id=7877fdebeeb35fad1cbbafce22598b1bdf97c786 commit 7877fdebeeb35fad1cbbafce22598b1bdf97c786 Author: Matt Macy AuthorDate: 2021-01-07 23:27:17 +0000 Commit: Matt Macy CommitDate: 2021-01-08 00:55:59 +0000 OpenZFS merge main-gf11b09 - add dRAID support - fix duplicate close handling - fix memory leak in prefetch - fix problem with SIMD benchmarking on FreeBSD boot ... --- sys/contrib/openzfs/.github/CONTRIBUTING.md | 68 +- .../openzfs/.github/ISSUE_TEMPLATE/bug_report.md | 53 + .../openzfs/.github/ISSUE_TEMPLATE/config.yml | 14 + .../.github/ISSUE_TEMPLATE/feature_request.md | 33 + sys/contrib/openzfs/.github/codecov.yml | 25 + sys/contrib/openzfs/.github/no-response.yml | 13 + sys/contrib/openzfs/.github/stale.yml | 26 + .../openzfs/.github/workflows/checkstyle.yaml | 36 + .../openzfs/.github/workflows/zfs-tests.yml | 58 + sys/contrib/openzfs/.github/workflows/zloop.yml | 67 + sys/contrib/openzfs/META | 4 +- sys/contrib/openzfs/Makefile.am | 10 +- sys/contrib/openzfs/cmd/Makefile.am | 1 + sys/contrib/openzfs/cmd/arc_summary/arc_summary2 | 108 +- sys/contrib/openzfs/cmd/arc_summary/arc_summary3 | 77 +- sys/contrib/openzfs/cmd/arcstat/arcstat.in | 76 +- sys/contrib/openzfs/cmd/dbufstat/dbufstat.in | 4 +- sys/contrib/openzfs/cmd/mount_zfs/mount_zfs.c | 91 +- sys/contrib/openzfs/cmd/raidz_test/raidz_bench.c | 25 +- sys/contrib/openzfs/cmd/raidz_test/raidz_test.c | 330 +- sys/contrib/openzfs/cmd/raidz_test/raidz_test.h | 9 +- sys/contrib/openzfs/cmd/zdb/zdb.c | 33 +- sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c | 2 + sys/contrib/openzfs/cmd/zed/agents/zfs_mod.c | 10 +- sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c | 11 +- sys/contrib/openzfs/cmd/zed/zed.d/all-syslog.sh | 44 +- .../zed/zed.d/history_event-zfs-list-cacher.sh.in | 2 +- sys/contrib/openzfs/cmd/zed/zed.d/zed.rc | 7 +- sys/contrib/openzfs/cmd/zfs/zfs_main.c | 166 +- .../openzfs/cmd/zfs_ids_to_path/zfs_ids_to_path.c | 2 +- sys/contrib/openzfs/cmd/zgenhostid/zgenhostid.c | 10 +- sys/contrib/openzfs/cmd/zhack/zhack.c | 1 + sys/contrib/openzfs/cmd/zpool/zpool_iter.c | 16 +- sys/contrib/openzfs/cmd/zpool/zpool_main.c | 148 +- sys/contrib/openzfs/cmd/zpool/zpool_util.h | 4 +- sys/contrib/openzfs/cmd/zpool/zpool_vdev.c | 393 +- sys/contrib/openzfs/cmd/zpool_influxdb/.gitignore | 1 + sys/contrib/openzfs/cmd/zpool_influxdb/Makefile.am | 11 + sys/contrib/openzfs/cmd/zpool_influxdb/README.md | 294 ++ .../cmd/zpool_influxdb/dashboards/README.md | 3 + .../ZFS-pool-latency-heatmaps-influxdb.json | 1667 +++++++ .../cmd/zpool_influxdb/telegraf.d/README.md | 7 + .../telegraf.d/exec_zpool_influxdb.conf | 15 + .../telegraf.d/execd_zpool_influxdb.conf | 23 + .../openzfs/cmd/zpool_influxdb/zpool_influxdb.c | 843 ++++ sys/contrib/openzfs/cmd/zstream/zstream_redup.c | 2 +- sys/contrib/openzfs/cmd/ztest/ztest.c | 293 +- sys/contrib/openzfs/config/Abigail.am | 29 + sys/contrib/openzfs/config/always-python.m4 | 2 +- sys/contrib/openzfs/config/always-pyzfs.m4 | 2 +- sys/contrib/openzfs/config/always-sed.m4 | 2 +- sys/contrib/openzfs/config/deb.am | 14 +- sys/contrib/openzfs/config/kernel-acl.m4 | 4 +- sys/contrib/openzfs/config/kernel-bio.m4 | 4 +- sys/contrib/openzfs/config/kernel-blk-queue.m4 | 4 +- sys/contrib/openzfs/config/kernel-blkdev.m4 | 137 +- .../openzfs/config/kernel-config-defined.m4 | 2 +- sys/contrib/openzfs/config/kernel-fpu.m4 | 4 +- .../openzfs/config/kernel-generic_io_acct.m4 | 47 +- .../openzfs/config/kernel-get-disk-and-module.m4 | 24 - sys/contrib/openzfs/config/kernel-hotplug.m4 | 26 + .../openzfs/config/kernel-make-request-fn.m4 | 73 +- sys/contrib/openzfs/config/kernel-objtool.m4 | 25 + sys/contrib/openzfs/config/kernel-percpu.m4 | 26 + .../openzfs/config/kernel-revalidate-disk-size.m4 | 46 + sys/contrib/openzfs/config/kernel-rwsem.m4 | 28 - sys/contrib/openzfs/config/kernel-vfs-iov_iter.m4 | 206 + sys/contrib/openzfs/config/kernel.m4 | 50 +- sys/contrib/openzfs/config/mount-helper.m4 | 2 +- sys/contrib/openzfs/config/user-dracut.m4 | 2 +- sys/contrib/openzfs/config/user-libexec.m4 | 2 +- sys/contrib/openzfs/config/user-makedev.m4 | 14 +- sys/contrib/openzfs/config/user-systemd.m4 | 10 +- sys/contrib/openzfs/config/user-sysvinit.m4 | 2 +- sys/contrib/openzfs/config/user-udev.m4 | 4 +- sys/contrib/openzfs/config/zfs-build.m4 | 2 +- sys/contrib/openzfs/configure.ac | 9 +- .../openzfs/contrib/dracut/90zfs/export-zfs.sh.in | 2 +- .../contrib/dracut/90zfs/module-setup.sh.in | 8 +- .../openzfs/contrib/dracut/90zfs/mount-zfs.sh.in | 4 +- .../openzfs/contrib/dracut/90zfs/parse-zfs.sh.in | 2 +- .../contrib/dracut/90zfs/zfs-generator.sh.in | 23 +- .../openzfs/contrib/dracut/90zfs/zfs-lib.sh.in | 4 +- .../contrib/dracut/90zfs/zfs-load-key.sh.in | 14 +- .../contrib/dracut/90zfs/zfs-needshutdown.sh.in | 4 +- .../openzfs/contrib/initramfs/hooks/zfsunlock.in | 2 +- .../openzfs/contrib/pam_zfs_key/pam_zfs_key.c | 54 + .../etc/systemd/system/zfs-share.service.in | 1 + .../etc/systemd/system/zfs-volume-wait.service.in | 1 + .../openzfs/etc/systemd/system/zfs-zed.service.in | 1 + sys/contrib/openzfs/include/libzfs.h | 7 +- .../openzfs/include/os/freebsd/spl/sys/misc.h | 8 +- .../openzfs/include/os/freebsd/spl/sys/mod_os.h | 12 + .../openzfs/include/os/freebsd/spl/sys/policy.h | 3 +- .../openzfs/include/os/freebsd/spl/sys/sysmacros.h | 1 + .../openzfs/include/os/freebsd/spl/sys/types.h | 2 +- .../openzfs/include/os/freebsd/spl/sys/uio.h | 23 +- .../openzfs/include/os/freebsd/zfs/sys/Makefile.am | 2 +- .../include/os/freebsd/zfs/sys/zfs_context_os.h | 1 - .../openzfs/include/os/freebsd/zfs/sys/zfs_vnops.h | 5 +- .../include/os/freebsd/zfs/sys/zfs_znode_impl.h | 7 +- .../include/os/linux/kernel/linux/blkdev_compat.h | 117 +- .../include/os/linux/kernel/linux/mod_compat.h | 14 + .../openzfs/include/os/linux/spl/sys/sysmacros.h | 1 + .../openzfs/include/os/linux/spl/sys/taskq.h | 5 + sys/contrib/openzfs/include/os/linux/spl/sys/uio.h | 115 +- .../openzfs/include/os/linux/spl/sys/vnode.h | 6 + .../openzfs/include/os/linux/zfs/sys/Makefile.am | 2 +- .../openzfs/include/os/linux/zfs/sys/policy.h | 4 +- .../openzfs/include/os/linux/zfs/sys/trace_acl.h | 6 +- .../openzfs/include/os/linux/zfs/sys/zfs_vnops.h | 13 +- .../include/os/linux/zfs/sys/zfs_znode_impl.h | 13 +- sys/contrib/openzfs/include/os/linux/zfs/sys/zpl.h | 9 - sys/contrib/openzfs/include/sys/Makefile.am | 2 + sys/contrib/openzfs/include/sys/arc.h | 6 + sys/contrib/openzfs/include/sys/arc_impl.h | 20 + sys/contrib/openzfs/include/sys/dbuf.h | 35 +- sys/contrib/openzfs/include/sys/dmu.h | 12 - sys/contrib/openzfs/include/sys/dmu_impl.h | 7 - sys/contrib/openzfs/include/sys/dmu_objset.h | 4 +- sys/contrib/openzfs/include/sys/dmu_zfetch.h | 16 +- sys/contrib/openzfs/include/sys/dsl_dataset.h | 1 + sys/contrib/openzfs/include/sys/dsl_scan.h | 1 + sys/contrib/openzfs/include/sys/frame.h | 4 + sys/contrib/openzfs/include/sys/fs/zfs.h | 17 +- sys/contrib/openzfs/include/sys/metaslab.h | 1 + sys/contrib/openzfs/include/sys/metaslab_impl.h | 52 +- sys/contrib/openzfs/include/sys/spa_impl.h | 5 +- sys/contrib/openzfs/include/sys/txg.h | 1 + sys/contrib/openzfs/include/sys/vdev.h | 16 +- sys/contrib/openzfs/include/sys/vdev_draid.h | 110 + sys/contrib/openzfs/include/sys/vdev_impl.h | 55 +- sys/contrib/openzfs/include/sys/vdev_raidz.h | 17 +- sys/contrib/openzfs/include/sys/vdev_raidz_impl.h | 61 +- sys/contrib/openzfs/include/sys/vdev_rebuild.h | 4 + sys/contrib/openzfs/include/sys/zfs_context.h | 1 + sys/contrib/openzfs/include/sys/zfs_vnops.h | 55 + sys/contrib/openzfs/include/sys/zfs_znode.h | 1 - sys/contrib/openzfs/include/sys/zio.h | 1 + sys/contrib/openzfs/include/sys/zvol_impl.h | 2 + sys/contrib/openzfs/include/zfeature_common.h | 1 + sys/contrib/openzfs/lib/Makefile.am | 19 +- sys/contrib/openzfs/lib/libnvpair/Makefile.am | 10 +- sys/contrib/openzfs/lib/libnvpair/libnvpair.abi | 2805 +++++++++++ sys/contrib/openzfs/lib/libnvpair/libnvpair.suppr | 2 + sys/contrib/openzfs/lib/libspl/include/sys/uio.h | 41 - sys/contrib/openzfs/lib/libuutil/Makefile.am | 10 +- sys/contrib/openzfs/lib/libuutil/libuutil.abi | 1608 +++++++ sys/contrib/openzfs/lib/libuutil/libuutil.suppr | 2 + sys/contrib/openzfs/lib/libzfs/Makefile.am | 14 +- sys/contrib/openzfs/lib/libzfs/libzfs.abi | 4879 ++++++++++++++++++++ sys/contrib/openzfs/lib/libzfs/libzfs.suppr | 13 + sys/contrib/openzfs/lib/libzfs/libzfs_dataset.c | 93 +- sys/contrib/openzfs/lib/libzfs/libzfs_import.c | 1 - sys/contrib/openzfs/lib/libzfs/libzfs_pool.c | 117 +- sys/contrib/openzfs/lib/libzfs/libzfs_util.c | 10 +- sys/contrib/openzfs/lib/libzfs_core/Makefile.am | 11 +- .../openzfs/lib/libzfs_core/libzfs_core.abi | 2820 +++++++++++ .../openzfs/lib/libzfs_core/libzfs_core.suppr | 5 + sys/contrib/openzfs/lib/libzfsbootenv/Makefile.am | 6 + .../openzfs/lib/libzfsbootenv/libzfsbootenv.abi | 212 + .../openzfs/lib/libzfsbootenv/libzfsbootenv.pc.in | 2 +- .../openzfs/lib/libzfsbootenv/libzfsbootenv.suppr | 2 + sys/contrib/openzfs/lib/libzpool/Makefile.am | 10 +- sys/contrib/openzfs/lib/libzutil/zutil_import.c | 7 +- sys/contrib/openzfs/man/man1/arcstat.1 | 112 +- sys/contrib/openzfs/man/man1/raidz_test.1 | 9 + sys/contrib/openzfs/man/man1/ztest.1 | 23 +- .../openzfs/man/man5/zfs-module-parameters.5 | 136 +- sys/contrib/openzfs/man/man5/zpool-features.5 | 34 +- sys/contrib/openzfs/man/man8/Makefile.am | 3 +- sys/contrib/openzfs/man/man8/zfs-allow.8 | 36 +- sys/contrib/openzfs/man/man8/zfs-bookmark.8 | 4 +- sys/contrib/openzfs/man/man8/zfs-clone.8 | 6 +- sys/contrib/openzfs/man/man8/zfs-create.8 | 20 +- sys/contrib/openzfs/man/man8/zfs-destroy.8 | 14 +- sys/contrib/openzfs/man/man8/zfs-diff.8 | 8 +- sys/contrib/openzfs/man/man8/zfs-hold.8 | 14 +- sys/contrib/openzfs/man/man8/zfs-jail.8 | 10 +- sys/contrib/openzfs/man/man8/zfs-list.8 | 6 +- sys/contrib/openzfs/man/man8/zfs-load-key.8 | 18 +- sys/contrib/openzfs/man/man8/zfs-mount.8 | 14 +- sys/contrib/openzfs/man/man8/zfs-program.8 | 5 +- sys/contrib/openzfs/man/man8/zfs-project.8 | 18 +- sys/contrib/openzfs/man/man8/zfs-promote.8 | 6 +- sys/contrib/openzfs/man/man8/zfs-receive.8 | 18 +- sys/contrib/openzfs/man/man8/zfs-rename.8 | 18 +- sys/contrib/openzfs/man/man8/zfs-rollback.8 | 6 +- sys/contrib/openzfs/man/man8/zfs-send.8 | 26 +- sys/contrib/openzfs/man/man8/zfs-set.8 | 14 +- sys/contrib/openzfs/man/man8/zfs-share.8 | 10 +- sys/contrib/openzfs/man/man8/zfs-snapshot.8 | 6 +- sys/contrib/openzfs/man/man8/zfs-upgrade.8 | 14 +- sys/contrib/openzfs/man/man8/zfs-userspace.8 | 14 +- sys/contrib/openzfs/man/man8/zfs-wait.8 | 6 +- sys/contrib/openzfs/man/man8/zgenhostid.8 | 3 +- sys/contrib/openzfs/man/man8/zpool-add.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-attach.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-checkpoint.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-clear.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-create.8 | 8 +- sys/contrib/openzfs/man/man8/zpool-destroy.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-detach.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-events.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-export.8 | 8 +- sys/contrib/openzfs/man/man8/zpool-get.8 | 10 +- sys/contrib/openzfs/man/man8/zpool-history.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-import.8 | 14 +- sys/contrib/openzfs/man/man8/zpool-initialize.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-iostat.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-labelclear.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-list.8 | 8 +- sys/contrib/openzfs/man/man8/zpool-offline.8 | 10 +- sys/contrib/openzfs/man/man8/zpool-reguid.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-remove.8 | 10 +- sys/contrib/openzfs/man/man8/zpool-reopen.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-replace.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-resilver.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-scrub.8 | 8 +- sys/contrib/openzfs/man/man8/zpool-split.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-status.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-sync.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-trim.8 | 6 +- sys/contrib/openzfs/man/man8/zpool-upgrade.8 | 14 +- sys/contrib/openzfs/man/man8/zpool-wait.8 | 6 +- sys/contrib/openzfs/man/man8/zpool_influxdb.8 | 93 + sys/contrib/openzfs/man/man8/zpoolconcepts.8 | 78 +- sys/contrib/openzfs/man/man8/zpoolprops.8 | 15 +- sys/contrib/openzfs/module/Makefile.bsd | 39 +- sys/contrib/openzfs/module/icp/algs/modes/gcm.c | 54 +- sys/contrib/openzfs/module/icp/algs/modes/modes.c | 8 + .../module/icp/asm-x86_64/modes/aesni-gcm-x86_64.S | 24 +- sys/contrib/openzfs/module/icp/core/kcf_sched.c | 4 +- .../openzfs/module/icp/include/modes/modes.h | 8 +- sys/contrib/openzfs/module/icp/io/aes.c | 18 + sys/contrib/openzfs/module/lua/lapi.c | 2 +- .../openzfs/module/os/freebsd/spl/spl_policy.c | 5 +- sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c | 43 +- sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c | 10 + .../openzfs/module/os/freebsd/zfs/sysctl_os.c | 12 +- .../openzfs/module/os/freebsd/zfs/vdev_file.c | 70 +- .../openzfs/module/os/freebsd/zfs/vdev_geom.c | 36 +- .../openzfs/module/os/freebsd/zfs/zfs_file_os.c | 6 +- .../openzfs/module/os/freebsd/zfs/zfs_onexit_os.c | 70 - .../openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 3 +- .../openzfs/module/os/freebsd/zfs/zfs_vnops.c | 877 +--- .../openzfs/module/os/freebsd/zfs/zfs_znode.c | 18 +- .../openzfs/module/os/freebsd/zfs/zio_crypt.c | 15 +- .../openzfs/module/os/freebsd/zfs/zvol_os.c | 248 +- .../openzfs/module/os/linux/spl/spl-taskq.c | 132 +- .../openzfs/module/os/linux/zfs/Makefile.in | 3 +- sys/contrib/openzfs/module/os/linux/zfs/abd_os.c | 2 +- sys/contrib/openzfs/module/os/linux/zfs/arc_os.c | 88 +- sys/contrib/openzfs/module/os/linux/zfs/policy.c | 5 +- .../openzfs/module/os/linux/zfs/vdev_disk.c | 31 +- .../openzfs/module/os/linux/zfs/vdev_file.c | 18 + .../openzfs/module/os/linux/zfs/zfs_ctldir.c | 1 - .../openzfs/module/os/linux/zfs/zfs_vfsops.c | 4 +- .../openzfs/module/os/linux/zfs/zfs_vnops.c | 1091 +---- .../openzfs/module/os/linux/zfs/zfs_znode.c | 5 +- .../openzfs/module/os/linux/zfs/zio_crypt.c | 15 +- .../openzfs/module/os/linux/zfs/zpl_ctldir.c | 25 +- sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c | 354 +- .../openzfs/module/os/linux/zfs/zpl_inode.c | 10 +- .../openzfs/module/os/linux/zfs/zpl_super.c | 23 +- .../openzfs/module/os/linux/zfs/zpl_xattr.c | 24 +- sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c | 177 +- sys/contrib/openzfs/module/zcommon/Makefile.in | 1 - .../openzfs/module/zcommon/zfeature_common.c | 6 +- sys/contrib/openzfs/module/zcommon/zfs_fletcher.c | 69 +- sys/contrib/openzfs/module/zcommon/zfs_namecheck.c | 4 +- sys/contrib/openzfs/module/zcommon/zfs_prop.c | 6 +- sys/contrib/openzfs/module/zcommon/zfs_uio.c | 173 +- sys/contrib/openzfs/module/zfs/Makefile.in | 3 + sys/contrib/openzfs/module/zfs/abd.c | 14 +- sys/contrib/openzfs/module/zfs/aggsum.c | 9 +- sys/contrib/openzfs/module/zfs/arc.c | 306 +- sys/contrib/openzfs/module/zfs/dbuf.c | 371 +- sys/contrib/openzfs/module/zfs/dmu.c | 226 +- sys/contrib/openzfs/module/zfs/dmu_object.c | 4 +- sys/contrib/openzfs/module/zfs/dmu_objset.c | 206 +- sys/contrib/openzfs/module/zfs/dmu_recv.c | 294 +- sys/contrib/openzfs/module/zfs/dmu_redact.c | 2 +- sys/contrib/openzfs/module/zfs/dmu_send.c | 6 +- sys/contrib/openzfs/module/zfs/dmu_tx.c | 3 - sys/contrib/openzfs/module/zfs/dmu_zfetch.c | 122 +- sys/contrib/openzfs/module/zfs/dnode.c | 13 +- sys/contrib/openzfs/module/zfs/dnode_sync.c | 6 +- sys/contrib/openzfs/module/zfs/dsl_bookmark.c | 114 +- sys/contrib/openzfs/module/zfs/dsl_crypt.c | 11 +- sys/contrib/openzfs/module/zfs/dsl_dataset.c | 6 +- sys/contrib/openzfs/module/zfs/dsl_pool.c | 49 +- sys/contrib/openzfs/module/zfs/dsl_scan.c | 13 +- sys/contrib/openzfs/module/zfs/metaslab.c | 238 +- sys/contrib/openzfs/module/zfs/mmp.c | 11 +- sys/contrib/openzfs/module/zfs/multilist.c | 9 +- sys/contrib/openzfs/module/zfs/spa.c | 158 +- sys/contrib/openzfs/module/zfs/spa_history.c | 2 +- sys/contrib/openzfs/module/zfs/spa_misc.c | 20 +- sys/contrib/openzfs/module/zfs/txg.c | 9 +- sys/contrib/openzfs/module/zfs/vdev.c | 387 +- sys/contrib/openzfs/module/zfs/vdev_draid.c | 2984 ++++++++++++ sys/contrib/openzfs/module/zfs/vdev_draid_rand.c | 40 + sys/contrib/openzfs/module/zfs/vdev_indirect.c | 39 +- sys/contrib/openzfs/module/zfs/vdev_initialize.c | 141 +- sys/contrib/openzfs/module/zfs/vdev_label.c | 62 +- sys/contrib/openzfs/module/zfs/vdev_mirror.c | 137 +- sys/contrib/openzfs/module/zfs/vdev_missing.c | 18 + sys/contrib/openzfs/module/zfs/vdev_queue.c | 134 +- sys/contrib/openzfs/module/zfs/vdev_raidz.c | 1864 +++++--- sys/contrib/openzfs/module/zfs/vdev_raidz_math.c | 14 +- .../openzfs/module/zfs/vdev_raidz_math_impl.h | 313 +- sys/contrib/openzfs/module/zfs/vdev_rebuild.c | 231 +- sys/contrib/openzfs/module/zfs/vdev_removal.c | 100 +- sys/contrib/openzfs/module/zfs/vdev_root.c | 9 + sys/contrib/openzfs/module/zfs/vdev_trim.c | 153 +- sys/contrib/openzfs/module/zfs/zcp.c | 7 +- sys/contrib/openzfs/module/zfs/zfs_fm.c | 4 +- sys/contrib/openzfs/module/zfs/zfs_ioctl.c | 77 +- sys/contrib/openzfs/module/zfs/zfs_vnops.c | 895 ++++ sys/contrib/openzfs/module/zfs/zio.c | 72 +- sys/contrib/openzfs/module/zfs/zio_inject.c | 6 + sys/contrib/openzfs/module/zfs/zvol.c | 22 +- sys/contrib/openzfs/module/zstd/zfs_zstd.c | 52 +- sys/contrib/openzfs/rpm/generic/zfs-kmod.spec.in | 4 - sys/contrib/openzfs/rpm/generic/zfs.spec.in | 77 +- sys/contrib/openzfs/scripts/Makefile.am | 3 + sys/contrib/openzfs/scripts/commitcheck.sh | 113 +- sys/contrib/openzfs/scripts/common.sh.in | 1 + sys/contrib/openzfs/scripts/dkms.mkconf | 1 + sys/contrib/openzfs/scripts/zfs-tests.sh | 12 +- sys/contrib/openzfs/scripts/zfs.sh | 3 + sys/contrib/openzfs/scripts/zloop.sh | 54 +- sys/contrib/openzfs/tests/runfiles/Makefile.am | 1 + sys/contrib/openzfs/tests/runfiles/common.run | 54 +- sys/contrib/openzfs/tests/runfiles/linux.run | 3 +- sys/contrib/openzfs/tests/runfiles/sanity.run | 618 +++ .../openzfs/tests/test-runner/bin/zts-report.py.in | 3 +- .../openzfs/tests/zfs-tests/cmd/Makefile.am | 1 + .../tests/zfs-tests/cmd/btree_test/btree_test.c | 2 +- .../openzfs/tests/zfs-tests/cmd/draid/.gitignore | 1 + .../openzfs/tests/zfs-tests/cmd/draid/Makefile.am | 15 + .../openzfs/tests/zfs-tests/cmd/draid/draid.c | 1414 ++++++ .../cmd/libzfs_input_check/libzfs_input_check.c | 2 +- .../openzfs/tests/zfs-tests/include/blkdev.shlib | 89 +- .../openzfs/tests/zfs-tests/include/commands.cfg | 5 +- .../openzfs/tests/zfs-tests/include/libtest.shlib | 41 +- .../openzfs/tests/zfs-tests/include/tunables.cfg | 3 + .../tests/zfs-tests/tests/functional/Makefile.am | 3 +- .../functional/alloc_class/alloc_class_012_pos.ksh | 5 +- .../tests/functional/checksum/Makefile.am | 3 +- .../tests/functional/checksum/filetest_001_pos.ksh | 5 +- .../tests/functional/checksum/filetest_002_pos.ksh | 91 + .../cli_root/zdb/zdb_block_size_histogram.ksh | 8 +- .../cli_root/zfs_copies/zfs_copies_002_pos.ksh | 2 +- .../functional/cli_root/zfs_create/Makefile.am | 1 + .../cli_root/zfs_create/zfs_create_001_pos.ksh | 6 + .../cli_root/zfs_create/zfs_create_nomount.ksh | 51 + .../functional/cli_root/zfs_mount/Makefile.am | 2 + .../functional/cli_root/zfs_mount/zfs_mount.kshlib | 3 +- .../cli_root/zfs_mount/zfs_mount_013_pos.ksh | 78 + .../cli_root/zfs_mount/zfs_mount_014_neg.ksh | 68 + .../zfs_mount/zfs_mount_all_mountpoints.ksh | 2 + .../zfs_share/zfs_share_concurrent_shares.ksh | 12 +- .../cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh | 17 + .../functional/cli_root/zpool_add/Makefile.am | 3 +- .../cli_root/zpool_add/zpool_add_001_pos.ksh | 20 +- .../cli_root/zpool_add/zpool_add_003_pos.ksh | 4 +- .../cli_root/zpool_add/zpool_add_dryrun_output.ksh | 175 + .../functional/cli_root/zpool_create/Makefile.am | 8 +- .../cli_root/zpool_create/zpool_create_001_pos.ksh | 4 +- .../cli_root/zpool_create/zpool_create_005_pos.ksh | 8 +- .../cli_root/zpool_create/zpool_create_006_pos.ksh | 22 + .../cli_root/zpool_create/zpool_create_007_neg.ksh | 9 +- .../cli_root/zpool_create/zpool_create_009_neg.ksh | 2 +- .../cli_root/zpool_create/zpool_create_010_neg.ksh | 7 +- .../cli_root/zpool_create/zpool_create_011_neg.ksh | 14 +- .../zpool_create/zpool_create_draid_001_pos.ksh | 75 + .../zpool_create/zpool_create_draid_002_pos.ksh | 82 + .../zpool_create/zpool_create_draid_003_pos.ksh | 112 + .../zpool_create/zpool_create_draid_004_pos.ksh | 43 + .../zpool_create/zpool_create_dryrun_output.ksh | 138 + .../cli_root/zpool_expand/zpool_expand_001_pos.ksh | 12 +- .../cli_root/zpool_expand/zpool_expand_002_pos.ksh | 27 +- .../cli_root/zpool_expand/zpool_expand_003_neg.ksh | 2 +- .../cli_root/zpool_expand/zpool_expand_004_pos.ksh | 2 +- .../functional/cli_root/zpool_get/zpool_get.cfg | 1 + .../functional/cli_root/zpool_import/Makefile.am | 2 + .../zpool_import/import_cachefile_device_added.ksh | 2 + .../import_cachefile_device_replaced.ksh | 6 + .../import_cachefile_shared_device.ksh | 1 + .../cli_root/zpool_import/import_paths_changed.ksh | 2 + .../zpool_import/import_rewind_config_changed.ksh | 1 + .../zpool_import/import_rewind_device_replaced.ksh | 5 + .../functional/cli_root/zpool_import/setup.ksh | 2 +- .../cli_root/zpool_import/zpool_import.cfg | 3 +- .../cli_root/zpool_import/zpool_import.kshlib | 16 +- .../cli_root/zpool_import/zpool_import_007_pos.ksh | 2 +- .../cli_root/zpool_import/zpool_import_008_pos.ksh | 2 +- .../cli_root/zpool_import/zpool_import_010_pos.ksh | 4 +- .../cli_root/zpool_import/zpool_import_016_pos.ksh | 91 + .../cli_root/zpool_import/zpool_import_017_pos.ksh | 92 + .../zpool_import/zpool_import_missing_001_pos.ksh | 21 +- .../zpool_import/zpool_import_missing_002_pos.ksh | 23 +- .../zpool_import/zpool_import_missing_003_pos.ksh | 5 +- .../zpool_initialize_verify_initialized.ksh | 49 +- .../functional/cli_root/zpool_split/Makefile.am | 3 +- .../zpool_split/zpool_split_dryrun_output.ksh | 152 + .../cli_root/zpool_trim/zpool_trim.kshlib | 17 + .../zpool_trim/zpool_trim_online_offline.ksh | 8 +- .../zpool_trim/zpool_trim_start_and_cancel_neg.ksh | 6 +- .../zpool_wait/scan/zpool_wait_replace_cancel.ksh | 1 + .../tests/functional/events/events_001_pos.ksh | 26 +- .../tests/functional/events/events_002_pos.ksh | 2 +- .../tests/functional/events/events_common.kshlib | 69 +- .../functional/fault/auto_offline_001_pos.ksh | 10 +- .../tests/functional/fault/auto_spare_001_pos.ksh | 47 +- .../tests/functional/fault/auto_spare_002_pos.ksh | 7 +- .../tests/functional/fault/auto_spare_ashift.ksh | 4 +- .../tests/functional/fault/auto_spare_multiple.ksh | 102 +- .../tests/functional/fault/auto_spare_shared.ksh | 4 +- .../tests/functional/l2arc/l2arc_arcstats_pos.ksh | 107 + .../tests/functional/l2arc/l2arc_l2miss_pos.ksh | 94 + .../tests/functional/l2arc/l2arc_mfuonly_pos.ksh | 94 + .../tests/functional/persist_l2arc/Makefile.am | 7 +- .../tests/functional/persist_l2arc/cleanup.ksh | 6 +- .../functional/persist_l2arc/persist_l2arc.cfg | 5 +- .../persist_l2arc/persist_l2arc_001_pos.ksh | 21 +- .../persist_l2arc/persist_l2arc_002_pos.ksh | 19 +- .../persist_l2arc/persist_l2arc_003_neg.ksh | 6 +- .../persist_l2arc/persist_l2arc_004_pos.ksh | 19 +- .../persist_l2arc/persist_l2arc_005_pos.ksh | 19 +- .../persist_l2arc/persist_l2arc_006_pos.ksh | 21 +- .../persist_l2arc/persist_l2arc_007_pos.ksh | 26 +- .../persist_l2arc/persist_l2arc_008_pos.ksh | 48 +- .../tests/functional/persist_l2arc/setup.ksh | 3 +- .../zfs-tests/tests/functional/raidz/Makefile.am | 4 +- .../tests/functional/raidz/raidz_003_pos.ksh | 41 + .../tests/functional/raidz/raidz_004_pos.ksh | 41 + .../tests/functional/redundancy/Makefile.am | 15 +- .../tests/functional/redundancy/redundancy.kshlib | 49 +- .../functional/redundancy/redundancy_001_pos.ksh | 4 +- .../functional/redundancy/redundancy_002_pos.ksh | 4 +- .../functional/redundancy/redundancy_draid1.ksh | 78 + .../functional/redundancy/redundancy_draid2.ksh | 85 + .../functional/redundancy/redundancy_draid3.ksh | 85 + .../redundancy/redundancy_draid_spare1.ksh | 107 + .../redundancy/redundancy_draid_spare2.ksh | 80 + .../redundancy/redundancy_draid_spare3.ksh | 197 + .../functional/redundancy/redundancy_raidz3.ksh | 84 + .../zfs-tests/tests/functional/removal/Makefile.am | 3 +- .../functional/removal/remove_attach_mirror.ksh | 73 + .../functional/replacement/attach_rebuild.ksh | 4 +- .../functional/replacement/attach_resilver.ksh | 4 +- .../tests/functional/replacement/detach.ksh | 4 +- .../tests/functional/replacement/rebuild_raidz.ksh | 7 +- .../functional/replacement/replace_rebuild.ksh | 4 +- .../functional/replacement/replace_resilver.ksh | 4 +- .../tests/functional/trim/autotrim_config.ksh | 10 +- .../tests/functional/trim/autotrim_integrity.ksh | 2 +- .../functional/trim/autotrim_trim_integrity.ksh | 2 +- .../tests/functional/trim/trim_config.ksh | 10 +- .../tests/functional/trim/trim_integrity.ksh | 2 +- .../tests/functional/userquota/Makefile.am | 3 +- .../functional/userquota/userspace_encrypted.ksh | 85 + .../userquota/userspace_send_encrypted.ksh | 108 + .../tests/functional/xattr/xattr_004_pos.ksh | 34 +- .../tests/functional/zpool_influxdb/Makefile.am | 5 + .../tests/functional/zpool_influxdb/cleanup.ksh | 29 + .../tests/functional/zpool_influxdb/setup.ksh | 29 + .../functional/zpool_influxdb/zpool_influxdb.ksh | 71 + 471 files changed, 34096 insertions(+), 6691 deletions(-) diff --git a/sys/contrib/openzfs/.github/CONTRIBUTING.md b/sys/contrib/openzfs/.github/CONTRIBUTING.md index 9bc2e7ef0684..f28a747e82c4 100644 --- a/sys/contrib/openzfs/.github/CONTRIBUTING.md +++ b/sys/contrib/openzfs/.github/CONTRIBUTING.md @@ -126,8 +126,8 @@ feature needed? What problem does it solve? #### General -* All pull requests must be based on the current master branch and apply -without conflicts. +* All pull requests, except backports and releases, must be based on the current master branch +and should apply without conflicts. * Please attempt to limit pull requests to a single commit which resolves one specific issue. * Make sure your commit messages are in the correct format. See the @@ -230,70 +230,6 @@ attempting to solve. Signed-off-by: Contributor ``` -#### OpenZFS Patch Ports -If you are porting OpenZFS patches, the commit message must meet -the following guidelines: -* The first line must be the summary line from the most important OpenZFS commit being ported. -It must begin with `OpenZFS dddd, dddd - ` where `dddd` are OpenZFS issue numbers. -* Provides a `Authored by:` line to attribute each patch for each original author. -* Provides the `Reviewed by:` and `Approved by:` lines from each original -OpenZFS commit. -* Provides a `Ported-by:` line with the developer's name followed by -their email for each OpenZFS commit. -* Provides a `OpenZFS-issue:` line with link for each original illumos -issue. -* Provides a `OpenZFS-commit:` line with link for each original OpenZFS commit. -* If necessary, provide some porting notes to describe any deviations from -the original OpenZFS commits. - -An example OpenZFS patch port commit message for a single patch is provided -below. -``` -OpenZFS 1234 - Summary from the original OpenZFS commit - -Authored by: Original Author -Reviewed by: Reviewer One -Reviewed by: Reviewer Two -Approved by: Approver One -Ported-by: ZFS Contributor - -Provide some porting notes here if necessary. - -OpenZFS-issue: https://www.illumos.org/issues/1234 -OpenZFS-commit: https://github.com/openzfs/openzfs/commit/abcd1234 -``` - -If necessary, multiple OpenZFS patches can be combined in a single port. -This is useful when you are porting a new patch and its subsequent bug -fixes. An example commit message is provided below. -``` -OpenZFS 1234, 5678 - Summary of most important OpenZFS commit - -1234 Summary from original OpenZFS commit for 1234 - -Authored by: Original Author -Reviewed by: Reviewer Two -Approved by: Approver One -Ported-by: ZFS Contributor - -Provide some porting notes here for 1234 if necessary. - -OpenZFS-issue: https://www.illumos.org/issues/1234 -OpenZFS-commit: https://github.com/openzfs/openzfs/commit/abcd1234 - -5678 Summary from original OpenZFS commit for 5678 - -Authored by: Original Author2 -Reviewed by: Reviewer One -Approved by: Approver Two -Ported-by: ZFS Contributor - -Provide some porting notes here for 5678 if necessary. - -OpenZFS-issue: https://www.illumos.org/issues/5678 -OpenZFS-commit: https://github.com/openzfs/openzfs/commit/efgh5678 -``` - #### Coverity Defect Fixes If you are submitting a fix to a [Coverity defect](https://scan.coverity.com/projects/zfsonlinux-zfs), diff --git a/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/bug_report.md b/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000000..1dbb5f6edb55 --- /dev/null +++ b/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,53 @@ +--- +name: Bug report +about: Create a report to help us improve OpenZFS +title: '' +labels: 'Type: Defect, Status: Triage Needed' +assignees: '' + +--- + + + + + +### System information + +Type | Version/Name + --- | --- +Distribution Name | +Distribution Version | +Linux Kernel | +Architecture | +ZFS Version | +SPL Version | + + +### Describe the problem you're observing + +### Describe how to reproduce the problem + +### Include any warning/errors/backtraces from the system logs + + diff --git a/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/config.yml b/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000000..dd8f0557a30c --- /dev/null +++ b/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,14 @@ +blank_issues_enabled: false +contact_links: + - name: OpenZFS Questions + url: https://github.com/openzfs/zfs/discussions/new + about: Ask the community for help + - name: OpenZFS Community Support Mailing list (Linux) + url: https://zfsonlinux.topicbox.com/groups/zfs-discuss + about: Get community support for OpenZFS on Linux + - name: FreeBSD Community Support Mailing list + url: https://lists.freebsd.org/mailman/listinfo/freebsd-fs + about: Get community support for OpenZFS on FreeBSD + - name: OpenZFS on IRC + url: https://webchat.freenode.net/#openzfs + about: Use IRC to get community support for OpenZFS diff --git a/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/feature_request.md b/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000000..9b50a4a3d96e --- /dev/null +++ b/sys/contrib/openzfs/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,33 @@ +--- +name: Feature request +about: Suggest a feature for OpenZFS +title: '' +labels: 'Type: Feature' +assignees: '' + +--- + + + +### Describe the feature would like to see added to OpenZFS + + + +### How will this feature improve OpenZFS? + + + +### Additional context + + diff --git a/sys/contrib/openzfs/.github/codecov.yml b/sys/contrib/openzfs/.github/codecov.yml new file mode 100644 index 000000000000..6d4932680e5c --- /dev/null +++ b/sys/contrib/openzfs/.github/codecov.yml @@ -0,0 +1,25 @@ +codecov: + notify: + require_ci_to_pass: false # always post + after_n_builds: 2 # user and kernel + +coverage: + precision: 0 # 0 decimals of precision + round: nearest # Round to nearest precision point + range: "50...90" # red -> yellow -> green + + status: + project: + default: + threshold: 1% # allow 1% coverage variance + + patch: + default: + threshold: 1% # allow 1% coverage variance + +comment: + layout: "reach, diff, flags, footer" + behavior: once # update if exists; post new; skip if deleted + require_changes: yes # only post when coverage changes + +# ignore: Please place any ignores in config/ax_code_coverage.m4 instead diff --git a/sys/contrib/openzfs/.github/no-response.yml b/sys/contrib/openzfs/.github/no-response.yml new file mode 100644 index 000000000000..ef2656ec96ef --- /dev/null +++ b/sys/contrib/openzfs/.github/no-response.yml @@ -0,0 +1,13 @@ +# Configuration for probot-no-response - https://github.com/probot/no-response + +# Number of days of inactivity before an Issue is closed for lack of response +daysUntilClose: 31 +# Label requiring a response +responseRequiredLabel: "Status: Feedback requested" +# Comment to post when closing an Issue for lack of response. Set to `false` to disable +closeComment: > + This issue has been automatically closed because there has been no response + to our request for more information from the original author. With only the + information that is currently in the issue, we don't have enough information + to take action. Please reach out if you have or find the answers we need so + that we can investigate further. diff --git a/sys/contrib/openzfs/.github/stale.yml b/sys/contrib/openzfs/.github/stale.yml new file mode 100644 index 000000000000..895cc8e803b2 --- /dev/null +++ b/sys/contrib/openzfs/.github/stale.yml @@ -0,0 +1,26 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 365 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 90 +# Limit to only `issues` or `pulls` +only: issues +# Issues with these labels will never be considered stale +exemptLabels: + - "Type: Feature" + - "Bot: Not Stale" + - "Status: Work in Progress" +# Set to true to ignore issues in a project (defaults to false) +exemptProjects: true +# Set to true to ignore issues in a milestone (defaults to false) +exemptMilestones: true +# Set to true to ignore issues with an assignee (defaults to false) +exemptAssignees: true +# Label to use when marking an issue as stale +staleLabel: "Status: Stale" +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as "stale" because it has not had + any activity for a while. It will be closed in 90 days if no further activity occurs. + Thank you for your contributions. +# Limit the number of actions per hour, from 1-30. Default is 30 +limitPerRun: 6 diff --git a/sys/contrib/openzfs/.github/workflows/checkstyle.yaml b/sys/contrib/openzfs/.github/workflows/checkstyle.yaml new file mode 100644 index 000000000000..1707f5bb21db --- /dev/null +++ b/sys/contrib/openzfs/.github/workflows/checkstyle.yaml @@ -0,0 +1,36 @@ +name: checkstyle + +on: + push: + pull_request: + +jobs: + checkstyle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install --yes -qq build-essential autoconf libtool gawk alien fakeroot linux-headers-$(uname -r) + sudo apt-get install --yes -qq zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev python-dev python-setuptools python-cffi python3 python3-dev python3-setuptools python3-cffi + # packages for tests + sudo apt-get install --yes -qq parted lsscsi ksh attr acl nfs-kernel-server fio + sudo apt-get install --yes -qq mandoc cppcheck pax-utils devscripts abigail-tools + sudo -E pip --quiet install flake8 + - name: Prepare + run: | + sh ./autogen.sh + ./configure + make -j$(nproc) + - name: Checkstyle + run: | + make checkstyle + - name: Lint + run: | + make lint + - name: CheckABI + run: | + make checkabi diff --git a/sys/contrib/openzfs/.github/workflows/zfs-tests.yml b/sys/contrib/openzfs/.github/workflows/zfs-tests.yml new file mode 100644 index 000000000000..b075a78c7729 --- /dev/null +++ b/sys/contrib/openzfs/.github/workflows/zfs-tests.yml @@ -0,0 +1,58 @@ +name: zfs-tests-sanity + +on: + push: + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install --yes -qq build-essential autoconf libtool gdb lcov \ + git alien fakeroot wget curl bc fio acl \ + sysstat mdadm lsscsi parted gdebi attr dbench watchdog ksh \ + nfs-kernel-server samba rng-tools xz-utils \ + zlib1g-dev uuid-dev libblkid-dev libselinux-dev \ + xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ + libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ + libpam0g-dev pamtester python-dev python-setuptools python-cffi \ + python3 python3-dev python3-setuptools python3-cffi + - name: Autogen.sh + run: | + sh autogen.sh + - name: Configure + run: | + ./configure --enable-debug --enable-debuginfo + - name: Make + run: | + make --no-print-directory -s pkg-utils pkg-kmod + - name: Install + run: | + sudo dpkg -i *.deb + # Update order of directories to search for modules, otherwise + # Ubuntu will load kernel-shipped ones. + sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf + sudo depmod + sudo modprobe zfs + - name: Tests + run: | + /usr/share/zfs/zfs-tests.sh -v -s 3G -r sanity + - name: Prepare artifacts + if: failure() + run: | + RESULTS_PATH=$(readlink -f /var/tmp/test_results/current) + sudo dmesg > $RESULTS_PATH/dmesg + sudo cp /var/log/syslog $RESULTS_PATH/ + sudo chmod +r $RESULTS_PATH/* + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: Test logs + path: /var/tmp/test_results/20*/ + if-no-files-found: ignore diff --git a/sys/contrib/openzfs/.github/workflows/zloop.yml b/sys/contrib/openzfs/.github/workflows/zloop.yml new file mode 100644 index 000000000000..30785b14507a --- /dev/null +++ b/sys/contrib/openzfs/.github/workflows/zloop.yml @@ -0,0 +1,67 @@ +name: zloop + +on: + push: + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + env: + TEST_DIR: /var/tmp/zloop + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install --yes -qq build-essential autoconf libtool gdb \ + git alien fakeroot \ + zlib1g-dev uuid-dev libblkid-dev libselinux-dev \ + xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ + libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ + libpam0g-dev \ + python-dev python-setuptools python-cffi \ + python3 python3-dev python3-setuptools python3-cffi + - name: Autogen.sh + run: | + sh autogen.sh + - name: Configure + run: | + ./configure --enable-debug --enable-debuginfo + - name: Make + run: | + make --no-print-directory -s pkg-utils pkg-kmod + - name: Install + run: | + sudo dpkg -i *.deb + # Update order of directories to search for modules, otherwise + # Ubuntu will load kernel-shipped ones. + sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf + sudo depmod + sudo modprobe zfs + - name: Tests + run: | + sudo mkdir -p $TEST_DIR + # run for 20 minutes to have a total runner time of 30 minutes + sudo /usr/share/zfs/zloop.sh -t 1200 -l -m1 + - name: Prepare artifacts + if: failure() + run: | + sudo chmod +r -R $TEST_DIR/ + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: Logs + path: | + /var/tmp/zloop/*/ + !/var/tmp/zloop/*/vdev/ + if-no-files-found: ignore + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: Pool files + path: | + /var/tmp/zloop/*/vdev/ + if-no-files-found: ignore diff --git a/sys/contrib/openzfs/META b/sys/contrib/openzfs/META index 87ffae5f4c09..886da443357d 100644 --- a/sys/contrib/openzfs/META +++ b/sys/contrib/openzfs/META @@ -2,9 +2,9 @@ Meta: 1 Name: zfs Branch: 1.0 Version: 2.0.0 -Release: rc3 +Release: rc1 Release-Tags: relext License: CDDL Author: OpenZFS -Linux-Maximum: 5.9 +Linux-Maximum: 5.10 Linux-Minimum: 3.10 diff --git a/sys/contrib/openzfs/Makefile.am b/sys/contrib/openzfs/Makefile.am index b409d2196f86..436b78d76282 100644 --- a/sys/contrib/openzfs/Makefile.am +++ b/sys/contrib/openzfs/Makefile.am @@ -136,6 +136,13 @@ shellcheck: echo "skipping shellcheck because shellcheck is not installed"; \ fi +PHONY += checkabi storeabi +checkabi: lib + $(MAKE) -C lib checkabi + +storeabi: lib + $(MAKE) -C lib storeabi + *** 56332 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Jan 8 01:02:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 188624E268F; Fri, 8 Jan 2021 01:02:03 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) (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 4DBlDq02G1z4gcH; Fri, 8 Jan 2021 01:02:02 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: by mail-oi1-x22f.google.com with SMTP id s75so9616255oih.1; Thu, 07 Jan 2021 17:02:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=w7ZaGnUQWRGPueW4UtTjAj+mWLP9y0SlhnOOx+5yyvU=; b=c0vN5RdqdagnUPaWBATCEQCpnlyxKhs4ZpPfdtjm+g3jzlKq+EDI5g4+r1pwh+xymp PhNO3eWFmkaheNsDzJnLP++pWvWWRoiRCA8wf5L+vIbNBuFaTFcvkj5+zP2tBM6Hy9G7 u4pqxtzIZ2ss/MLiol7tta2AdW0K6Zmz49BPiVoewigkvtq9PQsGi0OxkWwymHNwa3F1 4VCfCaRXI1aE0KP90Gerwxqmg4+MKVck69Tdn8C9JpeDy5tUdqxcX/Tt/8fu7Bb2NfUK TnAM6C/ktDRrXXilkwUvj2ZM3sTyRuu9eL7fUhfF6IzOiciSySqElmkY2qEwJLvQyVaE mhEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=w7ZaGnUQWRGPueW4UtTjAj+mWLP9y0SlhnOOx+5yyvU=; b=e0ROShCJW9h41a5FbjHGloxzsArJ7C3M0CqqvJNtRHKvpuToth+/4OpG6PqXabG2Ov qFg9AwF9jq4uM864mY1eVRU3SvKSQphouolqZ8z8jo1rqx5LSv15mvmZFZ3UGdEHOCuc 413Qrwk00P1Yw3F/AmNNpaEO2HZqN6h0bdeTB9I78vx7mNILXWZsUxyME7PanOQPN7EC d1D9Fk2B+Tj/LfTq3UkHqQAK+msZ5V1dHObYGn84NKZaMX8g8dpQgKgsVn3uPYRr2aRZ aYQ7uc9aEanK40G8bYulhCN3LMQbnOU81Ino2VvT6cr1jk1L6hZA/KRdvjc9DjpbKNIc AKsg== X-Gm-Message-State: AOAM530JH4Qc9hrt7sMSQISfIzNwYf5T/cYFd3ohiFwH5ZJjG4sRggJs SEs+7MFJNTzkUmCtDM9YIHGEcaLlL31P3RZEXkDE7ogl X-Google-Smtp-Source: ABdhPJy1JBzffHO6UIl+7HjgyCmqvtQb/GVZulMwc7YoAob1DMvtS+WzQpyjpl8JUFn4mmTICgjTO6qIwbP35yCTqhs= X-Received: by 2002:aca:474b:: with SMTP id u72mr874078oia.114.1610067721682; Thu, 07 Jan 2021 17:02:01 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a4a:a187:0:0:0:0:0 with HTTP; Thu, 7 Jan 2021 17:02:01 -0800 (PST) In-Reply-To: <202101080028.1080S1nv047048@gitrepo.freebsd.org> References: <202101080028.1080S1nv047048@gitrepo.freebsd.org> From: Oliver Pinter Date: Fri, 8 Jan 2021 02:02:01 +0100 Message-ID: Subject: Re: git: 84089de83e79 - main - ObsoleteFiles.inc: add newlines between some recent entries To: Ed Maste Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4DBlDq02G1z4gcH X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 01:02:03 -0000 On Friday, January 8, 2021, Ed Maste wrote: > The branch main has been updated by emaste: > > URL: https://cgit.FreeBSD.org/src/commit/?id= > 84089de83e79a0f748c6e22b1aacb59156e153d2 > > commit 84089de83e79a0f748c6e22b1aacb59156e153d2 > Author: Ed Maste > AuthorDate: 2021-01-08 00:27:15 +0000 > Commit: Ed Maste > CommitDate: 2021-01-08 00:27:15 +0000 > > ObsoleteFiles.inc: add newlines between some recent entries > --- > ObsoleteFiles.inc | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc > index eb5a7785b69e..35b8f88bd009 100644 > --- a/ObsoleteFiles.inc > +++ b/ObsoleteFiles.inc > @@ -42,6 +42,7 @@ OLD_DIRS+=usr/lib/compat/aout > > # 20210105: remove non widechar version of clang This was originally part of 821aa63a09402935da0a73abf20ba0441562aa07, but the clang here will be libncurses. > OLD_LIBS+=lib/libncurses.so.9 > + > # 20210103: new clang import which bumps version from 11.0.0 to 11.0.1. > OLD_FILES+=usr/lib/clang/11.0.0/include/cuda_wrappers/algorithm > OLD_FILES+=usr/lib/clang/11.0.0/include/cuda_wrappers/complex > @@ -333,6 +334,7 @@ OLD_FILES+=usr/libexec/kgdb > # 20201211: hme(4) removed > OLD_FILES+=usr/share/man/man4/hme.4.gz > OLD_FILES+=usr/share/man/man4/if_hme.4.gz > + > # 20201124: ping6(8) was merged into ping(8) > OLD_FILES+=usr/lib/debug/sbin/ping6.debug > OLD_FILES+=usr/share/man/man8/ping6.8.gz > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main- > unsubscribe@freebsd.org" > From owner-dev-commits-src-all@freebsd.org Fri Jan 8 01:42:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7748A4E2FAA; Fri, 8 Jan 2021 01:42:38 +0000 (UTC) (envelope-from git@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 4DBm7f30Pyz4j8q; Fri, 8 Jan 2021 01:42:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59A651B310; Fri, 8 Jan 2021 01:42:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1081gcW2050416; Fri, 8 Jan 2021 01:42:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1081gciG050415; Fri, 8 Jan 2021 01:42:38 GMT (envelope-from git) Date: Fri, 8 Jan 2021 01:42:38 GMT Message-Id: <202101080142.1081gciG050415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Matt Macy Subject: git: b363d3d52a49 - main - OpenZFS: Fix issues caused by reversed commits + rebase MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmacy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b363d3d52a4977fa6e3856bb88fca1224e043234 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 01:42:38 -0000 The branch main has been updated by mmacy: URL: https://cgit.FreeBSD.org/src/commit/?id=b363d3d52a4977fa6e3856bb88fca1224e043234 commit b363d3d52a4977fa6e3856bb88fca1224e043234 Author: Matt Macy AuthorDate: 2021-01-08 00:03:48 +0000 Commit: Matt Macy CommitDate: 2021-01-08 01:42:10 +0000 OpenZFS: Fix issues caused by reversed commits + rebase --- cddl/lib/libzpool/Makefile | 2 ++ sys/conf/files | 5 ++++- .../include/os/freebsd/zfs/sys/{zfs_vnops.h => zfs_vnops_os.h} | 0 .../include/os/linux/zfs/sys/{zfs_vnops.h => zfs_vnops_os.h} | 0 sys/contrib/openzfs/module/os/freebsd/zfs/zfs_onexit_os.c | 0 .../openzfs/module/os/freebsd/zfs/{zfs_vnops.c => zfs_vnops_os.c} | 0 .../openzfs/module/os/linux/zfs/{zfs_vnops.c => zfs_vnops_os.c} | 0 sys/contrib/openzfs/module/zfs/arc.c | 1 - sys/modules/zfs/Makefile | 8 ++++++-- 9 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cddl/lib/libzpool/Makefile b/cddl/lib/libzpool/Makefile index 643bafed8b74..0e2cc9456faa 100644 --- a/cddl/lib/libzpool/Makefile +++ b/cddl/lib/libzpool/Makefile @@ -124,6 +124,8 @@ KERNEL_C = \ unique.c \ vdev.c \ vdev_cache.c \ + vdev_draid.c \ + vdev_draid_rand.c \ vdev_file.c \ vdev_indirect_births.c \ vdev_indirect.c \ diff --git a/sys/conf/files b/sys/conf/files index 4a5421936558..467cbb3406f1 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -218,7 +218,7 @@ contrib/openzfs/module/os/freebsd/zfs/zfs_file_os.c optional zfs compile-with " contrib/openzfs/module/os/freebsd/zfs/zfs_ioctl_compat.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/os/freebsd/zfs/zfs_ioctl_os.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c optional zfs compile-with "${ZFS_C}" -contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c optional zfs compile-with "${ZFS_C}" +contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/os/freebsd/zfs/zio_crypt.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/os/freebsd/zfs/zvol_os.c optional zfs compile-with "${ZFS_C}" @@ -311,6 +311,8 @@ contrib/openzfs/module/zfs/uberblock.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zfs/unique.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zfs/vdev.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zfs/vdev_cache.c optional zfs compile-with "${ZFS_C}" +contrib/openzfs/module/zfs/vdev_draid.c optional zfs compile-with "${ZFS_C}" +contrib/openzfs/module/zfs/vdev_draid_rand.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zfs/vdev_indirect.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zfs/vdev_indirect_births.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zfs/vdev_indirect_mapping.c optional zfs compile-with "${ZFS_C}" @@ -347,6 +349,7 @@ contrib/openzfs/module/zfs/zfs_ratelimit.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zfs/zfs_replay.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zfs/zfs_rlock.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zfs/zfs_sa.c optional zfs compile-with "${ZFS_C}" +contrib/openzfs/module/zfs/zfs_vnops.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zstd/zfs_zstd.c optional zfs zstdio compile-with "${ZFS_C}" contrib/openzfs/module/zfs/zil.c optional zfs compile-with "${ZFS_C}" contrib/openzfs/module/zfs/zio.c optional zfs compile-with "${ZFS_C}" diff --git a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vnops.h b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vnops_os.h similarity index 100% rename from sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vnops.h rename to sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vnops_os.h diff --git a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vnops.h b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vnops_os.h similarity index 100% rename from sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vnops.h rename to sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_vnops_os.h diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_onexit_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_onexit_os.c deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c similarity index 100% rename from sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c rename to sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zfs_vnops.c b/sys/contrib/openzfs/module/os/linux/zfs/zfs_vnops_os.c similarity index 100% rename from sys/contrib/openzfs/module/os/linux/zfs/zfs_vnops.c rename to sys/contrib/openzfs/module/os/linux/zfs/zfs_vnops_os.c diff --git a/sys/contrib/openzfs/module/zfs/arc.c b/sys/contrib/openzfs/module/zfs/arc.c index c21ae27b9af8..e05b11d51942 100644 --- a/sys/contrib/openzfs/module/zfs/arc.c +++ b/sys/contrib/openzfs/module/zfs/arc.c @@ -4896,7 +4896,6 @@ arc_evict_cb_check(void *arg, zthr_t *zthr) * suffice. The arc_state_t structures can be queried * directly if more accurate information is needed. */ -#ifndef __FreeBSD__ if (arc_ksp != NULL) arc_ksp->ks_update(arc_ksp, KSTAT_READ); #endif diff --git a/sys/modules/zfs/Makefile b/sys/modules/zfs/Makefile index d2617dc6bdc6..e4b92db764ef 100644 --- a/sys/modules/zfs/Makefile +++ b/sys/modules/zfs/Makefile @@ -128,7 +128,7 @@ SRCS+= abd_os.c \ zfs_log.c \ zfs_replay.c \ zfs_vfsops.c \ - zfs_vnops.c \ + zfs_vnops_os.c \ zfs_znode.c \ zio_crypt.c \ zvol_os.c @@ -223,6 +223,8 @@ SRCS+= abd.c \ unique.c \ vdev.c \ vdev_cache.c \ + vdev_draid.c \ + vdev_draid_rand.c \ vdev_indirect.c \ vdev_indirect_births.c \ vdev_indirect_mapping.c \ @@ -264,6 +266,7 @@ SRCS+= abd.c \ zfs_ratelimit.c \ zfs_rlock.c \ zfs_sa.c \ + zfs_vnops.c \ zil.c \ zio.c \ zio_checksum.c \ @@ -294,7 +297,7 @@ CFLAGS.spl_vm.c= -Wno-cast-qual CFLAGS.spl_zlib.c= -Wno-cast-qual CFLAGS.abd.c= -Wno-cast-qual CFLAGS.zfs_log.c= -Wno-cast-qual -CFLAGS.zfs_vnops.c= -Wno-pointer-arith +CFLAGS.zfs_vnops_os.c= -Wno-pointer-arith CFLAGS.u8_textprep.c= -Wno-cast-qual CFLAGS.zfs_fletcher.c= -Wno-cast-qual -Wno-pointer-arith CFLAGS.zfs_fletcher_intel.c= -Wno-cast-qual -Wno-pointer-arith @@ -312,6 +315,7 @@ CFLAGS.lz4.c= -Wno-cast-qual CFLAGS.spa.c= -Wno-cast-qual CFLAGS.spa_misc.c= -Wno-cast-qual CFLAGS.sysctl_os.c= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h +CFLAGS.vdev_draid.c= -Wno-cast-qual CFLAGS.vdev_raidz.c= -Wno-cast-qual CFLAGS.vdev_raidz_math.c= -Wno-cast-qual CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual From owner-dev-commits-src-all@freebsd.org Fri Jan 8 02:08:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 209A44E3359; Fri, 8 Jan 2021 02:08:17 +0000 (UTC) (envelope-from git@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 4DBmjF0PLkz4k0f; Fri, 8 Jan 2021 02:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 008621B8AC; Fri, 8 Jan 2021 02:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10828GEL077707; Fri, 8 Jan 2021 02:08:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10828GMU077706; Fri, 8 Jan 2021 02:08:16 GMT (envelope-from git) Date: Fri, 8 Jan 2021 02:08:16 GMT Message-Id: <202101080208.10828GMU077706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: a28fcd1c6360 - main - Correct typo in ObsoleteFiles.inc comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a28fcd1c636085993847fda8b08798128f8fbf3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 02:08:17 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=a28fcd1c636085993847fda8b08798128f8fbf3c commit a28fcd1c636085993847fda8b08798128f8fbf3c Author: Ed Maste AuthorDate: 2021-01-08 02:07:18 +0000 Commit: Ed Maste CommitDate: 2021-01-08 02:08:10 +0000 Correct typo in ObsoleteFiles.inc comment Reported by: Oliver Pinter --- ObsoleteFiles.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 35b8f88bd009..73b9f667fa17 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,7 +40,7 @@ OLD_DIRS+=usr/lib/aout OLD_DIRS+=usr/lib/compat/aout -# 20210105: remove non widechar version of clang +# 20210105: remove non widechar version of ncurses OLD_LIBS+=lib/libncurses.so.9 # 20210103: new clang import which bumps version from 11.0.0 to 11.0.1. From owner-dev-commits-src-all@freebsd.org Fri Jan 8 02:51:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 076624E3FAA; Fri, 8 Jan 2021 02:51:12 +0000 (UTC) (envelope-from git@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 4DBnfl6k8Cz4lfT; Fri, 8 Jan 2021 02:51:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D99BB1C20C; Fri, 8 Jan 2021 02:51:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1082pBIx037121; Fri, 8 Jan 2021 02:51:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1082pBah037120; Fri, 8 Jan 2021 02:51:11 GMT (envelope-from git) Date: Fri, 8 Jan 2021 02:51:11 GMT Message-Id: <202101080251.1082pBah037120@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 20321e622515 - main - Regenerate syscall files after reallocation of aio_writev/aio_readv MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20321e622515aec35becb7de71ebe65021fd45b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 02:51:12 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=20321e622515aec35becb7de71ebe65021fd45b4 commit 20321e622515aec35becb7de71ebe65021fd45b4 Author: Alan Somers AuthorDate: 2021-01-05 23:31:35 +0000 Commit: Alan Somers CommitDate: 2021-01-08 02:50:32 +0000 Regenerate syscall files after reallocation of aio_writev/aio_readv --- sys/compat/freebsd32/freebsd32_proto.h | 20 +++--- sys/compat/freebsd32/freebsd32_syscall.h | 6 +- sys/compat/freebsd32/freebsd32_syscalls.c | 6 +- sys/compat/freebsd32/freebsd32_sysent.c | 6 +- sys/compat/freebsd32/freebsd32_systrace_args.c | 88 +++++++++++++------------- sys/kern/init_sysent.c | 6 +- sys/kern/syscalls.c | 6 +- sys/kern/systrace_args.c | 88 +++++++++++++------------- sys/sys/syscall.h | 6 +- sys/sys/syscall.mk | 6 +- sys/sys/sysproto.h | 20 +++--- 11 files changed, 133 insertions(+), 125 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h index 148f58050117..14a2fe794c94 100644 --- a/sys/compat/freebsd32/freebsd32_proto.h +++ b/sys/compat/freebsd32/freebsd32_proto.h @@ -251,12 +251,6 @@ struct freebsd32_lio_listio_args { char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; char sig_l_[PADL_(struct sigevent32 *)]; struct sigevent32 * sig; char sig_r_[PADR_(struct sigevent32 *)]; }; -struct freebsd32_aio_writev_args { - char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; -}; -struct freebsd32_aio_readv_args { - char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; -}; struct freebsd32_lutimes_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char tptr_l_[PADL_(struct timeval32 *)]; struct timeval32 * tptr; char tptr_r_[PADR_(struct timeval32 *)]; @@ -751,6 +745,12 @@ struct freebsd32___sysctlbyname_args { char new_l_[PADL_(void *)]; void * new; char new_r_[PADR_(void *)]; char newlen_l_[PADL_(size_t)]; size_t newlen; char newlen_r_[PADR_(size_t)]; }; +struct freebsd32_aio_writev_args { + char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; +}; +struct freebsd32_aio_readv_args { + char aiocbp_l_[PADL_(struct aiocb32 *)]; struct aiocb32 * aiocbp; char aiocbp_r_[PADR_(struct aiocb32 *)]; +}; #if !defined(PAD64_REQUIRED) && !defined(__amd64__) #define PAD64_REQUIRED #endif @@ -795,8 +795,6 @@ int freebsd32_clock_getcpuclockid2(struct thread *, struct freebsd32_clock_getcp int freebsd32_aio_read(struct thread *, struct freebsd32_aio_read_args *); int freebsd32_aio_write(struct thread *, struct freebsd32_aio_write_args *); int freebsd32_lio_listio(struct thread *, struct freebsd32_lio_listio_args *); -int freebsd32_aio_writev(struct thread *, struct freebsd32_aio_writev_args *); -int freebsd32_aio_readv(struct thread *, struct freebsd32_aio_readv_args *); int freebsd32_lutimes(struct thread *, struct freebsd32_lutimes_args *); int freebsd32_preadv(struct thread *, struct freebsd32_preadv_args *); int freebsd32_pwritev(struct thread *, struct freebsd32_pwritev_args *); @@ -893,6 +891,8 @@ int freebsd32_kevent(struct thread *, struct freebsd32_kevent_args *); int freebsd32_cpuset_getdomain(struct thread *, struct freebsd32_cpuset_getdomain_args *); int freebsd32_cpuset_setdomain(struct thread *, struct freebsd32_cpuset_setdomain_args *); int freebsd32___sysctlbyname(struct thread *, struct freebsd32___sysctlbyname_args *); +int freebsd32_aio_writev(struct thread *, struct freebsd32_aio_writev_args *); +int freebsd32_aio_readv(struct thread *, struct freebsd32_aio_readv_args *); #ifdef COMPAT_43 @@ -1382,8 +1382,6 @@ int freebsd11_freebsd32_fstatat(struct thread *, struct freebsd11_freebsd32_fsta #define FREEBSD32_SYS_AUE_freebsd32_aio_read AUE_AIO_READ #define FREEBSD32_SYS_AUE_freebsd32_aio_write AUE_AIO_WRITE #define FREEBSD32_SYS_AUE_freebsd32_lio_listio AUE_LIO_LISTIO -#define FREEBSD32_SYS_AUE_freebsd32_aio_writev AUE_AIO_WRITEV -#define FREEBSD32_SYS_AUE_freebsd32_aio_readv AUE_AIO_READV #define FREEBSD32_SYS_AUE_freebsd11_freebsd32_getdents AUE_O_GETDENTS #define FREEBSD32_SYS_AUE_freebsd32_lutimes AUE_LUTIMES #define FREEBSD32_SYS_AUE_freebsd32_preadv AUE_PREADV @@ -1476,6 +1474,8 @@ int freebsd11_freebsd32_fstatat(struct thread *, struct freebsd11_freebsd32_fsta #define FREEBSD32_SYS_AUE_freebsd32_cpuset_getdomain AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_cpuset_setdomain AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32___sysctlbyname AUE_SYSCTL +#define FREEBSD32_SYS_AUE_freebsd32_aio_writev AUE_AIO_WRITEV +#define FREEBSD32_SYS_AUE_freebsd32_aio_readv AUE_AIO_READV #undef PAD_ #undef PADL_ diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h index edb68b36096e..eea7e2f56968 100644 --- a/sys/compat/freebsd32/freebsd32_syscall.h +++ b/sys/compat/freebsd32/freebsd32_syscall.h @@ -229,8 +229,6 @@ #define FREEBSD32_SYS_freebsd32_aio_read 255 #define FREEBSD32_SYS_freebsd32_aio_write 256 #define FREEBSD32_SYS_freebsd32_lio_listio 257 -#define FREEBSD32_SYS_freebsd32_aio_writev 258 -#define FREEBSD32_SYS_freebsd32_aio_readv 259 #define FREEBSD32_SYS_freebsd11_freebsd32_getdents 272 #define FREEBSD32_SYS_lchmod 274 /* 275 is obsolete netbsd_lchown */ @@ -506,4 +504,6 @@ #define FREEBSD32_SYS_close_range 575 #define FREEBSD32_SYS_rpctls_syscall 576 #define FREEBSD32_SYS___specialfd 577 -#define FREEBSD32_SYS_MAXSYSCALL 578 +#define FREEBSD32_SYS_freebsd32_aio_writev 578 +#define FREEBSD32_SYS_freebsd32_aio_readv 579 +#define FREEBSD32_SYS_MAXSYSCALL 580 diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c index ba36bd222f11..0311882f02d0 100644 --- a/sys/compat/freebsd32/freebsd32_syscalls.c +++ b/sys/compat/freebsd32/freebsd32_syscalls.c @@ -267,8 +267,8 @@ const char *freebsd32_syscallnames[] = { "freebsd32_aio_read", /* 255 = freebsd32_aio_read */ "freebsd32_aio_write", /* 256 = freebsd32_aio_write */ "freebsd32_lio_listio", /* 257 = freebsd32_lio_listio */ - "freebsd32_aio_writev", /* 258 = freebsd32_aio_writev */ - "freebsd32_aio_readv", /* 259 = freebsd32_aio_readv */ + "#258", /* 258 = nosys */ + "#259", /* 259 = nosys */ "#260", /* 260 = nosys */ "#261", /* 261 = nosys */ "#262", /* 262 = nosys */ @@ -614,4 +614,6 @@ const char *freebsd32_syscallnames[] = { "close_range", /* 575 = close_range */ "rpctls_syscall", /* 576 = rpctls_syscall */ "__specialfd", /* 577 = __specialfd */ + "freebsd32_aio_writev", /* 578 = freebsd32_aio_writev */ + "freebsd32_aio_readv", /* 579 = freebsd32_aio_readv */ }; diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c index 91d6e27778d4..bec3a87c820a 100644 --- a/sys/compat/freebsd32/freebsd32_sysent.c +++ b/sys/compat/freebsd32/freebsd32_sysent.c @@ -320,8 +320,8 @@ struct sysent freebsd32_sysent[] = { { .sy_narg = AS(freebsd32_aio_read_args), .sy_call = (sy_call_t *)freebsd32_aio_read, .sy_auevent = AUE_AIO_READ, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 255 = freebsd32_aio_read */ { .sy_narg = AS(freebsd32_aio_write_args), .sy_call = (sy_call_t *)freebsd32_aio_write, .sy_auevent = AUE_AIO_WRITE, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 256 = freebsd32_aio_write */ { .sy_narg = AS(freebsd32_lio_listio_args), .sy_call = (sy_call_t *)freebsd32_lio_listio, .sy_auevent = AUE_LIO_LISTIO, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 257 = freebsd32_lio_listio */ - { .sy_narg = AS(freebsd32_aio_writev_args), .sy_call = (sy_call_t *)freebsd32_aio_writev, .sy_auevent = AUE_AIO_WRITEV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 258 = freebsd32_aio_writev */ - { .sy_narg = AS(freebsd32_aio_readv_args), .sy_call = (sy_call_t *)freebsd32_aio_readv, .sy_auevent = AUE_AIO_READV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 259 = freebsd32_aio_readv */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 258 = nosys */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 259 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 260 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 261 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 262 = nosys */ @@ -667,4 +667,6 @@ struct sysent freebsd32_sysent[] = { { .sy_narg = AS(close_range_args), .sy_call = (sy_call_t *)sys_close_range, .sy_auevent = AUE_CLOSERANGE, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 575 = close_range */ { .sy_narg = AS(rpctls_syscall_args), .sy_call = (sy_call_t *)lkmressys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 576 = rpctls_syscall */ { .sy_narg = AS(__specialfd_args), .sy_call = (sy_call_t *)sys___specialfd, .sy_auevent = AUE_SPECIALFD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 577 = __specialfd */ + { .sy_narg = AS(freebsd32_aio_writev_args), .sy_call = (sy_call_t *)freebsd32_aio_writev, .sy_auevent = AUE_AIO_WRITEV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 578 = freebsd32_aio_writev */ + { .sy_narg = AS(freebsd32_aio_readv_args), .sy_call = (sy_call_t *)freebsd32_aio_readv, .sy_auevent = AUE_AIO_READV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 579 = freebsd32_aio_readv */ }; diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c index 3d6b228709a8..c4f1602f885c 100644 --- a/sys/compat/freebsd32/freebsd32_systrace_args.c +++ b/sys/compat/freebsd32/freebsd32_systrace_args.c @@ -1284,20 +1284,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 4; break; } - /* freebsd32_aio_writev */ - case 258: { - struct freebsd32_aio_writev_args *p = params; - uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb32 * */ - *n_args = 1; - break; - } - /* freebsd32_aio_readv */ - case 259: { - struct freebsd32_aio_readv_args *p = params; - uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb32 * */ - *n_args = 1; - break; - } /* lchmod */ case 274: { struct lchmod_args *p = params; @@ -3407,6 +3393,20 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } + /* freebsd32_aio_writev */ + case 578: { + struct freebsd32_aio_writev_args *p = params; + uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb32 * */ + *n_args = 1; + break; + } + /* freebsd32_aio_readv */ + case 579: { + struct freebsd32_aio_readv_args *p = params; + uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb32 * */ + *n_args = 1; + break; + } default: *n_args = 0; break; @@ -5434,26 +5434,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* freebsd32_aio_writev */ - case 258: - switch(ndx) { - case 0: - p = "userland struct aiocb32 *"; - break; - default: - break; - }; - break; - /* freebsd32_aio_readv */ - case 259: - switch(ndx) { - case 0: - p = "userland struct aiocb32 *"; - break; - default: - break; - }; - break; /* lchmod */ case 274: switch(ndx) { @@ -9183,6 +9163,26 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; + /* freebsd32_aio_writev */ + case 578: + switch(ndx) { + case 0: + p = "userland struct aiocb32 *"; + break; + default: + break; + }; + break; + /* freebsd32_aio_readv */ + case 579: + switch(ndx) { + case 0: + p = "userland struct aiocb32 *"; + break; + default: + break; + }; + break; default: break; }; @@ -9927,16 +9927,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; - /* freebsd32_aio_writev */ - case 258: - if (ndx == 0 || ndx == 1) - p = "int"; - break; - /* freebsd32_aio_readv */ - case 259: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* lchmod */ case 274: if (ndx == 0 || ndx == 1) @@ -11102,6 +11092,16 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; + /* freebsd32_aio_writev */ + case 578: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* freebsd32_aio_readv */ + case 579: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 775ae9f7fc7e..efd18ec5ce01 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -313,8 +313,8 @@ struct sysent sysent[] = { { .sy_narg = AS(aio_read_args), .sy_call = (sy_call_t *)sys_aio_read, .sy_auevent = AUE_AIO_READ, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 255 = aio_read */ { .sy_narg = AS(aio_write_args), .sy_call = (sy_call_t *)sys_aio_write, .sy_auevent = AUE_AIO_WRITE, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 256 = aio_write */ { .sy_narg = AS(lio_listio_args), .sy_call = (sy_call_t *)sys_lio_listio, .sy_auevent = AUE_LIO_LISTIO, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 257 = lio_listio */ - { .sy_narg = AS(aio_writev_args), .sy_call = (sy_call_t *)sys_aio_writev, .sy_auevent = AUE_AIO_WRITEV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 258 = aio_writev */ - { .sy_narg = AS(aio_readv_args), .sy_call = (sy_call_t *)sys_aio_readv, .sy_auevent = AUE_AIO_READV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 259 = aio_readv */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 258 = nosys */ + { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 259 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 260 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 261 = nosys */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 262 = nosys */ @@ -633,4 +633,6 @@ struct sysent sysent[] = { { .sy_narg = AS(close_range_args), .sy_call = (sy_call_t *)sys_close_range, .sy_auevent = AUE_CLOSERANGE, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 575 = close_range */ { .sy_narg = AS(rpctls_syscall_args), .sy_call = (sy_call_t *)lkmressys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 576 = rpctls_syscall */ { .sy_narg = AS(__specialfd_args), .sy_call = (sy_call_t *)sys___specialfd, .sy_auevent = AUE_SPECIALFD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 577 = __specialfd */ + { .sy_narg = AS(aio_writev_args), .sy_call = (sy_call_t *)sys_aio_writev, .sy_auevent = AUE_AIO_WRITEV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 578 = aio_writev */ + { .sy_narg = AS(aio_readv_args), .sy_call = (sy_call_t *)sys_aio_readv, .sy_auevent = AUE_AIO_READV, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 579 = aio_readv */ }; diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index 8b17b9af24d6..88fa3aee980f 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -264,8 +264,8 @@ const char *syscallnames[] = { "aio_read", /* 255 = aio_read */ "aio_write", /* 256 = aio_write */ "lio_listio", /* 257 = lio_listio */ - "aio_writev", /* 258 = aio_writev */ - "aio_readv", /* 259 = aio_readv */ + "#258", /* 258 = nosys */ + "#259", /* 259 = nosys */ "#260", /* 260 = nosys */ "#261", /* 261 = nosys */ "#262", /* 262 = nosys */ @@ -584,4 +584,6 @@ const char *syscallnames[] = { "close_range", /* 575 = close_range */ "rpctls_syscall", /* 576 = rpctls_syscall */ "__specialfd", /* 577 = __specialfd */ + "aio_writev", /* 578 = aio_writev */ + "aio_readv", /* 579 = aio_readv */ }; diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c index 936faddd8b11..7296b69787b0 100644 --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -1320,20 +1320,6 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 4; break; } - /* aio_writev */ - case 258: { - struct aio_writev_args *p = params; - uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb * */ - *n_args = 1; - break; - } - /* aio_readv */ - case 259: { - struct aio_readv_args *p = params; - uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb * */ - *n_args = 1; - break; - } /* lchmod */ case 274: { struct lchmod_args *p = params; @@ -3399,6 +3385,20 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) *n_args = 3; break; } + /* aio_writev */ + case 578: { + struct aio_writev_args *p = params; + uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb * */ + *n_args = 1; + break; + } + /* aio_readv */ + case 579: { + struct aio_readv_args *p = params; + uarg[0] = (intptr_t) p->aiocbp; /* struct aiocb * */ + *n_args = 1; + break; + } default: *n_args = 0; break; @@ -5485,26 +5485,6 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; - /* aio_writev */ - case 258: - switch(ndx) { - case 0: - p = "userland struct aiocb *"; - break; - default: - break; - }; - break; - /* aio_readv */ - case 259: - switch(ndx) { - case 0: - p = "userland struct aiocb *"; - break; - default: - break; - }; - break; /* lchmod */ case 274: switch(ndx) { @@ -9088,6 +9068,26 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; }; break; + /* aio_writev */ + case 578: + switch(ndx) { + case 0: + p = "userland struct aiocb *"; + break; + default: + break; + }; + break; + /* aio_readv */ + case 579: + switch(ndx) { + case 0: + p = "userland struct aiocb *"; + break; + default: + break; + }; + break; default: break; }; @@ -9854,16 +9854,6 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; - /* aio_writev */ - case 258: - if (ndx == 0 || ndx == 1) - p = "int"; - break; - /* aio_readv */ - case 259: - if (ndx == 0 || ndx == 1) - p = "int"; - break; /* lchmod */ case 274: if (ndx == 0 || ndx == 1) @@ -11034,6 +11024,16 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) if (ndx == 0 || ndx == 1) p = "int"; break; + /* aio_writev */ + case 578: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* aio_readv */ + case 579: + if (ndx == 0 || ndx == 1) + p = "int"; + break; default: break; }; diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index 9da639113a6f..3d2db9563e35 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -234,8 +234,6 @@ #define SYS_aio_read 255 #define SYS_aio_write 256 #define SYS_lio_listio 257 -#define SYS_aio_writev 258 -#define SYS_aio_readv 259 #define SYS_freebsd11_getdents 272 #define SYS_lchmod 274 /* 275 is obsolete netbsd_lchown */ @@ -515,4 +513,6 @@ #define SYS_close_range 575 #define SYS_rpctls_syscall 576 #define SYS___specialfd 577 -#define SYS_MAXSYSCALL 578 +#define SYS_aio_writev 578 +#define SYS_aio_readv 579 +#define SYS_MAXSYSCALL 580 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index cd2a595891e5..4c3e04ebd0f7 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -168,8 +168,6 @@ MIASM = \ aio_read.o \ aio_write.o \ lio_listio.o \ - aio_writev.o \ - aio_readv.o \ freebsd11_getdents.o \ lchmod.o \ lutimes.o \ @@ -420,4 +418,6 @@ MIASM = \ __realpathat.o \ close_range.o \ rpctls_syscall.o \ - __specialfd.o + __specialfd.o \ + aio_writev.o \ + aio_readv.o diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index 24f76b1c4409..66060ab77f9a 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -714,12 +714,6 @@ struct lio_listio_args { char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; char sig_l_[PADL_(struct sigevent *)]; struct sigevent * sig; char sig_r_[PADR_(struct sigevent *)]; }; -struct aio_writev_args { - char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)]; -}; -struct aio_readv_args { - char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)]; -}; struct lchmod_args { char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)]; @@ -1847,6 +1841,12 @@ struct __specialfd_args { char req_l_[PADL_(const void *)]; const void * req; char req_r_[PADR_(const void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; }; +struct aio_writev_args { + char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)]; +}; +struct aio_readv_args { + char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_sys_exit(struct thread *, struct sys_exit_args *); int sys_fork(struct thread *, struct fork_args *); @@ -2002,8 +2002,6 @@ int sys_lchown(struct thread *, struct lchown_args *); int sys_aio_read(struct thread *, struct aio_read_args *); int sys_aio_write(struct thread *, struct aio_write_args *); int sys_lio_listio(struct thread *, struct lio_listio_args *); -int sys_aio_writev(struct thread *, struct aio_writev_args *); -int sys_aio_readv(struct thread *, struct aio_readv_args *); int sys_lchmod(struct thread *, struct lchmod_args *); int sys_lutimes(struct thread *, struct lutimes_args *); int sys_preadv(struct thread *, struct preadv_args *); @@ -2241,6 +2239,8 @@ int sys___realpathat(struct thread *, struct __realpathat_args *); int sys_close_range(struct thread *, struct close_range_args *); int sys_rpctls_syscall(struct thread *, struct rpctls_syscall_args *); int sys___specialfd(struct thread *, struct __specialfd_args *); +int sys_aio_writev(struct thread *, struct aio_writev_args *); +int sys_aio_readv(struct thread *, struct aio_readv_args *); #ifdef COMPAT_43 @@ -2915,8 +2915,6 @@ int freebsd12_closefrom(struct thread *, struct freebsd12_closefrom_args *); #define SYS_AUE_aio_read AUE_AIO_READ #define SYS_AUE_aio_write AUE_AIO_WRITE #define SYS_AUE_lio_listio AUE_LIO_LISTIO -#define SYS_AUE_aio_writev AUE_AIO_WRITEV -#define SYS_AUE_aio_readv AUE_AIO_READV #define SYS_AUE_freebsd11_getdents AUE_O_GETDENTS #define SYS_AUE_lchmod AUE_LCHMOD #define SYS_AUE_lutimes AUE_LUTIMES @@ -3175,6 +3173,8 @@ int freebsd12_closefrom(struct thread *, struct freebsd12_closefrom_args *); #define SYS_AUE_close_range AUE_CLOSERANGE #define SYS_AUE_rpctls_syscall AUE_NULL #define SYS_AUE___specialfd AUE_SPECIALFD +#define SYS_AUE_aio_writev AUE_AIO_WRITEV +#define SYS_AUE_aio_readv AUE_AIO_READV #undef PAD_ #undef PADL_ From owner-dev-commits-src-all@freebsd.org Fri Jan 8 02:51:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1FF4A4E3FAB; Fri, 8 Jan 2021 02:51:12 +0000 (UTC) (envelope-from git@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 4DBnfm0R9Gz4m28; Fri, 8 Jan 2021 02:51:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0059B1C20D; Fri, 8 Jan 2021 02:51:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1082pB9Q037138; Fri, 8 Jan 2021 02:51:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1082pBDa037137; Fri, 8 Jan 2021 02:51:11 GMT (envelope-from git) Date: Fri, 8 Jan 2021 02:51:11 GMT Message-Id: <202101080251.1082pBDa037137@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: b3286afae364 - main - Reallocate syscall numbers for aio_writev and aio_readv MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b3286afae364c065183da3a910a33db3032529d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 02:51:12 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=b3286afae364c065183da3a910a33db3032529d4 commit b3286afae364c065183da3a910a33db3032529d4 Author: Alan Somers AuthorDate: 2021-01-05 23:28:23 +0000 Commit: Alan Somers CommitDate: 2021-01-08 02:49:27 +0000 Reallocate syscall numbers for aio_writev and aio_readv The originally chosen numbers interfere with downstream projects' syscalls. Move them to the end of the syscall table instead. Reported by: jrtc27 Reviewed by: brooks MFC-With: 022ca2fc7fe08d51f33a1d23a9be49e6d132914e Differential Revision: 022ca2fc7fe08d51f33a1d23a9be49e6d132914e --- sys/compat/freebsd32/syscalls.master | 10 ++++++---- sys/kern/syscalls.master | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master index ca0db9a76b1e..93d5a251d8ab 100644 --- a/sys/compat/freebsd32/syscalls.master +++ b/sys/compat/freebsd32/syscalls.master @@ -493,10 +493,8 @@ 257 AUE_LIO_LISTIO STD { int freebsd32_lio_listio(int mode, \ struct aiocb32 * const *acb_list, \ int nent, struct sigevent32 *sig); } -258 AUE_AIO_WRITEV STD { int freebsd32_aio_writev( \ - struct aiocb32 *aiocbp); } -259 AUE_AIO_READV STD { int freebsd32_aio_readv( \ - struct aiocb32 *aiocbp); } +258 AUE_NULL UNIMPL nosys +259 AUE_NULL UNIMPL nosys 260 AUE_NULL UNIMPL nosys 261 AUE_NULL UNIMPL nosys 262 AUE_NULL UNIMPL nosys @@ -1172,5 +1170,9 @@ const char *path); } 577 AUE_SPECIALFD NOPROTO { int __specialfd(int type, const void *req, \ size_t len); } +578 AUE_AIO_WRITEV STD { int freebsd32_aio_writev( \ + struct aiocb32 *aiocbp); } +579 AUE_AIO_READV STD { int freebsd32_aio_readv( \ + struct aiocb32 *aiocbp); } ; vim: syntax=off diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index aaa0a1277461..5c6ebeb9b52f 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1477,17 +1477,7 @@ _In_opt_ struct sigevent *sig ); } -258 AUE_AIO_WRITEV STD { - int aio_writev( - _Inout_ struct aiocb *aiocbp - ); - } -259 AUE_AIO_READV STD { - int aio_readv( - _Inout_ struct aiocb *aiocbp - ); - } -260-271 AUE_NULL UNIMPL nosys +258-271 AUE_NULL UNIMPL nosys 272 AUE_O_GETDENTS COMPAT11 { int getdents( int fd, @@ -3258,6 +3248,16 @@ size_t len ); } +578 AUE_AIO_WRITEV STD { + int aio_writev( + _Inout_ struct aiocb *aiocbp + ); + } +579 AUE_AIO_READV STD { + int aio_readv( + _Inout_ struct aiocb *aiocbp + ); + } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master From owner-dev-commits-src-all@freebsd.org Fri Jan 8 03:44:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BC5A84E4AB5; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@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 4DBpr04ybtz4pKq; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D4361CE1F; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1083iGhi006679; Fri, 8 Jan 2021 03:44:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1083iGcP006678; Fri, 8 Jan 2021 03:44:16 GMT (envelope-from git) Date: Fri, 8 Jan 2021 03:44:16 GMT Message-Id: <202101080344.1083iGcP006678@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 429c7d1ab4c0 - main - pccard: Update UPDATING MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 429c7d1ab4c0f56495e7b2e4acd15df91cbc14ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 03:44:16 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=429c7d1ab4c0f56495e7b2e4acd15df91cbc14ab commit 429c7d1ab4c0f56495e7b2e4acd15df91cbc14ab Author: Warner Losh AuthorDate: 2021-01-08 00:21:14 +0000 Commit: Warner Losh CommitDate: 2021-01-08 03:41:08 +0000 pccard: Update UPDATING Update the UPDATING file for PC Card device removal. Also note that 1300134 is used for the FreeBSD_version since wulf@ just bumped that in the last few hours. --- UPDATING | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPDATING b/UPDATING index a2647870235f..cbb9000b17db 100644 --- a/UPDATING +++ b/UPDATING @@ -26,6 +26,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20210108: + PC Card attachments for all devices have been removed. In the case of + wi and cmx, the entire drivers were removed because they were only + PC Card devices. FreeBSD_version 1300134 should be used for this + since it was bumped so recently. + 20210107: Transport-independent parts of HID support have been split off the USB code in to separate subsystem. Kernel configs which include one of From owner-dev-commits-src-all@freebsd.org Fri Jan 8 03:44:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 107DB4E4BC9; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@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 4DBpr075Lcz4p4P; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4A0F1CE21; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1083iGM2006747; Fri, 8 Jan 2021 03:44:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1083iG3U006746; Fri, 8 Jan 2021 03:44:16 GMT (envelope-from git) Date: Fri, 8 Jan 2021 03:44:16 GMT Message-Id: <202101080344.1083iG3U006746@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 31cafce9fddd - main - pccard: Remove ata(4) PC Card attachemnt MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31cafce9fdddcfe18299b32cebe5762e4054eb4f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 03:44:17 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=31cafce9fdddcfe18299b32cebe5762e4054eb4f commit 31cafce9fdddcfe18299b32cebe5762e4054eb4f Author: Warner Losh AuthorDate: 2021-01-07 23:27:16 +0000 Commit: Warner Losh CommitDate: 2021-01-08 03:23:14 +0000 pccard: Remove ata(4) PC Card attachemnt Remove ata PC Card attachment. Relnotes: Yes --- share/man/man4/ata.4 | 4 - sys/conf/files | 1 - sys/dev/ata/ata-card.c | 189 --------------------------------------- sys/modules/ata/Makefile | 1 - sys/modules/ata/atacard/Makefile | 9 -- 5 files changed, 204 deletions(-) diff --git a/share/man/man4/ata.4 b/share/man/man4/ata.4 index d9bce208680f..4fb7a3a75874 100644 --- a/share/man/man4/ata.4 +++ b/share/man/man4/ata.4 @@ -44,7 +44,6 @@ place some of the following lines in .Bd -literal -offset indent ata_load="YES" -atacard_load="YES" ataisa_load="YES" atapci_load="YES" @@ -222,9 +221,6 @@ Unknown ATA chipsets are supported in PIO modes, and if the standard busmaster DMA registers are present and contain valid setup, DMA is also enabled, although the max mode is limited to UDMA33, as it is not known what the chipset can do and how to program it. -.Sh DEPRECATION NOTICE -The PC Card attachment of this driver is scheduled for removal prior to the release of -.Fx 13.0 .Sh NOTES Please remember that in order to use UDMA4/ATA66 and above modes you .Em must diff --git a/sys/conf/files b/sys/conf/files index 16086435246a..7fb003178270 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -920,7 +920,6 @@ dev/ata/ata-all.c optional ata | atacore dev/ata/ata-dma.c optional ata | atacore dev/ata/ata-lowlevel.c optional ata | atacore dev/ata/ata-sata.c optional ata | atacore -dev/ata/ata-card.c optional ata pccard | atapccard dev/ata/ata-isa.c optional ata isa | ataisa dev/ata/ata-pci.c optional ata pci | atapci dev/ata/chipsets/ata-acard.c optional ata pci | ataacard diff --git a/sys/dev/ata/ata-card.c b/sys/dev/ata/ata-card.c deleted file mode 100644 index aa688338558c..000000000000 --- a/sys/dev/ata/ata-card.c +++ /dev/null @@ -1,189 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 1998 - 2008 Søren Schmidt - * 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, - * without modification, immediately at the beginning of the file. - * 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 ``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 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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "pccarddevs.h" - -static const struct pccard_product ata_pccard_products[] = { - PCMCIA_CARD(FREECOM, PCCARDIDE), - PCMCIA_CARD(EXP, EXPMULTIMEDIA), - PCMCIA_CARD(IODATA3, CBIDE2), - PCMCIA_CARD(OEM2, CDROM1), - PCMCIA_CARD(OEM2, IDE), - PCMCIA_CARD(PANASONIC, KXLC005), - PCMCIA_CARD(TEAC, IDECARDII), - {NULL} -}; - -static int -ata_pccard_probe(device_t dev) -{ - const struct pccard_product *pp; - u_int32_t fcn = PCCARD_FUNCTION_UNSPEC; - int error = 0; - - if ((error = pccard_get_function(dev, &fcn))) - return error; - - /* if it says its a disk we should register it */ - if (fcn == PCCARD_FUNCTION_DISK) - return 0; - - /* match other devices here, primarily cdrom/dvd rom */ - if ((pp = pccard_product_lookup(dev, ata_pccard_products, - sizeof(ata_pccard_products[0]), NULL))) { - if (pp->pp_name) - device_set_desc(dev, pp->pp_name); - return 0; - } - return ENXIO; -} - -static int -ata_pccard_attach(device_t dev) -{ - struct ata_channel *ch = device_get_softc(dev); - struct resource *io, *ctlio; - int i, rid, err; - uint16_t funce; - - if (ch->attached) - return (0); - ch->attached = 1; - - /* allocate the io range to get start and length */ - rid = ATA_IOADDR_RID; - if (!(io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, - ATA_IOSIZE, RF_ACTIVE))) - return (ENXIO); - - /* setup the resource vectors */ - for (i = ATA_DATA; i <= ATA_COMMAND; i++) { - ch->r_io[i].res = io; - ch->r_io[i].offset = i; - } - ch->r_io[ATA_IDX_ADDR].res = io; - - /* - * if we got more than the default ATA_IOSIZE ports, this is a device - * where ctlio is located at offset 14 into "normal" io space. - */ - if (rman_get_size(io) > ATA_IOSIZE) { - ch->r_io[ATA_CONTROL].res = io; - ch->r_io[ATA_CONTROL].offset = 14; - } - else { - rid = ATA_CTLADDR_RID; - if (!(ctlio = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, - ATA_CTLIOSIZE, RF_ACTIVE))) { - bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); - for (i = ATA_DATA; i < ATA_MAX_RES; i++) - ch->r_io[i].res = NULL; - return (ENXIO); - } - ch->r_io[ATA_CONTROL].res = ctlio; - ch->r_io[ATA_CONTROL].offset = 0; - } - ata_default_registers(dev); - - /* initialize softc for this channel */ - ch->unit = 0; - ch->flags |= ATA_USE_16BIT; - funce = 0; /* Default to sane setting of FUNCE */ - pccard_get_funce_disk(dev, &funce); - if (!(funce & PFD_I_D)) - ch-> flags |= ATA_NO_SLAVE; - ata_generic_hw(dev); - err = ata_probe(dev); - if (err > 0) - return (err); - gone_in_dev(dev, 13, "pccard removed"); - return (ata_attach(dev)); -} - -static int -ata_pccard_detach(device_t dev) -{ - struct ata_channel *ch = device_get_softc(dev); - int i; - - if (!ch->attached) - return (0); - ch->attached = 0; - - ata_detach(dev); - if (ch->r_io[ATA_CONTROL].res != ch->r_io[ATA_DATA].res) - bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, - ch->r_io[ATA_CONTROL].res); - bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, - ch->r_io[ATA_DATA].res); - for (i = ATA_DATA; i < ATA_MAX_RES; i++) - ch->r_io[i].res = NULL; - return 0; -} - -static device_method_t ata_pccard_methods[] = { - /* device interface */ - DEVMETHOD(device_probe, ata_pccard_probe), - DEVMETHOD(device_attach, ata_pccard_attach), - DEVMETHOD(device_detach, ata_pccard_detach), - - DEVMETHOD_END -}; - -static driver_t ata_pccard_driver = { - "ata", - ata_pccard_methods, - sizeof(struct ata_channel), -}; - -DRIVER_MODULE(ata, pccard, ata_pccard_driver, ata_devclass, NULL, NULL); -MODULE_DEPEND(ata, ata, 1, 1, 1); -PCCARD_PNP_INFO(ata_pccard_products); diff --git a/sys/modules/ata/Makefile b/sys/modules/ata/Makefile index 21d853325824..c7d1b17f5f40 100644 --- a/sys/modules/ata/Makefile +++ b/sys/modules/ata/Makefile @@ -1,7 +1,6 @@ # $FreeBSD$ SUBDIR = atacore -SUBDIR += atacard SUBDIR += ataisa SUBDIR += atapci diff --git a/sys/modules/ata/atacard/Makefile b/sys/modules/ata/atacard/Makefile deleted file mode 100644 index 2b58e37dad9c..000000000000 --- a/sys/modules/ata/atacard/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/dev/ata - -KMOD= atacard -SRCS= ata-card.c -SRCS+= ata_if.h bus_if.h card_if.h device_if.h pccarddevs.h - -.include From owner-dev-commits-src-all@freebsd.org Fri Jan 8 03:44:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2F24A4E4EA8; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@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 4DBpr10nyrz4pLZ; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C7E21CE22; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1083iGQA006764; Fri, 8 Jan 2021 03:44:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1083iGYk006763; Fri, 8 Jan 2021 03:44:16 GMT (envelope-from git) Date: Fri, 8 Jan 2021 03:44:16 GMT Message-Id: <202101080344.1083iGYk006763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: ba29d48c7cbc - main - pccard: Remove uart(4) PC Card attachment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ba29d48c7cbc95ba08df1d62930bf7f7183f67d6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 03:44:17 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ba29d48c7cbc95ba08df1d62930bf7f7183f67d6 commit ba29d48c7cbc95ba08df1d62930bf7f7183f67d6 Author: Warner Losh AuthorDate: 2021-01-07 22:37:26 +0000 Commit: Warner Losh CommitDate: 2021-01-08 03:23:09 +0000 pccard: Remove uart(4) PC Card attachment pccard is going away, so remove uart's attachment. Relnotes: Yes --- share/man/man4/uart.4 | 3 -- sys/conf/files | 1 - sys/dev/uart/uart_bus_pccard.c | 106 ----------------------------------------- sys/modules/uart/Makefile | 7 ++- 4 files changed, 3 insertions(+), 114 deletions(-) diff --git a/share/man/man4/uart.4 b/share/man/man4/uart.4 index cce718b790f3..2fe7bb4175d5 100644 --- a/share/man/man4/uart.4 +++ b/share/man/man4/uart.4 @@ -271,9 +271,6 @@ be locked for devices that support more than one setting. The CLOCAL flag on callin ports should be locked off for logins to avoid certain security holes, but this needs to be done by getty if the callin port is used for anything else. -.Sh DEPRECATION NOTICE -The PC Card attachment of this driver is scheduled for removal prior to the release of -.Fx 13.0 .Sh FILES .Bl -tag -width "/dev/ttyu?.init" -compact .It Pa /dev/ttyu? diff --git a/sys/conf/files b/sys/conf/files index 86047c264a79..16086435246a 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3242,7 +3242,6 @@ dev/tws/tws_user.c optional tws dev/uart/uart_bus_acpi.c optional uart acpi dev/uart/uart_bus_fdt.c optional uart fdt dev/uart/uart_bus_isa.c optional uart isa -dev/uart/uart_bus_pccard.c optional uart pccard dev/uart/uart_bus_pci.c optional uart pci dev/uart/uart_bus_puc.c optional uart puc dev/uart/uart_bus_scc.c optional uart scc diff --git a/sys/dev/uart/uart_bus_pccard.c b/sys/dev/uart/uart_bus_pccard.c deleted file mode 100644 index c3397bc80b86..000000000000 --- a/sys/dev/uart/uart_bus_pccard.c +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003 Norikatsu Shigemura, Takenori Watanabe All rights reserved. - * Copyright (c) 2001 M. Warner Losh - * - * 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 ``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 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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include "pccarddevs.h" - -static int uart_pccard_probe(device_t dev); -static int uart_pccard_attach(device_t dev); - -static device_method_t uart_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, uart_pccard_probe), - DEVMETHOD(device_attach, uart_pccard_attach), - DEVMETHOD(device_detach, uart_bus_detach), - { 0, 0 } -}; - -static uint32_t uart_pccard_function = PCCARD_FUNCTION_SERIAL; - -static driver_t uart_pccard_driver = { - uart_driver_name, - uart_pccard_methods, - sizeof(struct uart_softc), -}; - -static int -uart_pccard_probe(device_t dev) -{ - int error; - uint32_t fcn; - - fcn = PCCARD_FUNCTION_UNSPEC; - error = pccard_get_function(dev, &fcn); - if (error != 0) - return (error); - /* - * If a serial card, we are likely the right driver. However, - * some serial cards are better serviced by other drivers, so - * allow other drivers to claim it, if they want. - */ - if (fcn == uart_pccard_function) - return (BUS_PROBE_GENERIC); - - return (ENXIO); -} - -static int -uart_pccard_attach(device_t dev) -{ - struct uart_softc *sc; - int error; - - sc = device_get_softc(dev); - sc->sc_class = &uart_ns8250_class; - - error = uart_bus_probe(dev, 0, 0, 0, 0, 0, 0); - if (error > 0) - return (error); - gone_in_dev(dev, 13, "pccard removed"); - return (uart_bus_attach(dev)); -} - -DRIVER_MODULE(uart, pccard, uart_pccard_driver, uart_devclass, 0, 0); -MODULE_PNP_INFO("U32:function_type;", pccard, uart, &uart_pccard_function, - 1); diff --git a/sys/modules/uart/Makefile b/sys/modules/uart/Makefile index 821fff46763e..ad946fb063d6 100644 --- a/sys/modules/uart/Makefile +++ b/sys/modules/uart/Makefile @@ -28,16 +28,15 @@ uart_dev_mu=uart_dev_mu.c .endif KMOD= uart -SRCS= ${uart_bus_acpi} uart_bus_isa.c uart_bus_pccard.c \ +SRCS= ${uart_bus_acpi} uart_bus_isa.c \ uart_bus_pci.c uart_bus_puc.c uart_bus_scc.c \ uart_core.c ${uart_cpu_acpi} ${uart_cpu_machine} uart_dbg.c \ ${uart_dev_mvebu} uart_dev_ns8250.c ${uart_dev_mu} \ uart_dev_quicc.c uart_dev_z8530.c \ uart_if.c uart_if.h uart_subr.c uart_tty.c -SRCS+= acpi_if.h bus_if.h card_if.h device_if.h isa_if.h ${ofw_bus_if} \ - pci_if.h \ - power_if.h pccarddevs.h serdev_if.h +SRCS+= acpi_if.h bus_if.h device_if.h isa_if.h ${ofw_bus_if} pci_if.h \ + serdev_if.h SRCS+= opt_acpi.h opt_platform.h opt_uart.h .include From owner-dev-commits-src-all@freebsd.org Fri Jan 8 03:44:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6E73A4E4EA9; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@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 4DBpr11qvyz4p78; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F2DE1CDA4; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1083iHlM006798; Fri, 8 Jan 2021 03:44:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1083iH2m006797; Fri, 8 Jan 2021 03:44:17 GMT (envelope-from git) Date: Fri, 8 Jan 2021 03:44:17 GMT Message-Id: <202101080344.1083iH2m006797@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 135021edfd9c - main - pccard: Remove puc(4) PC Card attachment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 135021edfd9c6cc570bec6236629848829da48ed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 03:44:17 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=135021edfd9c6cc570bec6236629848829da48ed commit 135021edfd9c6cc570bec6236629848829da48ed Author: Warner Losh AuthorDate: 2021-01-07 22:24:41 +0000 Commit: Warner Losh CommitDate: 2021-01-08 03:23:00 +0000 pccard: Remove puc(4) PC Card attachment Remove PUC's pccard attachment. This removes support for 16-bit PC Cards. Relnotes: Yes --- share/man/man4/puc.4 | 3 -- sys/conf/files | 1 - sys/dev/puc/puc_pccard.c | 112 ----------------------------------------------- sys/modules/puc/Makefile | 5 +-- 4 files changed, 2 insertions(+), 119 deletions(-) diff --git a/share/man/man4/puc.4 b/share/man/man4/puc.4 index effebf188419..eb76c36f4aff 100644 --- a/share/man/man4/puc.4 +++ b/share/man/man4/puc.4 @@ -47,9 +47,6 @@ driver. The list of supported devices is in .Pa sys/dev/puc/pucdata.c . Support for new cards should be added there. -.Sh DEPRECATION NOTICE -The PC Card attachment of this driver is scheduled for removal prior to the release of -.Fx 13.0 .Sh SEE ALSO .Xr ppc 4 , .Xr uart 4 diff --git a/sys/conf/files b/sys/conf/files index c9525bdcf49f..86047c264a79 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2766,7 +2766,6 @@ dev/pst/pst-raid.c optional pst dev/pty/pty.c optional pty dev/puc/puc.c optional puc dev/puc/puc_cfg.c optional puc -dev/puc/puc_pccard.c optional puc pccard dev/puc/puc_pci.c optional puc pci dev/pwm/pwmc.c optional pwm | pwmc dev/pwm/pwmbus.c optional pwm | pwmbus diff --git a/sys/dev/puc/puc_pccard.c b/sys/dev/puc/puc_pccard.c deleted file mode 100644 index 1b26b034dfa5..000000000000 --- a/sys/dev/puc/puc_pccard.c +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2002 Poul-Henning Kamp. 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 unmodified, 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 ``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 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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -/* http://www.argosy.com.tw/product/sp320.htm */ -const struct puc_cfg puc_pccard_rscom = { - 0, 0, 0, 0, - "ARGOSY SP320 Dual port serial PCMCIA", - DEFAULT_RCLK, - PUC_PORT_2S, 0, 1, 0, -}; - -static int -puc_pccard_probe(device_t dev) -{ - const char *vendor, *product; - int error; - - error = pccard_get_vendor_str(dev, &vendor); - if (error) - return(error); - error = pccard_get_product_str(dev, &product); - if (error) - return(error); - if (!strcmp(vendor, "PCMCIA") && !strcmp(product, "RS-COM 2P")) - return (puc_bfe_probe(dev, &puc_pccard_rscom)); - - return (ENXIO); -} - -static int -puc_pccard_attach(device_t dev) -{ - int error; - - error = puc_bfe_attach(dev); - if (error == 0) - gone_in_dev(dev, 13, "pccard removed"); - return (error); -} - -static device_method_t puc_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, puc_pccard_probe), - DEVMETHOD(device_attach, puc_pccard_attach), - DEVMETHOD(device_detach, puc_bfe_detach), - - DEVMETHOD(bus_alloc_resource, puc_bus_alloc_resource), - DEVMETHOD(bus_release_resource, puc_bus_release_resource), - DEVMETHOD(bus_get_resource, puc_bus_get_resource), - DEVMETHOD(bus_read_ivar, puc_bus_read_ivar), - DEVMETHOD(bus_setup_intr, puc_bus_setup_intr), - DEVMETHOD(bus_teardown_intr, puc_bus_teardown_intr), - DEVMETHOD(bus_print_child, puc_bus_print_child), - DEVMETHOD(bus_child_pnpinfo_str, puc_bus_child_pnpinfo_str), - DEVMETHOD(bus_child_location_str, puc_bus_child_location_str), - - DEVMETHOD_END -}; - -static driver_t puc_pccard_driver = { - puc_driver_name, - puc_pccard_methods, - sizeof(struct puc_softc), -}; - -DRIVER_MODULE(puc, pccard, puc_pccard_driver, puc_devclass, 0, 0); diff --git a/sys/modules/puc/Makefile b/sys/modules/puc/Makefile index 882e33343067..a306e5d77e86 100644 --- a/sys/modules/puc/Makefile +++ b/sys/modules/puc/Makefile @@ -4,8 +4,7 @@ .PATH: ${SRCTOP}/sys/dev/puc KMOD= puc -SRCS= puc.c puc_cfg.c puc_pci.c puc_pccard.c -SRCS+= bus_if.h device_if.h serdev_if.c serdev_if.h \ - card_if.h pci_if.h +SRCS= puc.c puc_cfg.c puc_pci.c +SRCS+= bus_if.h device_if.h serdev_if.c serdev_if.h pci_if.h .include From owner-dev-commits-src-all@freebsd.org Fri Jan 8 03:44:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E5C6B4E4D43; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@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 4DBpr068X2z4pCZ; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C40E21CCAB; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1083iGOm006713; Fri, 8 Jan 2021 03:44:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1083iGli006712; Fri, 8 Jan 2021 03:44:16 GMT (envelope-from git) Date: Fri, 8 Jan 2021 03:44:16 GMT Message-Id: <202101080344.1083iGli006712@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 23e124c78bcb - main - pccard: Remove bt3c(4) driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 23e124c78bcb46ac78d9f06449c4454f43732805 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 03:44:17 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=23e124c78bcb46ac78d9f06449c4454f43732805 commit 23e124c78bcb46ac78d9f06449c4454f43732805 Author: Warner Losh AuthorDate: 2021-01-07 22:52:49 +0000 Commit: Warner Losh CommitDate: 2021-01-08 03:40:41 +0000 pccard: Remove bt3c(4) driver pccard is being removed, so remove bt3c driver since it only has PC Card attachment. Also remove bt3cfw(8) since it's the firmware for this driver. Relnotes: Yes --- ObsoleteFiles.inc | 5 +- share/man/man4/Makefile | 1 - share/man/man4/ng_bt3c.4 | 132 --- sys/conf/NOTES | 1 - sys/conf/files | 1 - sys/modules/netgraph/bluetooth/Makefile | 1 - sys/modules/netgraph/bluetooth/bt3c/Makefile | 12 - .../bluetooth/drivers/bt3c/ng_bt3c_pccard.c | 1227 -------------------- sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h | 108 -- sys/netgraph/bluetooth/include/ng_bt3c.h | 112 -- usr.sbin/bluetooth/Makefile | 1 - usr.sbin/bluetooth/bt3cfw/Makefile | 11 - usr.sbin/bluetooth/bt3cfw/Makefile.depend | 18 - usr.sbin/bluetooth/bt3cfw/bt3cfw.8 | 73 -- usr.sbin/bluetooth/bt3cfw/bt3cfw.c | 230 ---- 15 files changed, 4 insertions(+), 1929 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index d5b7e22ab9e2..85d6e3eecd43 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,8 +36,11 @@ # xargs -n1 | sort | uniq -d; # done -# 20210108: retire cmx driver +# 20210108: retire cmx, ng_bt3c drivers +OLD_FILES+=usr/sbin/bt3cfw OLD_FILES+=usr/share/man/man4/cmw.4.gz +OLD_FILES+=usr/share/man/man4/ng_bt3c.4.gz +OLD_FILES+=usr/share/man/man8/bt3cfw.8.gz # 20210107: retire a.out support OLD_DIRS+=usr/lib/aout diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index beb5d47c46b2..95f11ed3ca1b 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -337,7 +337,6 @@ MAN= aac.4 \ ng_atmllc.4 \ ng_bpf.4 \ ng_bridge.4 \ - ng_bt3c.4 \ ng_btsocket.4 \ ng_car.4 \ ng_ccatm.4 \ diff --git a/share/man/man4/ng_bt3c.4 b/share/man/man4/ng_bt3c.4 deleted file mode 100644 index d3942ea1d7fc..000000000000 --- a/share/man/man4/ng_bt3c.4 +++ /dev/null @@ -1,132 +0,0 @@ -.\" Copyright (c) 2001-2002 Maksim Yevmenkin -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: ng_bt3c.4,v 1.3 2003/09/14 23:28:51 max Exp $ -.\" $FreeBSD$ -.\" -.Dd December 17, 2004 -.Dt NG_BT3C 4 -.Os -.Sh NAME -.Nm ng_bt3c -.Nd Netgraph node type that is also a 3Com Bluetooth PC card driver -.Sh SYNOPSIS -.In sys/types.h -.In netgraph/bluetooth/include/ng_bt3c.h -.Sh DEPRECATION NOTICE -This driver is scheduled for removal prior to the release of -.Fx 13.0 -.Sh DESCRIPTION -The -.Nm btccc -node type is both a persistent Netgraph node type and a driver for the -3Com Bluetooth PC card (3CRWB6096-HP). -It implements a Bluetooth HCI -UART transport layer as per chapter H4 of the Bluetooth Specification -Book v1.1. -A new node is created when the card is plugged. -.Pp -In order to use the card one -.Em MUST -download the firmware first. -Due to copyright issues the firmware cannot be provided with this driver. -The firmware can be obtained -from the Windows driver package that can be downloaded from the 3Com web -site at no charge. -The firmware name is -.Pa BT3CPCC.BIN . -To load the firmware into the card, use -.Xr bt3cfw 8 . -I am using the original firmware that came with the card on CD-ROM. -.Pp -.Dl "MD5 (BT3CPCC.BIN) = 36170fda56ea9fdbf1702c966f8a97f1" -.Pp -The node has a single hook called -.Dv hook . -Incoming bytes received on the device are re-assembled into HCI frames -(according to the length). -Full HCI frames are sent out on the hook. -HCI frames received on -.Dv hook -are transmitted out. -No modification to the data is performed in either direction. -.Sh HARDWARE -The -.Nm -driver provides support for the 3Com/HP 3CRWB6096-A PCCARD bluetooth adapter. -.Sh HOOKS -This node type supports the following hooks: -.Bl -tag -width ".Va hook" -.It Va hook -single HCI frame contained in single -.Vt mbuf -structure. -.El -.Sh CONTROL MESSAGES -This node type supports the generic control messages, plus the following: -.Bl -tag -width foo -.It Dv NGM_BT3C_NODE_GET_STATE Pq Ic get_state -Returns the current receiving state for the node. -.It Dv NGM_BT3C_NODE_SET_DEBUG Pq Ic set_debug -This command takes an integer argument and sets the current debug level -for the node. -.It Dv NGM_BT3C_NODE_GET_DEBUG Pq Ic get_debug -Returns an integer containing the current debug level for the node. -.It Dv NGM_BT3C_NODE_GET_QLEN Pq Ic get_qlen -This command takes a parameter that specifies queue number and returns -the current length of the queue for the node. -.It Dv NGM_BT3C_NODE_SET_QLEN Pq Ic set_qlen -This command takes two parameters that specify the queue number and -the maximum length of the queue and sets the maximum length of the queue for -the node. -.It Dv NGM_BT3C_NODE_GET_STAT Pq Ic get_stat -Returns various statistic information for the node, such as: number of -bytes (frames) sent, number of bytes (frames) received and number of -input (output) errors. -.It Dv NGM_BT3C_NODE_RESET_STAT Pq Ic reset_stat -Reset all statistic counters to zero. -.It Dv NGM_BT3C_NODE_DOWNLOAD_FIRMWARE -Download card firmware. -.El -.Sh SHUTDOWN -This node shuts down when the corresponding card is un-plugged. -.Sh SEE ALSO -.Xr cardbus 4 , -.Xr netgraph 4 , -.Xr pccbb 4 , -.Xr pcic 4 , -.Xr pccard.conf 5 , -.Xr bt3cfw 8 , -.Xr ngctl 8 -.Sh HISTORY -The -.Nm btccc -node type was implemented in -.Fx 5.0 . -.Sh AUTHORS -.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com -.Sh BUGS -The driver is based on information obtained from -.An Jose Orlando Pereira Aq Mt jop@di.uminho.pt -and disassembled the W2K driver. diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 103b0929a56c..c3a9c097dedb 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -769,7 +769,6 @@ options NETGRAPH_ASYNC options NETGRAPH_ATMLLC options NETGRAPH_ATM_ATMPIF options NETGRAPH_BLUETOOTH # ng_bluetooth(4) -options NETGRAPH_BLUETOOTH_BT3C # ng_bt3c(4) options NETGRAPH_BLUETOOTH_HCI # ng_hci(4) options NETGRAPH_BLUETOOTH_L2CAP # ng_l2cap(4) options NETGRAPH_BLUETOOTH_SOCKET # ng_btsocket(4) diff --git a/sys/conf/files b/sys/conf/files index d58d2e6c2e0d..370b67709ad6 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4259,7 +4259,6 @@ netgraph/atm/sscop/ng_sscop.c optional ngatm_sscop \ netgraph/atm/uni/ng_uni.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" netgraph/bluetooth/common/ng_bluetooth.c optional netgraph_bluetooth -netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c optional netgraph_bluetooth_bt3c netgraph/bluetooth/drivers/h4/ng_h4.c optional netgraph_bluetooth_h4 netgraph/bluetooth/drivers/ubt/ng_ubt.c optional netgraph_bluetooth_ubt usb netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c optional netgraph_bluetooth_ubt usb diff --git a/sys/modules/netgraph/bluetooth/Makefile b/sys/modules/netgraph/bluetooth/Makefile index 9169cf113491..4d353fd94f4b 100644 --- a/sys/modules/netgraph/bluetooth/Makefile +++ b/sys/modules/netgraph/bluetooth/Makefile @@ -6,7 +6,6 @@ SUBDIR= \ hci \ l2cap \ socket \ - bt3c \ ubt \ ubtbcmfw diff --git a/sys/modules/netgraph/bluetooth/bt3c/Makefile b/sys/modules/netgraph/bluetooth/bt3c/Makefile deleted file mode 100644 index 47c4f7a0f140..000000000000 --- a/sys/modules/netgraph/bluetooth/bt3c/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $Id: Makefile,v 1.2 2002/11/24 20:50:56 max Exp $ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/netgraph/bluetooth/drivers/bt3c - -CFLAGS+= -I${SRCTOP}/sys/netgraph/bluetooth/include \ - -I${SRCTOP}/sys/netgraph/bluetooth/drivers/bt3c - -KMOD= ng_bt3c -SRCS= ng_bt3c_pccard.c bus_if.h card_if.h device_if.h pccarddevs.h - -.include diff --git a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c deleted file mode 100644 index c9045e84f256..000000000000 --- a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c +++ /dev/null @@ -1,1227 +0,0 @@ -/* - * ng_bt3c_pccard.c - */ - -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001-2002 Maksim Yevmenkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: ng_bt3c_pccard.c,v 1.5 2003/04/01 18:15:21 max Exp $ - * $FreeBSD$ - * - * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX - * - * Based on information obrained from: Jose Orlando Pereira - * and disassembled w2k driver. - * - * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX - * - */ - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include "pccarddevs.h" - -#include -#include -#include -#include -#include -#include -#include - -/* Netgraph methods */ -static ng_constructor_t ng_bt3c_constructor; -static ng_shutdown_t ng_bt3c_shutdown; -static ng_newhook_t ng_bt3c_newhook; -static ng_connect_t ng_bt3c_connect; -static ng_disconnect_t ng_bt3c_disconnect; -static ng_rcvmsg_t ng_bt3c_rcvmsg; -static ng_rcvdata_t ng_bt3c_rcvdata; - -/* PCMCIA driver methods */ -static int bt3c_pccard_probe (device_t); -static int bt3c_pccard_attach (device_t); -static int bt3c_pccard_detach (device_t); - -static void bt3c_intr (void *); -static void bt3c_receive (bt3c_softc_p); - -static void bt3c_swi_intr (void *); -static void bt3c_forward (node_p, hook_p, void *, int); -static void bt3c_send (node_p, hook_p, void *, int); - -static void bt3c_download_firmware (bt3c_softc_p, char const *, int); - -#define bt3c_set_address(sc, address) \ -do { \ - bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_ADDR_L, ((address) & 0xff)); \ - bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_ADDR_H, (((address) >> 8) & 0xff)); \ -} while (0) - -#define bt3c_read_data(sc, data) \ -do { \ - (data) = bus_space_read_1((sc)->iot, (sc)->ioh, BT3C_DATA_L); \ - (data) |= ((bus_space_read_1((sc)->iot, (sc)->ioh, BT3C_DATA_H) & 0xff) << 8); \ -} while (0) - -#define bt3c_write_data(sc, data) \ -do { \ - bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_DATA_L, ((data) & 0xff)); \ - bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_DATA_H, (((data) >> 8) & 0xff)); \ -} while (0) - -#define bt3c_read_control(sc, data) \ -do { \ - (data) = bus_space_read_1((sc)->iot, (sc)->ioh, BT3C_CONTROL); \ -} while (0) - -#define bt3c_write_control(sc, data) \ -do { \ - bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_CONTROL, (data)); \ -} while (0) - -#define bt3c_read(sc, address, data) \ -do { \ - bt3c_set_address((sc), (address)); \ - bt3c_read_data((sc), (data)); \ -} while(0) - -#define bt3c_write(sc, address, data) \ -do { \ - bt3c_set_address((sc), (address)); \ - bt3c_write_data((sc), (data)); \ -} while(0) - -static MALLOC_DEFINE(M_BT3C, "bt3c", "bt3c data structures"); - -/**************************************************************************** - **************************************************************************** - ** Netgraph specific - **************************************************************************** - ****************************************************************************/ - -/* - * Netgraph node type - */ - -/* Queue length */ -static const struct ng_parse_struct_field ng_bt3c_node_qlen_type_fields[] = -{ - { "queue", &ng_parse_int32_type, }, - { "qlen", &ng_parse_int32_type, }, - { NULL, } -}; -static const struct ng_parse_type ng_bt3c_node_qlen_type = { - &ng_parse_struct_type, - &ng_bt3c_node_qlen_type_fields -}; - -/* Stat info */ -static const struct ng_parse_struct_field ng_bt3c_node_stat_type_fields[] = -{ - { "pckts_recv", &ng_parse_uint32_type, }, - { "bytes_recv", &ng_parse_uint32_type, }, - { "pckts_sent", &ng_parse_uint32_type, }, - { "bytes_sent", &ng_parse_uint32_type, }, - { "oerrors", &ng_parse_uint32_type, }, - { "ierrors", &ng_parse_uint32_type, }, - { NULL, } -}; -static const struct ng_parse_type ng_bt3c_node_stat_type = { - &ng_parse_struct_type, - &ng_bt3c_node_stat_type_fields -}; - -static const struct ng_cmdlist ng_bt3c_cmdlist[] = { -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_GET_STATE, - "get_state", - NULL, - &ng_parse_uint16_type -}, -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_SET_DEBUG, - "set_debug", - &ng_parse_uint16_type, - NULL -}, -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_GET_DEBUG, - "get_debug", - NULL, - &ng_parse_uint16_type -}, -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_GET_QLEN, - "get_qlen", - NULL, - &ng_bt3c_node_qlen_type -}, -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_SET_QLEN, - "set_qlen", - &ng_bt3c_node_qlen_type, - NULL -}, -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_GET_STAT, - "get_stat", - NULL, - &ng_bt3c_node_stat_type -}, -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_RESET_STAT, - "reset_stat", - NULL, - NULL -}, -{ 0, } -}; - -static struct ng_type typestruct = { - .version = NG_ABI_VERSION, - .name = NG_BT3C_NODE_TYPE, - .constructor = ng_bt3c_constructor, - .rcvmsg = ng_bt3c_rcvmsg, - .shutdown = ng_bt3c_shutdown, - .newhook = ng_bt3c_newhook, - .connect = ng_bt3c_connect, - .rcvdata = ng_bt3c_rcvdata, - .disconnect = ng_bt3c_disconnect, - .cmdlist = ng_bt3c_cmdlist -}; - -/* - * Netgraph node constructor. Do not allow to create node of this type. - */ - -static int -ng_bt3c_constructor(node_p node) -{ - return (EINVAL); -} /* ng_bt3c_constructor */ - -/* - * Netgraph node destructor. Destroy node only when device has been detached - */ - -static int -ng_bt3c_shutdown(node_p node) -{ - bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); - - /* Let old node go */ - NG_NODE_SET_PRIVATE(node, NULL); - NG_NODE_UNREF(node); - - /* Create new fresh one if we are not going down */ - if (sc == NULL) - goto out; - - /* Create new Netgraph node */ - if (ng_make_node_common(&typestruct, &sc->node) != 0) { - device_printf(sc->dev, "Could not create Netgraph node\n"); - sc->node = NULL; - goto out; - } - - /* Name new Netgraph node */ - if (ng_name_node(sc->node, device_get_nameunit(sc->dev)) != 0) { - device_printf(sc->dev, "Could not name Netgraph node\n"); - NG_NODE_UNREF(sc->node); - sc->node = NULL; - goto out; - } - - NG_NODE_SET_PRIVATE(sc->node, sc); -out: - return (0); -} /* ng_bt3c_shutdown */ - -/* - * Create new hook. There can only be one. - */ - -static int -ng_bt3c_newhook(node_p node, hook_p hook, char const *name) -{ - bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); - - if (strcmp(name, NG_BT3C_HOOK) != 0) - return (EINVAL); - - if (sc->hook != NULL) - return (EISCONN); - - sc->hook = hook; - - return (0); -} /* ng_bt3c_newhook */ - -/* - * Connect hook. Say YEP, that's OK with me. - */ - -static int -ng_bt3c_connect(hook_p hook) -{ - bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); - - if (hook != sc->hook) { - sc->hook = NULL; - return (EINVAL); - } - - /* set the hook into queueing mode (for incoming (from wire) packets) */ - NG_HOOK_FORCE_QUEUE(NG_HOOK_PEER(hook)); - - return (0); -} /* ng_bt3c_connect */ - -/* - * Disconnect hook - */ - -static int -ng_bt3c_disconnect(hook_p hook) -{ - bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); - - /* - * We need to check for sc != NULL because we can be called from - * bt3c_pccard_detach() via ng_rmnode_self() - */ - - if (sc != NULL) { - if (hook != sc->hook) - return (EINVAL); - - IF_DRAIN(&sc->inq); - IF_DRAIN(&sc->outq); - - sc->hook = NULL; - } - - return (0); -} /* ng_bt3c_disconnect */ - -/* - * Process control message - */ - -static int -ng_bt3c_rcvmsg(node_p node, item_p item, hook_p lasthook) -{ - bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); - struct ng_mesg *msg = NULL, *rsp = NULL; - int error = 0; - - if (sc == NULL) { - NG_FREE_ITEM(item); - return (EHOSTDOWN); - } - - NGI_GET_MSG(item, msg); - - switch (msg->header.typecookie) { - case NGM_GENERIC_COOKIE: - switch (msg->header.cmd) { - case NGM_TEXT_STATUS: - NG_MKRESPONSE(rsp, msg, NG_TEXTRESPONSE, M_NOWAIT); - if (rsp == NULL) - error = ENOMEM; - else - snprintf(rsp->data, NG_TEXTRESPONSE, - "Hook: %s\n" \ - "Flags: %#x\n" \ - "Debug: %d\n" \ - "State: %d\n" \ - "IncmQ: [len:%d,max:%d]\n" \ - "OutgQ: [len:%d,max:%d]\n", - (sc->hook != NULL)? NG_BT3C_HOOK : "", - sc->flags, - sc->debug, - sc->state, - _IF_QLEN(&sc->inq), /* XXX */ - sc->inq.ifq_maxlen, /* XXX */ - _IF_QLEN(&sc->outq), /* XXX */ - sc->outq.ifq_maxlen /* XXX */ - ); - break; - - default: - error = EINVAL; - break; - } - break; - - case NGM_BT3C_COOKIE: - switch (msg->header.cmd) { - case NGM_BT3C_NODE_GET_STATE: - NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_state_ep), - M_NOWAIT); - if (rsp == NULL) - error = ENOMEM; - else - *((ng_bt3c_node_state_ep *)(rsp->data)) = - sc->state; - break; - - case NGM_BT3C_NODE_SET_DEBUG: - if (msg->header.arglen != sizeof(ng_bt3c_node_debug_ep)) - error = EMSGSIZE; - else - sc->debug = - *((ng_bt3c_node_debug_ep *)(msg->data)); - break; - - case NGM_BT3C_NODE_GET_DEBUG: - NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_debug_ep), - M_NOWAIT); - if (rsp == NULL) - error = ENOMEM; - else - *((ng_bt3c_node_debug_ep *)(rsp->data)) = - sc->debug; - break; - - case NGM_BT3C_NODE_GET_QLEN: - NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_qlen_ep), - M_NOWAIT); - if (rsp == NULL) { - error = ENOMEM; - break; - } - - switch (((ng_bt3c_node_qlen_ep *)(msg->data))->queue) { - case NGM_BT3C_NODE_IN_QUEUE: - ((ng_bt3c_node_qlen_ep *)(rsp->data))->queue = - NGM_BT3C_NODE_IN_QUEUE; - ((ng_bt3c_node_qlen_ep *)(rsp->data))->qlen = - sc->inq.ifq_maxlen; - break; - - case NGM_BT3C_NODE_OUT_QUEUE: - ((ng_bt3c_node_qlen_ep *)(rsp->data))->queue = - NGM_BT3C_NODE_OUT_QUEUE; - ((ng_bt3c_node_qlen_ep *)(rsp->data))->qlen = - sc->outq.ifq_maxlen; - break; - - default: - NG_FREE_MSG(rsp); - error = EINVAL; - break; - } - break; - - case NGM_BT3C_NODE_SET_QLEN: - if (msg->header.arglen != sizeof(ng_bt3c_node_qlen_ep)){ - error = EMSGSIZE; - break; - } - - if (((ng_bt3c_node_qlen_ep *)(msg->data))->qlen <= 0) { - error = EINVAL; - break; - } - - switch (((ng_bt3c_node_qlen_ep *)(msg->data))->queue) { - case NGM_BT3C_NODE_IN_QUEUE: - sc->inq.ifq_maxlen = ((ng_bt3c_node_qlen_ep *) - (msg->data))->qlen; /* XXX */ - break; - - case NGM_BT3C_NODE_OUT_QUEUE: - sc->outq.ifq_maxlen = ((ng_bt3c_node_qlen_ep *) - (msg->data))->qlen; /* XXX */ - break; - - default: - error = EINVAL; - break; - } - break; - - case NGM_BT3C_NODE_GET_STAT: - NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_stat_ep), - M_NOWAIT); - if (rsp == NULL) - error = ENOMEM; - else - bcopy(&sc->stat, rsp->data, - sizeof(ng_bt3c_node_stat_ep)); - break; - - case NGM_BT3C_NODE_RESET_STAT: - NG_BT3C_STAT_RESET(sc->stat); - break; - - case NGM_BT3C_NODE_DOWNLOAD_FIRMWARE: - if (msg->header.arglen < - sizeof(ng_bt3c_firmware_block_ep)) - error = EMSGSIZE; - else - bt3c_download_firmware(sc, msg->data, - msg->header.arglen); - break; - - default: - error = EINVAL; - break; - } - break; - - default: - error = EINVAL; - break; - } - - NG_RESPOND_MSG(error, node, item, rsp); - NG_FREE_MSG(msg); - - return (error); -} /* ng_bt3c_rcvmsg */ - -/* - * Process data - */ - -static int -ng_bt3c_rcvdata(hook_p hook, item_p item) -{ - bt3c_softc_p sc = (bt3c_softc_p)NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); - struct mbuf *m = NULL; - int error = 0; - - if (sc == NULL) { - error = EHOSTDOWN; - goto out; - } - - if (hook != sc->hook) { - error = EINVAL; - goto out; - } - - NGI_GET_M(item, m); - - IF_LOCK(&sc->outq); - if (_IF_QFULL(&sc->outq)) { - NG_BT3C_ERR(sc->dev, -"Outgoing queue is full. Dropping mbuf, len=%d\n", m->m_pkthdr.len); - - NG_BT3C_STAT_OERROR(sc->stat); - - NG_FREE_M(m); - } else - _IF_ENQUEUE(&sc->outq, m); - IF_UNLOCK(&sc->outq); - - error = ng_send_fn(sc->node, NULL, bt3c_send, NULL, 0 /* new send */); -out: - NG_FREE_ITEM(item); - - return (error); -} /* ng_bt3c_rcvdata */ - -/**************************************************************************** - **************************************************************************** - ** PCMCIA driver specific - **************************************************************************** - ****************************************************************************/ - -/* - * PC Card (PCMCIA) probe routine - */ - -static struct pccard_product const bt3c_pccard_products[] = { - PCMCIA_CARD(3COM, 3CRWB609), - { NULL, } -}; - -static int -bt3c_pccard_probe(device_t dev) -{ - struct pccard_product const *pp = NULL; - - pp = pccard_product_lookup(dev, bt3c_pccard_products, - sizeof(bt3c_pccard_products[0]), NULL); - if (pp == NULL) - return (ENXIO); - - device_set_desc(dev, pp->pp_name); - - return (0); -} /* bt3c_pccard_probe */ - -/* - * PC Card (PCMCIA) attach routine - */ - -static int -bt3c_pccard_attach(device_t dev) -{ - bt3c_softc_p sc = (bt3c_softc_p) device_get_softc(dev); - - /* Allocate I/O ports */ - sc->iobase_rid = 0; - sc->iobase = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, - &sc->iobase_rid, 8, RF_ACTIVE); - if (sc->iobase == NULL) { - device_printf(dev, "Could not allocate I/O ports\n"); - goto bad; - } - sc->iot = rman_get_bustag(sc->iobase); - sc->ioh = rman_get_bushandle(sc->iobase); - - /* Allocate IRQ */ - sc->irq_rid = 0; - sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid, - RF_ACTIVE); - if (sc->irq == NULL) { - device_printf(dev, "Could not allocate IRQ\n"); - goto bad; - } - - sc->irq_cookie = NULL; - if (bus_setup_intr(dev, sc->irq, INTR_TYPE_TTY, NULL, bt3c_intr, sc, - &sc->irq_cookie) != 0) { - device_printf(dev, "Could not setup ISR\n"); - goto bad; - } - - /* Attach handler to TTY SWI thread */ - sc->ith = NULL; - if (swi_add(&tty_intr_event, device_get_nameunit(dev), - bt3c_swi_intr, sc, SWI_TTY, 0, &sc->ith) < 0) { - device_printf(dev, "Could not setup SWI ISR\n"); - goto bad; - } - - /* Create Netgraph node */ - if (ng_make_node_common(&typestruct, &sc->node) != 0) { - device_printf(dev, "Could not create Netgraph node\n"); - sc->node = NULL; - goto bad; - } - - /* Name Netgraph node */ - if (ng_name_node(sc->node, device_get_nameunit(dev)) != 0) { - device_printf(dev, "Could not name Netgraph node\n"); - NG_NODE_UNREF(sc->node); - sc->node = NULL; - goto bad; - } - - sc->dev = dev; - sc->debug = NG_BT3C_WARN_LEVEL; - - sc->inq.ifq_maxlen = sc->outq.ifq_maxlen = BT3C_DEFAULTQLEN; - mtx_init(&sc->inq.ifq_mtx, "BT3C inq", NULL, MTX_DEF); - mtx_init(&sc->outq.ifq_mtx, "BT3C outq", NULL, MTX_DEF); - - sc->state = NG_BT3C_W4_PKT_IND; - sc->want = 1; - - NG_NODE_SET_PRIVATE(sc->node, sc); - - gone_in_dev(dev, 13, "pccard removed"); - - return (0); -bad: - if (sc->ith != NULL) { - swi_remove(sc->ith); - sc->ith = NULL; - } - - if (sc->irq != NULL) { - if (sc->irq_cookie != NULL) - bus_teardown_intr(dev, sc->irq, sc->irq_cookie); - - bus_release_resource(dev, SYS_RES_IRQ, - sc->irq_rid, sc->irq); - - sc->irq = NULL; - sc->irq_rid = 0; - } - - if (sc->iobase != NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, - sc->iobase_rid, sc->iobase); - - sc->iobase = NULL; - sc->iobase_rid = 0; - } - - return (ENXIO); -} /* bt3c_pccacd_attach */ - -/* - * PC Card (PCMCIA) detach routine - */ - -static int -bt3c_pccard_detach(device_t dev) -{ - bt3c_softc_p sc = (bt3c_softc_p) device_get_softc(dev); - - if (sc == NULL) - return (0); - - swi_remove(sc->ith); - sc->ith = NULL; - *** 1102 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Jan 8 03:44:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F19824E4D44; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@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 4DBpr06Vsdz4p4N; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D24A41CDA3; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1083iGQf006730; Fri, 8 Jan 2021 03:44:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1083iGQ5006729; Fri, 8 Jan 2021 03:44:16 GMT (envelope-from git) Date: Fri, 8 Jan 2021 03:44:16 GMT Message-Id: <202101080344.1083iGQ5006729@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 0d3a424a89c1 - main - pccard: Remove cmx(4) driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0d3a424a89c1f61c2a46791c097a06f1d139cd5e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 03:44:17 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0d3a424a89c1f61c2a46791c097a06f1d139cd5e commit 0d3a424a89c1f61c2a46791c097a06f1d139cd5e Author: Warner Losh AuthorDate: 2021-01-07 22:15:09 +0000 Commit: Warner Losh CommitDate: 2021-01-08 03:23:18 +0000 pccard: Remove cmx(4) driver The only attachment of cmx was pccard, so remove the driver in anticipation of PC Card support removal. Relnotes: Yes --- ObsoleteFiles.inc | 3 + share/man/man4/Makefile | 1 - share/man/man4/cmx.4 | 126 --------- sys/conf/NOTES | 7 - sys/conf/files | 2 - sys/dev/cmx/cmx.c | 702 ----------------------------------------------- sys/dev/cmx/cmx_pccard.c | 116 -------- sys/dev/cmx/cmxreg.h | 68 ----- sys/dev/cmx/cmxvar.h | 101 ------- sys/modules/Makefile | 2 - sys/modules/cmx/Makefile | 10 - 11 files changed, 3 insertions(+), 1135 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 73b9f667fa17..d5b7e22ab9e2 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20210108: retire cmx driver +OLD_FILES+=usr/share/man/man4/cmw.4.gz + # 20210107: retire a.out support OLD_DIRS+=usr/lib/aout OLD_DIRS+=usr/lib/compat/aout diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index b905d97d80d0..beb5d47c46b2 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -111,7 +111,6 @@ MAN= aac.4 \ ${_chvgpio.4} \ ciss.4 \ cloudabi.4 \ - cmx.4 \ ${_coretemp.4} \ cp2112.4 \ ${_cpuctl.4} \ diff --git a/share/man/man4/cmx.4 b/share/man/man4/cmx.4 deleted file mode 100644 index 0600bb2071a4..000000000000 --- a/share/man/man4/cmx.4 +++ /dev/null @@ -1,126 +0,0 @@ -.\" -.\" Copyright (c) 2006-2007 Daniel Roethlisberger -.\" 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 unmodified, this list of conditions, and the following -.\" disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd July 7, 2007 -.Dt CMX 4 -.Os -.Sh NAME -.Nm cmx -.Nd Omnikey CardMan 4040 smartcard reader device driver -.Sh SYNOPSIS -.Cd device cmx -.Sh DEPRECATION NOTICE -This driver is scheduled for removal prior to the release of -.Fx 13.0 -.Sh DESCRIPTION -The -.Nm -driver provides support for the PCCARD based -.Em Omnikey CardMan 4040 -smartcard reader. -The driver provides a character device special file based -.Em Chip/Smart Card Interface Devices (CCID) -interface. -The driver implements what the vendor calls the -.Em Synchronous API -onto the smartcard reader device. -.Pp -Reading and writing is synchronous, meaning that a call to -.Xr write 2 -directly corresponds to a complete CCID command sent to the -device, while the following -.Xr read 2 -will return the complete answer from the reader. -There is no support for partial reads or writes. -There is no upper limit on -CCID request or response sizes, but the complete CCID request -must be sent to the driver in -.Xr write 2 -and the complete CCID response must fit into the buffer -supplied to -.Xr read 2 . -.Pp -Non-blocking I/O, -.Xr select 2 -and -.Xr poll 2 -are supported and work as expected. -An open file descriptor -will always be ready for writing, but only ready for reading -if the device indicates that it has data available. -.Sh FILES -.Bl -tag -width /usr/ports/security/openct -compact -.It Pa /dev/cmx\fBn\fP -Character device special file. -.It Pa /usr/ports/security/openct -OpenCT, a userspace smartcard daemon containing a -.Em CCID -driver which directly supports -.Nm -devices. -.\".It Pa /usr/ports/devel/pcsc-lite -.\"PC/SC-Lite, a userspace smartcard daemon. -.\".It Pa /usr/ports/devel/libccid -.\"libccid, a generic -.\".Em CCID -.\"driver for use by PC/SC-Lite to interface to -.\".Nm -.\"devices. -.El -.Sh COMPATIBILITY -Userland smartcard code written for the vendor's Linux drivers -should work with the -.Nm -driver without modification. -.Sh SEE ALSO -.Xr pccard 4 -.Sh HISTORY -The -.Nm cmx -driver first appeared in -.Fx 7.1 . -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was written by -.An Daniel Roethlisberger Aq Mt daniel@roe.ch , -originally based on the Linux driver v1.1.0 by -.An Omnikey GmbH Lk www.omnikey.com . -Early testing and bug fixes by -.An Marcin Cieslak Aq Mt saper@system.pl . -.Sh BUGS -.An -nosplit -The way the -.Nm -driver talks to the CardMan 4040 is a bit rough. -Due to the complete lack of hardware documentation other than vendor drivers -for other operating systems, the gory details of the device's -I/O registers are not understood very well. -There may be error conditions which can only be solved by physically -reinserting the reader. diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 62213a2a16ee..103b0929a56c 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2185,13 +2185,6 @@ options SND_FEEDER_RATE_HP options SND_PCM_64 options SND_OLDSTEREO -# -# Miscellaneous hardware: -# -# cmx: OmniKey CardMan 4040 pccard smartcard reader - -device cmx - # # PC Card/PCMCIA and Cardbus # diff --git a/sys/conf/files b/sys/conf/files index 7fb003178270..d58d2e6c2e0d 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1418,8 +1418,6 @@ dev/cfi/cfi_dev.c optional cfi dev/cfi/cfi_disk.c optional cfid dev/chromebook_platform/chromebook_platform.c optional chromebook_platform dev/ciss/ciss.c optional ciss -dev/cmx/cmx.c optional cmx -dev/cmx/cmx_pccard.c optional cmx pccard dev/cpufreq/ichss.c optional cpufreq pci dev/cxgb/cxgb_main.c optional cxgb pci \ compile-with "${NORMAL_C} -I$S/dev/cxgb" diff --git a/sys/dev/cmx/cmx.c b/sys/dev/cmx/cmx.c deleted file mode 100644 index f0ff4d80fff9..000000000000 --- a/sys/dev/cmx/cmx.c +++ /dev/null @@ -1,702 +0,0 @@ -/*- - * Copyright (c) 2006-2007 Daniel Roethlisberger - * Copyright (c) 2000-2004 OMNIKEY GmbH (www.omnikey.com) - * 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 unmodified, 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 -__FBSDID("$FreeBSD$"); - -/* - * OMNIKEY CardMan 4040 a.k.a. CardMan eXtended (cmx) driver. - * This is a PCMCIA based smartcard reader which seems to work - * like an I/O port mapped USB CCID smartcard device. - * - * I/O originally based on Linux driver version 1.1.0 by OMNIKEY. - * Dual GPL/BSD. Almost all of the code has been rewritten. - * $Omnikey: cm4040_cs.c,v 1.7 2004/10/04 09:08:50 jp Exp $ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#ifdef CMX_DEBUG -#define DEBUG_printf(dev, fmt, args...) \ - device_printf(dev, "%s: " fmt, __FUNCTION__, ##args) -#else -#define DEBUG_printf(dev, fmt, args...) -#endif - -#define SPIN_COUNT 1000 -#define WAIT_TICKS (hz/100) -#define POLL_TICKS (hz/10) - -/* possibly bogus */ -#define CCID_DRIVER_BULK_DEFAULT_TIMEOUT (150*hz) -#define CCID_DRIVER_ASYNC_POWERUP_TIMEOUT (35*hz) -#define CCID_DRIVER_MINIMUM_TIMEOUT (3*hz) - -#ifdef CMX_DEBUG -static char BSRBITS[] = "\020" - "\01BULK_OUT_FULL" /* 0x01 */ - "\02BULK_IN_FULL" /* 0x02 */ - "\03(0x04)"; /* 0x04 */ -#ifdef CMX_INTR -static char SCRBITS[] = "\020" - "\01POWER_DOWN" /* 0x01 */ - "\02PULSE_INTERRUPT" /* 0x02 */ - "\03HOST_TO_READER_DONE" /* 0x04 */ - "\04READER_TO_HOST_DONE" /* 0x08 */ - "\05ACK_NOTIFY" /* 0x10 */ - "\06EN_NOTIFY" /* 0x20 */ - "\07ABORT" /* 0x40 */ - "\10HOST_TO_READER_START"; /* 0x80 */ -#endif /* CMX_INTR */ -static char POLLBITS[] = "\020" - "\01POLLIN" /* 0x0001 */ - "\02POLLPRI" /* 0x0002 */ - "\03POLLOUT" /* 0x0004 */ - "\04POLLERR" /* 0x0008 */ - "\05POLLHUP" /* 0x0010 */ - "\06POLLINVAL" /* 0x0020 */ - "\07POLLRDNORM" /* 0x0040 */ - "\10POLLRDBAND" /* 0x0080 */ - "\11POLLWRBAND"; /* 0x0100 */ -static char MODEBITS[] = "\020" - "\01READ" /* 0x0001 */ - "\02WRITE" /* 0x0002 */ - "\03NONBLOCK" /* 0x0004 */ - "\04APPEND" /* 0x0008 */ - "\05SHLOCK" /* 0x0010 */ - "\06EXLOCK" /* 0x0020 */ - "\07ASYNC" /* 0x0040 */ - "\10FSYNC" /* 0x0080 */ - "\11NOFOLLOW" /* 0x0100 */ - "\12CREAT" /* 0x0200 */ - "\13TRUNK" /* 0x0400 */ - "\14EXCL" /* 0x0800 */ - "\15(0x1000)" /* 0x1000 */ - "\16(0x2000)" /* 0x2000 */ - "\17HASLOCK" /* 0x4000 */ - "\20NOCTTY" /* 0x8000 */ - "\21DIRECT"; /* 0x00010000 */ -#endif /* CMX_DEBUG */ - -devclass_t cmx_devclass; - -static d_open_t cmx_open; -static d_close_t cmx_close; -static d_read_t cmx_read; -static d_write_t cmx_write; -static d_poll_t cmx_poll; -#ifdef CMX_INTR -static void cmx_intr(void *arg); -#endif - -static struct cdevsw cmx_cdevsw = { - .d_version = D_VERSION, - .d_open = cmx_open, - .d_close = cmx_close, - .d_read = cmx_read, - .d_write = cmx_write, - .d_poll = cmx_poll, - .d_name = "cmx", -}; - -/* - * Initialize the softc structure. Must be called from - * the bus specific device allocation routine. - */ -void -cmx_init_softc(device_t dev) -{ - struct cmx_softc *sc = device_get_softc(dev); - sc->dev = dev; - sc->timeout = CCID_DRIVER_MINIMUM_TIMEOUT; -} - -/* - * Allocate driver resources. Must be called from the - * bus specific device allocation routine. Caller must - * ensure to call cmx_release_resources to free the - * resources when detaching. - * Return zero if successful, and ENOMEM if the resources - * could not be allocated. - */ -int -cmx_alloc_resources(device_t dev) -{ - struct cmx_softc *sc = device_get_softc(dev); -#ifdef CMX_INTR - int rv; -#endif - - sc->ioport = bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->ioport_rid, RF_ACTIVE); - if (!sc->ioport) { - device_printf(dev, "failed to allocate io port\n"); - return ENOMEM; - } - sc->bst = rman_get_bustag(sc->ioport); - sc->bsh = rman_get_bushandle(sc->ioport); - -#ifdef CMX_INTR - sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &sc->irq_rid, RF_ACTIVE); - if (!sc->irq) { - device_printf(dev, "failed to allocate irq\n"); - return ENOMEM; - } - if ((rv = bus_setup_intr(dev, sc->irq, INTR_TYPE_TTY, - cmx_intr, sc, &sc->ih)) != 0) { - device_printf(dev, "failed to set up irq\n"); - return ENOMEM; - } -#endif - - mtx_init(&sc->mtx, device_get_nameunit(dev), - "cmx softc lock", - MTX_DEF | MTX_RECURSE); - callout_init_mtx(&sc->ch, &sc->mtx, 0); - - return 0; -} - -/* - * Release the resources allocated by cmx_allocate_resources. - */ -void -cmx_release_resources(device_t dev) -{ - struct cmx_softc *sc = device_get_softc(dev); - - mtx_destroy(&sc->mtx); - -#ifdef CMX_INTR - if (sc->ih) { - bus_teardown_intr(dev, sc->irq, sc->ih); - sc->ih = NULL; - } - if (sc->irq) { - bus_release_resource(dev, SYS_RES_IRQ, - sc->irq_rid, sc->irq); - sc->irq = NULL; - } -#endif - - if (sc->ioport) { - bus_deactivate_resource(dev, SYS_RES_IOPORT, - sc->ioport_rid, sc->ioport); - bus_release_resource(dev, SYS_RES_IOPORT, - sc->ioport_rid, sc->ioport); - sc->ioport = NULL; - } - return; -} - -/* - * Bus independent device attachment routine. Creates the - * character device node. - */ -int -cmx_attach(device_t dev) -{ - struct cmx_softc *sc = device_get_softc(dev); - - if (!sc || sc->dying) - return ENXIO; - - sc->cdev = make_dev(&cmx_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, - "cmx%d", device_get_unit(dev)); - if (!sc->cdev) { - device_printf(dev, "failed to create character device\n"); - return ENOMEM; - } - sc->cdev->si_drv1 = sc; - - return 0; -} - -/* - * Bus independent device detachment routine. Makes sure all - * allocated resources are freed, callouts disabled and waiting - * processes unblocked. - */ -int -cmx_detach(device_t dev) -{ - struct cmx_softc *sc = device_get_softc(dev); - - DEBUG_printf(dev, "called\n"); - - sc->dying = 1; - - CMX_LOCK(sc); - if (sc->polling) { - DEBUG_printf(sc->dev, "disabling polling\n"); - callout_stop(&sc->ch); - sc->polling = 0; - CMX_UNLOCK(sc); - callout_drain(&sc->ch); - selwakeuppri(&sc->sel, PZERO); - } else { - CMX_UNLOCK(sc); - } - - wakeup(sc); - destroy_dev(sc->cdev); - - DEBUG_printf(dev, "releasing resources\n"); - cmx_release_resources(dev); - return 0; -} - -/* - * Wait for buffer status register events. If test is non-zero, - * wait until flags are set, otherwise wait until flags are unset. - * Will spin SPIN_COUNT times, then sleep until timeout is reached. - * Returns zero if event happened, EIO if the timeout was reached, - * and ENXIO if the device was detached in the meantime. When that - * happens, the caller must quit immediately, since a detach is - * in progress. - */ -static inline int -cmx_wait_BSR(struct cmx_softc *sc, uint8_t flags, int test) -{ - int rv; - - for (int i = 0; i < SPIN_COUNT; i++) { - if (cmx_test_BSR(sc, flags, test)) - return 0; - } - - for (int i = 0; i * WAIT_TICKS < sc->timeout; i++) { - if (cmx_test_BSR(sc, flags, test)) - return 0; - rv = tsleep(sc, PWAIT|PCATCH, "cmx", WAIT_TICKS); - /* - * Currently, the only reason for waking up with - * rv == 0 is when we are detaching, in which - * case sc->dying is always 1. - */ - if (sc->dying) - return ENXIO; - if (rv != EAGAIN) - return rv; - } - - /* timeout */ - return EIO; -} - -/* - * Set the sync control register to val. Before and after writing - * to the SCR, we wait for the BSR to not signal BULK_OUT_FULL. - * Returns zero if successful, or whatever errors cmx_wait_BSR can - * return. ENXIO signals that the device has been detached in the - * meantime, and that we should leave the kernel immediately. - */ -static inline int -cmx_sync_write_SCR(struct cmx_softc *sc, uint8_t val) -{ - int rv = 0; - - if ((rv = cmx_wait_BSR(sc, BSR_BULK_OUT_FULL, 0)) != 0) { - return rv; - } - - cmx_write_SCR(sc, val); - - if ((rv = cmx_wait_BSR(sc, BSR_BULK_OUT_FULL, 0)) != 0) { - return rv; - } - - return 0; -} - -/* - * Returns a suitable timeout value based on the given command byte. - * Some commands appear to need longer timeout values than others. - */ -static inline unsigned long -cmx_timeout_by_cmd(uint8_t cmd) -{ - switch (cmd) { - case CMD_PC_TO_RDR_XFRBLOCK: - case CMD_PC_TO_RDR_SECURE: - case CMD_PC_TO_RDR_TEST_SECURE: - case CMD_PC_TO_RDR_OK_SECURE: - return CCID_DRIVER_BULK_DEFAULT_TIMEOUT; - - case CMD_PC_TO_RDR_ICCPOWERON: - return CCID_DRIVER_ASYNC_POWERUP_TIMEOUT; - - case CMD_PC_TO_RDR_GETSLOTSTATUS: - case CMD_PC_TO_RDR_ICCPOWEROFF: - case CMD_PC_TO_RDR_GETPARAMETERS: - case CMD_PC_TO_RDR_RESETPARAMETERS: - case CMD_PC_TO_RDR_SETPARAMETERS: - case CMD_PC_TO_RDR_ESCAPE: - case CMD_PC_TO_RDR_ICCCLOCK: - default: - return CCID_DRIVER_MINIMUM_TIMEOUT; - } -} - -/* - * Periodical callout routine, polling the reader for data - * availability. If the reader signals data ready for reading, - * wakes up the processes which are waiting in select()/poll(). - * Otherwise, reschedules itself with a delay of POLL_TICKS. - */ -static void -cmx_tick(void *xsc) -{ - struct cmx_softc *sc = xsc; - uint8_t bsr; - - CMX_LOCK(sc); - if (sc->polling && !sc->dying) { - bsr = cmx_read_BSR(sc); - DEBUG_printf(sc->dev, "BSR=%b\n", bsr, BSRBITS); - if (cmx_test(bsr, BSR_BULK_IN_FULL, 1)) { - sc->polling = 0; - selwakeuppri(&sc->sel, PZERO); - } else { - callout_reset(&sc->ch, POLL_TICKS, cmx_tick, sc); - } - } - CMX_UNLOCK(sc); -} - -/* - * Open the character device. Only a single process may open the - * device at a time. - */ -static int -cmx_open(struct cdev *cdev, int flags, int fmt, struct thread *td) -{ - struct cmx_softc *sc = cdev->si_drv1; - - if (sc == NULL || sc->dying) - return ENXIO; - - CMX_LOCK(sc); - if (sc->open) { - CMX_UNLOCK(sc); - return EBUSY; - } - sc->open = 1; - CMX_UNLOCK(sc); - - DEBUG_printf(sc->dev, "open (flags=%b thread=%p)\n", - flags, MODEBITS, td); - return 0; -} - -/* - * Close the character device. - */ -static int -cmx_close(struct cdev *cdev, int flags, int fmt, struct thread *td) -{ - struct cmx_softc *sc = cdev->si_drv1; - - if (sc == NULL || sc->dying) - return ENXIO; - - CMX_LOCK(sc); - if (!sc->open) { - CMX_UNLOCK(sc); - return EINVAL; - } - if (sc->polling) { - DEBUG_printf(sc->dev, "disabling polling\n"); - callout_stop(&sc->ch); - sc->polling = 0; - CMX_UNLOCK(sc); - callout_drain(&sc->ch); - selwakeuppri(&sc->sel, PZERO); - CMX_LOCK(sc); - } - sc->open = 0; - CMX_UNLOCK(sc); - - DEBUG_printf(sc->dev, "close (flags=%b thread=%p)\n", - flags, MODEBITS, td); - return 0; -} - -/* - * Read from the character device. - * Returns zero if successful, ENXIO if dying, EINVAL if an attempt - * was made to read less than CMX_MIN_RDLEN bytes or less than the - * device has available, or any of the errors that cmx_sync_write_SCR - * can return. Partial reads are not supported. - */ -static int -cmx_read(struct cdev *cdev, struct uio *uio, int flag) -{ - struct cmx_softc *sc = cdev->si_drv1; - unsigned long bytes_left; - uint8_t uc; - int rv, amnt, offset; - - if (sc == NULL || sc->dying) - return ENXIO; - - DEBUG_printf(sc->dev, "called (len=%d flag=%b)\n", - uio->uio_resid, flag, MODEBITS); - - CMX_LOCK(sc); - if (sc->polling) { - DEBUG_printf(sc->dev, "disabling polling\n"); - callout_stop(&sc->ch); - sc->polling = 0; - CMX_UNLOCK(sc); - callout_drain(&sc->ch); - selwakeuppri(&sc->sel, PZERO); - } else { - CMX_UNLOCK(sc); - } - - if (uio->uio_resid == 0) { - return 0; - } - - if (uio->uio_resid < CMX_MIN_RDLEN) { - return EINVAL; - } - - if (flag & O_NONBLOCK) { - if (cmx_test_BSR(sc, BSR_BULK_IN_FULL, 0)) { - return EAGAIN; - } - } - - for (int i = 0; i < 5; i++) { - if ((rv = cmx_wait_BSR(sc, BSR_BULK_IN_FULL, 1)) != 0) { - return rv; - } - sc->buf[i] = cmx_read_DTR(sc); - DEBUG_printf(sc->dev, "buf[%02x]=%02x\n", i, sc->buf[i]); - } - - bytes_left = CMX_MIN_RDLEN + - (0x000000FF&((char)sc->buf[1])) + - (0x0000FF00&((char)sc->buf[2] << 8)) + - (0x00FF0000&((char)sc->buf[3] << 16)) + - (0xFF000000&((char)sc->buf[4] << 24)); - DEBUG_printf(sc->dev, "msgsz=%lu\n", bytes_left); - - if (uio->uio_resid < bytes_left) { - return EINVAL; - } - - offset = 5; /* prefetched header */ - while (bytes_left > 0) { - amnt = MIN(bytes_left, sizeof(sc->buf)); - - for (int i = offset; i < amnt; i++) { - if ((rv = cmx_wait_BSR(sc, BSR_BULK_IN_FULL, 1))!=0) { - return rv; - } - sc->buf[i] = cmx_read_DTR(sc); - DEBUG_printf(sc->dev, "buf[%02x]=%02x\n", - i, sc->buf[i]); - } - - if ((rv = uiomove(sc->buf, amnt, uio)) != 0) { - DEBUG_printf(sc->dev, "uiomove failed (%d)\n", rv); - return rv; - } - - if (offset) - offset = 0; - bytes_left -= amnt; - } - - if ((rv = cmx_wait_BSR(sc, BSR_BULK_IN_FULL, 1)) != 0) { - return rv; - } - - if ((rv = cmx_sync_write_SCR(sc, SCR_READER_TO_HOST_DONE)) != 0) { - return rv; - } - - uc = cmx_read_DTR(sc); - DEBUG_printf(sc->dev, "success (DTR=%02x)\n", uc); - return 0; -} - -/* - * Write to the character device. - * Returns zero if successful, NXIO if dying, EINVAL if less data - * written than CMX_MIN_WRLEN, or any of the errors that cmx_sync_SCR - * can return. - */ -static int -cmx_write(struct cdev *cdev, struct uio *uio, int flag) -{ - struct cmx_softc *sc = cdev->si_drv1; - int rv, amnt; - - if (sc == NULL || sc->dying) - return ENXIO; - - DEBUG_printf(sc->dev, "called (len=%d flag=%b)\n", - uio->uio_resid, flag, MODEBITS); - - if (uio->uio_resid == 0) { - return 0; - } - - if (uio->uio_resid < CMX_MIN_WRLEN) { - return EINVAL; - } - - if ((rv = cmx_sync_write_SCR(sc, SCR_HOST_TO_READER_START)) != 0) { - return rv; - } - - sc->timeout = 0; - while (uio->uio_resid > 0) { - amnt = MIN(uio->uio_resid, sizeof(sc->buf)); - - if ((rv = uiomove(sc->buf, amnt, uio)) != 0) { - DEBUG_printf(sc->dev, "uiomove failed (%d)\n", rv); - /* wildly guessed attempt to notify device */ - sc->timeout = CCID_DRIVER_MINIMUM_TIMEOUT; - cmx_sync_write_SCR(sc, SCR_HOST_TO_READER_DONE); - return rv; - } - - if (sc->timeout == 0) { - sc->timeout = cmx_timeout_by_cmd(sc->buf[0]); - DEBUG_printf(sc->dev, "cmd=%02x timeout=%lu\n", - sc->buf[0], sc->timeout); - } - - for (int i = 0; i < amnt; i++) { - if ((rv = cmx_wait_BSR(sc, BSR_BULK_OUT_FULL, 0))!=0) { - return rv; - } - cmx_write_DTR(sc, sc->buf[i]); - DEBUG_printf(sc->dev, "buf[%02x]=%02x\n", - i, sc->buf[i]); - } - } - - if ((rv = cmx_sync_write_SCR(sc, SCR_HOST_TO_READER_DONE)) != 0) { - return rv; - } - - DEBUG_printf(sc->dev, "success\n"); - return 0; -} - -/* - * Poll handler. Writing is always possible, reading is only possible - * if BSR_BULK_IN_FULL is set. Will start the cmx_tick callout and - * set sc->polling. - */ -static int -cmx_poll(struct cdev *cdev, int events, struct thread *td) -{ - struct cmx_softc *sc = cdev->si_drv1; - int revents = 0; - uint8_t bsr = 0; - - if (sc == NULL || sc->dying) - return ENXIO; - - bsr = cmx_read_BSR(sc); - DEBUG_printf(sc->dev, "called (events=%b BSR=%b)\n", - events, POLLBITS, bsr, BSRBITS); - - revents = events & (POLLOUT | POLLWRNORM); - if (events & (POLLIN | POLLRDNORM)) { - if (cmx_test(bsr, BSR_BULK_IN_FULL, 1)) { - revents |= events & (POLLIN | POLLRDNORM); - } else { - selrecord(td, &sc->sel); - CMX_LOCK(sc); - if (!sc->polling) { - DEBUG_printf(sc->dev, "enabling polling\n"); - sc->polling = 1; - callout_reset(&sc->ch, POLL_TICKS, - cmx_tick, sc); - } else { - DEBUG_printf(sc->dev, "already polling\n"); - } - CMX_UNLOCK(sc); - } - } - - DEBUG_printf(sc->dev, "success (revents=%b)\n", revents, POLLBITS); - - return revents; -} - -#ifdef CMX_INTR -/* - * Interrupt handler. Currently has no function except to - * print register status (if debugging is also enabled). - */ -static void -cmx_intr(void *arg) -{ - struct cmx_softc *sc = (struct cmx_softc *)arg; - - if (sc == NULL || sc->dying) - return; - - DEBUG_printf(sc->dev, "received interrupt (SCR=%b BSR=%b)\n", - cmx_read_SCR(sc), SCRBITS, - cmx_read_BSR(sc), BSRBITS); - - return; -} -#endif diff --git a/sys/dev/cmx/cmx_pccard.c b/sys/dev/cmx/cmx_pccard.c deleted file mode 100644 index 70758e673ddc..000000000000 --- a/sys/dev/cmx/cmx_pccard.c +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2006-2007 Daniel Roethlisberger - * 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 unmodified, 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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include - -#include -#include - -#include "pccarddevs.h" - *** 279 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Jan 8 03:44:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 382E04E4A5D; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@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 4DBpr10zYGz4p4Q; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1419B1CC60; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1083iHIt006781; Fri, 8 Jan 2021 03:44:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1083iHMr006780; Fri, 8 Jan 2021 03:44:17 GMT (envelope-from git) Date: Fri, 8 Jan 2021 03:44:17 GMT Message-Id: <202101080344.1083iHMr006780@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 07263b02d872 - main - pccard: Remove if_ndis(4) PC Card attachment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 07263b02d872144c5182773889a0e1220e1e583a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 03:44:17 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=07263b02d872144c5182773889a0e1220e1e583a commit 07263b02d872144c5182773889a0e1220e1e583a Author: Warner Losh AuthorDate: 2021-01-07 22:32:53 +0000 Commit: Warner Losh CommitDate: 2021-01-08 03:23:04 +0000 pccard: Remove if_ndis(4) PC Card attachment PC Card support is being removed, so remove its attachment here. ndis is slated to be removed entirely for 13, but that's not been done yet. Relnotes: Yes --- share/man/man4/ndis.4 | 5 +- sys/conf/files.x86 | 1 - sys/dev/if_ndis/if_ndis_pccard.c | 337 --------------------------------------- sys/modules/if_ndis/Makefile | 4 +- 4 files changed, 4 insertions(+), 343 deletions(-) diff --git a/share/man/man4/ndis.4 b/share/man/man4/ndis.4 index 4f0b0ab2ed22..0feec231e605 100644 --- a/share/man/man4/ndis.4 +++ b/share/man/man4/ndis.4 @@ -105,9 +105,8 @@ file. The .Nm driver is designed to support mainly Ethernet and wireless -network devices with PCI, PCMCIA and USB bus attachments. -(Cardbus -devices are also supported as a subset of PCI.) +network devices with PCI and USB bus attachments. +(Cardbus devices are also supported as PCI.) It can support many different media types and speeds. One limitation diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index 785a1c719b91..f51392d0614c 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -158,7 +158,6 @@ dev/hyperv/vmbus/vmbus_res.c optional hyperv dev/hyperv/vmbus/vmbus_xact.c optional hyperv dev/ichwd/ichwd.c optional ichwd dev/if_ndis/if_ndis.c optional ndis -dev/if_ndis/if_ndis_pccard.c optional ndis pccard dev/if_ndis/if_ndis_pci.c optional ndis cardbus | ndis pci dev/if_ndis/if_ndis_usb.c optional ndis usb dev/imcsmb/imcsmb.c optional imcsmb diff --git a/sys/dev/if_ndis/if_ndis_pccard.c b/sys/dev/if_ndis/if_ndis_pccard.c deleted file mode 100644 index 85b23a18d11a..000000000000 --- a/sys/dev/if_ndis/if_ndis_pccard.c +++ /dev/null @@ -1,337 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (c) 2003 - * Bill Paul . 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Bill Paul. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD - * 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 -__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 "card_if.h" - -MODULE_DEPEND(ndis, pccard, 1, 1, 1); - -static int ndis_probe_pccard (device_t); -static int ndis_attach_pccard (device_t); -static int ndis_detach_pccard (device_t); -static struct resource_list *ndis_get_resource_list - (device_t, device_t); -static int ndis_devcompare (interface_type, - struct ndis_pccard_type *, device_t); -extern int ndisdrv_modevent (module_t, int, void *); -extern int ndis_attach (device_t); -extern int ndis_shutdown (device_t); -extern int ndis_detach (device_t); -extern int ndis_suspend (device_t); -extern int ndis_resume (device_t); - -extern unsigned char drv_data[]; - -static device_method_t ndis_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ndis_probe_pccard), - DEVMETHOD(device_attach, ndis_attach_pccard), - DEVMETHOD(device_detach, ndis_detach_pccard), - DEVMETHOD(device_shutdown, ndis_shutdown), - DEVMETHOD(device_suspend, ndis_suspend), - DEVMETHOD(device_resume, ndis_resume), - - /* Bus interface. */ - - /* - * This is an awful kludge, but we need it becase pccard - * does not implement a bus_get_resource_list() method. - */ - - DEVMETHOD(bus_get_resource_list, ndis_get_resource_list), - - { 0, 0 } -}; - -static driver_t ndis_driver = { - "ndis", - ndis_methods, - sizeof(struct ndis_softc) -}; - -static devclass_t ndis_devclass; - -DRIVER_MODULE(ndis, pccard, ndis_driver, ndis_devclass, ndisdrv_modevent, 0); - -static int -ndis_devcompare(bustype, t, dev) - interface_type bustype; - struct ndis_pccard_type *t; - device_t dev; -{ - const char *prodstr, *vendstr; - int error; - - if (bustype != PCMCIABus) - return(FALSE); - - error = pccard_get_product_str(dev, &prodstr); - if (error) - return(FALSE); - error = pccard_get_vendor_str(dev, &vendstr); - if (error) - return(FALSE); - - while(t->ndis_name != NULL) { - if (strcasecmp(vendstr, t->ndis_vid) == 0 && - strcasecmp(prodstr, t->ndis_did) == 0) { - device_set_desc(dev, t->ndis_name); - return(TRUE); - } - t++; - } - - return(FALSE); -} - -/* - * Probe for an NDIS device. Check the PCI vendor and device - * IDs against our list and return a device name if we find a match. - */ -static int -ndis_probe_pccard(dev) - device_t dev; -{ - driver_object *drv; - struct drvdb_ent *db; - - drv = windrv_lookup(0, "PCCARD Bus"); - if (drv == NULL) - return(ENXIO); - - db = windrv_match((matchfuncptr)ndis_devcompare, dev); - - if (db != NULL) { - /* Create PDO for this device instance */ - windrv_create_pdo(drv, dev); - return(0); - } - - return(ENXIO); -} - -#define NDIS_AM_RID 3 - -static int -ndis_alloc_amem(struct ndis_softc *sc) -{ - int error, rid; - - rid = NDIS_AM_RID; - sc->ndis_res_am = bus_alloc_resource_anywhere(sc->ndis_dev, - SYS_RES_MEMORY, &rid, 0x1000, RF_ACTIVE); - - if (sc->ndis_res_am == NULL) { - device_printf(sc->ndis_dev, - "failed to allocate attribute memory\n"); - return(ENXIO); - } - sc->ndis_rescnt++; - resource_list_add(&sc->ndis_rl, SYS_RES_MEMORY, rid, - rman_get_start(sc->ndis_res_am), rman_get_end(sc->ndis_res_am), - rman_get_size(sc->ndis_res_am)); - - error = CARD_SET_MEMORY_OFFSET(device_get_parent(sc->ndis_dev), - sc->ndis_dev, rid, 0, NULL); - - if (error) { - device_printf(sc->ndis_dev, - "CARD_SET_MEMORY_OFFSET() returned 0x%x\n", error); - return(error); - } - - error = CARD_SET_RES_FLAGS(device_get_parent(sc->ndis_dev), - sc->ndis_dev, SYS_RES_MEMORY, rid, PCCARD_A_MEM_ATTR); - - if (error) { - device_printf(sc->ndis_dev, - "CARD_SET_RES_FLAGS() returned 0x%x\n", error); - return(error); - } - - sc->ndis_am_rid = rid; - - return(0); -} - -/* - * Attach the interface. Allocate softc structures, do ifmedia - * setup and ethernet/BPF attach. - */ -static int -ndis_attach_pccard(dev) - device_t dev; -{ - struct ndis_softc *sc; - int unit, error = 0, rid; - struct ndis_pccard_type *t; - int devidx = 0; - const char *prodstr, *vendstr; - struct drvdb_ent *db; - - sc = device_get_softc(dev); - unit = device_get_unit(dev); - sc->ndis_dev = dev; - - db = windrv_match((matchfuncptr)ndis_devcompare, dev); - if (db == NULL) - return (ENXIO); - sc->ndis_dobj = db->windrv_object; - sc->ndis_regvals = db->windrv_regvals; - resource_list_init(&sc->ndis_rl); - - sc->ndis_io_rid = 0; - sc->ndis_res_io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &sc->ndis_io_rid, RF_ACTIVE); - if (sc->ndis_res_io == NULL) { - device_printf(dev, - "couldn't map iospace\n"); - error = ENXIO; - goto fail; - } - sc->ndis_rescnt++; - resource_list_add(&sc->ndis_rl, SYS_RES_IOPORT, sc->ndis_io_rid, - rman_get_start(sc->ndis_res_io), rman_get_end(sc->ndis_res_io), - rman_get_size(sc->ndis_res_io)); - - rid = 0; - sc->ndis_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_SHAREABLE | RF_ACTIVE); - if (sc->ndis_irq == NULL) { - device_printf(dev, - "couldn't map interrupt\n"); - error = ENXIO; - goto fail; - } - sc->ndis_rescnt++; - resource_list_add(&sc->ndis_rl, SYS_RES_IRQ, rid, - rman_get_start(sc->ndis_irq), rman_get_start(sc->ndis_irq), 1); - - sc->ndis_iftype = PCMCIABus; - - /* Figure out exactly which device we matched. */ - - t = db->windrv_devlist; - - error = pccard_get_product_str(dev, &prodstr); - if (error) - return(error); - error = pccard_get_vendor_str(dev, &vendstr); - if (error) - return(error); - - while(t->ndis_name != NULL) { - if (strcasecmp(vendstr, t->ndis_vid) == 0 && - strcasecmp(prodstr, t->ndis_did) == 0) - break; - t++; - devidx++; - } - - sc->ndis_devidx = devidx; - - error = ndis_alloc_amem(sc); - if (error) { - device_printf(dev, "failed to allocate attribute memory\n"); - goto fail; - } - - error = ndis_attach(dev); - if (error == 0) - gone_in_dev(dev, 13, "ndis removed"); - -fail: - return(error); -} - -static int -ndis_detach_pccard(device_t dev) -{ - struct ndis_softc *sc = device_get_softc(dev); - - (void) ndis_detach(dev); - - if (sc->ndis_res_am != NULL) - bus_release_resource(sc->ndis_dev, SYS_RES_MEMORY, - sc->ndis_am_rid, sc->ndis_res_am); - resource_list_free(&sc->ndis_rl); - - return (0); -} - -static struct resource_list * -ndis_get_resource_list(dev, child) - device_t dev; - device_t child; -{ - struct ndis_softc *sc; - - sc = device_get_softc(dev); - return (&sc->ndis_rl); -} diff --git a/sys/modules/if_ndis/Makefile b/sys/modules/if_ndis/Makefile index ced1a4fb332c..efdde6e0977e 100644 --- a/sys/modules/if_ndis/Makefile +++ b/sys/modules/if_ndis/Makefile @@ -3,8 +3,8 @@ .PATH: ${SRCTOP}/sys/dev/if_ndis KMOD= if_ndis -SRCS= if_ndis.c if_ndis_pci.c if_ndis_pccard.c if_ndis_usb.c -SRCS+= device_if.h bus_if.h pci_if.h card_if.h pccarddevs.h +SRCS= if_ndis.c if_ndis_pci.c if_ndis_usb.c +SRCS+= device_if.h bus_if.h pci_if.h SRCS+= opt_bus.h opt_usb.h usb_if.h usbdevs.h .include From owner-dev-commits-src-all@freebsd.org Fri Jan 8 03:44:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B055B4E4AB8; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@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 4DBpr12vDvz4pLc; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F8CC1C93F; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1083iHvR006834; Fri, 8 Jan 2021 03:44:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1083iHmJ006833; Fri, 8 Jan 2021 03:44:17 GMT (envelope-from git) Date: Fri, 8 Jan 2021 03:44:17 GMT Message-Id: <202101080344.1083iHmJ006833@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: fbcdcec55b77 - main - pccard: Remove an(4) PC Card attachment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fbcdcec55b77c475bcab861d29adcacc8a205a48 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 03:44:18 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=fbcdcec55b77c475bcab861d29adcacc8a205a48 commit fbcdcec55b77c475bcab861d29adcacc8a205a48 Author: Warner Losh AuthorDate: 2021-01-07 21:55:19 +0000 Commit: Warner Losh CommitDate: 2021-01-08 03:22:42 +0000 pccard: Remove an(4) PC Card attachment Remove pccard attachment for an driver since pccard support is being removed. Relnotes: Yes --- share/man/man4/an.4 | 22 ++----- sys/conf/files | 1 - sys/dev/an/if_an_pccard.c | 161 ---------------------------------------------- sys/modules/an/Makefile | 5 +- 4 files changed, 8 insertions(+), 181 deletions(-) diff --git a/share/man/man4/an.4 b/share/man/man4/an.4 index 622cdd5efac9..aaa761a36b4d 100644 --- a/share/man/man4/an.4 +++ b/share/man/man4/an.4 @@ -51,9 +51,6 @@ module at boot time, place the following line in .Bd -literal -offset indent if_an_load="YES" .Ed -.Sh DEPRECATION NOTICE -This driver is scheduled for removal prior to the release of -.Fx 13.0 .Sh DESCRIPTION The .Nm @@ -65,25 +62,18 @@ wireless network adapters and variants, including the following: Aironet Communications 4500 and 4800 series .It Cisco Aironet 340 and 350 series -.It -Xircom Wireless Ethernet Adapter .El .Pp -Support for these devices include the ISA, PCI and PCMCIA +Support for these devices include the ISA and PCI varieties. The Aironet 4500 series adapters operate at 1 and 2Mbps while the Aironet 4800 series and Cisco adapters can operate at 1, 2, 5.5 and 11Mbps. -The ISA, PCI -and PCMCIA devices are all based on the same core PCMCIA modules -and all have the same programming interface, however unlike the -Lucent WaveLAN/IEEE cards, the ISA and PCI cards appear to the -host as normal ISA and PCI devices and do not require any PCCARD -support. +The ISA and PCI +devices are all based on the same core PCMCIA hardware +and all have the same programming interface. +The ISA and PCI cards appear to the +host as normal ISA and PCI devices. .Pp -The PCMCIA Aironet cards require PC Card support, including the -kernel -.Xr pccard 4 -driver. ISA cards can either be configured to use ISA Plug and Play or to use a particular I/O address and IRQ by properly setting the DIP switches on the board. diff --git a/sys/conf/files b/sys/conf/files index 467cbb3406f1..c9525bdcf49f 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -913,7 +913,6 @@ dev/amr/amr_linux.c optional amr compat_linux dev/amr/amr_pci.c optional amr pci dev/an/if_an.c optional an dev/an/if_an_isa.c optional an isa -dev/an/if_an_pccard.c optional an pccard dev/an/if_an_pci.c optional an pci # dev/ata/ata_if.m optional ata | atacore diff --git a/sys/dev/an/if_an_pccard.c b/sys/dev/an/if_an_pccard.c deleted file mode 100644 index f20964473bb6..000000000000 --- a/sys/dev/an/if_an_pccard.c +++ /dev/null @@ -1,161 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (c) 1997, 1998, 1999 - * Bill Paul . 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Bill Paul. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD - * 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. - */ -/* - * Aironet 4500/4800 802.11 PCMCIA/ISA/PCI driver for FreeBSD. - * - * Written by Bill Paul - * Electrical Engineering Department - * Columbia University, New York City - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_inet.h" - -#ifdef INET -#define ANCACHE -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include "pccarddevs.h" -#include "card_if.h" - -/* - * Support for PCMCIA cards. - */ -static int an_pccard_probe(device_t); -static int an_pccard_attach(device_t); - -static device_method_t an_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, an_pccard_probe), - DEVMETHOD(device_attach, an_pccard_attach), - DEVMETHOD(device_detach, an_detach), - DEVMETHOD(device_shutdown, an_shutdown), - { 0, 0 } -}; - -static driver_t an_pccard_driver = { - "an", - an_pccard_methods, - sizeof(struct an_softc) -}; - -static devclass_t an_pccard_devclass; - -DRIVER_MODULE(an, pccard, an_pccard_driver, an_pccard_devclass, 0, 0); -MODULE_DEPEND(an, wlan, 1, 1, 1); - -static const struct pccard_product an_pccard_products[] = { - PCMCIA_CARD(AIRONET, PC4800), - PCMCIA_CARD(AIRONET, PC4500), - PCMCIA_CARD(AIRONET, 350), - PCMCIA_CARD(XIRCOM, CWE1130), - { NULL } -}; -PCCARD_PNP_INFO(an_pccard_products); - -static int -an_pccard_probe(device_t dev) -{ - const struct pccard_product *pp; - - if ((pp = pccard_product_lookup(dev, an_pccard_products, - sizeof(an_pccard_products[0]), NULL)) != NULL) { - if (pp->pp_name != NULL) - device_set_desc(dev, pp->pp_name); - return (0); - } - return (ENXIO); -} - -static int -an_pccard_attach(device_t dev) -{ - struct an_softc *sc = device_get_softc(dev); - int flags = device_get_flags(dev); - int error; - - error = an_probe(dev); /* 0 is failure for now */ - if (error == 0) { - error = ENXIO; - goto fail; - } - error = an_alloc_irq(dev, 0, 0); - if (error != 0) - goto fail; - - an_alloc_irq(dev, sc->irq_rid, 0); - - error = an_attach(sc, flags); - if (error) - goto fail; - - /* - * Must setup the interrupt after the an_attach to prevent racing. - */ - error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET, - NULL, an_intr, sc, &sc->irq_handle); -fail: - if (error) - an_release_resources(dev); - else - gone_in_dev(dev, 13, "pccard removed, an doesn't support modern crypto"); - return (error); -} diff --git a/sys/modules/an/Makefile b/sys/modules/an/Makefile index 41c7b2fb871f..a0c613a37c9f 100644 --- a/sys/modules/an/Makefile +++ b/sys/modules/an/Makefile @@ -3,8 +3,7 @@ .PATH: ${SRCTOP}/sys/dev/an KMOD= if_an -SRCS= if_an.c if_an_pccard.c if_an_pci.c if_an_isa.c -SRCS+= opt_inet.h device_if.h bus_if.h pci_if.h isa_if.h card_if.h -SRCS+= pccarddevs.h +SRCS= if_an.c if_an_pci.c if_an_isa.c +SRCS+= opt_inet.h device_if.h bus_if.h pci_if.h isa_if.h .include From owner-dev-commits-src-all@freebsd.org Fri Jan 8 03:44:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6C1A34E4D46; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@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 4DBpr12R3hz4nw4; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39FF91CAAA; Fri, 8 Jan 2021 03:44:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1083iH0u006817; Fri, 8 Jan 2021 03:44:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1083iHiw006816; Fri, 8 Jan 2021 03:44:17 GMT (envelope-from git) Date: Fri, 8 Jan 2021 03:44:17 GMT Message-Id: <202101080344.1083iHiw006816@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 163b959a73c8 - main - pccard: Remove fdc(4) PC Card attachment point MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 163b959a73c8b76839d816ffba2e6c0016d48f0c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 03:44:17 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=163b959a73c8b76839d816ffba2e6c0016d48f0c commit 163b959a73c8b76839d816ffba2e6c0016d48f0c Author: Warner Losh AuthorDate: 2021-01-07 22:19:34 +0000 Commit: Warner Losh CommitDate: 2021-01-08 03:22:56 +0000 pccard: Remove fdc(4) PC Card attachment point Remove PC Card attachemnt point for fdc. Relnotes: Yes --- share/man/man4/fdc.4 | 3 - sys/conf/files.x86 | 1 - sys/dev/fdc/fdc_pccard.c | 146 ----------------------------------------------- sys/modules/fdc/Makefile | 5 +- 4 files changed, 2 insertions(+), 153 deletions(-) diff --git a/share/man/man4/fdc.4 b/share/man/man4/fdc.4 index 370083b1b9b4..1580fc067771 100644 --- a/share/man/man4/fdc.4 +++ b/share/man/man4/fdc.4 @@ -313,9 +313,6 @@ Third argument is a pointer to This type is the same as being used in the per-drive configuration flags, or in the CMOS configuration data or ACPI namespace on IA32 systems. .El -.Sh DEPRECATION NOTICE -The PC Card attachment of this driver is scheduled for removal prior to the release of -.Fx 13.0 .Sh FILES .Bl -tag -width ".Pa /dev/fd*" -compact .It Pa /dev/fd* diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index bfd55806ee70..785a1c719b91 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -95,7 +95,6 @@ dev/fb/vga.c optional vga dev/fdc/fdc.c optional fdc dev/fdc/fdc_acpi.c optional fdc dev/fdc/fdc_isa.c optional fdc isa -dev/fdc/fdc_pccard.c optional fdc pccard dev/gpio/bytgpio.c optional bytgpio dev/gpio/chvgpio.c optional chvgpio dev/hpt27xx/hpt27xx_os_bsd.c optional hpt27xx diff --git a/sys/dev/fdc/fdc_pccard.c b/sys/dev/fdc/fdc_pccard.c deleted file mode 100644 index 7b7f88648884..000000000000 --- a/sys/dev/fdc/fdc_pccard.c +++ /dev/null @@ -1,146 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2004-2005 M. Warner Losh - * - * 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 -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "pccarddevs.h" - -static int fdc_pccard_probe(device_t); -static int fdc_pccard_attach(device_t); - -static const struct pccard_product fdc_pccard_products[] = { - PCMCIA_CARD(YEDATA, EXTERNAL_FDD), - { NULL } -}; - -static int -fdc_pccard_alloc_resources(device_t dev, struct fdc_data *fdc) -{ - struct resource *res; - int rid, i; - - rid = 0; - res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); - if (res == NULL) { - device_printf(dev, "cannot alloc I/O port range\n"); - return (ENXIO); - } - for (i = 0; i < FDC_MAXREG; i++) { - fdc->resio[i] = res; - fdc->ridio[i] = rid; - fdc->ioff[i] = i; - fdc->ioh[i] = rman_get_bushandle(res); - } - fdc->iot = rman_get_bustag(res); - - fdc->rid_irq = 0; - fdc->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &fdc->rid_irq, - RF_ACTIVE | RF_SHAREABLE); - if (fdc->res_irq == NULL) { - device_printf(dev, "cannot reserve interrupt line\n"); - return (ENXIO); - } - return (0); -} - -static int -fdc_pccard_probe(device_t dev) -{ - if (pccard_product_lookup(dev, fdc_pccard_products, - sizeof(fdc_pccard_products[0]), NULL) != NULL) { - device_set_desc(dev, "PC Card Floppy"); - return (0); - } - return (ENXIO); -} - -static int -fdc_pccard_attach(device_t dev) -{ - int error; - struct fdc_data *fdc; - device_t child; - - fdc = device_get_softc(dev); - fdc->flags = FDC_NODMA | FDC_NOFAST; - fdc->fdct = FDC_NE765; - error = fdc_pccard_alloc_resources(dev, fdc); - if (error == 0) - error = fdc_attach(dev); - if (error == 0) { - child = fdc_add_child(dev, "fd", -1); - device_set_flags(child, 0x24); - error = bus_generic_attach(dev); - } - if (error == 0) { - gone_in_dev(dev, 13, "pccard removed"); - fdc_start_worker(dev); - } else - fdc_release_resources(fdc); - return (error); -} - -static device_method_t fdc_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, fdc_pccard_probe), - DEVMETHOD(device_attach, fdc_pccard_attach), - DEVMETHOD(device_detach, fdc_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, fdc_print_child), - DEVMETHOD(bus_read_ivar, fdc_read_ivar), - DEVMETHOD(bus_write_ivar, fdc_write_ivar), - /* Our children never use any other bus interface methods. */ - - { 0, 0 } -}; - -static driver_t fdc_pccard_driver = { - "fdc", - fdc_pccard_methods, - sizeof(struct fdc_data) -}; - -DRIVER_MODULE(fdc, pccard, fdc_pccard_driver, fdc_devclass, 0, 0); -PCCARD_PNP_INFO(fdc_pccard_products); diff --git a/sys/modules/fdc/Makefile b/sys/modules/fdc/Makefile index 400e75a1a630..140135d43e66 100644 --- a/sys/modules/fdc/Makefile +++ b/sys/modules/fdc/Makefile @@ -3,12 +3,11 @@ KMOD= fdc .PATH: ${SRCTOP}/sys/dev/fdc -SRCS= fdc.c fdc_isa.c fdc_pccard.c +SRCS= fdc.c fdc_isa.c .if ${MACHINE} == "i386" || ${MACHINE} == "amd64" SRCS+= opt_acpi.h acpi_if.h fdc_acpi.c .endif -SRCS+= opt_fdc.h bus_if.h card_if.h device_if.h \ - isa_if.h pccarddevs.h +SRCS+= opt_fdc.h bus_if.h device_if.h isa_if.h .include From owner-dev-commits-src-all@freebsd.org Fri Jan 8 03:44:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DD73E4E4D41; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@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 4DBpr05wGmz4pPB; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD6F61CE20; Fri, 8 Jan 2021 03:44:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1083iGRw006696; Fri, 8 Jan 2021 03:44:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1083iGii006695; Fri, 8 Jan 2021 03:44:16 GMT (envelope-from git) Date: Fri, 8 Jan 2021 03:44:16 GMT Message-Id: <202101080344.1083iGii006695@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a21def4d568f - main - pccard: Remove wi(4) driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a21def4d568fd2f6723252c16e116b5e7d8125eb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 03:44:17 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a21def4d568fd2f6723252c16e116b5e7d8125eb commit a21def4d568fd2f6723252c16e116b5e7d8125eb Author: Warner Losh AuthorDate: 2021-01-07 22:45:23 +0000 Commit: Warner Losh CommitDate: 2021-01-08 03:41:06 +0000 pccard: Remove wi(4) driver Remove wi(4). pccard is going away, and wi only supports PC Card devices, though it has a minor amount of glue to also support PCI cards. However, removing the one without removing the other is hard, so the whole driver is being removed. Relnotes: Yes --- ObsoleteFiles.inc | 6 +- include/Makefile | 2 +- share/man/man4/Makefile | 2 - share/man/man4/wi.4 | 380 ------ sys/amd64/conf/GENERIC | 1 - sys/conf/NOTES | 4 - sys/conf/files | 3 - sys/dev/wi/if_wavelan_ieee.h | 747 ------------ sys/dev/wi/if_wi.c | 2088 -------------------------------- sys/dev/wi/if_wi_macio.c | 148 --- sys/dev/wi/if_wi_pccard.c | 205 ---- sys/dev/wi/if_wi_pci.c | 267 ---- sys/dev/wi/if_wireg.h | 726 ----------- sys/dev/wi/if_wivar.h | 189 --- sys/i386/conf/GENERIC | 1 - sys/modules/Makefile | 3 - sys/modules/wi/Makefile | 15 - tools/kerneldoc/subsys/Doxyfile-dev_wi | 21 - 18 files changed, 6 insertions(+), 4802 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 85d6e3eecd43..cf8b2ed118ab 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,10 +36,14 @@ # xargs -n1 | sort | uniq -d; # done -# 20210108: retire cmx, ng_bt3c drivers +# 20210108: retire cmx, ng_bt3c, wi drivers +OLD_FILES+=usr/include/dev/wi/if_wireg.h +OLD_FILES+=usr/include/dev/wi/if_wavelan_ieee.h +OLD_FILES+=usr/include/dev/wi/if_wivar.h OLD_FILES+=usr/sbin/bt3cfw OLD_FILES+=usr/share/man/man4/cmw.4.gz OLD_FILES+=usr/share/man/man4/ng_bt3c.4.gz +OLD_FILES+=usr/share/man/man4/wi.4.gz OLD_FILES+=usr/share/man/man8/bt3cfw.8.gz # 20210107: retire a.out support diff --git a/include/Makefile b/include/Makefile index 59f62f1d4897..4533dfea1b67 100644 --- a/include/Makefile +++ b/include/Makefile @@ -46,7 +46,7 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ dev/hwpmc dev/hyperv \ dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ - dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd dev/wi \ + dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 95f11ed3ca1b..c72caf0199c9 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -580,7 +580,6 @@ MAN= aac.4 \ ${_vtnet.4} \ watchdog.4 \ ${_wbwd.4} \ - wi.4 \ witness.4 \ wlan.4 \ wlan_acl.4 \ @@ -763,7 +762,6 @@ MLINKS+=vr.4 if_vr.4 MLINKS+=vte.4 if_vte.4 MLINKS+=${_vtnet.4} ${_if_vtnet.4} MLINKS+=watchdog.4 SW_WATCHDOG.4 -MLINKS+=wi.4 if_wi.4 MLINKS+=${_wpi.4} ${_if_wpi.4} MLINKS+=xl.4 if_xl.4 diff --git a/share/man/man4/wi.4 b/share/man/man4/wi.4 deleted file mode 100644 index c3a6a2b713c2..000000000000 --- a/share/man/man4/wi.4 +++ /dev/null @@ -1,380 +0,0 @@ -.\" Copyright (c) 1997, 1998, 1999 -.\" Bill Paul . 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. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by Bill Paul. -.\" 4. Neither the name of the author nor the names of any co-contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD -.\" 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$ -.\" $OpenBSD: wi.4tbl,v 1.14 2002/04/29 19:53:50 jsyn Exp $ -.\" -.Dd July 23, 2011 -.Dt WI 4 -.Os -.Sh NAME -.Nm wi -.Nd "Lucent Hermes, and Intersil PRISM IEEE 802.11 driver" -.Sh SYNOPSIS -To compile this driver into the kernel, -place the following lines in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "device wi" -.Cd "device wlan" -.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 -if_wi_load="YES" -.Ed -.Sh DEPRECATION NOTICE -This driver is scheduled for removal prior to the release of -.Fx 13.0 -.Sh DESCRIPTION -The -.Nm -driver provides support for 802.11b wireless network adapters based around -the Lucent Hermes, Intersil PRISM-II, Intersil PRISM-2.5, and Intersil -Prism-3 chipsets. -All chipsets provide a similar interface to the driver. -Only the Intersil chipsets support access point operation or WPA. -Very old versions of firmware are not supported at all. -Older versions of the firmware that are supported may severely limit -the ability to use these cards in newer networks. -Only relatively recent versions of Intersil firmware supports WPA. -See CAVEATS for details. -All host/device interaction is via programmed I/O, even on those cards -that support a DMA interface. -.Pp -For more information on configuring this device, see -.Xr ifconfig 8 . -.Pp -.Nm -supports -.Cm station , -.Cm adhoc , -.Cm adhoc-demo , -.Cm hostap , -and -.Cm monitor -mode operation. -Only one -virtual interface may be configured at a time. -For more information on configuring this device, see -.Xr ifconfig 8 . -.Pp -Cards supported by the -.Nm -driver come in a variety of packages, though the most common -are of the PCMCIA type. -In many cases, the PCI version of a wireless card is simply -a PCMCIA card bundled with a PCI adapter. -The PCI adapters come in two flavors: true PCMCIA bridges and -dumb PCMCIA bridges. -A true PCMCIA bridge (such as those sold by Lucent) will attach -as a real PCMCIA controller. -The wireless card will then attach to the PCMCIA bus. -Wireless cards in PCMCIA slots may be inserted and ejected on the fly. -.Pp -A dumb bridge, on the other hand, does not show up as a true PCMCIA bus. -The wireless card will simply appear to the host as a normal PCI -device and will not require any PCMCIA support. -Cards in this type of adapter should only be removed when the -machine is powered down. -.Pp -The following cards are among those supported by the -.Nm -driver: -.Pp -.Bl -column -compact "Linksys Instant Wireless WPC11 2.5" "Spectrum24" "PCI or PCMCIA" -.Em "Card Chip Bus" -3Com AirConnect 3CRWE777A Prism-II PCI -Accton airDirect WN3301 PCMCIA -ACTIONTEC HWC01170 Prism-2.5 PCMCIA -Adaptech ANW-8030 Prism-3 PCMCIA -Addtron AWP-100 Prism-II PCMCIA -Adtec Adlink/340C Prism-II PCMCIA -Airvast WN 100 Prism-3 PCMCIA -Airway 802.11 Adapter PCMCIA -Agere Orinoco Hermes PCMCIA -Allied Telesis WR211PCM Prism-II PCMCIA -ArTem OnAir Prism? PCMCIA -Asus WL100 Prism-2.5 PCMCIA -Avaya Wireless Prism-II PCMCIA -Bay eMobility 11B Prism-2.5? PCMCIA -Blue Concentric Circle WL-379F Prism-II CF -BreezeNet Wireless Prism-II PCMCIA -Buffalo WLI-PCM-S11 Prism-II PCMCIA -Buffalo WLI-PCM-L11G Hermes PCMCIA -Buffalo WLI-CF-S11G Prism-II CF -Buffalo WLI2-CF-S11G Prism 2.5 CF -Cabletron RoamAbout Hermes PCMCIA -Compaq Agency NC5004 Prism-II PCMCIA -Compaq WL100 Prism-II PCMCIA -Compaq WL110 Hermes PCMCIA -Compaq WL200 Prism-II PCMCIA -Contec FLEXLAN/FX-DS110-PCC Prism-II PCMCIA -Corega PCC-11 Prism-II PCMCIA -Corega PCCA-11 Prism-II PCMCIA -Corega PCCB-11 Prism-II PCMCIA -Corega CGWLPCIA11 Prism-II PCI -Dell TrueMobile 1150 Hermes PCMCIA -Dlink Air 660 Prism-II PCMCIA -Dlink DWL520 Prism-2.5 PCI -Dlink DWL650 Prism-2.5 PCMCIA -ELECOM Air@Hawk/LD-WL11/PCC PCMCIA -ELSA MC-11 PCMCIA -ELSA XI300 Prism-II PCMCIA -ELSA XI325 Prism-2.5 PCMCIA -ELSA APDL325 Prism-2.5 PCMCIA -ELSA XI330 Prism-3 PCMCIA -ELSA XI800 Prism-II CF -EMTAC A2424i Prism-II PCMCIA -Farallon Skyline Prism-II PCMCIA -Gemtek WL-311 Prism-2.5 PCMCIA -Hawking Technology WE110P Prism-2.5 PCMCIA -Home Wireless Networks Prism-II PCMCIA -IBM High Rate Wireless Hermes PCMCIA -ICOM SL-1100 Prism-II PCMCIA -I-O DATA WN-B11/PCM Prism-II PCMCIA -Intersil Prism II Prism-II PCMCIA -Intersil Mini-PCI Prism-2.5 PCI -Intersil ISL37100P Prism-3 PCMCIA -Intersil ISL37110P Prism-3 PCMCIA -Intersil ISL37300P Prism-3 PCMCIA -Laneed Wireless PCMCIA -Linksys Instant Wireless WPC11 Prism-II PCMCIA -Linksys Instant Wireless WPC11 2.5 Prism-2.5 PCMCIA -Linksys Instant Wireless WPC11 3.0 Prism-3 PCMCIA -Linksys WCF11 Prism-3 PCMCIA -Linksys WCF12 Prism-3 CF -Lucent WaveLAN Hermes PCMCIA -Melco Airconnect Prism-II PCMCIA -Microsoft MN-520 WLAN Prism-II PCMCIA -NANOSPEED ROOT-RZ2000 Prism-II PCMCIA -NCR WaveLAN/IEEE 802.11 PCMCIA -NDC/Sohoware NCP130 Prism-II PCI -NEC CMZ-RT-WP Prism-II PCMCIA -NEC PK-WL001 Lucent PCMCIA -NEC PC-WL/11C Prism-II PCMCIA -Netgear MA311 Prism-2.5 PCI -Netgear MA401 Prism-II/2.5 PCMCIA -Netgear MA401RA Prism-II PCMCIA -Netgear MA701 Prism-II CF -NOKIA C020 WLAN Prism-II PCMCIA -NOKIA C110 WLAN Prism-2.5 PCMCIA -NTT-ME 11Mbps Wireless LAN Prism-II PCMCIA -Planex GeoWave/GW-NS110 Prism-II PCMCIA -Planex GW-NS11H Prism-II PCMCIA -Proxim Harmony Prism-II PCMCIA -Proxim RangeLAN-DS Prism-II PCMCIA -Samsung MagicLAN SWL-2000N Prism-II PCMCIA -SENAO SL-2511CD Prism-3 PCMCIA -Siemens SpeedStream SS1021 Prism-II PCMCIA -Siemens SpeedStream SS1021 Prism-3 PCMCIA -SMC 2532W-B Prism-II PCMCIA -SMC 2602 EZ Connect (3.3V) Prism-II PCI or PCMCIA -SMC 2632 EZ Connect Prism-II PCMCIA -Socket Low Power WLAN-CF Prism-II CF -Sony PCWA-C100 Lucent PCMCIA -Sony PEGA-WL110 Prism-2.5 PCMCIA -TDK LAK-CD011WL Prism-II PCMCIA -Toshiba Wireless LAN Card Prism-II PCMCIA -U.S.\& Robotics Wireless Card 2410 Prism-II PCMCIA -YIS YWL-11B Prism-II PCMCIA -.El -.Pp -Several vendors sell PCI adapters built around the PLX Technology 9050 -or 9052 chip. -The following such adapters are supported or expected to work: -.Pp -.Bl -item -compact -.It -3Com AirConnect 3CRWE777A (3.3V) -.It -Belkin F5D6000 (a rebadged WL11000P) -.It -Eumitcom WL11000P -.It -Global Sun Technology GL24110P (untested) -.It -Global Sun Technology GL24110P02 -.It -LinkSys WDT11 (a rebadged GL24110P02) -.It -Netgear MA301 -.It -US Robotics 2415 (rebadged WL11000P) -.It -Wisecom Wireless LAN PCI Adapter -.El -.Pp -The following adapters have the same model numbers as those listed -above, but might not work if the actual card is after the change away -from the Prism family: -.Pp -.Bl -item -compact -.It -DLink DWL520 -.El -.Sh EXAMPLES -Join an existing BSS network (ie: connect to an access point): -.Bd -literal -offset indent -ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e - netmask 0xffffff00 -.Ed -.Pp -Join a specific BSS network with network name -.Dq Li my_net : -.Bd -literal -offset indent -ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e - netmask 0xffffff00 ssid my_net -.Ed -.Pp -Join a specific BSS network with WEP encryption: -.Bd -literal -offset indent -ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e - netmask 0xffffff00 ssid my_net \e - wepmode on wepkey 0x8736639624 weptxkey 1 -.Ed -.Pp -Join a Lucent legacy demo ad-hoc network with network name -.Dq Li my_net : -.Bd -literal -offset indent -ifconfig wlan create wlandev wi0 wlanmode ahdemo \e - inet 192.168.0.20 netmask 0xffffff00 ssid my_net -.Ed -.Pp -Join/create an IBSS network with network name -.Dq Li my_net : -.Bd -literal -offset indent -ifconfig wlan create wlandev wi0 wlanmode adhoc wi0 \e - inet 192.168.0.22 netmask 0xffffff00 ssid my_net -.Ed -.Pp -Create a host-based access point (Prism only): -.Bd -literal -offset indent -ifconfig wlan create wlandev wi0 wlanmode hostap \e - inet 192.168.0.10 netmask 0xffffff00 ssid my_ap -.Ed -.Pp -Create a host-based access point with WEP enabled (Prism only) -and plumb it into bridge to fxp0: -.Bd -literal -offset indent -ifconfig wlan0 create wlandev wi0 wlanmode hostap \e - inet 192.168.0.10 netmask 0xffffff00 ssid my_ap \e - wepmode on wepkey 0x1234567890 weptxkey 1 -ifconfig bridge0 create -ifconfig bridge0 addm wlan0 addm fxp0 up -.Ed -.Pp -This will give you the same functionality as an access point. -.Sh DIAGNOSTICS -.Bl -diag -.It "wi%d: init failed" -The WaveLAN card failed to become ready after an initialization command -was issued. -.It "wi%d: failed to allocate %d bytes on NIC" -The driver was unable to allocate memory for transmit frames in the -NIC's on-board RAM. -This can also be an indication of an incorrectly configured interrupt. -.It "wi%d: device timeout" -The WaveLAN card failed to generate an interrupt to acknowledge a transmit -command. -.El -.Sh SEE ALSO -.Xr intro 4 , -.Xr pccard 4 , -.Xr pccbb 4 , -.Xr pcic 4 , -.Xr wlan 4 , -.Xr wlan_ccmp 4 , -.Xr wlan_tkip 4 , -.Xr wlan_wep 4 , -.Xr wlan_xauth 4 , -.Xr hostapd 8 , -.Xr ifconfig 8 , -.Xr wpa_supplicant 8 -.Rs -.%T HCF Light programming specification -.%U http://web.archive.org/web/20040130141721/http://wavelan.com/ -.Re -.Sh HISTORY -The -.Nm -device driver first appeared in -.Fx 3.0 . -.Sh AUTHORS -The original -.Nm -driver was written by -.An Bill Paul Aq Mt wpaul@ctr.columbia.edu . -This man page comes from -.Ox . -.Sh CAVEATS -The driver will reject devices with old firmware to -avoid dealing with numerous defects. -Unfortunately the driver does not support downloading new firmware -to the card so if new firmware is needed users will have to boot -a different system to accomplish this. -.Pp -Intersil Prism cards must have firmware versions 0.8.0 or later and -version 1.7.0 or later are required to support functionality such as WPA. -Some users of Prism-II and 2.5 based cards report that station firmware -version 1.3.4 works better for them in hostap than 1.4.9. -Older versions of the Prism station firmware have a number of issues -with hostap mode. -The IBSS/adhoc mode appears to work well on station firmware 1.3.1 and -later. -The IBSS/adhoc mode appears to have problems for some people with -older versions of station firmware. -.Pp -Lucent cards prior to firmware version 6.0.6 do not implement IBSS -mode and are not supported. -.Pp -Prior versions of -.Nm -supported Symbol firmware. -That support has been removed due to persistent problems with this -firmware as well as getting proper documentation on this firmware. -.Pp -Hermes 2 and Hermes 3 chips are not supported by this driver. -.Pp -Here's the above requirements in the form of a table -.Pp -.Bl -column -compact "Prims II/2.5" "xxxxxxxx" "xxxxxxxx" "xxxxxxxx" "xxxxxxxx" -.Em "Firmware Minimum WPA Host AP Adhoc/IBSS" -Prism II/2.5 0.8.0 1.7.0 1.3.4 1.3.1 -Prism 3 0.8.0 1.7.0 1.4.9 1.3.1 -Hermes 6.0.6 none none 6.0.6 -Symbol none none none none -.El -.Sh BUGS -Not all the new messages are documented here, and many of them are -indications of transient errors that are not indications of serious -problems. diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 94f184334648..1ccd06669951 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -311,7 +311,6 @@ device iwn # Intel 4965/1000/5000/6000 wireless NICs. device malo # Marvell Libertas wireless NICs. device mwl # Marvell 88W8363 802.11n wireless NICs. device ral # Ralink Technology RT2500 wireless NICs. -device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. device wpi # Intel 3945ABG wireless NICs. # Pseudo devices. diff --git a/sys/conf/NOTES b/sys/conf/NOTES index c3a9c097dedb..4a9e09184caa 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -1923,9 +1923,6 @@ device xmphy # XaQti XMAC II # including the D-Link DFE520TX and D-Link DFE530TX (see 'rl' for # DFE530TX+), the Hawking Technologies PN102TX, and the AOpen/Acer ALN-320. # vte: DM&P Vortex86 RDC R6040 Fast Ethernet -# wi: Lucent WaveLAN/IEEE 802.11 PCMCIA adapters. Note: this supports both -# the PCMCIA and ISA cards: the ISA card is really a PCMCIA to ISA -# bridge with a PCMCIA adapter plugged into it. # xl: Support for the 3Com 3c900, 3c905, 3c905B and 3c905C (Fast) # Etherlink XL cards and integrated controllers. This includes the # integrated 3c905B-TX chips in certain Dell Optiplex and Dell @@ -1936,7 +1933,6 @@ device xmphy # XaQti XMAC II # Order for ISA devices is important here device an -device wi # PCI Ethernet NICs that use the common MII bus controller code. device ae # Attansic/Atheros L2 FastEthernet diff --git a/sys/conf/files b/sys/conf/files index 370b67709ad6..860fae3c8273 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3499,9 +3499,6 @@ dev/vt/vt_font.c optional vt dev/vt/vt_sysmouse.c optional vt dev/vte/if_vte.c optional vte pci dev/watchdog/watchdog.c standard -dev/wi/if_wi.c optional wi -dev/wi/if_wi_pccard.c optional wi pccard -dev/wi/if_wi_pci.c optional wi pci dev/wpi/if_wpi.c optional wpi pci wpifw.c optional wpifw \ compile-with "${AWK} -f $S/tools/fw_stub.awk wpi.fw:wpifw:153229 -mwpi -c${.TARGET}" \ diff --git a/sys/dev/wi/if_wavelan_ieee.h b/sys/dev/wi/if_wavelan_ieee.h deleted file mode 100644 index 27b7ed0f80bb..000000000000 --- a/sys/dev/wi/if_wavelan_ieee.h +++ /dev/null @@ -1,747 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (c) 1997, 1998, 1999 - * Bill Paul . 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Bill Paul. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD - * 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 _IF_WAVELAN_IEEE_H -#define _IF_WAVELAN_IEEE_H - -/* - * This header defines a simple command interface to the FreeBSD - * WaveLAN/IEEE driver (wi) driver, which is used to set certain - * device-specific parameters which can't be easily managed through - * ifconfig(8). No, sysctl(2) is not the answer. I said a _simple_ - * interface, didn't I. - */ - -#ifndef SIOCSWAVELAN -#define SIOCSWAVELAN SIOCSIFGENERIC -#endif - -#ifndef SIOCGWAVELAN -#define SIOCGWAVELAN SIOCGIFGENERIC -#endif - -/* - * Technically I don't think there's a limit to a record - * length. The largest record is the one that contains the CIS - * data, which is 240 words long, so 256 should be a safe - * value. - */ -#define WI_MAX_DATALEN 512 - -#if 0 -struct wi_req { - u_int16_t wi_len; - u_int16_t wi_type; - u_int16_t wi_val[WI_MAX_DATALEN]; -}; -#endif - -/* - * Private LTV records (interpreted only by the driver). This is - * a minor kludge to allow reading the interface statistics from - * the driver. - */ -#define WI_RID_IFACE_STATS 0x0100 -#define WI_RID_MGMT_XMIT 0x0200 -#define WI_RID_ZERO_CACHE 0x0300 -#define WI_RID_READ_CACHE 0x0400 -#define WI_RID_FWDOWNLOAD 0x0500 -#define WI_RID_MONITOR_MODE 0x0600 -#define WI_RID_MIF 0x0700 -#define WI_RID_SCAN_APS 0x0800 -#define WI_RID_READ_APS 0x0900 - -struct wi_80211_hdr { - u_int16_t frame_ctl; - u_int16_t dur_id; - u_int8_t addr1[6]; - u_int8_t addr2[6]; - u_int8_t addr3[6]; - u_int16_t seq_ctl; - u_int8_t addr4[6]; -}; - -#define WI_FCTL_VERS 0x0002 -#define WI_FCTL_FTYPE 0x000C -#define WI_FCTL_STYPE 0x00F0 -#define WI_FCTL_TODS 0x0100 -#define WI_FCTL_FROMDS 0x0200 -#define WI_FCTL_MOREFRAGS 0x0400 -#define WI_FCTL_RETRY 0x0800 -#define WI_FCTL_PM 0x1000 -#define WI_FCTL_MOREDATA 0x2000 -#define WI_FCTL_WEP 0x4000 -#define WI_FCTL_ORDER 0x8000 - -#define WI_FTYPE_MGMT 0x0000 -#define WI_FTYPE_CTL 0x0004 -#define WI_FTYPE_DATA 0x0008 - -#define WI_STYPE_MGMT_ASREQ 0x0000 /* association request */ -#define WI_STYPE_MGMT_ASRESP 0x0010 /* association response */ -#define WI_STYPE_MGMT_REASREQ 0x0020 /* reassociation request */ -#define WI_STYPE_MGMT_REASRESP 0x0030 /* reassociation response */ -#define WI_STYPE_MGMT_PROBEREQ 0x0040 /* probe request */ -#define WI_STYPE_MGMT_PROBERESP 0x0050 /* probe response */ -#define WI_STYPE_MGMT_BEACON 0x0080 /* beacon */ -#define WI_STYPE_MGMT_ATIM 0x0090 /* announcement traffic ind msg */ -#define WI_STYPE_MGMT_DISAS 0x00A0 /* disassociation */ -#define WI_STYPE_MGMT_AUTH 0x00B0 /* authentication */ -#define WI_STYPE_MGMT_DEAUTH 0x00C0 /* deauthentication */ - -#define WI_STYPE_CTL_PSPOLL 0x00A0 -#define WI_STYPE_CTL_RTS 0x00B0 -#define WI_STYPE_CTL_CTS 0x00C0 -#define WI_STYPE_CTL_ACK 0x00D0 -#define WI_STYPE_CTL_CFEND 0x00E0 -#define WI_STYPE_CTL_CFENDACK 0x00F0 - -struct wi_mgmt_hdr { - u_int16_t frame_ctl; - u_int16_t duration; - u_int8_t dst_addr[6]; - u_int8_t src_addr[6]; - u_int8_t bssid[6]; - u_int16_t seq_ctl; -}; - -/* - * Lucent/wavelan IEEE signal strength cache - * - * driver keeps cache of last - * MAXWICACHE packets to arrive including signal strength info. - * daemons may read this via ioctl - * - * Each entry in the wi_sigcache has a unique macsrc. - */ -struct wi_sigcache { - char macsrc[6]; /* unique MAC address for entry */ - int ipsrc; /* ip address associated with packet */ - int signal; /* signal strength of the packet */ - int noise; /* noise value */ - int quality; /* quality of the packet */ -}; - -/* - * Firmware downloading API. We support downloading into RAM and into - * flash. We copy the entire .hex file for both the primary and secondary - * firmware into the kernel, which is minorly gross, but matches the - * format of the compiled in firmware. - */ -struct wi_fwdownload { - int type; /* What type of download. */ -#define WI_FW_RAM 1 -#define WI_FW_FLASH 2 - size_t pri_len; /* Primary firmware length */ - size_t sec_len; /* Secondary firmware length */ - caddr_t pri_data; /* Pointer (user) to primary data */ - caddr_t sec_data; /* Pointer (user) to secondary data */ -}; - -struct wi_counters { - u_int32_t wi_tx_unicast_frames; - u_int32_t wi_tx_multicast_frames; - u_int32_t wi_tx_fragments; - u_int32_t wi_tx_unicast_octets; - u_int32_t wi_tx_multicast_octets; - u_int32_t wi_tx_deferred_xmits; - u_int32_t wi_tx_single_retries; - u_int32_t wi_tx_multi_retries; - u_int32_t wi_tx_retry_limit; - u_int32_t wi_tx_discards; - u_int32_t wi_rx_unicast_frames; - u_int32_t wi_rx_multicast_frames; - u_int32_t wi_rx_fragments; - u_int32_t wi_rx_unicast_octets; - u_int32_t wi_rx_multicast_octets; - u_int32_t wi_rx_fcs_errors; - u_int32_t wi_rx_discards_nobuf; - u_int32_t wi_tx_discards_wrong_sa; - u_int32_t wi_rx_WEP_cant_decrypt; - u_int32_t wi_rx_msg_in_msg_frags; - u_int32_t wi_rx_msg_in_bad_msg_frags; -}; - -/* - * Network parameters, static configuration entities. - */ -#define WI_RID_PORTTYPE 0xFC00 /* Connection control characteristics */ -#define WI_RID_MAC_NODE 0xFC01 /* MAC address of this station */ -#define WI_RID_DESIRED_SSID 0xFC02 /* Service Set ID for connection */ -#define WI_RID_OWN_CHNL 0xFC03 /* Comm channel for BSS creation */ -#define WI_RID_OWN_SSID 0xFC04 /* IBSS creation ID */ -#define WI_RID_OWN_ATIM_WIN 0xFC05 /* ATIM window time for IBSS creation */ -#define WI_RID_SYSTEM_SCALE 0xFC06 /* scale that specifies AP density */ -#define WI_RID_MAX_DATALEN 0xFC07 /* Max len of MAC frame body data */ -#define WI_RID_MAC_WDS 0xFC08 /* MAC addr of corresponding WDS node */ -#define WI_RID_PM_ENABLED 0xFC09 /* ESS power management enable */ -#define WI_RID_PM_EPS 0xFC0A /* PM EPS/PS mode */ -#define WI_RID_MCAST_RX 0xFC0B /* ESS PM mcast reception */ -#define WI_RID_MAX_SLEEP 0xFC0C /* max sleep time for ESS PM */ -#define WI_RID_HOLDOVER 0xFC0D /* holdover time for ESS PM */ -#define WI_RID_NODENAME 0xFC0E /* ID name of this node for diag */ -#define WI_RID_DTIM_PERIOD 0xFC10 /* beacon interval between DTIMs */ -#define WI_RID_WDS_ADDR1 0xFC11 /* port 1 MAC of WDS link node */ -#define WI_RID_WDS_ADDR2 0xFC12 /* port 1 MAC of WDS link node */ -#define WI_RID_WDS_ADDR3 0xFC13 /* port 1 MAC of WDS link node */ -#define WI_RID_WDS_ADDR4 0xFC14 /* port 1 MAC of WDS link node */ -#define WI_RID_WDS_ADDR5 0xFC15 /* port 1 MAC of WDS link node */ -#define WI_RID_WDS_ADDR6 0xFC16 /* port 1 MAC of WDS link node */ -#define WI_RID_MCAST_PM_BUF 0xFC17 /* PM buffering of mcast */ -#define WI_RID_ENCRYPTION 0xFC20 /* enable/disable WEP */ -#define WI_RID_AUTHTYPE 0xFC21 /* specify authentication type */ -#define WI_RID_P2_TX_CRYPT_KEY 0xFC23 -#define WI_RID_P2_CRYPT_KEY0 0xFC24 -#define WI_RID_P2_CRYPT_KEY1 0xFC25 -#define WI_RID_MICROWAVE_OVEN 0xFC25 -#define WI_RID_P2_CRYPT_KEY2 0xFC26 -#define WI_RID_P2_CRYPT_KEY3 0xFC27 -#define WI_RID_P2_ENCRYPTION 0xFC28 -#define WI_RID_ALT_RETRY_CNT 0xFC32 -#define PRIVACY_INVOKED 0x01 -#define EXCLUDE_UNENCRYPTED 0x02 -#define HOST_ENCRYPT 0x10 -#define IV_EVERY_FRAME 0x00 /* IV = Initialization Vector */ -#define IV_EVERY10_FRAME 0x20 /* every 10 frame IV reuse */ -#define IV_EVERY50_FRAME 0x40 /* every 50 frame IV reuse */ -#define IV_EVERY100_FRAME 0x60 /* every 100 frame IV reuse */ -#define HOST_DECRYPT 0x80 -#define WI_RID_WEP_MAPTABLE 0xFC29 -#define WI_RID_CNFAUTHMODE 0xFC2A -#define WI_RID_ROAMING_MODE 0xFC2D -#define WI_RID_OWN_BEACON_INT 0xFC33 /* beacon xmit time for BSS creation */ -#define WI_RID_ENH_SECURITY 0xFC43 /* enhanced security (AP mode) */ -#define WI_RID_CNF_DBM_ADJUST 0xFC46 -#define WI_RID_DBM_ADJUST 0xFC46 /* RSSI - WI_RID_DBM_ADJUST ~ dBm */ -#define WI_RID_WPA_DATA 0xFC48 /* WPA IE */ -#define WI_RID_BASIC_RATE 0xFCB3 -#define WI_RID_SUPPORT_RATE 0xFCB4 -#define WI_RID_WPA_HANDLING 0xFCBB /* WPA handling procedures */ - -/* - * Network parameters, dynamic configuration entities - */ -#define WI_RID_MCAST_LIST 0xFC80 /* list of multicast addrs */ -#define WI_RID_CREATE_IBSS 0xFC81 /* create IBSS */ -#define WI_RID_FRAG_THRESH 0xFC82 /* frag len, unicast msg xmit */ -#define WI_RID_RTS_THRESH 0xFC83 /* frame len for RTS/CTS handshake */ -#define WI_RID_TX_RATE 0xFC84 /* data rate for message xmit - * 0 == Fixed 1mbps - * 1 == Fixed 2mbps - * 2 == auto fallback - */ -#define WI_RID_PROMISC 0xFC85 /* enable promisc mode */ -#define WI_RID_FRAG_THRESH0 0xFC90 -#define WI_RID_FRAG_THRESH1 0xFC91 -#define WI_RID_FRAG_THRESH2 0xFC92 -#define WI_RID_FRAG_THRESH3 0xFC93 -#define WI_RID_FRAG_THRESH4 0xFC94 -#define WI_RID_FRAG_THRESH5 0xFC95 -#define WI_RID_FRAG_THRESH6 0xFC96 -#define WI_RID_RTS_THRESH0 0xFC97 -#define WI_RID_RTS_THRESH1 0xFC98 -#define WI_RID_RTS_THRESH2 0xFC99 -#define WI_RID_RTS_THRESH3 0xFC9A -#define WI_RID_RTS_THRESH4 0xFC9B -#define WI_RID_RTS_THRESH5 0xFC9C -#define WI_RID_RTS_THRESH6 0xFC9D -#define WI_RID_TX_RATE0 0xFC9E -#define WI_RID_TX_RATE1 0xFC9F -#define WI_RID_TX_RATE2 0xFCA0 -#define WI_RID_TX_RATE3 0xFCA1 -#define WI_RID_TX_RATE4 0xFCA2 -#define WI_RID_TX_RATE5 0xFCA3 -#define WI_RID_TX_RATE6 0xFCA4 -#define WI_RID_DEFLT_CRYPT_KEYS 0xFCB0 -#define WI_RID_TX_CRYPT_KEY 0xFCB1 -#define WI_RID_TICK_TIME 0xFCE0 - -struct wi_key { - u_int16_t wi_keylen; - u_int8_t wi_keydat[14]; -}; - -#define WI_NLTV_KEYS 4 -struct wi_ltv_keys { - u_int16_t wi_len; - u_int16_t wi_type; - struct wi_key wi_keys[WI_NLTV_KEYS]; -}; - -/* - * NIC information - */ -#define WI_RID_DNLD_BUF 0xFD01 -#define WI_RID_MEMSZ 0xFD02 /* memory size info (XXX Lucent) */ - /* Looks like on lucnet pri firm too */ -#define WI_RID_PRI_IDENTITY 0xFD02 /* primary funcs firmware ident (PRISM2) */ -#define WI_RID_PRI_SUP_RANGE 0xFD03 /* primary supplier compatibility */ -#define WI_RID_CIF_ACT_RANGE 0xFD04 /* controller sup. compatibility */ -#define WI_RID_SERIALNO 0xFD0A /* card serial number */ -#define WI_RID_CARD_ID 0xFD0B /* card identification */ -#define WI_RID_MFI_SUP_RANGE 0xFD0C /* modem supplier compatibility */ -#define WI_RID_CFI_SUP_RANGE 0xFD0D /* controller sup. compatibility */ -#define WI_RID_CHANNEL_LIST 0xFD10 /* allowd comm. frequencies. */ -#define WI_RID_REG_DOMAINS 0xFD11 /* list of intendted regulatory doms */ -#define WI_RID_TEMP_TYPE 0xFD12 /* hw temp range code */ -#define WI_RID_CIS 0xFD13 /* PC card info struct */ -#define WI_RID_STA_IDENTITY 0xFD20 /* station funcs firmware ident */ -#define WI_RID_STA_SUP_RANGE 0xFD21 /* station supplier compat */ -#define WI_RID_MFI_ACT_RANGE 0xFD22 -#define WI_RID_SYMBOL_IDENTITY 0xFD24 -#define WI_RID_CFI_ACT_RANGE 0xFD33 -#define WI_RID_COMMQUAL 0xFD43 -#define WI_RID_SCALETHRESH 0xFD46 -#define WI_RID_PCF 0xFD87 - -/* - * MAC information - */ -#define WI_RID_PORT_STAT 0xFD40 /* actual MAC port con control stat */ -#define WI_RID_CURRENT_SSID 0xFD41 /* ID of actually connected SS */ -#define WI_RID_CURRENT_BSSID 0xFD42 /* ID of actually connected BSS */ -#define WI_RID_COMMS_QUALITY 0xFD43 /* quality of BSS connection */ -#define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */ -#define WI_RID_CUR_BEACON_INT 0xFD45 /* current beacon interval */ -#define WI_RID_CUR_SCALE_THRESH 0xFD46 /* actual system scane thresh setting */ -#define WI_RID_PROT_RESP_TIME 0xFD47 /* time to wait for resp to req msg */ -#define WI_RID_SHORT_RTR_LIM 0xFD48 /* max tx attempts for short frames */ -#define WI_RID_LONG_RTS_LIM 0xFD49 /* max tx attempts for long frames */ -#define WI_RID_MAX_TX_LIFE 0xFD4A /* max tx frame handling duration */ -#define WI_RID_MAX_RX_LIFE 0xFD4B /* max rx frame handling duration */ -#define WI_RID_CF_POLL 0xFD4C /* contention free pollable ind */ -#define WI_RID_AUTH_ALGS 0xFD4D /* auth algorithms available */ -#define WI_RID_AUTH_TYPE 0xFD4E /* availanle auth types */ -#define WI_RID_WEP_AVAIL 0xFD4F /* WEP privacy option available */ -#define WI_RID_DBM_COMMS_QUAL 0xFD51 /* CommQuality normalized to dBm */ -#define WI_RID_CUR_TX_RATE1 0xFD80 -#define WI_RID_CUR_TX_RATE2 0xFD81 -#define WI_RID_CUR_TX_RATE3 0xFD82 -#define WI_RID_CUR_TX_RATE4 0xFD83 -#define WI_RID_CUR_TX_RATE5 0xFD84 -#define WI_RID_CUR_TX_RATE6 0xFD85 -#define WI_RID_OWN_MAC 0xFD86 /* unique local MAC addr */ -#define WI_RID_PCI_INFO 0xFD87 /* point coordination func cap */ - -/* - * Scan Information - */ -#define WI_RID_BCAST_SCAN_REQ 0xFCAB /* Broadcast Scan request (Symbol) */ -#define BSCAN_5SEC 0x01 -#define BSCAN_ONETIME 0x02 -#define BSCAN_PASSIVE 0x40 -#define BSCAN_BCAST 0x80 -#define WI_RID_SCAN_REQ 0xFCE1 /* Scan request (STA only) */ -#define WI_RID_JOIN_REQ 0xFCE2 /* Join request (STA only) */ -#define WI_RID_AUTH_STATION 0xFCE3 /* Authenticates Station (AP) */ -#define WI_RID_CHANNEL_REQ 0xFCE4 /* Channel Information Request (AP) */ -#define WI_RID_SCAN_RESULTS 0xFD88 /* Scan Results Table */ - -struct wi_apinfo { - int scanreason; /* ScanReason */ - char bssid[6]; /* BSSID (mac address) */ - int channel; /* Channel */ - int signal; /* Signal level */ - int noise; /* Average Noise Level*/ - int quality; /* Quality */ - int namelen; /* Length of SSID string */ - char name[32]; /* SSID string */ - int capinfo; /* Capability info. */ - int interval; /* BSS Beacon Interval */ - int rate; /* Data Rate */ -}; - -/* - * Modem information - */ -#define WI_RID_PHY_TYPE 0xFDC0 /* phys layer type indication */ -#define WI_RID_CURRENT_CHAN 0xFDC1 /* current frequency */ -#define WI_RID_PWR_STATE 0xFDC2 /* pwr consumption status */ -#define WI_RID_CCA_MODE 0xFDC3 /* clear chan assess mode indication */ -#define WI_RID_CCA_TIME 0xFDC4 /* clear chan assess time */ -#define WI_RID_MAC_PROC_DELAY 0xFDC5 /* MAC processing delay time */ -#define WI_RID_DATA_RATES 0xFDC6 /* supported data rates */ - -/* - * bsd-airtools v0.2 - source-mods v0.2 [common.h] - * by h1kari - (c) Dachb0den Labs 2001 - */ - -/* - * Copyright (c) 2001 Dachb0den Labs. - * David Hulton . 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by David Hulton. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY David Hulton 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 David Hulton OR THE VOICES IN HIS HEAD - * 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. - */ - -/* - * standard hermes receive frame used by wavelan/prism2 cards - */ -struct wi_rx_frame { - /* - * hermes prefix header. supplies information on the current status of - * the network and various other statistics gathered from the - * management/control frames as used internally. - */ - u_int16_t wi_status; - u_int16_t wi_ts0; - u_int16_t wi_ts1; - u_int8_t wi_silence; - u_int8_t wi_signal; - u_int8_t wi_rate; - u_int8_t wi_rx_flow; - u_int16_t wi_rsvd0; - u_int16_t wi_rsvd1; - /* - * standard 80211 frame header. all packets have to use this header as - * per the AN9900 from intersil, even management/control. for *** 4039 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Jan 8 03:54:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2031F4E543D; Fri, 8 Jan 2021 03:54:13 +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 4DBq3T0NTMz4qnS; Fri, 8 Jan 2021 03:54:13 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (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 F3AED2B173; Fri, 8 Jan 2021 03:54:12 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f175.google.com with SMTP id h19so5754136qtq.13; Thu, 07 Jan 2021 19:54:12 -0800 (PST) X-Gm-Message-State: AOAM531Apn6mzXBFgPQKKNQx/WRQ8kgwpNTKC+Ra6JHnOV3uc0w39KR9 JEzPGCERykT0OF6xfCNghLX3OTepQfH0QbhdVM0= X-Google-Smtp-Source: ABdhPJybwp4bXy9VMIUcrTGSbwU1C5JTJtcB5XFiDXes9J3V8xtziqa4eTGiDnBndRmLtYgkejjADXEBW993SVKqlZQ= X-Received: by 2002:aed:2e25:: with SMTP id j34mr1517182qtd.242.1610078052480; Thu, 07 Jan 2021 19:54:12 -0800 (PST) MIME-Version: 1.0 References: <202101080016.1080Gwu5034111@gitrepo.freebsd.org> In-Reply-To: <202101080016.1080Gwu5034111@gitrepo.freebsd.org> From: Kyle Evans Date: Thu, 7 Jan 2021 21:54:01 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: a5e284038edc - main - open(2): Add O_DSYNC flag. To: Thomas Munro Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 03:54:13 -0000 On Thu, Jan 7, 2021 at 6:17 PM Thomas Munro wrote: > > The branch main has been updated by tmunro: > > URL: https://cgit.FreeBSD.org/src/commit/?id=a5e284038edc36b0447f1e6337419a3c0ea1788d > > commit a5e284038edc36b0447f1e6337419a3c0ea1788d > Author: Thomas Munro > AuthorDate: 2021-01-07 10:46:51 +0000 > Commit: Thomas Munro > CommitDate: 2021-01-08 00:15:56 +0000 > > open(2): Add O_DSYNC flag. > > POSIX O_DSYNC means that writes include an implicit fdatasync(2), just > as O_SYNC implies fsync(2). > > VOP_WRITE() functions that understand the new IO_DATASYNC flag can act > accordingly, but we'll still pass down IO_SYNC so that file systems that > don't understand it will continue to provide the stronger O_SYNC > behaviour. > > Flag also applies to fcntl(2). > > Reviewed by: kib, delphij > Differential Revision: https://reviews.freebsd.org/D25090 > --- > lib/libc/sys/fcntl.2 | 19 +++++++++++++++++-- > lib/libc/sys/open.2 | 20 +++++++++++++------- > .../openzfs/include/os/freebsd/spl/sys/ccompile.h | 1 - > .../openzfs/include/os/freebsd/spl/sys/vnode.h | 2 ++ > sys/kern/vfs_vnops.c | 7 +++++++ > sys/sys/fcntl.h | 15 +++++++++------ > sys/sys/vnode.h | 1 + > 7 files changed, 49 insertions(+), 16 deletions(-) > > [... snip ...] > diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h > index 2f424d173949..e2597726c53b 100644 > --- a/sys/sys/fcntl.h > +++ b/sys/sys/fcntl.h > @@ -141,8 +141,10 @@ typedef __pid_t pid_t; > return back */ > #endif > > +#define O_DSYNC 0x00800000 /* POSIX data sync */ > + > /* > - * XXX missing O_DSYNC, O_RSYNC. > + * XXX missing O_RSYNC. > */ > > #ifdef _KERNEL I think the value of O_DSYNC got resolved incorrectly in a merge conflict; O_RESOLVE_BENEATH in the just prior __BSD_VISIBLE block took 0x00800000, so I believe this should be 0x01000000. Thanks, Kyle Evans From owner-dev-commits-src-all@freebsd.org Fri Jan 8 04:16:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 409AC4E5C95; Fri, 8 Jan 2021 04:16:07 +0000 (UTC) (envelope-from tmunro@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 4DBqXl1BtRz4rmS; Fri, 8 Jan 2021 04:16:07 +0000 (UTC) (envelope-from tmunro@freebsd.org) Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (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: tmunro/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 1735D2C590; Fri, 8 Jan 2021 04:16:07 +0000 (UTC) (envelope-from tmunro@freebsd.org) Received: by mail-io1-f50.google.com with SMTP id n4so8488895iow.12; Thu, 07 Jan 2021 20:16:07 -0800 (PST) X-Gm-Message-State: AOAM532Czl9w23251lT8sJe0b9Vcr2i05YMDpezp6zK3L9HczGev4fpa TWrvdpL/atsYT/W3hXXIlx7qaEDSqVl1+rcLj5w= X-Google-Smtp-Source: ABdhPJxbyKtlw30M7JQfUPXjAuBmoc+id/HpyZS8Wcfp9HXiAxU6v0AsUeso0yDmZ7Q3p2NONg8F7Oxf9aw6KrzkeF4= X-Received: by 2002:a5d:824b:: with SMTP id n11mr3960832ioo.27.1610079366346; Thu, 07 Jan 2021 20:16:06 -0800 (PST) MIME-Version: 1.0 References: <202101080016.1080Gwu5034111@gitrepo.freebsd.org> In-Reply-To: From: Thomas Munro Date: Fri, 8 Jan 2021 17:15:30 +1300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: a5e284038edc - main - open(2): Add O_DSYNC flag. To: Kyle Evans Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 04:16:07 -0000 On Fri, Jan 8, 2021 at 4:54 PM Kyle Evans wrote: > On Thu, Jan 7, 2021 at 6:17 PM Thomas Munro wrote: > > +#define O_DSYNC 0x00800000 /* POSIX data sync */ > I think the value of O_DSYNC got resolved incorrectly in a merge > conflict; O_RESOLVE_BENEATH in the just prior __BSD_VISIBLE block took > 0x00800000, so I believe this should be 0x01000000. Right, that's exactly what happened. Will fix. Thanks! From owner-dev-commits-src-all@freebsd.org Fri Jan 8 05:02:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 92E134E6407; Fri, 8 Jan 2021 05:02:56 +0000 (UTC) (envelope-from git@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 4DBrZm3lxbz4tNl; Fri, 8 Jan 2021 05:02:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73FD61D9E4; Fri, 8 Jan 2021 05:02:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10852uAI010374; Fri, 8 Jan 2021 05:02:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10852ubl010373; Fri, 8 Jan 2021 05:02:56 GMT (envelope-from git) Date: Fri, 8 Jan 2021 05:02:56 GMT Message-Id: <202101080502.10852ubl010373@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Thomas Munro Subject: git: da3ef8e66aa1 - main - Fix conflicting value of O_DSYNC. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tmunro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da3ef8e66aa13db9a79841127a3cbf067de41b69 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 05:02:56 -0000 The branch main has been updated by tmunro: URL: https://cgit.FreeBSD.org/src/commit/?id=da3ef8e66aa13db9a79841127a3cbf067de41b69 commit da3ef8e66aa13db9a79841127a3cbf067de41b69 Author: Thomas Munro AuthorDate: 2021-01-08 05:01:15 +0000 Commit: Thomas Munro CommitDate: 2021-01-08 05:01:15 +0000 Fix conflicting value of O_DSYNC. O_RESOLVE_BENEATH recently took value 0x00800000, but I failed to spot that while rebasing. Let's use 0x01000000 for the new O_DSYNC flag. Reported by: kevans --- sys/sys/fcntl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h index e2597726c53b..3c29c04e46db 100644 --- a/sys/sys/fcntl.h +++ b/sys/sys/fcntl.h @@ -141,7 +141,7 @@ typedef __pid_t pid_t; return back */ #endif -#define O_DSYNC 0x00800000 /* POSIX data sync */ +#define O_DSYNC 0x01000000 /* POSIX data sync */ /* * XXX missing O_RSYNC. From owner-dev-commits-src-all@freebsd.org Fri Jan 8 05:09:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DB75F4E6492; Fri, 8 Jan 2021 05:09:40 +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 4DBrkX5vc3z4tg7; Fri, 8 Jan 2021 05:09:40 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com [209.85.222.46]) (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 B7B982C721; Fri, 8 Jan 2021 05:09:40 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-ua1-f46.google.com with SMTP id n18so3057645ual.9; Thu, 07 Jan 2021 21:09:40 -0800 (PST) X-Gm-Message-State: AOAM5307EnKrZSriDqnT2uY/KdbQy12WZKkP87guWbdbjBmDxuXH8Y2+ ceIbx8jiqLqs/ugDMI7uDVyBpj/Xxn5btCYuCF8= X-Google-Smtp-Source: ABdhPJyYiNYzxodNYHHc8XoB/ptOELuqDmPPPskUMBEupiMNqd8FZ3lA66s71DjIgvi0g9IlydVWsft7ggXRgz6sfHQ= X-Received: by 2002:ab0:708c:: with SMTP id m12mr1641703ual.69.1610082580302; Thu, 07 Jan 2021 21:09:40 -0800 (PST) MIME-Version: 1.0 References: <202101080502.10852ubl010373@gitrepo.freebsd.org> In-Reply-To: <202101080502.10852ubl010373@gitrepo.freebsd.org> From: Kyle Evans Date: Thu, 7 Jan 2021 23:09:29 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: da3ef8e66aa1 - main - Fix conflicting value of O_DSYNC. To: Thomas Munro Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 05:09:40 -0000 On Thu, Jan 7, 2021 at 11:03 PM Thomas Munro wrote: > > The branch main has been updated by tmunro: > > URL: https://cgit.FreeBSD.org/src/commit/?id=da3ef8e66aa13db9a79841127a3cbf067de41b69 > > commit da3ef8e66aa13db9a79841127a3cbf067de41b69 > Author: Thomas Munro > AuthorDate: 2021-01-08 05:01:15 +0000 > Commit: Thomas Munro > CommitDate: 2021-01-08 05:01:15 +0000 > > Fix conflicting value of O_DSYNC. > > O_RESOLVE_BENEATH recently took value 0x00800000, but I failed to spot > that while rebasing. Let's use 0x01000000 for the new O_DSYNC flag. > > Reported by: kevans > Thanks! I wouldn't have spotted it, except I have a local patchset that I did the exact same thing on when rebasing across O_RESOLVE_BENEATH. :-) From owner-dev-commits-src-all@freebsd.org Fri Jan 8 07:52:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A3C4A4C0C01; Fri, 8 Jan 2021 07:52:21 +0000 (UTC) (envelope-from git@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 4DBwLF4JvBz3H94; Fri, 8 Jan 2021 07:52:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 871541FE23; Fri, 8 Jan 2021 07:52:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1087qLCM028907; Fri, 8 Jan 2021 07:52:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1087qLX6028906; Fri, 8 Jan 2021 07:52:21 GMT (envelope-from git) Date: Fri, 8 Jan 2021 07:52:21 GMT Message-Id: <202101080752.1087qLX6028906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 742653ebd539 - main - sysctl debug.dump_modinfo should recognize font module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 742653ebd5391610845e96c9edd2e2cbcae8cd8c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 07:52:21 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=742653ebd5391610845e96c9edd2e2cbcae8cd8c commit 742653ebd5391610845e96c9edd2e2cbcae8cd8c Author: Toomas Soome AuthorDate: 2021-01-07 15:05:45 +0000 Commit: Toomas Soome CommitDate: 2021-01-08 07:24:49 +0000 sysctl debug.dump_modinfo should recognize font module Add MODINFOMD_FONT to dump list. --- sys/kern/subr_module.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/kern/subr_module.c b/sys/kern/subr_module.c index 02137adae27c..1ada33c669dc 100644 --- a/sys/kern/subr_module.c +++ b/sys/kern/subr_module.c @@ -421,6 +421,11 @@ preload_modinfo_type(struct sbuf *sbp, int type) case MODINFOMD_VBE_FB: sbuf_cat(sbp, "MODINFOMD_VBE_FB"); break; +#endif +#ifdef MODINFOMD_FONT + case MODINFOMD_FONT: + sbuf_cat(sbp, "MODINFOMD_FONT"); + break; #endif default: sbuf_cat(sbp, "unrecognized metadata type"); @@ -470,6 +475,9 @@ preload_modinfo_value(struct sbuf *sbp, uint32_t *bptr, int type, int len) #endif #ifdef MODINFOMD_VBE_FB case MODINFO_METADATA | MODINFOMD_VBE_FB: +#endif +#ifdef MODINFOMD_FONT + case MODINFO_METADATA | MODINFOMD_FONT: #endif sbuf_print_vmoffset(sbp, *(vm_offset_t *)bptr); break; From owner-dev-commits-src-all@freebsd.org Fri Jan 8 09:27:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5FEF14C2B73; Fri, 8 Jan 2021 09:27:14 +0000 (UTC) (envelope-from bapt@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 4DByRk2FCPz3Lxc; Fri, 8 Jan 2021 09:27:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from ivaldir.etoilebsd.net (etoilebsd.net [178.32.217.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id 268EB2EACE; Fri, 8 Jan 2021 09:27:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by ivaldir.etoilebsd.net (Postfix, from userid 1001) id 0F4E5EC8CB; Fri, 8 Jan 2021 10:26:38 +0100 (CET) Date: Fri, 8 Jan 2021 10:26:38 +0100 From: Baptiste Daroussin To: Vladimir Kondratyev Cc: Ravi Pokala , Jessica Clarke , Vladimir Kondratyev , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. Message-ID: <20210108092638.x2kkvpeftey2wk62@ivaldir.net> References: <202101072320.107NKpMS063374@gitrepo.freebsd.org> <7a7fa0fb-51c2-1b14-6d37-2c400f69d7dd@kondratyev.su> <3EA011C9-2EEC-4693-B36D-69E74DF8473C@panasas.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pvwjn3u42ifxw2qb" Content-Disposition: inline In-Reply-To: X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 09:27:14 -0000 --pvwjn3u42ifxw2qb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 08, 2021 at 02:49:31AM +0300, Vladimir Kondratyev wrote: > On 08.01.2021 02:41, Ravi Pokala wrote: > > -----Original Message----- > > From: on behalf of Vladimir Kondraty= ev > > Date: 2021-01-07, Thursday at 15:33 > > To: Jessica Clarke , Vladimir Kondratyev > > Cc: "src-committers@freebsd.org" , "dev-com= mits-src-all@freebsd.org" , "dev-commits-s= rc-main@freebsd.org" > > Subject: Re: git: 92cf602e3809 - main - Copy strcasestr.c from libc to = libkern. > >=20 > > On 08.01.2021 02:27, Jessica Clarke wrote: > > > On 7 Jan 2021, at 23:20, Vladimir Kondratyev w= rote: > > >> +#include > > >> +#include > > >> +#include "xlocale_private.h" > > >> + > > >> +/* > > >> + * Find the first occurrence of find in s, ignore case. > > >> + */ > > >> +char * > > >> +strcasestr_l(const char *s, const char *find, locale_t locale) > > >=20 > > > Locales in the kernel? This feels wrong. > > >=20 > > > Jess > > >=20 > >=20 > > strcasestr.c was copied from userland unmodified just to allow > > "git log --follow" to work. Next commit removed locale support from= this > > file and connected it to build. > >=20 > > Unfortunately, about two-dozen commit messages from you arrived at the = same time, and some were out of order; without incrementing change numbers = in the subject line, figuring out the actual ordering is non-trivial. :-p > >=20 > > -Ravi (rpokala@) > >=20 >=20 > I hope, commit hook will be improved some day. Pushing of two-dozen > commits one by one is too boring. The history is in the right order and gitlog/cgit/anything that reads the l= og show everything in the right order. mails are asynchronuous, expecting the mail to always arrive in a given ord= er is wrong ;) pushing all those commits at once was imho the right thing to do. Best regards, Bapt --pvwjn3u42ifxw2qb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAl/4JUsACgkQY4mL3PG3 PlrGlw/9H8MYzsk+I2mrmVaeoVZ5O1xUQ1yuQusSR6q+AApXcHOKbPuW1VTF+R+F sCIsbMQZJwCJDUkpwTfw7SXanz1WjhGPd2hstxDUlmgdQWPirHZjJCkSu9la0WDk SEq/FqH/tBIN8kJWeegMo8AobQWbpgt+tkW6U8eSygSKsEL2QpKzbxjAd4CQlwH1 rgv1eg19RLS6/B4AAty9GOOWtN5MQYrVRBmuNQQmmTKYfDRav4Zgb/hgt1MPdtU5 8Y++nYtSkk0AfIhHPX3dHPMZhxJUyqpyFKe3UjI3tPk8AJV68Xx8WN3gjb2+ObVH 9ecWzkl6aypbceBOhcrt5KBowa0r2x14fwEolgI8mmhPRGRp0oCtzi/PRhd39E+d jDYDO92qNJ/ie/fbXKAjXiDTM3zAU2w1ZsiixPW/s5huoSd+9N9Z0sP+vjqnqpc9 c3/UhHXY4OCndQgchcVlO1cYalLzaxif1GETunWyDI/oN8m+4hTGiTaUY/CxwIM8 wFCx8wcq+XQB+LS9w+zxuQQcuju9c6yvSsSbL5zoPyVHGTKVAUzh2K563KdzoKtg 2WF+h1XzLcGm5ONBhjwx+Ki9kRbv/Tr4TD7xESscf6PL5uL0MFC/JhByLX8jOOoQ 4dBAvIt2vYPtVEgp67HHMEpIa11kerFGuaPS9rMpyvu2yaPoqVE= =LQmH -----END PGP SIGNATURE----- --pvwjn3u42ifxw2qb-- From owner-dev-commits-src-all@freebsd.org Fri Jan 8 11:36:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 540344C67F8; Fri, 8 Jan 2021 11:36:37 +0000 (UTC) (envelope-from git@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 4DC1K11s6gz3lMx; Fri, 8 Jan 2021 11:36:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32FD122924; Fri, 8 Jan 2021 11:36:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108Babt1013479; Fri, 8 Jan 2021 11:36:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108Bab8u013478; Fri, 8 Jan 2021 11:36:37 GMT (envelope-from git) Date: Fri, 8 Jan 2021 11:36:37 GMT Message-Id: <202101081136.108Bab8u013478@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 50a9f8bbc1dd - main - Downgrade error about missing VSC to warning and make messages consistent in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 50a9f8bbc1dd3551440dcd30fd9d85ee14353248 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 11:36:37 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=50a9f8bbc1dd3551440dcd30fd9d85ee14353248 commit 50a9f8bbc1dd3551440dcd30fd9d85ee14353248 Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:50:41 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 11:35:53 +0000 Downgrade error about missing VSC to warning and make messages consistent in mlx5core. Submitted by: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 2 +- sys/dev/mlx5/mlx5_core/mlx5_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c index 622ea7ae0cdb..d633333cb80d 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c @@ -72,7 +72,7 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) if (error != 0) { /* Inability to create a firmware dump is not fatal. */ mlx5_core_warn(mdev, - "Failed to find vendor-specific capability, error %d\n", + "Unable to find vendor-specific capability, error %d\n", error); return; } diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 8437596dba8f..d0b4027165ea 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -937,7 +937,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev, struct mlx5_priv *priv) err = mlx5_vsc_find_cap(dev); if (err) - mlx5_core_err(dev, "Unable to find vendor specific capabilities\n"); + mlx5_core_warn(dev, "Unable to find vendor specific capabilities\n"); err = mlx5_query_hca_caps(dev); if (err) { From owner-dev-commits-src-all@freebsd.org Fri Jan 8 11:36:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 71C224C6B2B; Fri, 8 Jan 2021 11:36:53 +0000 (UTC) (envelope-from git@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 4DC1KK2njyz3lWQ; Fri, 8 Jan 2021 11:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52A5C2262C; Fri, 8 Jan 2021 11:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108BarLt013618; Fri, 8 Jan 2021 11:36:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108Bar0J013617; Fri, 8 Jan 2021 11:36:53 GMT (envelope-from git) Date: Fri, 8 Jan 2021 11:36:53 GMT Message-Id: <202101081136.108Bar0J013617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: daa150aaa30f - main - Properly handle case where firmware dump returns more registers on second pass in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: daa150aaa30fad8187da8bcbce0880c5075fdda7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 11:36:53 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=daa150aaa30fad8187da8bcbce0880c5075fdda7 commit daa150aaa30fad8187da8bcbce0880c5075fdda7 Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:52:44 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 11:35:54 +0000 Properly handle case where firmware dump returns more registers on second pass in mlx5core. Submitted by: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_fwdump.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c index d633333cb80d..09e8f9f7660a 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c @@ -115,11 +115,15 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) mlx5_core_warn(mdev, "no output from scan space\n"); goto unlock_vsc; } - mdev->dump_rege = malloc(sz * sizeof(struct mlx5_crspace_regmap), + + /* + * We add a sentinel element at the end of the array to + * terminate the read loop in mlx5_fwdump(), so allocate sz + 1. + */ + mdev->dump_rege = malloc((sz + 1) * sizeof(struct mlx5_crspace_regmap), M_MLX5_DUMP, M_WAITOK | M_ZERO); for (i = 0, addr = 0;;) { - MPASS(i < sz); mdev->dump_rege[i].cnt++; MLX5_VSC_SET(vsc_addr, &in, address, addr); pci_write_config(dev, vsc_addr + MLX5_VSC_ADDR_OFFSET, in, 4); @@ -137,13 +141,21 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) next_addr = MLX5_VSC_GET(vsc_addr, &out, address); if (next_addr == 0 || next_addr == addr) break; - if (next_addr != addr + 4) - mdev->dump_rege[++i].addr = next_addr; + if (next_addr != addr + 4) { + if (++i == sz) { + mlx5_core_err(mdev, + "Inconsistent hw crspace reads (1): sz %u i %u addr %#lx", + sz, i, (unsigned long)addr); + break; + } + mdev->dump_rege[i].addr = next_addr; + } addr = next_addr; } - if (i + 1 != sz) { + /* i == sz case already reported by loop above */ + if (i + 1 != sz && i != sz) { mlx5_core_err(mdev, - "Inconsistent hw crspace reads: sz %u i %u addr %#lx", + "Inconsistent hw crspace reads (2): sz %u i %u addr %#lx", sz, i, (unsigned long)addr); } From owner-dev-commits-src-all@freebsd.org Fri Jan 8 11:37:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C8D914C6D04; Fri, 8 Jan 2021 11:37:39 +0000 (UTC) (envelope-from git@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 4DC1LC5Mmfz3lnj; Fri, 8 Jan 2021 11:37:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA6B022A11; Fri, 8 Jan 2021 11:37:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108BbdRx013833; Fri, 8 Jan 2021 11:37:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108BbdAw013832; Fri, 8 Jan 2021 11:37:39 GMT (envelope-from git) Date: Fri, 8 Jan 2021 11:37:39 GMT Message-Id: <202101081137.108BbdAw013832@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 87b3c8cc99f9 - main - Fix spelling in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 87b3c8cc99f964d152ab12f38560de157c681d4d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 11:37:39 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=87b3c8cc99f964d152ab12f38560de157c681d4d commit 87b3c8cc99f964d152ab12f38560de157c681d4d Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:54:16 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 11:35:54 +0000 Fix spelling in mlx5core. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_health.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_health.c b/sys/dev/mlx5/mlx5_core/mlx5_health.c index b9d89f1a552b..7df7870d006f 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_health.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_health.c @@ -492,7 +492,7 @@ static const char *hsynd_str(u8 synd) case MLX5_HEALTH_SYNDR_FFSER_ERR: return "FFSER error"; case MLX5_HEALTH_SYNDR_HIGH_TEMP: - return "High temprature"; + return "High temperature"; default: return "unrecognized error"; } From owner-dev-commits-src-all@freebsd.org Fri Jan 8 11:37:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9A9444C69ED; Fri, 8 Jan 2021 11:37:54 +0000 (UTC) (envelope-from git@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 4DC1LV41wbz3lkk; Fri, 8 Jan 2021 11:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D61B22A12; Fri, 8 Jan 2021 11:37:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108BbsVt013972; Fri, 8 Jan 2021 11:37:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108Bbs7N013971; Fri, 8 Jan 2021 11:37:54 GMT (envelope-from git) Date: Fri, 8 Jan 2021 11:37:54 GMT Message-Id: <202101081137.108Bbs7N013971@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 82c7abe7785b - main - The "unsigned" type is the same like "unsigned int". MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82c7abe7785bd8aeb290d91f80ddeb31e81407a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 11:37:54 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=82c7abe7785bd8aeb290d91f80ddeb31e81407a5 commit 82c7abe7785bd8aeb290d91f80ddeb31e81407a5 Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:58:10 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 11:35:54 +0000 The "unsigned" type is the same like "unsigned int". MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index d0b4027165ea..40cba09106f0 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -708,7 +708,7 @@ static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili, if (warn_time_mili && time_after(jiffies, warn)) { mlx5_core_warn(dev, "Waiting for FW initialization, timeout abort in %u s\n", - (unsigned int)(jiffies_to_msecs(end - warn) / 1000)); + (unsigned)(jiffies_to_msecs(end - warn) / 1000)); warn = jiffies + msecs_to_jiffies(warn_time_mili); } msleep(FW_INIT_WAIT_MS); From owner-dev-commits-src-all@freebsd.org Fri Jan 8 11:38:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4328E4C69FF; Fri, 8 Jan 2021 11:38:13 +0000 (UTC) (envelope-from git@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 4DC1Ls1VKGz3lt1; Fri, 8 Jan 2021 11:38:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B4FF22759; Fri, 8 Jan 2021 11:38:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108BcDO3014119; Fri, 8 Jan 2021 11:38:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108BcDht014118; Fri, 8 Jan 2021 11:38:13 GMT (envelope-from git) Date: Fri, 8 Jan 2021 11:38:13 GMT Message-Id: <202101081138.108BcDht014118@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 98140747ca93 - main - Update the PCI ID list in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 98140747ca93fa36f49103d6c01e47117b51f48c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 11:38:13 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=98140747ca93fa36f49103d6c01e47117b51f48c commit 98140747ca93fa36f49103d6c01e47117b51f48c Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:00:54 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 11:35:54 +0000 Update the PCI ID list in mlx5core. - Add descriptions for new devices. - Add support for Bluefield. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_main.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 40cba09106f0..687e7f1b1e0d 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -1975,15 +1975,15 @@ static const struct pci_device_id mlx5_core_pci_table[] = { { PCI_VDEVICE(MELLANOX, 4116) }, /* ConnectX-4 VF */ { PCI_VDEVICE(MELLANOX, 4117) }, /* ConnectX-4LX */ { PCI_VDEVICE(MELLANOX, 4118) }, /* ConnectX-4LX VF */ - { PCI_VDEVICE(MELLANOX, 4119) }, /* ConnectX-5 */ + { PCI_VDEVICE(MELLANOX, 4119) }, /* ConnectX-5, PCIe 3.0 */ { PCI_VDEVICE(MELLANOX, 4120) }, /* ConnectX-5 VF */ - { PCI_VDEVICE(MELLANOX, 4121) }, - { PCI_VDEVICE(MELLANOX, 4122) }, - { PCI_VDEVICE(MELLANOX, 4123) }, - { PCI_VDEVICE(MELLANOX, 4124) }, - { PCI_VDEVICE(MELLANOX, 4125) }, - { PCI_VDEVICE(MELLANOX, 4126) }, - { PCI_VDEVICE(MELLANOX, 4127) }, + { PCI_VDEVICE(MELLANOX, 4121) }, /* ConnectX-5 Ex */ + { PCI_VDEVICE(MELLANOX, 4122) }, /* ConnectX-5 Ex VF */ + { PCI_VDEVICE(MELLANOX, 4123) }, /* ConnectX-6 */ + { PCI_VDEVICE(MELLANOX, 4124) }, /* ConnectX-6 VF */ + { PCI_VDEVICE(MELLANOX, 4125) }, /* ConnectX-6 Dx */ + { PCI_VDEVICE(MELLANOX, 4126) }, /* ConnectX Family mlx5Gen Virtual Function */ + { PCI_VDEVICE(MELLANOX, 4127) }, /* ConnectX-6 LX */ { PCI_VDEVICE(MELLANOX, 4128) }, { PCI_VDEVICE(MELLANOX, 4129) }, { PCI_VDEVICE(MELLANOX, 4130) }, @@ -2001,7 +2001,10 @@ static const struct pci_device_id mlx5_core_pci_table[] = { { PCI_VDEVICE(MELLANOX, 4142) }, { PCI_VDEVICE(MELLANOX, 4143) }, { PCI_VDEVICE(MELLANOX, 4144) }, - { 0, } + { PCI_VDEVICE(MELLANOX, 0xa2d2) }, /* BlueField integrated ConnectX-5 network controller */ + { PCI_VDEVICE(MELLANOX, 0xa2d3) }, /* BlueField integrated ConnectX-5 network controller VF */ + { PCI_VDEVICE(MELLANOX, 0xa2d6) }, /* BlueField-2 integrated ConnectX-6 Dx network controller */ + { } }; MODULE_DEVICE_TABLE(pci, mlx5_core_pci_table); From owner-dev-commits-src-all@freebsd.org Fri Jan 8 11:39:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A72DE4C6C79; Fri, 8 Jan 2021 11:39:05 +0000 (UTC) (envelope-from git@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 4DC1Ms4PYTz3mHs; Fri, 8 Jan 2021 11:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88A832279A; Fri, 8 Jan 2021 11:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108Bd5EB014346; Fri, 8 Jan 2021 11:39:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108Bd5X0014345; Fri, 8 Jan 2021 11:39:05 GMT (envelope-from git) Date: Fri, 8 Jan 2021 11:39:05 GMT Message-Id: <202101081139.108Bd5X0014345@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 480570dbb309 - main - Fixes for SRIOV in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 480570dbb309585b04dcb6e9cb3f6b1e1a9bd683 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 11:39:05 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=480570dbb309585b04dcb6e9cb3f6b1e1a9bd683 commit 480570dbb309585b04dcb6e9cb3f6b1e1a9bd683 Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:06:11 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 11:35:55 +0000 Fixes for SRIOV in mlx5core. - call pci_iov_detach() on detaching from PCI device to take care of hang on destroying VFs after PF is down. - disable eswitch SRIOV support right after pci_iov_detach(), else the eswitch cleanup sometimes occur while the SRIOV flow table is still present. Submitted by: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_core/mlx5_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 687e7f1b1e0d..843227f928fa 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -1664,6 +1664,11 @@ static void remove_one(struct pci_dev *pdev) struct mlx5_core_dev *dev = pci_get_drvdata(pdev); struct mlx5_priv *priv = &dev->priv; +#ifdef PCI_IOV + pci_iov_detach(pdev->dev.bsddev); + mlx5_eswitch_disable_sriov(priv->eswitch); +#endif + if (mlx5_unload_one(dev, priv, true)) { mlx5_core_err(dev, "mlx5_unload_one() failed, leaked %lld bytes\n", (long long)(dev->priv.fw_pages * MLX5_ADAPTER_PAGE_SIZE)); From owner-dev-commits-src-all@freebsd.org Fri Jan 8 11:39:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1B9C54C6F41; Fri, 8 Jan 2021 11:39:30 +0000 (UTC) (envelope-from git@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 4DC1NL054Mz3mXQ; Fri, 8 Jan 2021 11:39:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18913225F4; Fri, 8 Jan 2021 11:39:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108BdRLM014501; Fri, 8 Jan 2021 11:39:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108BdR6J014500; Fri, 8 Jan 2021 11:39:27 GMT (envelope-from git) Date: Fri, 8 Jan 2021 11:39:27 GMT Message-Id: <202101081139.108BdR6J014500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: a00718e1dfcd - main - Implement SIOCGIFRSSKEY and SIOCGIFRSSHASH and mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a00718e1dfcd9b1f0a1b2706f552cd003ea082d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 11:39:30 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a00718e1dfcd9b1f0a1b2706f552cd003ea082d8 commit a00718e1dfcd9b1f0a1b2706f552cd003ea082d8 Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:12:02 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 11:35:55 +0000 Implement SIOCGIFRSSKEY and SIOCGIFRSSHASH and mlx5en(4). MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 62 ++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index c23335eb712e..37a494e35629 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -2756,6 +2756,31 @@ mlx5e_close_rqt(struct mlx5e_priv *priv) mlx5_cmd_exec(priv->mdev, in, sizeof(in), out, sizeof(out)); } +#define MLX5E_RSS_KEY_SIZE (10 * 4) /* bytes */ + +static void +mlx5e_get_rss_key(void *key_ptr) +{ +#ifdef RSS + rss_getkey(key_ptr); +#else + static const u32 rsskey[] = { + cpu_to_be32(0xD181C62C), + cpu_to_be32(0xF7F4DB5B), + cpu_to_be32(0x1983A2FC), + cpu_to_be32(0x943E1ADB), + cpu_to_be32(0xD9389E6B), + cpu_to_be32(0xD1039C2C), + cpu_to_be32(0xA74499AD), + cpu_to_be32(0x593D56D9), + cpu_to_be32(0xF3253C06), + cpu_to_be32(0x2ADC1FFC), + }; + CTASSERT(sizeof(rsskey) == MLX5E_RSS_KEY_SIZE); + memcpy(key_ptr, rsskey, MLX5E_RSS_KEY_SIZE); +#endif +} + static void mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) { @@ -2807,26 +2832,19 @@ mlx5e_build_tir_ctx(struct mlx5e_priv *priv, u32 * tirc, int tt) MLX5_SET(tirc, tirc, rx_hash_fn, MLX5_TIRC_RX_HASH_FN_HASH_TOEPLITZ); hkey = (__be32 *) MLX5_ADDR_OF(tirc, tirc, rx_hash_toeplitz_key); + + CTASSERT(MLX5_FLD_SZ_BYTES(tirc, rx_hash_toeplitz_key) >= + MLX5E_RSS_KEY_SIZE); #ifdef RSS /* * The FreeBSD RSS implementation does currently not * support symmetric Toeplitz hashes: */ MLX5_SET(tirc, tirc, rx_hash_symmetric, 0); - rss_getkey((uint8_t *)hkey); #else MLX5_SET(tirc, tirc, rx_hash_symmetric, 1); - hkey[0] = cpu_to_be32(0xD181C62C); - hkey[1] = cpu_to_be32(0xF7F4DB5B); - hkey[2] = cpu_to_be32(0x1983A2FC); - hkey[3] = cpu_to_be32(0x943E1ADB); - hkey[4] = cpu_to_be32(0xD9389E6B); - hkey[5] = cpu_to_be32(0xD1039C2C); - hkey[6] = cpu_to_be32(0xA74499AD); - hkey[7] = cpu_to_be32(0x593D56D9); - hkey[8] = cpu_to_be32(0xF3253C06); - hkey[9] = cpu_to_be32(0x2ADC1FFC); #endif + mlx5e_get_rss_key(hkey); break; } @@ -3259,6 +3277,8 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t data) struct ifreq *ifr; struct ifdownreason *ifdr; struct ifi2creq i2c; + struct ifrsskey *ifrk; + struct ifrsshash *ifrh; int error = 0; int mask = 0; int size_read = 0; @@ -3541,6 +3561,26 @@ err_i2c: ifdr->ifdr_reason = IFDR_REASON_MSG; break; + case SIOCGIFRSSKEY: + ifrk = (struct ifrsskey *)data; + ifrk->ifrk_func = RSS_FUNC_TOEPLITZ; + ifrk->ifrk_keylen = MLX5E_RSS_KEY_SIZE; + CTASSERT(sizeof(ifrk->ifrk_key) >= MLX5E_RSS_KEY_SIZE); + mlx5e_get_rss_key(ifrk->ifrk_key); + break; + + case SIOCGIFRSSHASH: + ifrh = (struct ifrsshash *)data; + ifrh->ifrh_func = RSS_FUNC_TOEPLITZ; + ifrh->ifrh_types = + RSS_TYPE_IPV4 | + RSS_TYPE_TCP_IPV4 | + RSS_TYPE_UDP_IPV4 | + RSS_TYPE_IPV6 | + RSS_TYPE_TCP_IPV6 | + RSS_TYPE_UDP_IPV6; + break; + default: error = ether_ioctl(ifp, command, data); break; From owner-dev-commits-src-all@freebsd.org Fri Jan 8 11:39:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 25BDB4C6FC0; Fri, 8 Jan 2021 11:39:50 +0000 (UTC) (envelope-from git@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 4DC1Nk0cQYz3mgd; Fri, 8 Jan 2021 11:39:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07BB62262E; Fri, 8 Jan 2021 11:39:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108BdnmD014660; Fri, 8 Jan 2021 11:39:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108BdnGO014659; Fri, 8 Jan 2021 11:39:49 GMT (envelope-from git) Date: Fri, 8 Jan 2021 11:39:49 GMT Message-Id: <202101081139.108BdnGO014659@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 89c0b4fa1172 - main - Bump some copyrights in mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 89c0b4fa1172dc7238346f9edb11d0e4a5d8c64e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 11:39:50 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=89c0b4fa1172dc7238346f9edb11d0e4a5d8c64e commit 89c0b4fa1172dc7238346f9edb11d0e4a5d8c64e Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:21:58 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 11:35:55 +0000 Bump some copyrights in mlx5en(4). MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c | 2 +- sys/dev/mlx5/mlx5_en/port_buffer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c b/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c index ebf61d521cec..f453b4759e27 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_port_buffer.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 Mellanox Technologies. All rights reserved. + * Copyright (c) 2018-2019 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/sys/dev/mlx5/mlx5_en/port_buffer.h b/sys/dev/mlx5/mlx5_en/port_buffer.h index 1a64749c4ee5..d16347f31a62 100644 --- a/sys/dev/mlx5/mlx5_en/port_buffer.h +++ b/sys/dev/mlx5/mlx5_en/port_buffer.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 Mellanox Technologies. All rights reserved. + * Copyright (c) 2018-2019 Mellanox Technologies. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-dev-commits-src-all@freebsd.org Fri Jan 8 11:40:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 469B64C7126; Fri, 8 Jan 2021 11:40:07 +0000 (UTC) (envelope-from git@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 4DC1P31SMpz3mc3; Fri, 8 Jan 2021 11:40:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24C1B22A13; Fri, 8 Jan 2021 11:40:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108Be7CP016740; Fri, 8 Jan 2021 11:40:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108Be7SA016737; Fri, 8 Jan 2021 11:40:07 GMT (envelope-from git) Date: Fri, 8 Jan 2021 11:40:07 GMT Message-Id: <202101081140.108Be7SA016737@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 376e130b4707 - main - Fix memory leaks in error paths in krping. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 376e130b4707d97a047a0d1e85cd8ce29035138b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 11:40:07 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=376e130b4707d97a047a0d1e85cd8ce29035138b commit 376e130b4707d97a047a0d1e85cd8ce29035138b Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:22:18 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 11:35:55 +0000 Fix memory leaks in error paths in krping. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/contrib/rdma/krping/krping.c | 52 ++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/sys/contrib/rdma/krping/krping.c b/sys/contrib/rdma/krping/krping.c index e9a379984dec..75c874411bb3 100644 --- a/sys/contrib/rdma/krping/krping.c +++ b/sys/contrib/rdma/krping/krping.c @@ -992,9 +992,11 @@ static void wlat_test(struct krping_cb *cb) volatile char *poll_buf = (char *) cb->start_buf; char *buf = (char *)cb->rdma_buf; struct timeval start_tv, stop_tv; - cycles_t *post_cycles_start, *post_cycles_stop; - cycles_t *poll_cycles_start, *poll_cycles_stop; - cycles_t *last_poll_cycles_start; + cycles_t *post_cycles_start = NULL; + cycles_t *post_cycles_stop = NULL; + cycles_t *poll_cycles_start = NULL; + cycles_t *poll_cycles_stop = NULL; + cycles_t *last_poll_cycles_start = NULL; cycles_t sum_poll = 0, sum_post = 0, sum_last_poll = 0; int i; int cycle_iters = 1000; @@ -1006,28 +1008,28 @@ static void wlat_test(struct krping_cb *cb) post_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!post_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } post_cycles_stop = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!post_cycles_stop) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } poll_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!poll_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } poll_cycles_stop = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!poll_cycles_stop) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } last_poll_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!last_poll_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } cb->rdma_sq_wr.wr.opcode = IB_WR_RDMA_WRITE; cb->rdma_sq_wr.rkey = cb->remote_rkey; @@ -1046,7 +1048,7 @@ static void wlat_test(struct krping_cb *cb) if (cb->state == ERROR) { printk(KERN_ERR PFX "state = ERROR, bailing\n"); - return; + goto done; } } } @@ -1061,7 +1063,7 @@ static void wlat_test(struct krping_cb *cb) printk(KERN_ERR PFX "Couldn't post send: scnt=%d\n", scnt); - return; + goto done; } if (scnt < cycle_iters) post_cycles_stop[scnt] = get_cycles(); @@ -1086,7 +1088,7 @@ static void wlat_test(struct krping_cb *cb) if (ne < 0) { printk(KERN_ERR PFX "poll CQ failed %d\n", ne); - return; + goto done; } if (wc.status != IB_WC_SUCCESS) { printk(KERN_ERR PFX @@ -1098,7 +1100,7 @@ static void wlat_test(struct krping_cb *cb) printk(KERN_ERR PFX "scnt=%d, rcnt=%d, ccnt=%d\n", scnt, rcnt, ccnt); - return; + goto done; } } } @@ -1122,6 +1124,7 @@ static void wlat_test(struct krping_cb *cb) scnt, cb->size, cycle_iters, (unsigned long long)sum_post, (unsigned long long)sum_poll, (unsigned long long)sum_last_poll); +done: kfree(post_cycles_start); kfree(post_cycles_stop); kfree(poll_cycles_start); @@ -1134,9 +1137,11 @@ static void bw_test(struct krping_cb *cb) int ccnt, scnt, rcnt; int iters=cb->count; struct timeval start_tv, stop_tv; - cycles_t *post_cycles_start, *post_cycles_stop; - cycles_t *poll_cycles_start, *poll_cycles_stop; - cycles_t *last_poll_cycles_start; + cycles_t *post_cycles_start = NULL; + cycles_t *post_cycles_stop = NULL; + cycles_t *poll_cycles_start = NULL; + cycles_t *poll_cycles_stop = NULL; + cycles_t *last_poll_cycles_start = NULL; cycles_t sum_poll = 0, sum_post = 0, sum_last_poll = 0; int i; int cycle_iters = 1000; @@ -1148,28 +1153,28 @@ static void bw_test(struct krping_cb *cb) post_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!post_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } post_cycles_stop = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!post_cycles_stop) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } poll_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!poll_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } poll_cycles_stop = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!poll_cycles_stop) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } last_poll_cycles_start = kmalloc(cycle_iters * sizeof(cycles_t), GFP_KERNEL); if (!last_poll_cycles_start) { printk(KERN_ERR PFX "%s kmalloc failed\n", __FUNCTION__); - return; + goto done; } cb->rdma_sq_wr.wr.opcode = IB_WR_RDMA_WRITE; cb->rdma_sq_wr.rkey = cb->remote_rkey; @@ -1190,7 +1195,7 @@ static void bw_test(struct krping_cb *cb) printk(KERN_ERR PFX "Couldn't post send: scnt=%d\n", scnt); - return; + goto done; } if (scnt < cycle_iters) post_cycles_stop[scnt] = get_cycles(); @@ -1215,7 +1220,7 @@ static void bw_test(struct krping_cb *cb) if (ne < 0) { printk(KERN_ERR PFX "poll CQ failed %d\n", ne); - return; + goto done; } if (wc.status != IB_WC_SUCCESS) { printk(KERN_ERR PFX @@ -1224,7 +1229,7 @@ static void bw_test(struct krping_cb *cb) printk(KERN_ERR PFX "Failed status %d: wr_id %d\n", wc.status, (int) wc.wr_id); - return; + goto done; } } } @@ -1248,6 +1253,7 @@ static void bw_test(struct krping_cb *cb) scnt, cb->size, cycle_iters, (unsigned long long)sum_post, (unsigned long long)sum_poll, (unsigned long long)sum_last_poll); +done: kfree(post_cycles_start); kfree(post_cycles_stop); kfree(poll_cycles_start); From owner-dev-commits-src-all@freebsd.org Fri Jan 8 11:40:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 679594C707A; Fri, 8 Jan 2021 11:40:32 +0000 (UTC) (envelope-from git@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 4DC1PX2XSPz3mnS; Fri, 8 Jan 2021 11:40:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A4FC22994; Fri, 8 Jan 2021 11:40:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108BeWTj022291; Fri, 8 Jan 2021 11:40:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108BeWxu022290; Fri, 8 Jan 2021 11:40:32 GMT (envelope-from git) Date: Fri, 8 Jan 2021 11:40:32 GMT Message-Id: <202101081140.108BeWxu022290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 9a47ae044b48 - main - Bump driver versions for mlx5en(4) and mlx4en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9a47ae044b487b98da8c3a892d2aa06df233ac53 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 11:40:32 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=9a47ae044b487b98da8c3a892d2aa06df233ac53 commit 9a47ae044b487b98da8c3a892d2aa06df233ac53 Author: Hans Petter Selasky AuthorDate: 2021-01-08 10:45:26 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 11:35:55 +0000 Bump driver versions for mlx5en(4) and mlx4en(4). MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx4/mlx4_core/mlx4.h | 6 ++++-- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 4 ++-- sys/dev/mlx5/mlx5_core/mlx5_core.h | 4 ++-- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 4 ++-- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 4 ++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/sys/dev/mlx4/mlx4_core/mlx4.h b/sys/dev/mlx4/mlx4_core/mlx4.h index a39bbeeff749..8b1afc2838e6 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4.h +++ b/sys/dev/mlx4/mlx4_core/mlx4.h @@ -53,8 +53,10 @@ #define DRV_NAME "mlx4_core" #define PFX DRV_NAME ": " -#define DRV_VERSION "3.5.1" -#define DRV_RELDATE "April 2019" +#ifndef DRV_VERSION +#define DRV_VERSION "3.6.0" +#endif +#define DRV_RELDATE "December 2020" #define MLX4_FS_UDP_UC_EN (1 << 1) #define MLX4_FS_TCP_UC_EN (1 << 2) diff --git a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c index 71ee6ae65229..2d628c7868cb 100644 --- a/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c +++ b/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c @@ -64,9 +64,9 @@ #define DRV_NAME MLX4_IB_DRV_NAME #ifndef DRV_VERSION -#define DRV_VERSION "3.5.1" +#define DRV_VERSION "3.6.0" #endif -#define DRV_RELDATE "April 2019" +#define DRV_RELDATE "December 2020" #define MLX4_IB_FLOW_MAX_PRIO 0xFFF #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF diff --git a/sys/dev/mlx5/mlx5_core/mlx5_core.h b/sys/dev/mlx5/mlx5_core/mlx5_core.h index c898981f72e9..a7ce1b31641c 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_core.h +++ b/sys/dev/mlx5/mlx5_core/mlx5_core.h @@ -36,9 +36,9 @@ #define DRIVER_NAME "mlx5_core" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.5.2" +#define DRIVER_VERSION "3.6.0" #endif -#define DRIVER_RELDATE "September 2019" +#define DRIVER_RELDATE "December 2020" extern int mlx5_core_debug_mask; diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 37a494e35629..1e6562fed667 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -36,9 +36,9 @@ #include #ifndef ETH_DRIVER_VERSION -#define ETH_DRIVER_VERSION "3.5.2" +#define ETH_DRIVER_VERSION "3.6.0" #endif -#define DRIVER_RELDATE "September 2019" +#define DRIVER_RELDATE "December 2020" static const char mlx5e_version[] = "mlx5en: Mellanox Ethernet driver " ETH_DRIVER_VERSION " (" DRIVER_RELDATE ")\n"; diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c index 532223fffed7..9f891d5e9599 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c @@ -52,9 +52,9 @@ #define DRIVER_NAME "mlx5ib" #ifndef DRIVER_VERSION -#define DRIVER_VERSION "3.5.2" +#define DRIVER_VERSION "3.6.0" #endif -#define DRIVER_RELDATE "September 2019" +#define DRIVER_RELDATE "December 2020" MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); From owner-dev-commits-src-all@freebsd.org Fri Jan 8 12:34:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E1E604C91DE; Fri, 8 Jan 2021 12:34:31 +0000 (UTC) (envelope-from git@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 4DC2bq664Tz3qsr; Fri, 8 Jan 2021 12:34:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BFFAB23447; Fri, 8 Jan 2021 12:34:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108CYV28091019; Fri, 8 Jan 2021 12:34:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108CYVGk091018; Fri, 8 Jan 2021 12:34:31 GMT (envelope-from git) Date: Fri, 8 Jan 2021 12:34:31 GMT Message-Id: <202101081234.108CYVGk091018@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 376479200760 - main - Fix whitespace in mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 37647920076048300c604b97d8a8691dca49ad4a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 12:34:31 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=37647920076048300c604b97d8a8691dca49ad4a commit 37647920076048300c604b97d8a8691dca49ad4a Author: Hans Petter Selasky AuthorDate: 2021-01-08 11:44:42 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 12:33:46 +0000 Fix whitespace in mlx5en(4). MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index 73376e45be03..4c3d696ed41c 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -796,7 +796,7 @@ struct mlx5e_sq { struct mtx lock; struct mtx comp_lock; struct mlx5e_sq_stats stats; - struct callout cev_callout; + struct callout cev_callout; /* data path */ #define mlx5e_sq_zero_start dma_tag From owner-dev-commits-src-all@freebsd.org Fri Jan 8 12:34:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 72C274C9314; Fri, 8 Jan 2021 12:34:52 +0000 (UTC) (envelope-from git@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 4DC2cD2qv9z3r2v; Fri, 8 Jan 2021 12:34:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5413E230DE; Fri, 8 Jan 2021 12:34:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108CYqY5091167; Fri, 8 Jan 2021 12:34:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108CYqMW091166; Fri, 8 Jan 2021 12:34:52 GMT (envelope-from git) Date: Fri, 8 Jan 2021 12:34:52 GMT Message-Id: <202101081234.108CYqMW091166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: f8f5b459d21e - main - Update user access region, UAR, APIs in the core in mlx5core. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f8f5b459d21ec9dd1ca5d9de319d8b440fef84a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 12:34:52 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=f8f5b459d21ec9dd1ca5d9de319d8b440fef84a8 commit f8f5b459d21ec9dd1ca5d9de319d8b440fef84a8 Author: Hans Petter Selasky AuthorDate: 2021-01-08 12:30:26 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 12:33:46 +0000 Update user access region, UAR, APIs in the core in mlx5core. This change include several changes as listed below all related to UAR. UAR is a special PCI memory area where the so-called doorbell register and blue flame register live. Blue flame is a feature for sending small packets more efficiently via a PCI memory page, instead of using PCI DMA. - All structures and functions named xxx_uuars were renamed into xxx_bfreg. - Remove partially implemented Blueflame support from mlx5en(4) and mlx5ib. - Implement blue flame register allocator. - Use blue flame register allocator in mlx5ib. - A common UAR page is now allocated by the core to support doorbell register writes for all of mlx5en and mlx5ib, instead of allocating one UAR per sendqueue. - Add support for DEVX query UAR. - Add support for 4K UAR for libmlx5. Linux commits: 7c043e908a74ae0a935037cdd984d0cb89b2b970 2f5ff26478adaff5ed9b7ad4079d6a710b5f27e7 0b80c14f009758cefeed0edff4f9141957964211 30aa60b3bd12bd79b5324b7b595bd3446ab24b52 5fe9dec0d045437e48f112b8fa705197bd7bc3c0 0118717583cda6f4f36092853ad0345e8150b286 a6d51b68611e98f05042ada662aed5dbe3279c1e MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/cq.h | 2 +- sys/dev/mlx5/device.h | 35 ++-- sys/dev/mlx5/driver.h | 89 ++++---- sys/dev/mlx5/mlx5_core/mlx5_cq.c | 1 + sys/dev/mlx5/mlx5_core/mlx5_eq.c | 15 +- sys/dev/mlx5/mlx5_core/mlx5_main.c | 61 +++--- sys/dev/mlx5/mlx5_core/mlx5_uar.c | 340 +++++++++++++++++++++---------- sys/dev/mlx5/mlx5_en/en.h | 19 +- sys/dev/mlx5/mlx5_en/en_rl.h | 1 - sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 44 ++-- sys/dev/mlx5/mlx5_en/mlx5_en_rl.c | 16 +- sys/dev/mlx5/mlx5_en/mlx5_en_tx.c | 2 +- sys/dev/mlx5/mlx5_ib/mlx5_ib.h | 67 +++++- sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c | 26 ++- sys/dev/mlx5/mlx5_ib/mlx5_ib_gsi.c | 2 +- sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c | 342 ++++++++++++++++++++++--------- sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c | 369 ++++++++++++++++------------------ sys/dev/mlx5/mlx5_ifc.h | 7 +- sys/ofed/include/uapi/rdma/mlx5-abi.h | 36 +++- 19 files changed, 871 insertions(+), 603 deletions(-) diff --git a/sys/dev/mlx5/cq.h b/sys/dev/mlx5/cq.h index 55386422efc2..d5e167498fd2 100644 --- a/sys/dev/mlx5/cq.h +++ b/sys/dev/mlx5/cq.h @@ -42,7 +42,7 @@ struct mlx5_core_cq { int irqn; void (*comp) (struct mlx5_core_cq *, struct mlx5_eqe *); void (*event) (struct mlx5_core_cq *, int); - struct mlx5_uar *uar; + struct mlx5_uars_page *uar; u32 cons_index; unsigned arm_sn; struct mlx5_rsc_debug *dbg; diff --git a/sys/dev/mlx5/device.h b/sys/dev/mlx5/device.h index 3431193cdafd..69057d5f2470 100644 --- a/sys/dev/mlx5/device.h +++ b/sys/dev/mlx5/device.h @@ -245,10 +245,22 @@ enum { }; enum { - MLX5_BF_REGS_PER_PAGE = 4, - MLX5_MAX_UAR_PAGES = 1 << 8, - MLX5_NON_FP_BF_REGS_PER_PAGE = 2, - MLX5_MAX_UUARS = MLX5_MAX_UAR_PAGES * MLX5_NON_FP_BF_REGS_PER_PAGE, + MLX5_ADAPTER_PAGE_SHIFT = 12, + MLX5_ADAPTER_PAGE_SIZE = 1 << MLX5_ADAPTER_PAGE_SHIFT, +}; + +enum { + MLX5_BFREGS_PER_UAR = 4, + MLX5_MAX_UARS = 1 << 8, + MLX5_NON_FP_BFREGS_PER_UAR = 2, + MLX5_FP_BFREGS_PER_UAR = MLX5_BFREGS_PER_UAR - + MLX5_NON_FP_BFREGS_PER_UAR, + MLX5_MAX_BFREGS = MLX5_MAX_UARS * + MLX5_NON_FP_BFREGS_PER_UAR, + MLX5_UARS_IN_PAGE = PAGE_SIZE / MLX5_ADAPTER_PAGE_SIZE, + MLX5_NON_FP_BFREGS_IN_PAGE = MLX5_NON_FP_BFREGS_PER_UAR * MLX5_UARS_IN_PAGE, + MLX5_MIN_DYN_BFREGS = 512, + MLX5_MAX_DYN_BFREGS = 1024, }; enum { @@ -407,11 +419,6 @@ enum { MLX5_MAX_PAGE_SHIFT = 31 }; -enum { - MLX5_ADAPTER_PAGE_SHIFT = 12, - MLX5_ADAPTER_PAGE_SIZE = 1 << MLX5_ADAPTER_PAGE_SHIFT, -}; - enum { MLX5_CAP_OFF_CMDIF_CSUM = 46, }; @@ -1146,16 +1153,6 @@ enum { MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP = 0x2, }; -enum { - MLX5_NUM_UUARS_PER_PAGE = MLX5_NON_FP_BF_REGS_PER_PAGE, - MLX5_DEF_TOT_UUARS = 8 * MLX5_NUM_UUARS_PER_PAGE, -}; - -enum { - NUM_DRIVER_UARS = 4, - NUM_LOW_LAT_UUARS = 4, -}; - enum { MLX5_CAP_PORT_TYPE_IB = 0x0, MLX5_CAP_PORT_TYPE_ETH = 0x1, diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index ec9c4f618f67..5d4f58d7e1fd 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -219,38 +219,6 @@ enum { #define MLX5_PROT_MASK(link_mode) (1 << link_mode) -struct mlx5_uuar_info { - struct mlx5_uar *uars; - int num_uars; - int num_low_latency_uuars; - unsigned long *bitmap; - unsigned int *count; - struct mlx5_bf *bfs; - - /* - * protect uuar allocation data structs - */ - struct mutex lock; - u32 ver; -}; - -struct mlx5_bf { - void __iomem *reg; - void __iomem *regreg; - int buf_size; - struct mlx5_uar *uar; - unsigned long offset; - int need_lock; - /* protect blue flame buffer selection when needed - */ - spinlock_t lock; - - /* serialize 64 bit writes when done as two 32 bit accesses - */ - spinlock_t lock32; - int uuarn; -}; - struct mlx5_cmd_first { __be32 data[4]; }; @@ -464,6 +432,39 @@ struct mlx5_core_rsc_common { struct completion free; }; +struct mlx5_uars_page { + void __iomem *map; + bool wc; + u32 index; + struct list_head list; + unsigned int bfregs; + unsigned long *reg_bitmap; /* for non fast path bf regs */ + unsigned long *fp_bitmap; + unsigned int reg_avail; + unsigned int fp_avail; + struct kref ref_count; + struct mlx5_core_dev *mdev; +}; + +struct mlx5_bfreg_head { + /* protect blue flame registers allocations */ + struct mutex lock; + struct list_head list; +}; + +struct mlx5_bfreg_data { + struct mlx5_bfreg_head reg_head; + struct mlx5_bfreg_head wc_head; +}; + +struct mlx5_sq_bfreg { + void __iomem *map; + struct mlx5_uars_page *up; + bool wc; + u32 index; + unsigned int offset; +}; + struct mlx5_core_srq { struct mlx5_core_rsc_common common; /* must be first */ u32 srqn; @@ -489,13 +490,6 @@ struct mlx5_eq_table { spinlock_t lock; }; -struct mlx5_uar { - u32 index; - void __iomem *bf_map; - void __iomem *map; -}; - - struct mlx5_core_health { struct mlx5_health_buffer __iomem *health; __be32 __iomem *health_counter; @@ -578,12 +572,9 @@ struct mlx5_priv { char name[MLX5_MAX_NAME_LEN]; struct mlx5_eq_table eq_table; struct msix_entry *msix_arr; - struct mlx5_uuar_info uuari; MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock); int disable_irqs; - struct io_mapping *bf_mapping; - /* pages stuff */ struct workqueue_struct *pg_wq; struct rb_root page_root; @@ -632,6 +623,9 @@ struct mlx5_priv { struct mlx5_pme_stats pme_stats; struct mlx5_eswitch *eswitch; + + struct mlx5_bfreg_data bfregs; + struct mlx5_uars_page *uar; }; enum mlx5_device_state { @@ -976,10 +970,11 @@ int mlx5_cmd_exec_polling(struct mlx5_core_dev *dev, void *in, int in_size, void *out, int out_size); int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn); int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn); -int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari); -int mlx5_free_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari); -int mlx5_alloc_map_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar); -void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar); +int mlx5_alloc_bfreg(struct mlx5_core_dev *mdev, struct mlx5_sq_bfreg *bfreg, + bool map_wc, bool fast_path); +void mlx5_free_bfreg(struct mlx5_core_dev *mdev, struct mlx5_sq_bfreg *bfreg); +struct mlx5_uars_page *mlx5_get_uars_page(struct mlx5_core_dev *mdev); +void mlx5_put_uars_page(struct mlx5_core_dev *mdev, struct mlx5_uars_page *up); void mlx5_health_cleanup(struct mlx5_core_dev *dev); int mlx5_health_init(struct mlx5_core_dev *dev); void mlx5_start_health_poll(struct mlx5_core_dev *dev); @@ -1049,7 +1044,7 @@ struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vector, enum mlx5_cmd_mode mode); void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type); int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, - int nent, u64 mask, struct mlx5_uar *uar); + int nent, u64 mask); int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq); int mlx5_start_eqs(struct mlx5_core_dev *dev); int mlx5_stop_eqs(struct mlx5_core_dev *dev); diff --git a/sys/dev/mlx5/mlx5_core/mlx5_cq.c b/sys/dev/mlx5/mlx5_core/mlx5_cq.c index 929fd1d6bc31..248d8c9d75c8 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_cq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_cq.c @@ -149,6 +149,7 @@ int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq, goto err_cmd; cq->pid = curthread->td_proc->p_pid; + cq->uar = dev->priv.uar; return 0; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_eq.c b/sys/dev/mlx5/mlx5_core/mlx5_eq.c index 9e744e132c36..2dc134d0f9c4 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_eq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_eq.c @@ -419,7 +419,7 @@ static void init_eq_buf(struct mlx5_eq *eq) } int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, - int nent, u64 mask, struct mlx5_uar *uar) + int nent, u64 mask) { u32 out[MLX5_ST_SZ_DW(create_eq_out)] = {0}; struct mlx5_priv *priv = &dev->priv; @@ -454,7 +454,7 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, eqc = MLX5_ADDR_OF(create_eq_in, in, eq_context_entry); MLX5_SET(eqc, eqc, log_eq_size, ilog2(eq->nent)); - MLX5_SET(eqc, eqc, uar_page, uar->index); + MLX5_SET(eqc, eqc, uar_page, priv->uar->index); MLX5_SET(eqc, eqc, intr, vecidx); MLX5_SET(eqc, eqc, log_page_size, eq->buf.page_shift - MLX5_ADAPTER_PAGE_SHIFT); @@ -466,7 +466,7 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, eq->eqn = MLX5_GET(create_eq_out, out, eq_number); eq->irqn = vecidx; eq->dev = dev; - eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET; + eq->doorbell = priv->uar->map + MLX5_EQ_DOORBEL_OFFSET; err = request_irq(priv->msix_arr[vecidx].vector, mlx5_msix_handler, 0, "mlx5_core", eq); if (err) @@ -569,8 +569,7 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) } err = mlx5_create_map_eq(dev, &table->cmd_eq, MLX5_EQ_VEC_CMD, - MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD, - &dev->priv.uuari.uars[0]); + MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD); if (err) { mlx5_core_warn(dev, "failed to create cmd EQ %d\n", err); return err; @@ -579,8 +578,7 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) mlx5_cmd_use_events(dev); err = mlx5_create_map_eq(dev, &table->async_eq, MLX5_EQ_VEC_ASYNC, - MLX5_NUM_ASYNC_EQE, async_event_mask, - &dev->priv.uuari.uars[0]); + MLX5_NUM_ASYNC_EQE, async_event_mask); if (err) { mlx5_core_warn(dev, "failed to create async EQ %d\n", err); goto err1; @@ -589,8 +587,7 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev) err = mlx5_create_map_eq(dev, &table->pages_eq, MLX5_EQ_VEC_PAGES, /* TODO: sriov max_vf + */ 1, - 1 << MLX5_EVENT_TYPE_PAGE_REQUEST, - &dev->priv.uuari.uars[0]); + 1 << MLX5_EVENT_TYPE_PAGE_REQUEST); if (err) { mlx5_core_warn(dev, "failed to create pages EQ %d\n", err); goto err2; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 843227f928fa..27326d692261 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2019, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2020, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -455,6 +455,12 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) /* disable cmdif checksum */ MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0); + /* Enable 4K UAR only when HCA supports it and page size is bigger + * than 4K. + */ + if (MLX5_CAP_GEN_MAX(dev, uar_4k) && PAGE_SIZE > 4096) + MLX5_SET(cmd_hca_cap, set_hca_cap, uar_4k, 1); + /* enable drain sigerr */ MLX5_SET(cmd_hca_cap, set_hca_cap, drain_sigerr, 1); @@ -650,8 +656,7 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev) eq = kzalloc(sizeof(*eq), GFP_KERNEL); err = mlx5_create_map_eq(dev, eq, - i + MLX5_EQ_VEC_COMP_BASE, nent, 0, - &dev->priv.uuari.uars[0]); + i + MLX5_EQ_VEC_COMP_BASE, nent, 0); if (err) { kfree(eq); goto clean; @@ -670,22 +675,6 @@ clean: return err; } -static int map_bf_area(struct mlx5_core_dev *dev) -{ - resource_size_t bf_start = pci_resource_start(dev->pdev, 0); - resource_size_t bf_len = pci_resource_len(dev->pdev, 0); - - dev->priv.bf_mapping = io_mapping_create_wc(bf_start, bf_len); - - return dev->priv.bf_mapping ? 0 : -ENOMEM; -} - -static void unmap_bf_area(struct mlx5_core_dev *dev) -{ - if (dev->priv.bf_mapping) - io_mapping_free(dev->priv.bf_mapping); -} - static inline int fw_initializing(struct mlx5_core_dev *dev) { return ioread32be(&dev->iseg->initializing) >> 31; @@ -1117,22 +1106,23 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, goto err_stop_poll; } - err = mlx5_enable_msix(dev); - if (err) { - mlx5_core_err(dev, "enable msix failed\n"); + dev->priv.uar = mlx5_get_uars_page(dev); + if (IS_ERR(dev->priv.uar)) { + mlx5_core_err(dev, "Failed allocating uar, aborting\n"); + err = PTR_ERR(dev->priv.uar); goto err_cleanup_once; } - err = mlx5_alloc_uuars(dev, &priv->uuari); + err = mlx5_enable_msix(dev); if (err) { - mlx5_core_err(dev, "Failed allocating uar, aborting\n"); - goto err_disable_msix; + mlx5_core_err(dev, "enable msix failed\n"); + goto err_cleanup_uar; } err = mlx5_start_eqs(dev); if (err) { mlx5_core_err(dev, "Failed to start pages and async EQs\n"); - goto err_free_uar; + goto err_disable_msix; } err = alloc_comp_eqs(dev); @@ -1141,9 +1131,6 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, goto err_stop_eqs; } - if (map_bf_area(dev)) - mlx5_core_err(dev, "Failed to map blue flame area\n"); - err = mlx5_init_fs(dev); if (err) { mlx5_core_err(dev, "flow steering init %d\n", err); @@ -1185,17 +1172,16 @@ err_fs: err_free_comp_eqs: free_comp_eqs(dev); - unmap_bf_area(dev); err_stop_eqs: mlx5_stop_eqs(dev); -err_free_uar: - mlx5_free_uuars(dev, &priv->uuari); - err_disable_msix: mlx5_disable_msix(dev); +err_cleanup_uar: + mlx5_put_uars_page(dev, dev->priv.uar); + err_cleanup_once: if (boot) mlx5_cleanup_once(dev); @@ -1248,12 +1234,11 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, mlx5_fpga_device_stop(dev); mlx5_mpfs_destroy(dev); mlx5_cleanup_fs(dev); - unmap_bf_area(dev); mlx5_wait_for_reclaim_vfs_pages(dev); free_comp_eqs(dev); mlx5_stop_eqs(dev); - mlx5_free_uuars(dev, &priv->uuari); mlx5_disable_msix(dev); + mlx5_put_uars_page(dev, dev->priv.uar); if (cleanup) mlx5_cleanup_once(dev); mlx5_stop_health_poll(dev, cleanup); @@ -1586,6 +1571,12 @@ static int init_one(struct pci_dev *pdev, spin_lock_init(&priv->ctx_lock); mutex_init(&dev->pci_status_mutex); mutex_init(&dev->intf_state_mutex); + + mutex_init(&priv->bfregs.reg_head.lock); + mutex_init(&priv->bfregs.wc_head.lock); + INIT_LIST_HEAD(&priv->bfregs.reg_head.list); + INIT_LIST_HEAD(&priv->bfregs.wc_head.list); + mtx_init(&dev->dump_lock, "mlx5dmp", NULL, MTX_DEF | MTX_NEW); err = mlx5_pci_init(dev, priv); if (err) { diff --git a/sys/dev/mlx5/mlx5_core/mlx5_uar.c b/sys/dev/mlx5/mlx5_core/mlx5_uar.c index 43a95d64bc88..1a662ade0aee 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_uar.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_uar.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-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 @@ -33,171 +33,291 @@ int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn) { - u32 in[MLX5_ST_SZ_DW(alloc_uar_in)] = {0}; u32 out[MLX5_ST_SZ_DW(alloc_uar_out)] = {0}; + u32 in[MLX5_ST_SZ_DW(alloc_uar_in)] = {0}; int err; MLX5_SET(alloc_uar_in, in, opcode, MLX5_CMD_OP_ALLOC_UAR); - err = mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); - if (err) - return err; - - *uarn = MLX5_GET(alloc_uar_out, out, uar); - - return 0; + if (!err) + *uarn = MLX5_GET(alloc_uar_out, out, uar); + return err; } EXPORT_SYMBOL(mlx5_cmd_alloc_uar); int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn) { - u32 in[MLX5_ST_SZ_DW(dealloc_uar_in)] = {0}; u32 out[MLX5_ST_SZ_DW(dealloc_uar_out)] = {0}; + u32 in[MLX5_ST_SZ_DW(dealloc_uar_in)] = {0}; MLX5_SET(dealloc_uar_in, in, opcode, MLX5_CMD_OP_DEALLOC_UAR); MLX5_SET(dealloc_uar_in, in, uar, uarn); - return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); } EXPORT_SYMBOL(mlx5_cmd_free_uar); -static int need_uuar_lock(int uuarn) +static int uars_per_sys_page(struct mlx5_core_dev *mdev) { - int tot_uuars = NUM_DRIVER_UARS * MLX5_BF_REGS_PER_PAGE; - - if (uuarn == 0 || tot_uuars - NUM_LOW_LAT_UUARS) - return 0; + if (MLX5_CAP_GEN(mdev, uar_4k)) + return MLX5_CAP_GEN(mdev, num_of_uars_per_page); return 1; } -int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari) +static u64 uar2pfn(struct mlx5_core_dev *mdev, u32 index) { - int tot_uuars = NUM_DRIVER_UARS * MLX5_BF_REGS_PER_PAGE; - struct mlx5_bf *bf; - phys_addr_t addr; - int err; - int i; + u32 system_page_index; - uuari->num_uars = NUM_DRIVER_UARS; - uuari->num_low_latency_uuars = NUM_LOW_LAT_UUARS; + if (MLX5_CAP_GEN(mdev, uar_4k)) + system_page_index = index >> (PAGE_SHIFT - MLX5_ADAPTER_PAGE_SHIFT); + else + system_page_index = index; - mutex_init(&uuari->lock); - uuari->uars = kcalloc(uuari->num_uars, sizeof(*uuari->uars), GFP_KERNEL); + return (pci_resource_start(mdev->pdev, 0) >> PAGE_SHIFT) + system_page_index; +} - uuari->bfs = kcalloc(tot_uuars, sizeof(*uuari->bfs), GFP_KERNEL); +static void up_rel_func(struct kref *kref) +{ + struct mlx5_uars_page *up = container_of(kref, struct mlx5_uars_page, ref_count); + + list_del(&up->list); + iounmap(up->map); + if (mlx5_cmd_free_uar(up->mdev, up->index)) + mlx5_core_warn(up->mdev, "failed to free uar index %d\n", up->index); + bitmap_free(up->reg_bitmap); + bitmap_free(up->fp_bitmap); + kfree(up); +} - uuari->bitmap = kcalloc(BITS_TO_LONGS(tot_uuars), sizeof(*uuari->bitmap), - GFP_KERNEL); +static struct mlx5_uars_page *alloc_uars_page(struct mlx5_core_dev *mdev, + bool map_wc) +{ + struct mlx5_uars_page *up; + int err = -ENOMEM; + phys_addr_t pfn; + int bfregs; + int i; - uuari->count = kcalloc(tot_uuars, sizeof(*uuari->count), GFP_KERNEL); + bfregs = uars_per_sys_page(mdev) * MLX5_BFREGS_PER_UAR; + up = kzalloc(sizeof(*up), GFP_KERNEL); + if (!up) + return ERR_PTR(err); - for (i = 0; i < uuari->num_uars; i++) { - err = mlx5_cmd_alloc_uar(dev, &uuari->uars[i].index); - if (err) - goto out_count; + up->mdev = mdev; + up->reg_bitmap = bitmap_zalloc(bfregs, GFP_KERNEL); + if (!up->reg_bitmap) + goto error1; - addr = pci_resource_start(dev->pdev, 0) + - ((phys_addr_t)(uuari->uars[i].index) << PAGE_SHIFT); - uuari->uars[i].map = ioremap(addr, PAGE_SIZE); - if (!uuari->uars[i].map) { - mlx5_cmd_free_uar(dev, uuari->uars[i].index); - err = -ENOMEM; - goto out_count; - } - mlx5_core_dbg(dev, "allocated uar index 0x%x, mmaped at %p\n", - uuari->uars[i].index, uuari->uars[i].map); - } + up->fp_bitmap = bitmap_zalloc(bfregs, GFP_KERNEL); + if (!up->fp_bitmap) + goto error1; - for (i = 0; i < tot_uuars; i++) { - bf = &uuari->bfs[i]; - - bf->buf_size = (1 << MLX5_CAP_GEN(dev, log_bf_reg_size)) / 2; - bf->uar = &uuari->uars[i / MLX5_BF_REGS_PER_PAGE]; - bf->regreg = uuari->uars[i / MLX5_BF_REGS_PER_PAGE].map; - bf->reg = NULL; /* Add WC support */ - bf->offset = (i % MLX5_BF_REGS_PER_PAGE) * - (1 << MLX5_CAP_GEN(dev, log_bf_reg_size)) + - MLX5_BF_OFFSET; - bf->need_lock = need_uuar_lock(i); - spin_lock_init(&bf->lock); - spin_lock_init(&bf->lock32); - bf->uuarn = i; - } + for (i = 0; i < bfregs; i++) + if ((i % MLX5_BFREGS_PER_UAR) < MLX5_NON_FP_BFREGS_PER_UAR) + set_bit(i, up->reg_bitmap); + else + set_bit(i, up->fp_bitmap); - return 0; + up->bfregs = bfregs; + up->fp_avail = bfregs * MLX5_FP_BFREGS_PER_UAR / MLX5_BFREGS_PER_UAR; + up->reg_avail = bfregs * MLX5_NON_FP_BFREGS_PER_UAR / MLX5_BFREGS_PER_UAR; -out_count: - for (i--; i >= 0; i--) { - iounmap(uuari->uars[i].map); - mlx5_cmd_free_uar(dev, uuari->uars[i].index); + err = mlx5_cmd_alloc_uar(mdev, &up->index); + if (err) { + mlx5_core_warn(mdev, "mlx5_cmd_alloc_uar() failed, %d\n", err); + goto error1; } - kfree(uuari->count); - kfree(uuari->bitmap); + pfn = uar2pfn(mdev, up->index); + if (map_wc) { + up->map = ioremap_wc(pfn << PAGE_SHIFT, PAGE_SIZE); + if (!up->map) { + err = -EAGAIN; + goto error2; + } + } else { + up->map = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE); + if (!up->map) { + err = -ENOMEM; + goto error2; + } + } + kref_init(&up->ref_count); + mlx5_core_dbg(mdev, "allocated UAR page: index %d, total bfregs %d\n", + up->index, up->bfregs); + return up; + +error2: + if (mlx5_cmd_free_uar(mdev, up->index)) + mlx5_core_warn(mdev, "failed to free uar index %d\n", up->index); +error1: + bitmap_free(up->fp_bitmap); + bitmap_free(up->reg_bitmap); + kfree(up); + return ERR_PTR(err); +} - kfree(uuari->bfs); +struct mlx5_uars_page *mlx5_get_uars_page(struct mlx5_core_dev *mdev) +{ + struct mlx5_uars_page *ret; + + mutex_lock(&mdev->priv.bfregs.reg_head.lock); + if (!list_empty(&mdev->priv.bfregs.reg_head.list)) { + ret = list_first_entry(&mdev->priv.bfregs.reg_head.list, + struct mlx5_uars_page, list); + kref_get(&ret->ref_count); + goto out; + } + ret = alloc_uars_page(mdev, false); + if (IS_ERR(ret)) + goto out; + list_add(&ret->list, &mdev->priv.bfregs.reg_head.list); +out: + mutex_unlock(&mdev->priv.bfregs.reg_head.lock); + + return ret; +} +EXPORT_SYMBOL(mlx5_get_uars_page); - kfree(uuari->uars); - return err; +void mlx5_put_uars_page(struct mlx5_core_dev *mdev, struct mlx5_uars_page *up) +{ + mutex_lock(&mdev->priv.bfregs.reg_head.lock); + kref_put(&up->ref_count, up_rel_func); + mutex_unlock(&mdev->priv.bfregs.reg_head.lock); } +EXPORT_SYMBOL(mlx5_put_uars_page); -int mlx5_free_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari) +static unsigned long map_offset(struct mlx5_core_dev *mdev, int dbi) { - int i = uuari->num_uars; + /* return the offset in bytes from the start of the page to the + * blue flame area of the UAR + */ + return dbi / MLX5_BFREGS_PER_UAR * MLX5_ADAPTER_PAGE_SIZE + + (dbi % MLX5_BFREGS_PER_UAR) * + (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) + MLX5_BF_OFFSET; +} - for (i--; i >= 0; i--) { - iounmap(uuari->uars[i].map); - mlx5_cmd_free_uar(dev, uuari->uars[i].index); +static int alloc_bfreg(struct mlx5_core_dev *mdev, struct mlx5_sq_bfreg *bfreg, + bool map_wc, bool fast_path) +{ + struct mlx5_bfreg_data *bfregs; + struct mlx5_uars_page *up; + struct list_head *head; + unsigned long *bitmap; + unsigned int *avail; + struct mutex *lock; /* pointer to right mutex */ + int dbi; + + bfregs = &mdev->priv.bfregs; + if (map_wc) { + head = &bfregs->wc_head.list; + lock = &bfregs->wc_head.lock; + } else { + head = &bfregs->reg_head.list; + lock = &bfregs->reg_head.lock; } - - kfree(uuari->count); - kfree(uuari->bitmap); - kfree(uuari->bfs); - kfree(uuari->uars); + mutex_lock(lock); + if (list_empty(head)) { + up = alloc_uars_page(mdev, map_wc); + if (IS_ERR(up)) { + mutex_unlock(lock); + return PTR_ERR(up); + } + list_add(&up->list, head); + } else { + up = list_entry(head->next, struct mlx5_uars_page, list); + kref_get(&up->ref_count); + } + if (fast_path) { + bitmap = up->fp_bitmap; + avail = &up->fp_avail; + } else { + bitmap = up->reg_bitmap; + avail = &up->reg_avail; + } + dbi = find_first_bit(bitmap, up->bfregs); + clear_bit(dbi, bitmap); + (*avail)--; + if (!(*avail)) + list_del(&up->list); + + bfreg->map = up->map + map_offset(mdev, dbi); + bfreg->up = up; + bfreg->wc = map_wc; + bfreg->index = up->index + dbi / MLX5_BFREGS_PER_UAR; + mutex_unlock(lock); return 0; } -int mlx5_alloc_map_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar) +int mlx5_alloc_bfreg(struct mlx5_core_dev *mdev, struct mlx5_sq_bfreg *bfreg, + bool map_wc, bool fast_path) { - phys_addr_t pfn; - phys_addr_t uar_bar_start; int err; - err = mlx5_cmd_alloc_uar(mdev, &uar->index); - if (err) { - mlx5_core_warn(mdev, "mlx5_cmd_alloc_uar() failed, %d\n", err); - return err; - } + err = alloc_bfreg(mdev, bfreg, map_wc, fast_path); + if (!err) + return 0; - uar_bar_start = pci_resource_start(mdev->pdev, 0); - pfn = (uar_bar_start >> PAGE_SHIFT) + uar->index; - uar->map = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE); - if (!uar->map) { - mlx5_core_warn(mdev, "ioremap() failed, %d\n", err); - err = -ENOMEM; - goto err_free_uar; - } + if (err == -EAGAIN && map_wc) + return alloc_bfreg(mdev, bfreg, false, fast_path); - if (mdev->priv.bf_mapping) - uar->bf_map = io_mapping_map_wc(mdev->priv.bf_mapping, - uar->index << PAGE_SHIFT, - PAGE_SIZE); + return err; +} +EXPORT_SYMBOL(mlx5_alloc_bfreg); - return 0; +static unsigned int addr_to_dbi_in_syspage(struct mlx5_core_dev *dev, + struct mlx5_uars_page *up, + struct mlx5_sq_bfreg *bfreg) +{ + unsigned int uar_idx; + unsigned int bfreg_idx; + unsigned int bf_reg_size; -err_free_uar: - mlx5_cmd_free_uar(mdev, uar->index); + bf_reg_size = 1 << MLX5_CAP_GEN(dev, log_bf_reg_size); - return err; + uar_idx = (bfreg->map - up->map) >> MLX5_ADAPTER_PAGE_SHIFT; + bfreg_idx = (((uintptr_t)bfreg->map % MLX5_ADAPTER_PAGE_SIZE) - MLX5_BF_OFFSET) / bf_reg_size; + + return uar_idx * MLX5_BFREGS_PER_UAR + bfreg_idx; } -EXPORT_SYMBOL(mlx5_alloc_map_uar); -void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar) +void mlx5_free_bfreg(struct mlx5_core_dev *mdev, struct mlx5_sq_bfreg *bfreg) { - io_mapping_unmap(uar->bf_map); - iounmap(uar->map); - mlx5_cmd_free_uar(mdev, uar->index); + struct mlx5_bfreg_data *bfregs; + struct mlx5_uars_page *up; + struct mutex *lock; /* pointer to right mutex */ + unsigned int dbi; + bool fp; + unsigned int *avail; + unsigned long *bitmap; + struct list_head *head; + + bfregs = &mdev->priv.bfregs; + if (bfreg->wc) { + head = &bfregs->wc_head.list; + lock = &bfregs->wc_head.lock; + } else { + head = &bfregs->reg_head.list; + lock = &bfregs->reg_head.lock; + } + up = bfreg->up; + dbi = addr_to_dbi_in_syspage(mdev, up, bfreg); + fp = (dbi % MLX5_BFREGS_PER_UAR) >= MLX5_NON_FP_BFREGS_PER_UAR; + if (fp) { + avail = &up->fp_avail; + bitmap = up->fp_bitmap; + } else { + avail = &up->reg_avail; + bitmap = up->reg_bitmap; + } + mutex_lock(lock); + (*avail)++; + set_bit(dbi, bitmap); + if (*avail == 1) + list_add_tail(&up->list, head); + + kref_put(&up->ref_count, up_rel_func); + mutex_unlock(lock); } -EXPORT_SYMBOL(mlx5_unmap_free_uar); +EXPORT_SYMBOL(mlx5_free_bfreg); diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index 4c3d696ed41c..b7c05264008a 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -827,7 +827,7 @@ struct mlx5e_sq { /* read only */ struct mlx5_wq_cyc wq; - struct mlx5_uar uar; + void __iomem *uar_map; struct ifnet *ifp; u32 sqn; u32 bf_buf_size; @@ -1001,7 +1001,6 @@ struct mlx5e_priv { #define PRIV_LOCKED(priv) sx_xlocked(&(priv)->state_lock) #define PRIV_ASSERT_LOCKED(priv) sx_assert(&(priv)->state_lock, SA_XLOCKED) struct sx state_lock; /* Protects Interface state */ - struct mlx5_uar cq_uar; u32 pdn; u32 tdn; struct mlx5_core_mr mr; @@ -1055,6 +1054,8 @@ struct mlx5e_priv { struct mlx5e_dcbx dcbx; bool sw_is_port_buf_owner; + struct mlx5_sq_bfreg bfreg; + struct pfil_head *pfil; struct mlx5e_channel channel[]; }; @@ -1127,7 +1128,7 @@ int mlx5e_add_all_vlan_rules(struct mlx5e_priv *priv); void mlx5e_del_all_vlan_rules(struct mlx5e_priv *priv); static inline void -mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe, int bf_sz) +mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe) { u16 ofst = MLX5_BF_OFFSET + sq->bf_offset; @@ -1142,16 +1143,8 @@ mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe, int bf_sz) */ wmb(); - if (bf_sz) { - __iowrite64_copy(sq->uar.bf_map + ofst, wqe, bf_sz); - - /* flush the write-combining mapped buffer */ - wmb(); - - } else { - mlx5_write64(wqe, sq->uar.map + ofst, - MLX5_GET_DOORBELL_LOCK(&sq->priv->doorbell_lock)); - } + mlx5_write64(wqe, sq->uar_map + ofst, + MLX5_GET_DOORBELL_LOCK(&sq->priv->doorbell_lock)); sq->bf_offset ^= sq->bf_buf_size; } diff --git a/sys/dev/mlx5/mlx5_en/en_rl.h b/sys/dev/mlx5/mlx5_en/en_rl.h index 6ad2f26e5a12..f30e8ba8cc07 100644 --- a/sys/dev/mlx5/mlx5_en/en_rl.h +++ b/sys/dev/mlx5/mlx5_en/en_rl.h @@ -156,7 +156,6 @@ struct mlx5e_rl_priv_data { struct mlx5e_rl_channel_param chan_param; struct mlx5e_rl_params param; struct mlx5e_rl_stats stats; - struct mlx5_uar sq_uar; struct mlx5e_rl_worker *workers; struct mlx5e_priv *priv; uint64_t *rate_limit_table; diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 1e6562fed667..9fc3af186c0d 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1660,14 +1660,12 @@ mlx5e_create_sq(struct mlx5e_channel *c, &sq->dma_tag))) goto done; *** 1680 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Jan 8 12:50:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AA35F4C9445; Fri, 8 Jan 2021 12:50:54 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 4DC2yk4K4Dz3rX2; Fri, 8 Jan 2021 12:50:54 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: by mail-ed1-f52.google.com with SMTP id u19so11129250edx.2; Fri, 08 Jan 2021 04:50:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=3ClQjwv3rGIvElMvVpEiyopbQBY9S2rDm0k1itTSOo8=; b=KPlBiOv7ALRd1yOl+yLnDCxWbU8pM7dFij5YEZaqsrzVB0yFkKY4w8Vz+D69cZk+Fx XORG2MJkSaBedww4rnf+8lqpJLMcS0TtsldRUuA6Rslw9B3kJ7wf/kAop0eYMijMli/h BdKdKRBWDvGUTaN71xdqB4VuK30R6vW0qyXQU0ujvDsvgdWuAzmpI39DezKTKI5zIusj zZvr2HWFFcI1Cm+55NFV4sNY8bGathg8d42swC+DHDqzUCaMAKmAjEjmuI+FwE+5bFzk i6brYvk6p3b47PJ2N3MPTNphiiUGKPYCzy3XDpiMPLwhoXWMmRPYtzZo2arA93vbaaFd ObYQ== X-Gm-Message-State: AOAM530zKXzE1PYpW8Yytpv/eX1nJeGtVnkQENmg+UkFJXMOKBX1ufZO TIpv14IyQAW0jU2nxXH3rmHmR1RI4BY= X-Google-Smtp-Source: ABdhPJwDmmydE3TTzRyYvEjsBCWhECjkZpcj8eg/37gndsWt4q7R+v4F+jvKG55Ge1jVT38teMqmlw== X-Received: by 2002:a50:c315:: with SMTP id a21mr5155454edb.50.1610110252099; Fri, 08 Jan 2021 04:50:52 -0800 (PST) Received: from ?IPv6:2a02:8109:98c0:4ad0:5e5f:67ff:fef4:ffd8? ([2a02:8109:98c0:4ad0:5e5f:67ff:fef4:ffd8]) by smtp.gmail.com with ESMTPSA id w13sm2463498edx.20.2021.01.08.04.50.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Jan 2021 04:50:51 -0800 (PST) To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202101070924.1079OE4g081849@gitrepo.freebsd.org> From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: Re: git: 74bd20769706 - main - Reference newfs_msdos(8) from the newfs(8) manual Message-ID: <52e99dc8-cd75-a2ab-7670-b81d8aaa8134@FreeBSD.org> Date: Fri, 8 Jan 2021 13:51:16 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Rspamd-Queue-Id: 4DC2yk4K4Dz3rX2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 12:50:54 -0000 Hello Konstantin, On 1/7/21 7:16 PM, Konstantin Belousov wrote: > On Thu, Jan 07, 2021 at 09:24:14AM +0000, Mateusz Piotrowski wrote: >> The branch main has been updated by 0mp (doc, ports committer): >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D74bd20769706041108a5736= 01cf0b61c755bdc56 >> >> commit 74bd20769706041108a573601cf0b61c755bdc56 >> Author: Mateusz Piotrowski <0mp@FreeBSD.org> >> AuthorDate: 2021-01-07 09:22:20 +0000 >> Commit: Mateusz Piotrowski <0mp@FreeBSD.org> >> CommitDate: 2021-01-07 09:24:07 +0000 >> >> Reference newfs_msdos(8) from the newfs(8) manual > Why ? newfs is not the interface to create arbitrary kind of filesyste= m, > it is just UFS writer. I think that it is beneficial nevertheless. Now users can discover other = newfs_* commands FreeBSD=20 offers. Also, newfs_msdos(8) already references newfs(8) (there are only = two items in the SEE ALSO=20 section there, the other one being gpart(8)). From my perspective it is not too bad to have this reference in the newf= s manual. It seems like=20 it's also something some FreeBSD users expect to see in the manual page a= s we received a bug report=20 for that. I can revert this patch and also remove newfs(8) from the newfs_msdos man= ual while at it if desired.=20 Perhaps newfs commands are easy enough to find so this patch only hurts t= he readability of the manual... Best, Mateusz From owner-dev-commits-src-all@freebsd.org Fri Jan 8 13:46:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 688424CA2FC; Fri, 8 Jan 2021 13:46: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 4DC4C82Kg2z3tyF; Fri, 8 Jan 2021 13:46:44 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 3D803D54; Fri, 8 Jan 2021 13:46:44 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f175.google.com with SMTP id b64so8371932qkc.12; Fri, 08 Jan 2021 05:46:44 -0800 (PST) X-Gm-Message-State: AOAM531KWp/lbYkMqA4f14NBa35+mNBr1pczSR/fBBCpoltKLO9eeNHA aPCPSbc47Baqwdyy7gngpn46aBZWQc0fup7Z6h8= X-Google-Smtp-Source: ABdhPJzlQfKhxUQqHTr/UvrrZMPzP+eIvdHn1N6UNn4vCVxh1muFEDcArzo8M+OTjLF6xL4H6GOCqIvqPAuvrE2kA6E= X-Received: by 2002:a37:6713:: with SMTP id b19mr3727268qkc.493.1610113603775; Fri, 08 Jan 2021 05:46:43 -0800 (PST) MIME-Version: 1.0 References: <202101072320.107NKpMS063374@gitrepo.freebsd.org> <7a7fa0fb-51c2-1b14-6d37-2c400f69d7dd@kondratyev.su> <3EA011C9-2EEC-4693-B36D-69E74DF8473C@panasas.com> <20210108092638.x2kkvpeftey2wk62@ivaldir.net> In-Reply-To: <20210108092638.x2kkvpeftey2wk62@ivaldir.net> From: Kyle Evans Date: Fri, 8 Jan 2021 07:46:31 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. To: Baptiste Daroussin Cc: Vladimir Kondratyev , Ravi Pokala , Jessica Clarke , Vladimir Kondratyev , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 13:46:44 -0000 On Fri, Jan 8, 2021 at 3:27 AM Baptiste Daroussin wrote: > > On Fri, Jan 08, 2021 at 02:49:31AM +0300, Vladimir Kondratyev wrote: > > On 08.01.2021 02:41, Ravi Pokala wrote: > > > -----Original Message----- > > > From: on behalf of Vladimir Kondratyev > > > Date: 2021-01-07, Thursday at 15:33 > > > To: Jessica Clarke , Vladimir Kondratyev > > > Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" > > > Subject: Re: git: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. > > > > > > On 08.01.2021 02:27, Jessica Clarke wrote: > > > > On 7 Jan 2021, at 23:20, Vladimir Kondratyev wrote: > > > >> +#include > > > >> +#include > > > >> +#include "xlocale_private.h" > > > >> + > > > >> +/* > > > >> + * Find the first occurrence of find in s, ignore case. > > > >> + */ > > > >> +char * > > > >> +strcasestr_l(const char *s, const char *find, locale_t locale) > > > > > > > > Locales in the kernel? This feels wrong. > > > > > > > > Jess > > > > > > > > > > strcasestr.c was copied from userland unmodified just to allow > > > "git log --follow" to work. Next commit removed locale support from this > > > file and connected it to build. > > > > > > Unfortunately, about two-dozen commit messages from you arrived at the same time, and some were out of order; without incrementing change numbers in the subject line, figuring out the actual ordering is non-trivial. :-p > > > > > > -Ravi (rpokala@) > > > > > > > I hope, commit hook will be improved some day. Pushing of two-dozen > > commits one by one is too boring. > > The history is in the right order and gitlog/cgit/anything that reads the log > show everything in the right order. > > mails are asynchronuous, expecting the mail to always arrive in a given order is > wrong ;) > > pushing all those commits at once was imho the right thing to do. > I've pointed this out a couple of times (with seemingly nothing coming from it), but the mails are being sent in reverse order. Fixing that would at least increase chances for some to receive them in order (and the archives show them perfectly in reverse order most of the time). Picking out the message-ids from the last series I sent, this is the correct order: 202101072237.107MbYaX002789@gitrepo.freebsd.org ("4832d2e8ae1d - main - du: tests: fix the H_flag test (primarily grep usage)") 202101072237.107MbYsM002771@gitrepo.freebsd.org ("3c5c39c7ad8f - main - du: tests: make H_flag tests more strict about output requirements") 202101072237.107MbYaX002789 -> 2789 was the last pid that assigned a message-id 202101072237.107MbYsM002771 -> 2771 was the last pid that assigned a message-id Given that this is clearly with kern.randompid=0 on the server, one can conclude that these were sent in the reverse order based on the pid sequence. If you pick a couple other series out, this holds true (at least for all the series I've looked at) Thanks, Kyle Evans From owner-dev-commits-src-all@freebsd.org Fri Jan 8 13:57:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8E2ED4CA741; Fri, 8 Jan 2021 13:57:20 +0000 (UTC) (envelope-from git@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 4DC4RN3chgz3vsg; Fri, 8 Jan 2021 13:57:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F0B1243B0; Fri, 8 Jan 2021 13:57:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108DvKmu094967; Fri, 8 Jan 2021 13:57:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108DvKZu094966; Fri, 8 Jan 2021 13:57:20 GMT (envelope-from git) Date: Fri, 8 Jan 2021 13:57:20 GMT Message-Id: <202101081357.108DvKZu094966@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 8ddea0b12720 - main - cache: just assign ni_resflags = NIRES_ABS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ddea0b1272087a13df11d07582df7eab57980c5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 13:57:20 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8ddea0b1272087a13df11d07582df7eab57980c5 commit 8ddea0b1272087a13df11d07582df7eab57980c5 Author: Mateusz Guzik AuthorDate: 2021-01-08 12:00:41 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-08 13:57:10 +0000 cache: just assign ni_resflags = NIRES_ABS It is guaranteed to be 0 on entry. --- sys/kern/vfs_cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 811aeb91d9c9..4dad5f388448 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5414,7 +5414,8 @@ cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, if (cnp->cn_pnbuf[0] == '/') { dvp = cache_fpl_handle_root(&fpl); - ndp->ni_resflags |= NIRES_ABS; + MPASS(ndp->ni_resflags == 0); + ndp->ni_resflags = NIRES_ABS; } else { if (ndp->ni_dirfd == AT_FDCWD) { dvp = pwd->pwd_cdir; From owner-dev-commits-src-all@freebsd.org Fri Jan 8 13:57:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A7E5A4CAC8E; Fri, 8 Jan 2021 13:57:20 +0000 (UTC) (envelope-from git@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 4DC4RN4RDrz3vWC; Fri, 8 Jan 2021 13:57:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FF67244C6; Fri, 8 Jan 2021 13:57:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108DvK0M094984; Fri, 8 Jan 2021 13:57:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108DvK0W094983; Fri, 8 Jan 2021 13:57:20 GMT (envelope-from git) Date: Fri, 8 Jan 2021 13:57:20 GMT Message-Id: <202101081357.108DvK0W094983@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 77589de8aa67 - main - mac: cheaper check for mac_vnode_check_readlink MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 77589de8aa67f6a06ce01dd951a91f5a2f216560 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 13:57:20 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=77589de8aa67f6a06ce01dd951a91f5a2f216560 commit 77589de8aa67f6a06ce01dd951a91f5a2f216560 Author: Mateusz Guzik AuthorDate: 2021-01-08 02:52:35 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-08 13:57:10 +0000 mac: cheaper check for mac_vnode_check_readlink --- sys/security/mac/mac_framework.c | 3 +++ sys/security/mac/mac_framework.h | 17 ++++++++++++++++- sys/security/mac/mac_vfs.c | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c index c1d52eff383e..f0b4f89db7ca 100644 --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.c @@ -142,6 +142,7 @@ FPFLAG(vnode_check_mmap); FPFLAG_RARE(vnode_check_poll); FPFLAG_RARE(vnode_check_rename_from); FPFLAG_RARE(vnode_check_access); +FPFLAG_RARE(vnode_check_readlink); FPFLAG_RARE(pipe_check_stat); FPFLAG_RARE(pipe_check_poll); @@ -422,6 +423,8 @@ struct mac_policy_fastpath_elem mac_policy_fastpath_array[] = { { .offset = FPO(priv_grant), .flag = &mac_priv_grant_fp_flag }, { .offset = FPO(vnode_check_lookup), .flag = &mac_vnode_check_lookup_fp_flag }, + { .offset = FPO(vnode_check_readlink), + .flag = &mac_vnode_check_readlink_fp_flag }, { .offset = FPO(vnode_check_open), .flag = &mac_vnode_check_open_fp_flag }, { .offset = FPO(vnode_check_stat), diff --git a/sys/security/mac/mac_framework.h b/sys/security/mac/mac_framework.h index ea061d6258ff..481f90a04801 100644 --- a/sys/security/mac/mac_framework.h +++ b/sys/security/mac/mac_framework.h @@ -538,7 +538,22 @@ mac_vnode_check_poll(struct ucred *active_cred, struct ucred *file_cred, } #endif int mac_vnode_check_readdir(struct ucred *cred, struct vnode *vp); -int mac_vnode_check_readlink(struct ucred *cred, struct vnode *vp); +int mac_vnode_check_readlink_impl(struct ucred *cred, struct vnode *dvp); +#ifdef MAC +extern bool mac_vnode_check_readlink_fp_flag; +#else +#define mac_vnode_check_readlink_fp_flag 0 +#endif +#define mac_vnode_check_readlink_enabled() __predict_false(mac_vnode_check_readlink_fp_flag) +static inline int +mac_vnode_check_readlink(struct ucred *cred, struct vnode *vp) +{ + + mac_vnode_assert_locked(vp, "mac_vnode_check_readlink"); + if (mac_vnode_check_readlink_enabled()) + return (mac_vnode_check_readlink_impl(cred, vp)); + return (0); +} #define mac_vnode_check_rename_from_enabled() __predict_false(mac_vnode_check_rename_from_fp_flag) #ifdef MAC extern bool mac_vnode_check_rename_from_fp_flag; diff --git a/sys/security/mac/mac_vfs.c b/sys/security/mac/mac_vfs.c index ec492ba243e6..323d693387bb 100644 --- a/sys/security/mac/mac_vfs.c +++ b/sys/security/mac/mac_vfs.c @@ -701,7 +701,7 @@ MAC_CHECK_PROBE_DEFINE2(vnode_check_readlink, "struct ucred *", "struct vnode *"); int -mac_vnode_check_readlink(struct ucred *cred, struct vnode *vp) +mac_vnode_check_readlink_impl(struct ucred *cred, struct vnode *vp) { int error; From owner-dev-commits-src-all@freebsd.org Fri Jan 8 14:29:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3A40F4CB835; Fri, 8 Jan 2021 14:29:50 +0000 (UTC) (envelope-from git@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 4DC58t1Cmmz4RfF; Fri, 8 Jan 2021 14:29:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CE7B24B19; Fri, 8 Jan 2021 14:29:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108ETohh034246; Fri, 8 Jan 2021 14:29:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108EToHL034245; Fri, 8 Jan 2021 14:29:50 GMT (envelope-from git) Date: Fri, 8 Jan 2021 14:29:50 GMT Message-Id: <202101081429.108EToHL034245@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 6815909abdaa - main - Move the PMC overflow count to make it per-CPU MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6815909abdaace1f8f70678873c763deec36223a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 14:29:50 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=6815909abdaace1f8f70678873c763deec36223a commit 6815909abdaace1f8f70678873c763deec36223a Author: Andrew Turner AuthorDate: 2021-01-04 13:25:45 +0000 Commit: Andrew Turner CommitDate: 2021-01-08 14:24:43 +0000 Move the PMC overflow count to make it per-CPU Virtual PMCs could be running on multiple CPUs so this needs to be a per-CPU value. Submitted by: rwatson (earlier version) Reviewed by: gnn Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D27973 --- sys/dev/hwpmc/hwpmc_arm64.c | 8 ++++---- sys/dev/hwpmc/hwpmc_armv7.c | 8 ++++---- sys/sys/pmc.h | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index 15ea4f892ed0..49375219a485 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -215,12 +215,12 @@ arm64_read_pmc(int cpu, int ri, pmc_value_t *v) /* Clear Overflow Flag */ WRITE_SPECIALREG(pmovsclr_el0, reg); if (!PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) - pm->pm_overflowcnt++; + pm->pm_pcpu_state[cpu].pps_overflowcnt++; /* Reread counter in case we raced. */ tmp = arm64_pmcn_read(ri); } - tmp += 0x100000000llu * pm->pm_overflowcnt; + tmp += 0x100000000llu * pm->pm_pcpu_state[cpu].pps_overflowcnt; intr_restore(s); PMCDBG2(MDP, REA, 2, "arm64-read id=%d -> %jd", ri, tmp); @@ -249,7 +249,7 @@ arm64_write_pmc(int cpu, int ri, pmc_value_t v) PMCDBG3(MDP, WRI, 1, "arm64-write cpu=%d ri=%d v=%jx", cpu, ri, v); - pm->pm_overflowcnt = v >> 32; + pm->pm_pcpu_state[cpu].pps_overflowcnt = v >> 32; arm64_pmcn_write(ri, v); return 0; @@ -373,7 +373,7 @@ arm64_intr(struct trapframe *tf) retval = 1; /* Found an interrupting PMC. */ if (!PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) { - pm->pm_overflowcnt += 1; + pm->pm_pcpu_state[cpu].pps_overflowcnt += 1; continue; } diff --git a/sys/dev/hwpmc/hwpmc_armv7.c b/sys/dev/hwpmc/hwpmc_armv7.c index bf38b06cfb56..84a983bbc69c 100644 --- a/sys/dev/hwpmc/hwpmc_armv7.c +++ b/sys/dev/hwpmc/hwpmc_armv7.c @@ -192,12 +192,12 @@ armv7_read_pmc(int cpu, int ri, pmc_value_t *v) /* Clear Overflow Flag */ cp15_pmovsr_set(reg); if (!PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) - pm->pm_overflowcnt += 1; + pm->pm_pcpu_state[cpu].pps_overflowcnt++; /* Reread counter in case we raced. */ tmp = armv7_pmcn_read(ri, pm->pm_md.pm_armv7.pm_armv7_evsel); } - tmp += 0x100000000llu * pm->pm_overflowcnt; + tmp += 0x100000000llu * pm->pm_pcpu_state[cpu].pps_overflowcnt; intr_restore(s); PMCDBG2(MDP, REA, 2, "armv7-read id=%d -> %jd", ri, tmp); @@ -226,7 +226,7 @@ armv7_write_pmc(int cpu, int ri, pmc_value_t v) PMCDBG3(MDP, WRI, 1, "armv7-write cpu=%d ri=%d v=%jx", cpu, ri, v); - pm->pm_overflowcnt = v >> 32; + pm->pm_pcpu_state[cpu].pps_overflowcnt = v >> 32; if (pm->pm_md.pm_armv7.pm_armv7_evsel == PMC_EV_CPU_CYCLES) cp15_pmccntr_set(v); else @@ -363,7 +363,7 @@ armv7_intr(struct trapframe *tf) retval = 1; /* Found an interrupting PMC. */ if (!PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) { - pm->pm_overflowcnt += 1; + pm->pm_pcpu_state[cpu].pps_overflowcnt += 1; continue; } if (pm->pm_state != PMC_STATE_RUNNING) diff --git a/sys/sys/pmc.h b/sys/sys/pmc.h index 997357c4a031..1486c7aa91c7 100644 --- a/sys/sys/pmc.h +++ b/sys/sys/pmc.h @@ -729,6 +729,7 @@ struct pmc_target { * */ struct pmc_pcpu_state { + uint32_t pps_overflowcnt; /* count overflow interrupts */ uint8_t pps_stalled; uint8_t pps_cpustate; } __aligned(CACHE_LINE_SIZE); @@ -773,7 +774,6 @@ struct pmc { struct pmc_owner *pm_owner; /* owner thread state */ counter_u64_t pm_runcount; /* #cpus currently on */ enum pmc_state pm_state; /* current PMC state */ - uint32_t pm_overflowcnt; /* count overflow interrupts */ /* * The PMC ID field encodes the row-index for the PMC, its From owner-dev-commits-src-all@freebsd.org Fri Jan 8 14:29:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4A8944CB981; Fri, 8 Jan 2021 14:29:50 +0000 (UTC) (envelope-from git@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 4DC58t1j7wz4Rbk; Fri, 8 Jan 2021 14:29:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DAAE24B1A; Fri, 8 Jan 2021 14:29:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108ETo1i034263; Fri, 8 Jan 2021 14:29:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108ETo5Y034262; Fri, 8 Jan 2021 14:29:50 GMT (envelope-from git) Date: Fri, 8 Jan 2021 14:29:50 GMT Message-Id: <202101081429.108ETo5Y034262@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 90a6e9ef6320 - main - Update hwpmc on armv7 to handle overflow better MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 90a6e9ef6320d6e48922b32bbefcb07dbb5e1ba7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 14:29:50 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=90a6e9ef6320d6e48922b32bbefcb07dbb5e1ba7 commit 90a6e9ef6320d6e48922b32bbefcb07dbb5e1ba7 Author: Andrew Turner AuthorDate: 2021-01-04 13:50:17 +0000 Commit: Andrew Turner CommitDate: 2021-01-08 14:24:43 +0000 Update hwpmc on armv7 to handle overflow better When testing hwpmc on arm64 we found the counter could overflow while reading the event count. Handle this case in the armv7 code by also checking if the overflow bit is set and incrementing the overflow cound as needed. Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D27969 --- sys/dev/hwpmc/hwpmc_armv7.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_armv7.c b/sys/dev/hwpmc/hwpmc_armv7.c index c43f2786655d..bf38b06cfb56 100644 --- a/sys/dev/hwpmc/hwpmc_armv7.c +++ b/sys/dev/hwpmc/hwpmc_armv7.c @@ -109,9 +109,13 @@ armv7_counter_disable(unsigned int pmc) * Performance Count Register N */ static uint32_t -armv7_pmcn_read(unsigned int pmc) +armv7_pmcn_read(unsigned int pmc, uint32_t evsel) { + if (evsel == PMC_EV_CPU_CYCLES) { + return ((uint32_t)cp15_pmccntr_get()); + } + KASSERT(pmc < armv7_npmcs, ("%s: illegal PMC number %d", __func__, pmc)); cp15_pmselr_set(pmc); @@ -165,6 +169,8 @@ armv7_read_pmc(int cpu, int ri, pmc_value_t *v) { pmc_value_t tmp; struct pmc *pm; + register_t s; + u_int reg; KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), ("[armv7,%d] illegal CPU value %d", __LINE__, cpu)); @@ -173,11 +179,26 @@ armv7_read_pmc(int cpu, int ri, pmc_value_t *v) pm = armv7_pcpu[cpu]->pc_armv7pmcs[ri].phw_pmc; + s = intr_disable(); + tmp = armv7_pmcn_read(ri, pm->pm_md.pm_armv7.pm_armv7_evsel); + + /* Check if counter has overflowed */ if (pm->pm_md.pm_armv7.pm_armv7_evsel == PMC_EV_CPU_CYCLES) - tmp = (uint32_t)cp15_pmccntr_get(); + reg = (1u << 31); else - tmp = armv7_pmcn_read(ri); + reg = (1u << ri); + + if ((cp15_pmovsr_get() & reg) != 0) { + /* Clear Overflow Flag */ + cp15_pmovsr_set(reg); + if (!PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) + pm->pm_overflowcnt += 1; + + /* Reread counter in case we raced. */ + tmp = armv7_pmcn_read(ri, pm->pm_md.pm_armv7.pm_armv7_evsel); + } tmp += 0x100000000llu * pm->pm_overflowcnt; + intr_restore(s); PMCDBG2(MDP, REA, 2, "armv7-read id=%d -> %jd", ri, tmp); if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) @@ -205,6 +226,7 @@ armv7_write_pmc(int cpu, int ri, pmc_value_t v) PMCDBG3(MDP, WRI, 1, "armv7-write cpu=%d ri=%d v=%jx", cpu, ri, v); + pm->pm_overflowcnt = v >> 32; if (pm->pm_md.pm_armv7.pm_armv7_evsel == PMC_EV_CPU_CYCLES) cp15_pmccntr_set(v); else @@ -247,8 +269,6 @@ armv7_start_pmc(int cpu, int ri) pm = phw->phw_pmc; config = pm->pm_md.pm_armv7.pm_armv7_evsel; - pm->pm_overflowcnt = 0; - /* * Configure the event selection. */ @@ -329,9 +349,9 @@ armv7_intr(struct trapframe *tf) /* Check if counter has overflowed */ if (pm->pm_md.pm_armv7.pm_armv7_evsel == PMC_EV_CPU_CYCLES) - reg = (1 << 31); + reg = (1u << 31); else - reg = (1 << ri); + reg = (1u << ri); if ((cp15_pmovsr_get() & reg) == 0) { continue; From owner-dev-commits-src-all@freebsd.org Fri Jan 8 14:37:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5977A4CBDDD; Fri, 8 Jan 2021 14:37:14 +0000 (UTC) (envelope-from git@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 4DC5KQ23r0z4SY3; Fri, 8 Jan 2021 14:37:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 399B024EB5; Fri, 8 Jan 2021 14:37:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108EbEhl047318; Fri, 8 Jan 2021 14:37:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108EbEfN047317; Fri, 8 Jan 2021 14:37:14 GMT (envelope-from git) Date: Fri, 8 Jan 2021 14:37:14 GMT Message-Id: <202101081437.108EbEfN047317@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ulrich Spörlein Subject: git: 40903394bf48 - main - GitHub actions: unbreak macOS build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: uqs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40903394bf48c916f0790fac8a2cde5c487a2676 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 14:37:14 -0000 The branch main has been updated by uqs: URL: https://cgit.FreeBSD.org/src/commit/?id=40903394bf48c916f0790fac8a2cde5c487a2676 commit 40903394bf48c916f0790fac8a2cde5c487a2676 Author: Ulrich Spörlein AuthorDate: 2021-01-08 14:36:38 +0000 Commit: Ulrich Spörlein CommitDate: 2021-01-08 14:36:38 +0000 GitHub actions: unbreak macOS build Error: llvm 11.0.0 is already installed Also make the linking failure non-fatal: Error: The `brew link` step did not complete successfully --- .github/workflows/cross-bootstrap-tools.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cross-bootstrap-tools.yml b/.github/workflows/cross-bootstrap-tools.yml index e8187e4299e9..65db86de3a97 100644 --- a/.github/workflows/cross-bootstrap-tools.yml +++ b/.github/workflows/cross-bootstrap-tools.yml @@ -25,8 +25,7 @@ jobs: pkgs: bmake libarchive-dev - os: macOS-latest compiler: clang-11 - #cross-bindir: /usr/local/Cellar/llvm/11.0.0/bin # script figures this out automatically - pkgs: bmake libarchive llvm@11 + pkgs: bmake libarchive steps: - uses: actions/checkout@v2 @@ -39,7 +38,7 @@ jobs: if: runner.os == 'macOS' run: | brew update --quiet || true - brew install ${{ matrix.pkgs }} + brew install ${{ matrix.pkgs }} || true - name: create environment run: | echo "GITHUB_WORKSPACE = $GITHUB_WORKSPACE" From owner-dev-commits-src-all@freebsd.org Fri Jan 8 14:54:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B73324CC891 for ; Fri, 8 Jan 2021 14:54:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) (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 4DC5jn4dLkz4V6W for ; Fri, 8 Jan 2021 14:54:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x736.google.com with SMTP id v126so8565625qkd.11 for ; Fri, 08 Jan 2021 06:54:53 -0800 (PST) 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=jnoULEh2eyovthNxBNKvFzzndbt0XZc8T9/xuF6G+Ps=; b=aBYUfjUkvh9kFc1JWRA8KM8abUxRRZqMeQDaoxkivawATdcWzV2xA7QbolAkc9n/qV Ovlyb45ShkRQ7cHE9tbx8Elao1KWy/d6fg3kIjygpSyBKKMUPvcbEq2qP3ExYokZxNIa Bjg5DqlUo7JO5Hpch5o2YlJEB4euxq3Mksj0rCFvm3XwTpjYD0dP9hLKDwj47ldbqDfe iAgIZ9weQJBVOFbgiuR+aM5s/ymVX3P2vnorPUf29nHUzlwn3U7Ax2Fz5uJzxT0x3tUf 818kkWzZykQjAqc0UVRXcU9lfalRVrkShyvAPiH03QqdNPKvgho0byAqGtREf3hSOZnX p85g== 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=jnoULEh2eyovthNxBNKvFzzndbt0XZc8T9/xuF6G+Ps=; b=h7wYRnrE4AtmJSkfPzaqaRz9i3sqzzL5+cLh+qMUyKpgj1AiUTuQ7/bzHI/i33AP82 0eTs6+6hk7wwh9rFe9bE/GfoXBliefb6YSDlJZmrhaGTa68QrZiYltXSNh9AsORshF9d NUY8FUo53NtbJWbxbVJM8XOMerNlsQvgQnefsVSxzh+C9LbB5xKI74LZID3C/j0ux3VY H44pVJcyOvEjgZ4nOhTv8cqa1wz/UOBVuDNGdWuffW2aMxuVpUxO2HpXsAuZ2yu85gS3 Ho3vvdlUnAFPXDjJYedKA2B2AS9YcfjtdmyqPf0C/P6adSz2/XAnMwrh00jKcbYsevnv sL2Q== X-Gm-Message-State: AOAM531D6d+W+dKQxOzQ1mUQBwoRCCPRplp6x5ktBJhY72TR93+peNUq V3Tu5Mtxk9DSkgo3EJp51mFccY1Pnljd4/eaVtvs2g== X-Google-Smtp-Source: ABdhPJy+ZjaLdBXay8POy+O+QXDIqi9gqfrL+asePSju07Fox1o6GBCPKxPygT4+O22Y151pQ4ReXZP8+bI4unLNfco= X-Received: by 2002:a37:a614:: with SMTP id p20mr4104006qke.359.1610117692725; Fri, 08 Jan 2021 06:54:52 -0800 (PST) MIME-Version: 1.0 References: <202101070924.1079OE4g081849@gitrepo.freebsd.org> <52e99dc8-cd75-a2ab-7670-b81d8aaa8134@FreeBSD.org> In-Reply-To: <52e99dc8-cd75-a2ab-7670-b81d8aaa8134@FreeBSD.org> From: Warner Losh Date: Fri, 8 Jan 2021 07:54:41 -0700 Message-ID: Subject: Re: git: 74bd20769706 - main - Reference newfs_msdos(8) from the newfs(8) manual To: Mateusz Piotrowski <0mp@freebsd.org> Cc: Konstantin Belousov , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4DC5jn4dLkz4V6W X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 14:54:53 -0000 On Fri, Jan 8, 2021 at 5:51 AM Mateusz Piotrowski <0mp@freebsd.org> wrote: > Hello Konstantin, > > On 1/7/21 7:16 PM, Konstantin Belousov wrote: > > On Thu, Jan 07, 2021 at 09:24:14AM +0000, Mateusz Piotrowski wrote: > >> The branch main has been updated by 0mp (doc, ports committer): > >> > >> URL: > https://cgit.FreeBSD.org/src/commit/?id=74bd20769706041108a573601cf0b61c755bdc56 > >> > >> commit 74bd20769706041108a573601cf0b61c755bdc56 > >> Author: Mateusz Piotrowski <0mp@FreeBSD.org> > >> AuthorDate: 2021-01-07 09:22:20 +0000 > >> Commit: Mateusz Piotrowski <0mp@FreeBSD.org> > >> CommitDate: 2021-01-07 09:24:07 +0000 > >> > >> Reference newfs_msdos(8) from the newfs(8) manual > > Why ? newfs is not the interface to create arbitrary kind of filesystem, > > it is just UFS writer. > > I think that it is beneficial nevertheless. Now users can discover other > newfs_* commands FreeBSD > offers. Also, newfs_msdos(8) already references newfs(8) (there are only > two items in the SEE ALSO > section there, the other one being gpart(8)). > > From my perspective it is not too bad to have this reference in the newfs > manual. It seems like > it's also something some FreeBSD users expect to see in the manual page as > we received a bug report > for that. > > I can revert this patch and also remove newfs(8) from the newfs_msdos > manual while at it if desired. > Perhaps newfs commands are easy enough to find so this patch only hurts > the readability of the manual... > I think it's a good change because many other filesystem manipulation commands will do arbitrary filesystems. Since it breaks this symmetry, having the xref is fine. Warner From owner-dev-commits-src-all@freebsd.org Fri Jan 8 15:21:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A3C004CCF39; Fri, 8 Jan 2021 15:21:14 +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 4DC6JB3v7pz4WG3; Fri, 8 Jan 2021 15:21:14 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 72DFB1901; Fri, 8 Jan 2021 15:21:14 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f175.google.com with SMTP id 143so8637565qke.10; Fri, 08 Jan 2021 07:21:14 -0800 (PST) X-Gm-Message-State: AOAM530M0O2wbaeukDi5vIHEXPgezikMdtFhXZ8z60qwvDQrYTXvahkZ H0MXrNM+PneazloJuEOHgztAMfHW2undvEzqgxc= X-Google-Smtp-Source: ABdhPJz1a0yOmlAWOBTYch71OjkVlY285AAwb/gPbXihVPxg/0CQJd0B0AWjtJg622K9/iFVMIR2vK8IgCJ7nz5m+hw= X-Received: by 2002:a37:6713:: with SMTP id b19mr4153636qkc.493.1610119273970; Fri, 08 Jan 2021 07:21:13 -0800 (PST) MIME-Version: 1.0 References: <202101051302.105D24lW041218@gitrepo.freebsd.org> <20210107135842.lji6ydbajmzxqiuq@ivaldir.net> In-Reply-To: <20210107135842.lji6ydbajmzxqiuq@ivaldir.net> From: Kyle Evans Date: Fri, 8 Jan 2021 09:21:01 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support To: Baptiste Daroussin Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 15:21:14 -0000 On Thu, Jan 7, 2021 at 7:59 AM Baptiste Daroussin wrote: > > On Thu, Jan 07, 2021 at 07:53:47AM -0600, Kyle Evans wrote: > > On Tue, Jan 5, 2021 at 7:02 AM Baptiste Daroussin wrote: > > > > > > The branch main has been updated by bapt: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba0441562aa07 > > > > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > > Author: Baptiste Daroussin > > > AuthorDate: 2021-01-04 16:29:40 +0000 > > > Commit: Baptiste Daroussin > > > CommitDate: 2021-01-05 13:01:32 +0000 > > > > > > ncurses: only keep the version with widechar support > > > > > > Only keep the widechar version of ncurses as libncursesw.so.9 > > > > > > Keep the old name to avoid breaking the ABI compatibility (the non > > > widechar version libncurses.so.9 is not binary compatible with > > > libncursesw.so.9) since all ports and base are already only linking > > > against the widechar version we can simply remove libncurses.so.9 > > > > > > Since the .9 version only lived in the dev branch and never ended in a > > > release, it is simply removed and not added to any binary compat > > > package. > > > > > > Add symlinks to keep build time compatibility for anyone linking against > > > -lncurses > > > --- > > > Makefile.inc1 | 5 +-- > > > Makefile.libcompat | 4 +- > > > ObsoleteFiles.inc | 2 + > > > lib/ncurses/Makefile | 6 +-- > > > lib/ncurses/config.mk | 11 +----- > > > lib/ncurses/form/Makefile | 18 ++++++--- > > > lib/ncurses/formw/Makefile | 5 --- > > > lib/ncurses/formw/Makefile.depend | 17 --------- > > > lib/ncurses/menu/Makefile | 18 ++++++--- > > > lib/ncurses/menuw/Makefile | 5 --- > > > lib/ncurses/menuw/Makefile.depend | 17 --------- > > > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++-------------------- > > > lib/ncurses/ncursesw/Makefile | 7 ---- > > > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > > > lib/ncurses/panel/Makefile | 23 ++++++++---- > > > lib/ncurses/panelw/Makefile | 5 --- > > > lib/ncurses/panelw/Makefile.depend | 17 --------- > > > share/mk/src.libnames.mk | 16 ++------ > > > tools/bsdbox/Makefile.base | 2 +- > > > tools/tools/ath/athratestats/Makefile | 2 +- > > > 20 files changed, 87 insertions(+), 180 deletions(-) > > > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > > index fecdc1bdca71..a19fde9195cf 100644 > > > --- a/Makefile.inc1 > > > +++ b/Makefile.inc1 > > > @@ -2524,7 +2524,6 @@ _bt_clean= ${CLEANDIR} > > > ${LOCAL_TOOL_DIRS} \ > > > ${_jevents} \ > > > lib/ncurses/ncurses \ > > > - lib/ncurses/ncursesw \ > > > ${_rescue} \ > > > ${_share} \ > > > usr.bin/awk \ > > > @@ -2870,7 +2869,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > > lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ > > > lib/libzstd \ > > > ${_lib_casper} \ > > > - lib/ncurses/ncurses lib/ncurses/ncursesw \ > > > + lib/ncurses/ncurses \ > > > lib/libopie lib/libpam/libpam ${_lib_libthr} \ > > > ${_lib_libradius} lib/libsbuf lib/libtacplus \ > > > lib/libgeom \ > > > @@ -2891,7 +2890,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > > > > > .if ${MK_DIALOG} != "no" > > > _prebuild_libs+= gnu/lib/libdialog > > > -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L > > > +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncurses__L > > > .endif > > > > > > .if ${MK_GOOGLETEST} != "no" > > > diff --git a/Makefile.libcompat b/Makefile.libcompat > > > index 3f23a33aa19b..85859a960d81 100644 > > > --- a/Makefile.libcompat > > > +++ b/Makefile.libcompat > > > @@ -45,7 +45,7 @@ _LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib > > > > > > _LC_INCDIRS= \ > > > include \ > > > - lib/ncurses/ncursesw \ > > > + lib/ncurses/ncurses \ > > > ${_LC_LIBDIRS.yes} > > > > > > .if ${MK_FILE} != "no" > > > @@ -94,7 +94,7 @@ build${libcompat}: .PHONY > > > DIRPRFX=${_dir}/ ${_t} > > > .endfor > > > .endfor > > > -.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevents} > > > +.for _dir in lib/ncurses/ncurses lib/ncurses/ncurses ${_libmagic} ${_jevents} > > > .for _t in ${_obj} build-tools > > > ${_+_}cd ${.CURDIR}/${_dir}; \ > > > WORLDTMP=${WORLDTMP} \ > > > > The second occurence of lib/ncurses/ncurses should probably just go away? > > > > > diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk > > > index d15be8601136..f199c5829b65 100644 > > > --- a/lib/ncurses/config.mk > > > +++ b/lib/ncurses/config.mk > > > @@ -4,20 +4,11 @@ > > > > > > NCURSES_DIR= ${SRCTOP}/contrib/ncurses > > > > > > -.if defined(ENABLE_WIDEC) > > > -LIB_SUFFIX= w > > > CFLAGS+= -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC > > > -NCURSES_CFG_H= ${.CURDIR:H}/ncurses/ncurses_cfg.h > > > -.else > > > -LIB_SUFFIX= > > > NCURSES_CFG_H= ${.CURDIR}/ncurses_cfg.h > > > -.endif > > > > > > CFLAGS+= -I. > > > -.if exists(${.OBJDIR:H}/ncurses${LIB_SUFFIX}) > > > -CFLAGS+= -I${.OBJDIR:H}/ncurses${LIB_SUFFIX} > > > -.endif > > > -CFLAGS+= -I${.CURDIR:H}/ncurses${LIB_SUFFIX} > > > +CFLAGS+= -I${.CURDIR:H}/ncurses > > > > > > # for ${NCURSES_CFG_H} > > > CFLAGS+= -I${.CURDIR:H}/ncurses > > > > Based on this we should really just nuke the entire ncurses dir for > > older WITHOUT_CLEAN builds, because any objects in this objdir will > > have been built without -DENABLE_WIDEC. Maybe just key it off of an > > ncursesw directory existing in the objdir hierarchy and nuke it all in > > depend-cleanup. > > > > Yes to everything you said ;) > I see you committed the first part (thanks!) -- here's the second, that I can commit if it seems reasonable: commit 619c0de456029adacdc823a3320c8768c9a40786 (HEAD -> ncdep) Author: Kyle Evans Date: Fri Jan 8 09:18:46 2021 -0600 build: add WITHOUT_CLEAN workaround for 821aa63a0940 The *w variants of ncurses directories went away, and the remaining names build the widechar variants instead of non-widechar variants. As such, the entire ncurses tree should be regenerated. Key off of lib/ncurses/ncursesw being present and remove the whole ncurses hierarchy if it is. diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh index 0b3ff9bcc63..23bedee1ea2 100755 --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -64,3 +64,9 @@ if [ -e "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o ] && \ echo "Removing old pf_ruleset dependecy file" rm -rf "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o fi + +# 20210108 821aa63a0940 non-widechar version of ncurses removed +if [ -e "$OBJTOP"/lib/ncurses/ncursesw ]; then + echo "Removing stale ncurses objects" + rm -rf "$OBJTOP"/lib/ncurses "$OBJTOP"/obj-lib32/lib/ncurses +fi From owner-dev-commits-src-all@freebsd.org Fri Jan 8 15:43:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3F3764CD639; Fri, 8 Jan 2021 15:43:13 +0000 (UTC) (envelope-from gbe@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 4DC6nY1LcMz4Xcg; Fri, 8 Jan 2021 15:43:13 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p200300d5d72fc856b4dda6d3715ec767.dip0.t-ipconnect.de [IPv6:2003:d5:d72f:c856:b4dd:a6d3:715e:c767]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id 8EFD61BD4; Fri, 8 Jan 2021 15:43:12 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Fri, 8 Jan 2021 16:43:09 +0100 From: Gordon Bergling To: Kyle Evans Cc: Baptiste Daroussin , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support Message-ID: References: <202101051302.105D24lW041218@gitrepo.freebsd.org> <20210107135842.lji6ydbajmzxqiuq@ivaldir.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 4:33PM up 4 days, 18:36, 4 users, load averages: 0.34, 0.32, 0.30 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 15:43:13 -0000 On Fri, Jan 08, 2021 at 09:21:01AM -0600, Kyle Evans wrote: > On Thu, Jan 7, 2021 at 7:59 AM Baptiste Daroussin wrote: > > On Thu, Jan 07, 2021 at 07:53:47AM -0600, Kyle Evans wrote: > > > On Tue, Jan 5, 2021 at 7:02 AM Baptiste Daroussin wrote: > > > > The branch main has been updated by bapt: > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba0441562aa07 > > > > > > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > > > Author: Baptiste Daroussin > > > > AuthorDate: 2021-01-04 16:29:40 +0000 > > > > Commit: Baptiste Daroussin > > > > CommitDate: 2021-01-05 13:01:32 +0000 > > > > > > > > ncurses: only keep the version with widechar support > > > > > > > > Only keep the widechar version of ncurses as libncursesw.so.9 > > > > > > > > Keep the old name to avoid breaking the ABI compatibility (the non > > > > widechar version libncurses.so.9 is not binary compatible with > > > > libncursesw.so.9) since all ports and base are already only linking > > > > against the widechar version we can simply remove libncurses.so.9 > > > > > > > > Since the .9 version only lived in the dev branch and never ended in a > > > > release, it is simply removed and not added to any binary compat > > > > package. > > > > > > > > Add symlinks to keep build time compatibility for anyone linking against > > > > -lncurses > > > > --- > > > > Makefile.inc1 | 5 +-- > > > > Makefile.libcompat | 4 +- > > > > ObsoleteFiles.inc | 2 + > > > > lib/ncurses/Makefile | 6 +-- > > > > lib/ncurses/config.mk | 11 +----- > > > > lib/ncurses/form/Makefile | 18 ++++++--- > > > > lib/ncurses/formw/Makefile | 5 --- > > > > lib/ncurses/formw/Makefile.depend | 17 --------- > > > > lib/ncurses/menu/Makefile | 18 ++++++--- > > > > lib/ncurses/menuw/Makefile | 5 --- > > > > lib/ncurses/menuw/Makefile.depend | 17 --------- > > > > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++-------------------- > > > > lib/ncurses/ncursesw/Makefile | 7 ---- > > > > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > > > > lib/ncurses/panel/Makefile | 23 ++++++++---- > > > > lib/ncurses/panelw/Makefile | 5 --- > > > > lib/ncurses/panelw/Makefile.depend | 17 --------- > > > > share/mk/src.libnames.mk | 16 ++------ > > > > tools/bsdbox/Makefile.base | 2 +- > > > > tools/tools/ath/athratestats/Makefile | 2 +- > > > > 20 files changed, 87 insertions(+), 180 deletions(-) > > > > > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > > > index fecdc1bdca71..a19fde9195cf 100644 > > > > --- a/Makefile.inc1 > > > > +++ b/Makefile.inc1 > > > > @@ -2524,7 +2524,6 @@ _bt_clean= ${CLEANDIR} > > > > ${LOCAL_TOOL_DIRS} \ > > > > ${_jevents} \ > > > > lib/ncurses/ncurses \ > > > > - lib/ncurses/ncursesw \ > > > > ${_rescue} \ > > > > ${_share} \ > > > > usr.bin/awk \ > > > > @@ -2870,7 +2869,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > > > lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ > > > > lib/libzstd \ > > > > ${_lib_casper} \ > > > > - lib/ncurses/ncurses lib/ncurses/ncursesw \ > > > > + lib/ncurses/ncurses \ > > > > lib/libopie lib/libpam/libpam ${_lib_libthr} \ > > > > ${_lib_libradius} lib/libsbuf lib/libtacplus \ > > > > lib/libgeom \ > > > > @@ -2891,7 +2890,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > > > > > > > .if ${MK_DIALOG} != "no" > > > > _prebuild_libs+= gnu/lib/libdialog > > > > -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L > > > > +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncurses__L > > > > .endif > > > > > > > > .if ${MK_GOOGLETEST} != "no" > > > > diff --git a/Makefile.libcompat b/Makefile.libcompat > > > > index 3f23a33aa19b..85859a960d81 100644 > > > > --- a/Makefile.libcompat > > > > +++ b/Makefile.libcompat > > > > @@ -45,7 +45,7 @@ _LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib > > > > > > > > _LC_INCDIRS= \ > > > > include \ > > > > - lib/ncurses/ncursesw \ > > > > + lib/ncurses/ncurses \ > > > > ${_LC_LIBDIRS.yes} > > > > > > > > .if ${MK_FILE} != "no" > > > > @@ -94,7 +94,7 @@ build${libcompat}: .PHONY > > > > DIRPRFX=${_dir}/ ${_t} > > > > .endfor > > > > .endfor > > > > -.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevents} > > > > +.for _dir in lib/ncurses/ncurses lib/ncurses/ncurses ${_libmagic} ${_jevents} > > > > .for _t in ${_obj} build-tools > > > > ${_+_}cd ${.CURDIR}/${_dir}; \ > > > > WORLDTMP=${WORLDTMP} \ > > > > > > The second occurence of lib/ncurses/ncurses should probably just go away? > > > > > > > diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk > > > > index d15be8601136..f199c5829b65 100644 > > > > --- a/lib/ncurses/config.mk > > > > +++ b/lib/ncurses/config.mk > > > > @@ -4,20 +4,11 @@ > > > > > > > > NCURSES_DIR= ${SRCTOP}/contrib/ncurses > > > > > > > > -.if defined(ENABLE_WIDEC) > > > > -LIB_SUFFIX= w > > > > CFLAGS+= -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC > > > > -NCURSES_CFG_H= ${.CURDIR:H}/ncurses/ncurses_cfg.h > > > > -.else > > > > -LIB_SUFFIX= > > > > NCURSES_CFG_H= ${.CURDIR}/ncurses_cfg.h > > > > -.endif > > > > > > > > CFLAGS+= -I. > > > > -.if exists(${.OBJDIR:H}/ncurses${LIB_SUFFIX}) > > > > -CFLAGS+= -I${.OBJDIR:H}/ncurses${LIB_SUFFIX} > > > > -.endif > > > > -CFLAGS+= -I${.CURDIR:H}/ncurses${LIB_SUFFIX} > > > > +CFLAGS+= -I${.CURDIR:H}/ncurses > > > > > > > > # for ${NCURSES_CFG_H} > > > > CFLAGS+= -I${.CURDIR:H}/ncurses > > > > > > Based on this we should really just nuke the entire ncurses dir for > > > older WITHOUT_CLEAN builds, because any objects in this objdir will > > > have been built without -DENABLE_WIDEC. Maybe just key it off of an > > > ncursesw directory existing in the objdir hierarchy and nuke it all in > > > depend-cleanup. > > > > Yes to everything you said ;) > > I see you committed the first part (thanks!) -- here's the second, > that I can commit if it seems reasonable: > > commit 619c0de456029adacdc823a3320c8768c9a40786 (HEAD -> ncdep) > Author: Kyle Evans > Date: Fri Jan 8 09:18:46 2021 -0600 > > build: add WITHOUT_CLEAN workaround for 821aa63a0940 > > The *w variants of ncurses directories went away, and the remaining names > build the widechar variants instead of non-widechar variants. As such, the > entire ncurses tree should be regenerated. > > Key off of lib/ncurses/ncursesw being present and remove the whole ncurses > hierarchy if it is. > > diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh > index 0b3ff9bcc63..23bedee1ea2 100755 > --- a/tools/build/depend-cleanup.sh > +++ b/tools/build/depend-cleanup.sh > @@ -64,3 +64,9 @@ if [ -e "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o ] && \ > echo "Removing old pf_ruleset dependecy file" > rm -rf "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o > fi > + > +# 20210108 821aa63a0940 non-widechar version of ncurses removed > +if [ -e "$OBJTOP"/lib/ncurses/ncursesw ]; then > + echo "Removing stale ncurses objects" > + rm -rf "$OBJTOP"/lib/ncurses "$OBJTOP"/obj-lib32/lib/ncurses > +fi Hi Kyle, thanks for the additional bugfix. It would be good to provide somewhere in UPDATING some information about 'depend-cleanup.sh'. I use FreeBSD since about 20 years, and even as a committer I had never heard something about 'depend-cleanup.sh' before. --Gordon From owner-dev-commits-src-all@freebsd.org Fri Jan 8 15:49:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9F5FD4CD9DA; Fri, 8 Jan 2021 15:49:07 +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 4DC6wL72Fwz4YFZ; Fri, 8 Jan 2021 15:49:06 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (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 A563D17B2; Fri, 8 Jan 2021 15:49:06 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f41.google.com with SMTP id l7so4465253qvt.4; Fri, 08 Jan 2021 07:49:06 -0800 (PST) X-Gm-Message-State: AOAM5318vPKJWVGdcHDuMVo3hTw5lwlmoHb8JQFdbwWEvehuOun+6dIh qWtoxrqqhV4QfiFHKoIG9MxkZwj65Rqp8KuAtE4= X-Google-Smtp-Source: ABdhPJyn2bLmpGZtNeVczE3nB+dwJjEgF0efTdF/7cQmB7OkzkHfiDh9LKwD7AMMo3HHfJXJhMtuG8+TMEqK0TsR3U0= X-Received: by 2002:a0c:f601:: with SMTP id r1mr3990236qvm.39.1610120945942; Fri, 08 Jan 2021 07:49:05 -0800 (PST) MIME-Version: 1.0 References: <202101051302.105D24lW041218@gitrepo.freebsd.org> <20210107135842.lji6ydbajmzxqiuq@ivaldir.net> In-Reply-To: From: Kyle Evans Date: Fri, 8 Jan 2021 09:48:53 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support To: Gordon Bergling Cc: Baptiste Daroussin , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 15:49:07 -0000 On Fri, Jan 8, 2021 at 9:43 AM Gordon Bergling wrote: > > On Fri, Jan 08, 2021 at 09:21:01AM -0600, Kyle Evans wrote: > > On Thu, Jan 7, 2021 at 7:59 AM Baptiste Daroussin wrote: > > > On Thu, Jan 07, 2021 at 07:53:47AM -0600, Kyle Evans wrote: > > > > On Tue, Jan 5, 2021 at 7:02 AM Baptiste Daroussin wrote: > > > > > The branch main has been updated by bapt: > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba0441562aa07 > > > > > > > > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > > > > Author: Baptiste Daroussin > > > > > AuthorDate: 2021-01-04 16:29:40 +0000 > > > > > Commit: Baptiste Daroussin > > > > > CommitDate: 2021-01-05 13:01:32 +0000 > > > > > > > > > > ncurses: only keep the version with widechar support > > > > > > > > > > Only keep the widechar version of ncurses as libncursesw.so.9 > > > > > > > > > > Keep the old name to avoid breaking the ABI compatibility (the non > > > > > widechar version libncurses.so.9 is not binary compatible with > > > > > libncursesw.so.9) since all ports and base are already only linking > > > > > against the widechar version we can simply remove libncurses.so.9 > > > > > > > > > > Since the .9 version only lived in the dev branch and never ended in a > > > > > release, it is simply removed and not added to any binary compat > > > > > package. > > > > > > > > > > Add symlinks to keep build time compatibility for anyone linking against > > > > > -lncurses > > > > > --- > > > > > Makefile.inc1 | 5 +-- > > > > > Makefile.libcompat | 4 +- > > > > > ObsoleteFiles.inc | 2 + > > > > > lib/ncurses/Makefile | 6 +-- > > > > > lib/ncurses/config.mk | 11 +----- > > > > > lib/ncurses/form/Makefile | 18 ++++++--- > > > > > lib/ncurses/formw/Makefile | 5 --- > > > > > lib/ncurses/formw/Makefile.depend | 17 --------- > > > > > lib/ncurses/menu/Makefile | 18 ++++++--- > > > > > lib/ncurses/menuw/Makefile | 5 --- > > > > > lib/ncurses/menuw/Makefile.depend | 17 --------- > > > > > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++-------------------- > > > > > lib/ncurses/ncursesw/Makefile | 7 ---- > > > > > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > > > > > lib/ncurses/panel/Makefile | 23 ++++++++---- > > > > > lib/ncurses/panelw/Makefile | 5 --- > > > > > lib/ncurses/panelw/Makefile.depend | 17 --------- > > > > > share/mk/src.libnames.mk | 16 ++------ > > > > > tools/bsdbox/Makefile.base | 2 +- > > > > > tools/tools/ath/athratestats/Makefile | 2 +- > > > > > 20 files changed, 87 insertions(+), 180 deletions(-) > > > > > > > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > > > > index fecdc1bdca71..a19fde9195cf 100644 > > > > > --- a/Makefile.inc1 > > > > > +++ b/Makefile.inc1 > > > > > @@ -2524,7 +2524,6 @@ _bt_clean= ${CLEANDIR} > > > > > ${LOCAL_TOOL_DIRS} \ > > > > > ${_jevents} \ > > > > > lib/ncurses/ncurses \ > > > > > - lib/ncurses/ncursesw \ > > > > > ${_rescue} \ > > > > > ${_share} \ > > > > > usr.bin/awk \ > > > > > @@ -2870,7 +2869,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > > > > lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ > > > > > lib/libzstd \ > > > > > ${_lib_casper} \ > > > > > - lib/ncurses/ncurses lib/ncurses/ncursesw \ > > > > > + lib/ncurses/ncurses \ > > > > > lib/libopie lib/libpam/libpam ${_lib_libthr} \ > > > > > ${_lib_libradius} lib/libsbuf lib/libtacplus \ > > > > > lib/libgeom \ > > > > > @@ -2891,7 +2890,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > > > > > > > > > .if ${MK_DIALOG} != "no" > > > > > _prebuild_libs+= gnu/lib/libdialog > > > > > -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L > > > > > +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncurses__L > > > > > .endif > > > > > > > > > > .if ${MK_GOOGLETEST} != "no" > > > > > diff --git a/Makefile.libcompat b/Makefile.libcompat > > > > > index 3f23a33aa19b..85859a960d81 100644 > > > > > --- a/Makefile.libcompat > > > > > +++ b/Makefile.libcompat > > > > > @@ -45,7 +45,7 @@ _LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib > > > > > > > > > > _LC_INCDIRS= \ > > > > > include \ > > > > > - lib/ncurses/ncursesw \ > > > > > + lib/ncurses/ncurses \ > > > > > ${_LC_LIBDIRS.yes} > > > > > > > > > > .if ${MK_FILE} != "no" > > > > > @@ -94,7 +94,7 @@ build${libcompat}: .PHONY > > > > > DIRPRFX=${_dir}/ ${_t} > > > > > .endfor > > > > > .endfor > > > > > -.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevents} > > > > > +.for _dir in lib/ncurses/ncurses lib/ncurses/ncurses ${_libmagic} ${_jevents} > > > > > .for _t in ${_obj} build-tools > > > > > ${_+_}cd ${.CURDIR}/${_dir}; \ > > > > > WORLDTMP=${WORLDTMP} \ > > > > > > > > The second occurence of lib/ncurses/ncurses should probably just go away? > > > > > > > > > diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk > > > > > index d15be8601136..f199c5829b65 100644 > > > > > --- a/lib/ncurses/config.mk > > > > > +++ b/lib/ncurses/config.mk > > > > > @@ -4,20 +4,11 @@ > > > > > > > > > > NCURSES_DIR= ${SRCTOP}/contrib/ncurses > > > > > > > > > > -.if defined(ENABLE_WIDEC) > > > > > -LIB_SUFFIX= w > > > > > CFLAGS+= -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC > > > > > -NCURSES_CFG_H= ${.CURDIR:H}/ncurses/ncurses_cfg.h > > > > > -.else > > > > > -LIB_SUFFIX= > > > > > NCURSES_CFG_H= ${.CURDIR}/ncurses_cfg.h > > > > > -.endif > > > > > > > > > > CFLAGS+= -I. > > > > > -.if exists(${.OBJDIR:H}/ncurses${LIB_SUFFIX}) > > > > > -CFLAGS+= -I${.OBJDIR:H}/ncurses${LIB_SUFFIX} > > > > > -.endif > > > > > -CFLAGS+= -I${.CURDIR:H}/ncurses${LIB_SUFFIX} > > > > > +CFLAGS+= -I${.CURDIR:H}/ncurses > > > > > > > > > > # for ${NCURSES_CFG_H} > > > > > CFLAGS+= -I${.CURDIR:H}/ncurses > > > > > > > > Based on this we should really just nuke the entire ncurses dir for > > > > older WITHOUT_CLEAN builds, because any objects in this objdir will > > > > have been built without -DENABLE_WIDEC. Maybe just key it off of an > > > > ncursesw directory existing in the objdir hierarchy and nuke it all in > > > > depend-cleanup. > > > > > > Yes to everything you said ;) > > > > I see you committed the first part (thanks!) -- here's the second, > > that I can commit if it seems reasonable: > > > > commit 619c0de456029adacdc823a3320c8768c9a40786 (HEAD -> ncdep) > > Author: Kyle Evans > > Date: Fri Jan 8 09:18:46 2021 -0600 > > > > build: add WITHOUT_CLEAN workaround for 821aa63a0940 > > > > The *w variants of ncurses directories went away, and the remaining names > > build the widechar variants instead of non-widechar variants. As such, the > > entire ncurses tree should be regenerated. > > > > Key off of lib/ncurses/ncursesw being present and remove the whole ncurses > > hierarchy if it is. > > > > diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh > > index 0b3ff9bcc63..23bedee1ea2 100755 > > --- a/tools/build/depend-cleanup.sh > > +++ b/tools/build/depend-cleanup.sh > > @@ -64,3 +64,9 @@ if [ -e "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o ] && \ > > echo "Removing old pf_ruleset dependecy file" > > rm -rf "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o > > fi > > + > > +# 20210108 821aa63a0940 non-widechar version of ncurses removed > > +if [ -e "$OBJTOP"/lib/ncurses/ncursesw ]; then > > + echo "Removing stale ncurses objects" > > + rm -rf "$OBJTOP"/lib/ncurses "$OBJTOP"/obj-lib32/lib/ncurses > > +fi > > Hi Kyle, > > thanks for the additional bugfix. It would be good to provide somewhere in > UPDATING some information about 'depend-cleanup.sh'. I use FreeBSD since > about 20 years, and even as a committer I had never heard something about > 'depend-cleanup.sh' before. > Hi, Ah, this is an internal script that need not be known about for updating procedures. It gets run automatically for WITHOUT_CLEAN builds. Thanks, Kyle Evans From owner-dev-commits-src-all@freebsd.org Fri Jan 8 16:07:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2A1E54CDFAF; Fri, 8 Jan 2021 16:07:16 +0000 (UTC) (envelope-from gbe@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 4DC7KJ0hnYz4Z6q; Fri, 8 Jan 2021 16:07:16 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p200300d5d72fc856b4dda6d3715ec767.dip0.t-ipconnect.de [IPv6:2003:d5:d72f:c856:b4dd:a6d3:715e:c767]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id 8840D191A; Fri, 8 Jan 2021 16:07:15 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Fri, 8 Jan 2021 17:07:14 +0100 From: Gordon Bergling To: Kyle Evans Cc: Baptiste Daroussin , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support Message-ID: References: <202101051302.105D24lW041218@gitrepo.freebsd.org> <20210107135842.lji6ydbajmzxqiuq@ivaldir.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 5:02PM up 4 days, 19:05, 4 users, load averages: 0.37, 0.35, 0.33 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 16:07:16 -0000 On Fri, Jan 08, 2021 at 09:48:53AM -0600, Kyle Evans wrote: > On Fri, Jan 8, 2021 at 9:43 AM Gordon Bergling wrote: > > On Fri, Jan 08, 2021 at 09:21:01AM -0600, Kyle Evans wrote: > > > On Thu, Jan 7, 2021 at 7:59 AM Baptiste Daroussin wrote: > > > > On Thu, Jan 07, 2021 at 07:53:47AM -0600, Kyle Evans wrote: > > > > > On Tue, Jan 5, 2021 at 7:02 AM Baptiste Daroussin wrote: > > > > > > The branch main has been updated by bapt: > > > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba0441562aa07 > > > > > > > > > > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > > > > > Author: Baptiste Daroussin > > > > > > AuthorDate: 2021-01-04 16:29:40 +0000 > > > > > > Commit: Baptiste Daroussin > > > > > > CommitDate: 2021-01-05 13:01:32 +0000 > > > > > > > > > > > > ncurses: only keep the version with widechar support > > > > > > > > > > > > Only keep the widechar version of ncurses as libncursesw.so.9 > > > > > > > > > > > > Keep the old name to avoid breaking the ABI compatibility (the non > > > > > > widechar version libncurses.so.9 is not binary compatible with > > > > > > libncursesw.so.9) since all ports and base are already only linking > > > > > > against the widechar version we can simply remove libncurses.so.9 > > > > > > > > > > > > Since the .9 version only lived in the dev branch and never ended in a > > > > > > release, it is simply removed and not added to any binary compat > > > > > > package. > > > > > > > > > > > > Add symlinks to keep build time compatibility for anyone linking against > > > > > > -lncurses > > > > > > --- > > > > > > Makefile.inc1 | 5 +-- > > > > > > Makefile.libcompat | 4 +- > > > > > > ObsoleteFiles.inc | 2 + > > > > > > lib/ncurses/Makefile | 6 +-- > > > > > > lib/ncurses/config.mk | 11 +----- > > > > > > lib/ncurses/form/Makefile | 18 ++++++--- > > > > > > lib/ncurses/formw/Makefile | 5 --- > > > > > > lib/ncurses/formw/Makefile.depend | 17 --------- > > > > > > lib/ncurses/menu/Makefile | 18 ++++++--- > > > > > > lib/ncurses/menuw/Makefile | 5 --- > > > > > > lib/ncurses/menuw/Makefile.depend | 17 --------- > > > > > > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++-------------------- > > > > > > lib/ncurses/ncursesw/Makefile | 7 ---- > > > > > > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > > > > > > lib/ncurses/panel/Makefile | 23 ++++++++---- > > > > > > lib/ncurses/panelw/Makefile | 5 --- > > > > > > lib/ncurses/panelw/Makefile.depend | 17 --------- > > > > > > share/mk/src.libnames.mk | 16 ++------ > > > > > > tools/bsdbox/Makefile.base | 2 +- > > > > > > tools/tools/ath/athratestats/Makefile | 2 +- > > > > > > 20 files changed, 87 insertions(+), 180 deletions(-) > > > > > > > > > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > > > > > index fecdc1bdca71..a19fde9195cf 100644 > > > > > > --- a/Makefile.inc1 > > > > > > +++ b/Makefile.inc1 > > > > > > @@ -2524,7 +2524,6 @@ _bt_clean= ${CLEANDIR} > > > > > > ${LOCAL_TOOL_DIRS} \ > > > > > > ${_jevents} \ > > > > > > lib/ncurses/ncurses \ > > > > > > - lib/ncurses/ncursesw \ > > > > > > ${_rescue} \ > > > > > > ${_share} \ > > > > > > usr.bin/awk \ > > > > > > @@ -2870,7 +2869,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > > > > > lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ > > > > > > lib/libzstd \ > > > > > > ${_lib_casper} \ > > > > > > - lib/ncurses/ncurses lib/ncurses/ncursesw \ > > > > > > + lib/ncurses/ncurses \ > > > > > > lib/libopie lib/libpam/libpam ${_lib_libthr} \ > > > > > > ${_lib_libradius} lib/libsbuf lib/libtacplus \ > > > > > > lib/libgeom \ > > > > > > @@ -2891,7 +2890,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > > > > > > > > > > > .if ${MK_DIALOG} != "no" > > > > > > _prebuild_libs+= gnu/lib/libdialog > > > > > > -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L > > > > > > +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncurses__L > > > > > > .endif > > > > > > > > > > > > .if ${MK_GOOGLETEST} != "no" > > > > > > diff --git a/Makefile.libcompat b/Makefile.libcompat > > > > > > index 3f23a33aa19b..85859a960d81 100644 > > > > > > --- a/Makefile.libcompat > > > > > > +++ b/Makefile.libcompat > > > > > > @@ -45,7 +45,7 @@ _LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib > > > > > > > > > > > > _LC_INCDIRS= \ > > > > > > include \ > > > > > > - lib/ncurses/ncursesw \ > > > > > > + lib/ncurses/ncurses \ > > > > > > ${_LC_LIBDIRS.yes} > > > > > > > > > > > > .if ${MK_FILE} != "no" > > > > > > @@ -94,7 +94,7 @@ build${libcompat}: .PHONY > > > > > > DIRPRFX=${_dir}/ ${_t} > > > > > > .endfor > > > > > > .endfor > > > > > > -.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevents} > > > > > > +.for _dir in lib/ncurses/ncurses lib/ncurses/ncurses ${_libmagic} ${_jevents} > > > > > > .for _t in ${_obj} build-tools > > > > > > ${_+_}cd ${.CURDIR}/${_dir}; \ > > > > > > WORLDTMP=${WORLDTMP} \ > > > > > > > > > > The second occurence of lib/ncurses/ncurses should probably just go away? > > > > > > > > > > > diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk > > > > > > index d15be8601136..f199c5829b65 100644 > > > > > > --- a/lib/ncurses/config.mk > > > > > > +++ b/lib/ncurses/config.mk > > > > > > @@ -4,20 +4,11 @@ > > > > > > > > > > > > NCURSES_DIR= ${SRCTOP}/contrib/ncurses > > > > > > > > > > > > -.if defined(ENABLE_WIDEC) > > > > > > -LIB_SUFFIX= w > > > > > > CFLAGS+= -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC > > > > > > -NCURSES_CFG_H= ${.CURDIR:H}/ncurses/ncurses_cfg.h > > > > > > -.else > > > > > > -LIB_SUFFIX= > > > > > > NCURSES_CFG_H= ${.CURDIR}/ncurses_cfg.h > > > > > > -.endif > > > > > > > > > > > > CFLAGS+= -I. > > > > > > -.if exists(${.OBJDIR:H}/ncurses${LIB_SUFFIX}) > > > > > > -CFLAGS+= -I${.OBJDIR:H}/ncurses${LIB_SUFFIX} > > > > > > -.endif > > > > > > -CFLAGS+= -I${.CURDIR:H}/ncurses${LIB_SUFFIX} > > > > > > +CFLAGS+= -I${.CURDIR:H}/ncurses > > > > > > > > > > > > # for ${NCURSES_CFG_H} > > > > > > CFLAGS+= -I${.CURDIR:H}/ncurses > > > > > > > > > > Based on this we should really just nuke the entire ncurses dir for > > > > > older WITHOUT_CLEAN builds, because any objects in this objdir will > > > > > have been built without -DENABLE_WIDEC. Maybe just key it off of an > > > > > ncursesw directory existing in the objdir hierarchy and nuke it all in > > > > > depend-cleanup. > > > > > > > > Yes to everything you said ;) > > > > > > I see you committed the first part (thanks!) -- here's the second, > > > that I can commit if it seems reasonable: > > > > > > commit 619c0de456029adacdc823a3320c8768c9a40786 (HEAD -> ncdep) > > > Author: Kyle Evans > > > Date: Fri Jan 8 09:18:46 2021 -0600 > > > > > > build: add WITHOUT_CLEAN workaround for 821aa63a0940 > > > > > > The *w variants of ncurses directories went away, and the remaining names > > > build the widechar variants instead of non-widechar variants. As such, the > > > entire ncurses tree should be regenerated. > > > > > > Key off of lib/ncurses/ncursesw being present and remove the whole ncurses > > > hierarchy if it is. > > > > > > diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh > > > index 0b3ff9bcc63..23bedee1ea2 100755 > > > --- a/tools/build/depend-cleanup.sh > > > +++ b/tools/build/depend-cleanup.sh > > > @@ -64,3 +64,9 @@ if [ -e "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o ] && \ > > > echo "Removing old pf_ruleset dependecy file" > > > rm -rf "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o > > > fi > > > + > > > +# 20210108 821aa63a0940 non-widechar version of ncurses removed > > > +if [ -e "$OBJTOP"/lib/ncurses/ncursesw ]; then > > > + echo "Removing stale ncurses objects" > > > + rm -rf "$OBJTOP"/lib/ncurses "$OBJTOP"/obj-lib32/lib/ncurses > > > +fi > > > > Hi Kyle, > > > > thanks for the additional bugfix. It would be good to provide somewhere in > > UPDATING some information about 'depend-cleanup.sh'. I use FreeBSD since > > about 20 years, and even as a committer I had never heard something about > > 'depend-cleanup.sh' before. > > Ah, this is an internal script that need not be known about for > updating procedures. It gets run automatically for WITHOUT_CLEAN > builds. Thanks for the info. Is this script executed within the scope of the commandline? Speaking, I have NO_CLEAN=yes append to my build scripts, but I haven't made an entry to src.conf. --Gordon From owner-dev-commits-src-all@freebsd.org Fri Jan 8 16:16:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 631684CE37E; Fri, 8 Jan 2021 16:16:03 +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 4DC7WR2JdSz4ZwX; Fri, 8 Jan 2021 16:16:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (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 3B5DE17DA; Fri, 8 Jan 2021 16:16:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f46.google.com with SMTP id az16so4514730qvb.5; Fri, 08 Jan 2021 08:16:03 -0800 (PST) X-Gm-Message-State: AOAM531UbTzh05y2IP/68at8PZoq02JO+oPQtIsdXDZAyCV5CdI+duTG gR7PkQkJp1ZFZO4hpHBXgq9IvLTl9jkfF9/NWwM= X-Google-Smtp-Source: ABdhPJzOOh+IayWY89DseJQvuPBEYyB9twRxOwRYEuCWfl2MsTq6tmYA+i2dNkLtK0OC9TIsNjZM/+0Z+5tIKhzeayo= X-Received: by 2002:a05:6214:6af:: with SMTP id s15mr4235430qvz.34.1610122562662; Fri, 08 Jan 2021 08:16:02 -0800 (PST) MIME-Version: 1.0 References: <202101051302.105D24lW041218@gitrepo.freebsd.org> <20210107135842.lji6ydbajmzxqiuq@ivaldir.net> In-Reply-To: From: Kyle Evans Date: Fri, 8 Jan 2021 10:15:50 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support To: Gordon Bergling Cc: Baptiste Daroussin , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 16:16:03 -0000 On Fri, Jan 8, 2021 at 10:07 AM Gordon Bergling wrote: > > On Fri, Jan 08, 2021 at 09:48:53AM -0600, Kyle Evans wrote: > > On Fri, Jan 8, 2021 at 9:43 AM Gordon Bergling wrote: > > > On Fri, Jan 08, 2021 at 09:21:01AM -0600, Kyle Evans wrote: > > > > On Thu, Jan 7, 2021 at 7:59 AM Baptiste Daroussin wrote: > > > > > On Thu, Jan 07, 2021 at 07:53:47AM -0600, Kyle Evans wrote: > > > > > > On Tue, Jan 5, 2021 at 7:02 AM Baptiste Daroussin wrote: > > > > > > > The branch main has been updated by bapt: > > > > > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba0441562aa07 > > > > > > > > > > > > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > > > > > > Author: Baptiste Daroussin > > > > > > > AuthorDate: 2021-01-04 16:29:40 +0000 > > > > > > > Commit: Baptiste Daroussin > > > > > > > CommitDate: 2021-01-05 13:01:32 +0000 > > > > > > > > > > > > > > ncurses: only keep the version with widechar support > > > > > > > > > > > > > > Only keep the widechar version of ncurses as libncursesw.so.9 > > > > > > > > > > > > > > Keep the old name to avoid breaking the ABI compatibility (the non > > > > > > > widechar version libncurses.so.9 is not binary compatible with > > > > > > > libncursesw.so.9) since all ports and base are already only linking > > > > > > > against the widechar version we can simply remove libncurses.so.9 > > > > > > > > > > > > > > Since the .9 version only lived in the dev branch and never ended in a > > > > > > > release, it is simply removed and not added to any binary compat > > > > > > > package. > > > > > > > > > > > > > > Add symlinks to keep build time compatibility for anyone linking against > > > > > > > -lncurses > > > > > > > --- > > > > > > > Makefile.inc1 | 5 +-- > > > > > > > Makefile.libcompat | 4 +- > > > > > > > ObsoleteFiles.inc | 2 + > > > > > > > lib/ncurses/Makefile | 6 +-- > > > > > > > lib/ncurses/config.mk | 11 +----- > > > > > > > lib/ncurses/form/Makefile | 18 ++++++--- > > > > > > > lib/ncurses/formw/Makefile | 5 --- > > > > > > > lib/ncurses/formw/Makefile.depend | 17 --------- > > > > > > > lib/ncurses/menu/Makefile | 18 ++++++--- > > > > > > > lib/ncurses/menuw/Makefile | 5 --- > > > > > > > lib/ncurses/menuw/Makefile.depend | 17 --------- > > > > > > > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++-------------------- > > > > > > > lib/ncurses/ncursesw/Makefile | 7 ---- > > > > > > > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > > > > > > > lib/ncurses/panel/Makefile | 23 ++++++++---- > > > > > > > lib/ncurses/panelw/Makefile | 5 --- > > > > > > > lib/ncurses/panelw/Makefile.depend | 17 --------- > > > > > > > share/mk/src.libnames.mk | 16 ++------ > > > > > > > tools/bsdbox/Makefile.base | 2 +- > > > > > > > tools/tools/ath/athratestats/Makefile | 2 +- > > > > > > > 20 files changed, 87 insertions(+), 180 deletions(-) > > > > > > > > > > > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > > > > > > index fecdc1bdca71..a19fde9195cf 100644 > > > > > > > --- a/Makefile.inc1 > > > > > > > +++ b/Makefile.inc1 > > > > > > > @@ -2524,7 +2524,6 @@ _bt_clean= ${CLEANDIR} > > > > > > > ${LOCAL_TOOL_DIRS} \ > > > > > > > ${_jevents} \ > > > > > > > lib/ncurses/ncurses \ > > > > > > > - lib/ncurses/ncursesw \ > > > > > > > ${_rescue} \ > > > > > > > ${_share} \ > > > > > > > usr.bin/awk \ > > > > > > > @@ -2870,7 +2869,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > > > > > > lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ > > > > > > > lib/libzstd \ > > > > > > > ${_lib_casper} \ > > > > > > > - lib/ncurses/ncurses lib/ncurses/ncursesw \ > > > > > > > + lib/ncurses/ncurses \ > > > > > > > lib/libopie lib/libpam/libpam ${_lib_libthr} \ > > > > > > > ${_lib_libradius} lib/libsbuf lib/libtacplus \ > > > > > > > lib/libgeom \ > > > > > > > @@ -2891,7 +2890,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > > > > > > > > > > > > > .if ${MK_DIALOG} != "no" > > > > > > > _prebuild_libs+= gnu/lib/libdialog > > > > > > > -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L > > > > > > > +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncurses__L > > > > > > > .endif > > > > > > > > > > > > > > .if ${MK_GOOGLETEST} != "no" > > > > > > > diff --git a/Makefile.libcompat b/Makefile.libcompat > > > > > > > index 3f23a33aa19b..85859a960d81 100644 > > > > > > > --- a/Makefile.libcompat > > > > > > > +++ b/Makefile.libcompat > > > > > > > @@ -45,7 +45,7 @@ _LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib > > > > > > > > > > > > > > _LC_INCDIRS= \ > > > > > > > include \ > > > > > > > - lib/ncurses/ncursesw \ > > > > > > > + lib/ncurses/ncurses \ > > > > > > > ${_LC_LIBDIRS.yes} > > > > > > > > > > > > > > .if ${MK_FILE} != "no" > > > > > > > @@ -94,7 +94,7 @@ build${libcompat}: .PHONY > > > > > > > DIRPRFX=${_dir}/ ${_t} > > > > > > > .endfor > > > > > > > .endfor > > > > > > > -.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevents} > > > > > > > +.for _dir in lib/ncurses/ncurses lib/ncurses/ncurses ${_libmagic} ${_jevents} > > > > > > > .for _t in ${_obj} build-tools > > > > > > > ${_+_}cd ${.CURDIR}/${_dir}; \ > > > > > > > WORLDTMP=${WORLDTMP} \ > > > > > > > > > > > > The second occurence of lib/ncurses/ncurses should probably just go away? > > > > > > > > > > > > > diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk > > > > > > > index d15be8601136..f199c5829b65 100644 > > > > > > > --- a/lib/ncurses/config.mk > > > > > > > +++ b/lib/ncurses/config.mk > > > > > > > @@ -4,20 +4,11 @@ > > > > > > > > > > > > > > NCURSES_DIR= ${SRCTOP}/contrib/ncurses > > > > > > > > > > > > > > -.if defined(ENABLE_WIDEC) > > > > > > > -LIB_SUFFIX= w > > > > > > > CFLAGS+= -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC > > > > > > > -NCURSES_CFG_H= ${.CURDIR:H}/ncurses/ncurses_cfg.h > > > > > > > -.else > > > > > > > -LIB_SUFFIX= > > > > > > > NCURSES_CFG_H= ${.CURDIR}/ncurses_cfg.h > > > > > > > -.endif > > > > > > > > > > > > > > CFLAGS+= -I. > > > > > > > -.if exists(${.OBJDIR:H}/ncurses${LIB_SUFFIX}) > > > > > > > -CFLAGS+= -I${.OBJDIR:H}/ncurses${LIB_SUFFIX} > > > > > > > -.endif > > > > > > > -CFLAGS+= -I${.CURDIR:H}/ncurses${LIB_SUFFIX} > > > > > > > +CFLAGS+= -I${.CURDIR:H}/ncurses > > > > > > > > > > > > > > # for ${NCURSES_CFG_H} > > > > > > > CFLAGS+= -I${.CURDIR:H}/ncurses > > > > > > > > > > > > Based on this we should really just nuke the entire ncurses dir for > > > > > > older WITHOUT_CLEAN builds, because any objects in this objdir will > > > > > > have been built without -DENABLE_WIDEC. Maybe just key it off of an > > > > > > ncursesw directory existing in the objdir hierarchy and nuke it all in > > > > > > depend-cleanup. > > > > > > > > > > Yes to everything you said ;) > > > > > > > > I see you committed the first part (thanks!) -- here's the second, > > > > that I can commit if it seems reasonable: > > > > > > > > commit 619c0de456029adacdc823a3320c8768c9a40786 (HEAD -> ncdep) > > > > Author: Kyle Evans > > > > Date: Fri Jan 8 09:18:46 2021 -0600 > > > > > > > > build: add WITHOUT_CLEAN workaround for 821aa63a0940 > > > > > > > > The *w variants of ncurses directories went away, and the remaining names > > > > build the widechar variants instead of non-widechar variants. As such, the > > > > entire ncurses tree should be regenerated. > > > > > > > > Key off of lib/ncurses/ncursesw being present and remove the whole ncurses > > > > hierarchy if it is. > > > > > > > > diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh > > > > index 0b3ff9bcc63..23bedee1ea2 100755 > > > > --- a/tools/build/depend-cleanup.sh > > > > +++ b/tools/build/depend-cleanup.sh > > > > @@ -64,3 +64,9 @@ if [ -e "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o ] && \ > > > > echo "Removing old pf_ruleset dependecy file" > > > > rm -rf "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o > > > > fi > > > > + > > > > +# 20210108 821aa63a0940 non-widechar version of ncurses removed > > > > +if [ -e "$OBJTOP"/lib/ncurses/ncursesw ]; then > > > > + echo "Removing stale ncurses objects" > > > > + rm -rf "$OBJTOP"/lib/ncurses "$OBJTOP"/obj-lib32/lib/ncurses > > > > +fi > > > > > > Hi Kyle, > > > > > > thanks for the additional bugfix. It would be good to provide somewhere in > > > UPDATING some information about 'depend-cleanup.sh'. I use FreeBSD since > > > about 20 years, and even as a committer I had never heard something about > > > 'depend-cleanup.sh' before. > > > > Ah, this is an internal script that need not be known about for > > updating procedures. It gets run automatically for WITHOUT_CLEAN > > builds. > > Thanks for the info. Is this script executed within the scope of the commandline? > Speaking, I have NO_CLEAN=yes append to my build scripts, but I haven't made an > entry to src.conf. > I'm not sure I understand the question; it's executed as part of buildworld; specifically in "stage 2.1: cleaning up the object tree" From owner-dev-commits-src-all@freebsd.org Fri Jan 8 16:16:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6BF794CE1C6 for ; Fri, 8 Jan 2021 16:16:36 +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 4DC7X42T2Pz4Zfp for ; Fri, 8 Jan 2021 16:16:36 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) (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 426501F83 for ; Fri, 8 Jan 2021 16:16:36 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f177.google.com with SMTP id g24so6811987qtq.12 for ; Fri, 08 Jan 2021 08:16:36 -0800 (PST) X-Gm-Message-State: AOAM532aOAGqqZG8kbdxRfqZ6MQVaMJi6jwFHmH+uHwcfNlyn56Md5BT IM5WMK/qPSY5754+T6qroG1trtXGHJ/SI6FIAE0= X-Received: by 2002:ac8:44cb:: with SMTP id b11mt4187970qto.60.1610122595796; Fri, 08 Jan 2021 08:16:35 -0800 (PST) MIME-Version: 1.0 References: <202101051302.105D24lW041218@gitrepo.freebsd.org> <20210107135842.lji6ydbajmzxqiuq@ivaldir.net> In-Reply-To: From: Kyle Evans Date: Fri, 8 Jan 2021 10:16:23 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support Cc: Gordon Bergling , Baptiste Daroussin , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 16:16:36 -0000 On Fri, Jan 8, 2021 at 10:15 AM Kyle Evans wrote: > > On Fri, Jan 8, 2021 at 10:07 AM Gordon Bergling wrote: > > > > On Fri, Jan 08, 2021 at 09:48:53AM -0600, Kyle Evans wrote: > > > On Fri, Jan 8, 2021 at 9:43 AM Gordon Bergling wrote: > > > > On Fri, Jan 08, 2021 at 09:21:01AM -0600, Kyle Evans wrote: > > > > > On Thu, Jan 7, 2021 at 7:59 AM Baptiste Daroussin wrote: > > > > > > On Thu, Jan 07, 2021 at 07:53:47AM -0600, Kyle Evans wrote: > > > > > > > On Tue, Jan 5, 2021 at 7:02 AM Baptiste Daroussin wrote: > > > > > > > > The branch main has been updated by bapt: > > > > > > > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba0441562aa07 > > > > > > > > > > > > > > > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > > > > > > > > Author: Baptiste Daroussin > > > > > > > > AuthorDate: 2021-01-04 16:29:40 +0000 > > > > > > > > Commit: Baptiste Daroussin > > > > > > > > CommitDate: 2021-01-05 13:01:32 +0000 > > > > > > > > > > > > > > > > ncurses: only keep the version with widechar support > > > > > > > > > > > > > > > > Only keep the widechar version of ncurses as libncursesw.so.9 > > > > > > > > > > > > > > > > Keep the old name to avoid breaking the ABI compatibility (the non > > > > > > > > widechar version libncurses.so.9 is not binary compatible with > > > > > > > > libncursesw.so.9) since all ports and base are already only linking > > > > > > > > against the widechar version we can simply remove libncurses.so.9 > > > > > > > > > > > > > > > > Since the .9 version only lived in the dev branch and never ended in a > > > > > > > > release, it is simply removed and not added to any binary compat > > > > > > > > package. > > > > > > > > > > > > > > > > Add symlinks to keep build time compatibility for anyone linking against > > > > > > > > -lncurses > > > > > > > > --- > > > > > > > > Makefile.inc1 | 5 +-- > > > > > > > > Makefile.libcompat | 4 +- > > > > > > > > ObsoleteFiles.inc | 2 + > > > > > > > > lib/ncurses/Makefile | 6 +-- > > > > > > > > lib/ncurses/config.mk | 11 +----- > > > > > > > > lib/ncurses/form/Makefile | 18 ++++++--- > > > > > > > > lib/ncurses/formw/Makefile | 5 --- > > > > > > > > lib/ncurses/formw/Makefile.depend | 17 --------- > > > > > > > > lib/ncurses/menu/Makefile | 18 ++++++--- > > > > > > > > lib/ncurses/menuw/Makefile | 5 --- > > > > > > > > lib/ncurses/menuw/Makefile.depend | 17 --------- > > > > > > > > lib/ncurses/ncurses/Makefile | 71 +++++++++++++++-------------------- > > > > > > > > lib/ncurses/ncursesw/Makefile | 7 ---- > > > > > > > > lib/ncurses/ncursesw/Makefile.depend | 16 -------- > > > > > > > > lib/ncurses/panel/Makefile | 23 ++++++++---- > > > > > > > > lib/ncurses/panelw/Makefile | 5 --- > > > > > > > > lib/ncurses/panelw/Makefile.depend | 17 --------- > > > > > > > > share/mk/src.libnames.mk | 16 ++------ > > > > > > > > tools/bsdbox/Makefile.base | 2 +- > > > > > > > > tools/tools/ath/athratestats/Makefile | 2 +- > > > > > > > > 20 files changed, 87 insertions(+), 180 deletions(-) > > > > > > > > > > > > > > > > diff --git a/Makefile.inc1 b/Makefile.inc1 > > > > > > > > index fecdc1bdca71..a19fde9195cf 100644 > > > > > > > > --- a/Makefile.inc1 > > > > > > > > +++ b/Makefile.inc1 > > > > > > > > @@ -2524,7 +2524,6 @@ _bt_clean= ${CLEANDIR} > > > > > > > > ${LOCAL_TOOL_DIRS} \ > > > > > > > > ${_jevents} \ > > > > > > > > lib/ncurses/ncurses \ > > > > > > > > - lib/ncurses/ncursesw \ > > > > > > > > ${_rescue} \ > > > > > > > > ${_share} \ > > > > > > > > usr.bin/awk \ > > > > > > > > @@ -2870,7 +2869,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > > > > > > > lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ > > > > > > > > lib/libzstd \ > > > > > > > > ${_lib_casper} \ > > > > > > > > - lib/ncurses/ncurses lib/ncurses/ncursesw \ > > > > > > > > + lib/ncurses/ncurses \ > > > > > > > > lib/libopie lib/libpam/libpam ${_lib_libthr} \ > > > > > > > > ${_lib_libradius} lib/libsbuf lib/libtacplus \ > > > > > > > > lib/libgeom \ > > > > > > > > @@ -2891,7 +2890,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ > > > > > > > > > > > > > > > > .if ${MK_DIALOG} != "no" > > > > > > > > _prebuild_libs+= gnu/lib/libdialog > > > > > > > > -gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L > > > > > > > > +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncurses__L > > > > > > > > .endif > > > > > > > > > > > > > > > > .if ${MK_GOOGLETEST} != "no" > > > > > > > > diff --git a/Makefile.libcompat b/Makefile.libcompat > > > > > > > > index 3f23a33aa19b..85859a960d81 100644 > > > > > > > > --- a/Makefile.libcompat > > > > > > > > +++ b/Makefile.libcompat > > > > > > > > @@ -45,7 +45,7 @@ _LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib > > > > > > > > > > > > > > > > _LC_INCDIRS= \ > > > > > > > > include \ > > > > > > > > - lib/ncurses/ncursesw \ > > > > > > > > + lib/ncurses/ncurses \ > > > > > > > > ${_LC_LIBDIRS.yes} > > > > > > > > > > > > > > > > .if ${MK_FILE} != "no" > > > > > > > > @@ -94,7 +94,7 @@ build${libcompat}: .PHONY > > > > > > > > DIRPRFX=${_dir}/ ${_t} > > > > > > > > .endfor > > > > > > > > .endfor > > > > > > > > -.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevents} > > > > > > > > +.for _dir in lib/ncurses/ncurses lib/ncurses/ncurses ${_libmagic} ${_jevents} > > > > > > > > .for _t in ${_obj} build-tools > > > > > > > > ${_+_}cd ${.CURDIR}/${_dir}; \ > > > > > > > > WORLDTMP=${WORLDTMP} \ > > > > > > > > > > > > > > The second occurence of lib/ncurses/ncurses should probably just go away? > > > > > > > > > > > > > > > diff --git a/lib/ncurses/config.mk b/lib/ncurses/config.mk > > > > > > > > index d15be8601136..f199c5829b65 100644 > > > > > > > > --- a/lib/ncurses/config.mk > > > > > > > > +++ b/lib/ncurses/config.mk > > > > > > > > @@ -4,20 +4,11 @@ > > > > > > > > > > > > > > > > NCURSES_DIR= ${SRCTOP}/contrib/ncurses > > > > > > > > > > > > > > > > -.if defined(ENABLE_WIDEC) > > > > > > > > -LIB_SUFFIX= w > > > > > > > > CFLAGS+= -D_XOPEN_SOURCE_EXTENDED -DENABLE_WIDEC > > > > > > > > -NCURSES_CFG_H= ${.CURDIR:H}/ncurses/ncurses_cfg.h > > > > > > > > -.else > > > > > > > > -LIB_SUFFIX= > > > > > > > > NCURSES_CFG_H= ${.CURDIR}/ncurses_cfg.h > > > > > > > > -.endif > > > > > > > > > > > > > > > > CFLAGS+= -I. > > > > > > > > -.if exists(${.OBJDIR:H}/ncurses${LIB_SUFFIX}) > > > > > > > > -CFLAGS+= -I${.OBJDIR:H}/ncurses${LIB_SUFFIX} > > > > > > > > -.endif > > > > > > > > -CFLAGS+= -I${.CURDIR:H}/ncurses${LIB_SUFFIX} > > > > > > > > +CFLAGS+= -I${.CURDIR:H}/ncurses > > > > > > > > > > > > > > > > # for ${NCURSES_CFG_H} > > > > > > > > CFLAGS+= -I${.CURDIR:H}/ncurses > > > > > > > > > > > > > > Based on this we should really just nuke the entire ncurses dir for > > > > > > > older WITHOUT_CLEAN builds, because any objects in this objdir will > > > > > > > have been built without -DENABLE_WIDEC. Maybe just key it off of an > > > > > > > ncursesw directory existing in the objdir hierarchy and nuke it all in > > > > > > > depend-cleanup. > > > > > > > > > > > > Yes to everything you said ;) > > > > > > > > > > I see you committed the first part (thanks!) -- here's the second, > > > > > that I can commit if it seems reasonable: > > > > > > > > > > commit 619c0de456029adacdc823a3320c8768c9a40786 (HEAD -> ncdep) > > > > > Author: Kyle Evans > > > > > Date: Fri Jan 8 09:18:46 2021 -0600 > > > > > > > > > > build: add WITHOUT_CLEAN workaround for 821aa63a0940 > > > > > > > > > > The *w variants of ncurses directories went away, and the remaining names > > > > > build the widechar variants instead of non-widechar variants. As such, the > > > > > entire ncurses tree should be regenerated. > > > > > > > > > > Key off of lib/ncurses/ncursesw being present and remove the whole ncurses > > > > > hierarchy if it is. > > > > > > > > > > diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh > > > > > index 0b3ff9bcc63..23bedee1ea2 100755 > > > > > --- a/tools/build/depend-cleanup.sh > > > > > +++ b/tools/build/depend-cleanup.sh > > > > > @@ -64,3 +64,9 @@ if [ -e "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o ] && \ > > > > > echo "Removing old pf_ruleset dependecy file" > > > > > rm -rf "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o > > > > > fi > > > > > + > > > > > +# 20210108 821aa63a0940 non-widechar version of ncurses removed > > > > > +if [ -e "$OBJTOP"/lib/ncurses/ncursesw ]; then > > > > > + echo "Removing stale ncurses objects" > > > > > + rm -rf "$OBJTOP"/lib/ncurses "$OBJTOP"/obj-lib32/lib/ncurses > > > > > +fi > > > > > > > > Hi Kyle, > > > > > > > > thanks for the additional bugfix. It would be good to provide somewhere in > > > > UPDATING some information about 'depend-cleanup.sh'. I use FreeBSD since > > > > about 20 years, and even as a committer I had never heard something about > > > > 'depend-cleanup.sh' before. > > > > > > Ah, this is an internal script that need not be known about for > > > updating procedures. It gets run automatically for WITHOUT_CLEAN > > > builds. > > > > Thanks for the info. Is this script executed within the scope of the commandline? > > Speaking, I have NO_CLEAN=yes append to my build scripts, but I haven't made an > > entry to src.conf. > > > > I'm not sure I understand the question; it's executed as part of > buildworld; specifically in "stage 2.1: cleaning up the object tree" Well, where 2.1 would go between 1.2 and 2.2 or 2.3 From owner-dev-commits-src-all@freebsd.org Fri Jan 8 16:43:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 854084CEBAF; Fri, 8 Jan 2021 16:43:22 +0000 (UTC) (envelope-from git@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 4DC86y3Lz1z4chF; Fri, 8 Jan 2021 16:43:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B97226906; Fri, 8 Jan 2021 16:43:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108GhMsx014147; Fri, 8 Jan 2021 16:43:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108GhMvn014146; Fri, 8 Jan 2021 16:43:22 GMT (envelope-from git) Date: Fri, 8 Jan 2021 16:43:22 GMT Message-Id: <202101081643.108GhMvn014146@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 9be9771c8752 - main - efidev: remove EFIIOC_GET_TABLE ioctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9be9771c875259b9c99414feb3833c5af03baa8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 16:43:22 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9be9771c875259b9c99414feb3833c5af03baa8b commit 9be9771c875259b9c99414feb3833c5af03baa8b Author: Kyle Evans AuthorDate: 2021-01-07 21:51:18 +0000 Commit: Kyle Evans CommitDate: 2021-01-08 16:41:50 +0000 efidev: remove EFIIOC_GET_TABLE ioctl This ioctl would instantly induce a panic, likely since near inception, up until 0861c7d3e048. Lack of previous interest in fixing it combined with the problematic interface (exports a pointer, really a physical address) brings us to the natural conclusion: remove it until a useful consumer forward. If it eventually gets resurrected, the interface should definitely not return in this exact form and likely needs to be reimagined. The associated KPI, efi_get_table, is left intact for the time being. Reviewed by: imp, jrtc27 Also discussed with: brooks, jhb Differential Revision: https://reviews.freebsd.org/D28030 --- sys/dev/efidev/efidev.c | 8 -------- sys/sys/efiio.h | 7 ------- 2 files changed, 15 deletions(-) diff --git a/sys/dev/efidev/efidev.c b/sys/dev/efidev/efidev.c index b585db4f0117..303b10c1d0ba 100644 --- a/sys/dev/efidev/efidev.c +++ b/sys/dev/efidev/efidev.c @@ -53,14 +53,6 @@ efidev_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr, int error; switch (cmd) { - case EFIIOC_GET_TABLE: - { - struct efi_get_table_ioc *egtioc = - (struct efi_get_table_ioc *)addr; - - error = efi_get_table(&egtioc->uuid, &egtioc->ptr); - break; - } case EFIIOC_GET_TIME: { struct efi_tm *tm = (struct efi_tm *)addr; diff --git a/sys/sys/efiio.h b/sys/sys/efiio.h index 87fed9c3afd8..e5a0763536a3 100644 --- a/sys/sys/efiio.h +++ b/sys/sys/efiio.h @@ -32,12 +32,6 @@ #include #include -struct efi_get_table_ioc -{ - struct uuid uuid; /* UUID to look up */ - void *ptr; /* Pointer to table in KVA space */ -}; - struct efi_var_ioc { efi_char *name; /* User pointer to name, in wide chars */ @@ -48,7 +42,6 @@ struct efi_var_ioc size_t datasize; /* Number of *bytes* in the data */ }; -#define EFIIOC_GET_TABLE _IOWR('E', 1, struct efi_get_table_ioc) #define EFIIOC_GET_TIME _IOR('E', 2, struct efi_tm) #define EFIIOC_SET_TIME _IOW('E', 3, struct efi_tm) #define EFIIOC_VAR_GET _IOWR('E', 4, struct efi_var_ioc) From owner-dev-commits-src-all@freebsd.org Fri Jan 8 16:44:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C3A9C4CEED6; Fri, 8 Jan 2021 16:44:11 +0000 (UTC) (envelope-from git@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 4DC87v59Klz4cKc; Fri, 8 Jan 2021 16:44:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A44A726986; Fri, 8 Jan 2021 16:44:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108GiBN3014393; Fri, 8 Jan 2021 16:44:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108GiBCV014392; Fri, 8 Jan 2021 16:44:11 GMT (envelope-from git) Date: Fri, 8 Jan 2021 16:44:11 GMT Message-Id: <202101081644.108GiBCV014392@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 14a16fd3e7ec - main - build: add WITHOUT_CLEAN workaround for 821aa63a0940 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 14a16fd3e7eced5b63ffd85fdac4334e30012e84 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 16:44:11 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=14a16fd3e7eced5b63ffd85fdac4334e30012e84 commit 14a16fd3e7eced5b63ffd85fdac4334e30012e84 Author: Kyle Evans AuthorDate: 2021-01-08 15:18:46 +0000 Commit: Kyle Evans CommitDate: 2021-01-08 16:43:53 +0000 build: add WITHOUT_CLEAN workaround for 821aa63a0940 The *w variants of ncurses directories went away, and the remaining names build the widechar variants instead of non-widechar variants. As such, the entire ncurses tree should be regenerated. Key off of lib/ncurses/ncursesw being present and remove the whole ncurses hierarchy if it is. Reviewed by: emaste (IRC) --- tools/build/depend-cleanup.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh index 0b3ff9bcc635..23bedee1ea26 100755 --- a/tools/build/depend-cleanup.sh +++ b/tools/build/depend-cleanup.sh @@ -64,3 +64,9 @@ if [ -e "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o ] && \ echo "Removing old pf_ruleset dependecy file" rm -rf "$OBJTOP"/sbin/pfctl/.depend.pf_ruleset.o fi + +# 20210108 821aa63a0940 non-widechar version of ncurses removed +if [ -e "$OBJTOP"/lib/ncurses/ncursesw ]; then + echo "Removing stale ncurses objects" + rm -rf "$OBJTOP"/lib/ncurses "$OBJTOP"/obj-lib32/lib/ncurses +fi From owner-dev-commits-src-all@freebsd.org Fri Jan 8 16:56:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 95B664CF01C; Fri, 8 Jan 2021 16:56:28 +0000 (UTC) (envelope-from jhb@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 4DC8Q43fVKz4dHL; Fri, 8 Jan 2021 16:56:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:cc57:d66b:fe5:d8b5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id DE45E2294; Fri, 8 Jan 2021 16:56:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 4979620ece98 - main - armv8crypto: add AES-XTS support To: Mitchell Horne , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202101071936.107JaL8B069216@gitrepo.freebsd.org> From: John Baldwin Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Fri, 8 Jan 2021 08:56:26 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <202101071936.107JaL8B069216@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 16:56:28 -0000 On 1/7/21 11:36 AM, Mitchell Horne wrote: > The branch main has been updated by mhorne: > > URL: https://cgit.FreeBSD.org/src/commit/?id=4979620ece984ffb10c27c2db7d0e253eb84b2ba > > commit 4979620ece984ffb10c27c2db7d0e253eb84b2ba > Author: Mitchell Horne > AuthorDate: 2021-01-07 19:30:40 +0000 > Commit: Mitchell Horne > CommitDate: 2021-01-07 19:35:20 +0000 > > armv8crypto: add AES-XTS support > > A straightforward(ish) port from aesni(4). This implementation does not > perform loop unrolling on the input blocks, so this is left as a future > performance improvement. > > Submitted by: Greg V > Looks good: jhb, jmg > Tested by: mhorne > Differential Revision: https://reviews.freebsd.org/D21017 IMO, this warrants adding armv8crypto to arm64 GENERIC at the same time aesni(4) is added to amd64/i386 GENERIC. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Fri Jan 8 17:11:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A70104CFDA7; Fri, 8 Jan 2021 17:11:43 +0000 (UTC) (envelope-from jhb@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 4DC8lg4DRKz4fJS; Fri, 8 Jan 2021 17:11:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:8974:ab93:8119:cfc9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id EEBDF2702; Fri, 8 Jan 2021 17:11:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 20ac5cda965e - main - fd: make fd/fp mandatory To: Mateusz Guzik , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202101072330.107NUM8u075841@gitrepo.freebsd.org> From: John Baldwin Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <252b68ff-3021-470f-3bc7-c6c809fa4958@FreeBSD.org> Date: Fri, 8 Jan 2021 09:11:41 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <202101072330.107NUM8u075841@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 17:11:43 -0000 On 1/7/21 3:30 PM, Mateusz Guzik wrote: > The branch main has been updated by mjg: > > URL: https://cgit.FreeBSD.org/src/commit/?id=20ac5cda965eccc34f975674c6efc97c3615a234 > > commit 20ac5cda965eccc34f975674c6efc97c3615a234 > Author: Mateusz Guzik > AuthorDate: 2020-12-23 13:50:34 +0000 > Commit: Mateusz Guzik > CommitDate: 2021-01-07 23:30:04 +0000 > > fd: make fd/fp mandatory > > They are both always passed anyway. Perhaps say which part of the API this affects (seems to be falloc*() from the diff?) next time? As it reads now, the log implies it applies to all functions in the file descriptor API which can't possibly be true (fdrop doesn't take 'fd' for example). -- John Baldwin From owner-dev-commits-src-all@freebsd.org Fri Jan 8 17:26:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B86DD4D02E8; Fri, 8 Jan 2021 17:26:15 +0000 (UTC) (envelope-from git@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 4DC94R3XJ1z4gbt; Fri, 8 Jan 2021 17:26:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC7F226FB2; Fri, 8 Jan 2021 17:26:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108HQETN066308; Fri, 8 Jan 2021 17:26:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108HQEWL066307; Fri, 8 Jan 2021 17:26:14 GMT (envelope-from git) Date: Fri, 8 Jan 2021 17:26:14 GMT Message-Id: <202101081726.108HQEWL066307@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 7edc1bd9dc17 - main - When be_activate() turns on a new boot environment, it always deactivates the current one first. And if it fails to do so, it abandons activation. However, with the new bootonce feature, there is a legitimate case when a pool doesn't have "bootfs" property set. Check for this case before calling be_deactivate(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7edc1bd9dc174526c69246ba45bf2c8c230d38f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 17:26:15 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=7edc1bd9dc174526c69246ba45bf2c8c230d38f4 commit 7edc1bd9dc174526c69246ba45bf2c8c230d38f4 Author: Gleb Smirnoff AuthorDate: 2021-01-08 17:23:16 +0000 Commit: Gleb Smirnoff CommitDate: 2021-01-08 17:23:16 +0000 When be_activate() turns on a new boot environment, it always deactivates the current one first. And if it fails to do so, it abandons activation. However, with the new bootonce feature, there is a legitimate case when a pool doesn't have "bootfs" property set. Check for this case before calling be_deactivate(). Reviewed by: kevans --- lib/libbe/be.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libbe/be.c b/lib/libbe/be.c index 644cf90a6fd7..d6fe027f5df3 100644 --- a/lib/libbe/be.c +++ b/lib/libbe/be.c @@ -1263,7 +1263,8 @@ be_activate(libbe_handle_t *lbh, const char *bootenv, bool temporary) return (lzbe_set_boot_device( zpool_get_name(lbh->active_phandle), lzbe_add, be_path)); } else { - if (be_deactivate(lbh, lbh->bootfs, false) != 0) + if (strncmp(lbh->bootfs, "-", 1) != 0 && + be_deactivate(lbh, lbh->bootfs, false) != 0) return (-1); /* Obtain bootenv zpool */ From owner-dev-commits-src-all@freebsd.org Fri Jan 8 17:29:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 543CC4D001A; Fri, 8 Jan 2021 17:29:16 +0000 (UTC) (envelope-from git@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 4DC97w1z7Rz4gs2; Fri, 8 Jan 2021 17:29:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36AEC270E7; Fri, 8 Jan 2021 17:29:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108HTGsH066885; Fri, 8 Jan 2021 17:29:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108HTG7j066884; Fri, 8 Jan 2021 17:29:16 GMT (envelope-from git) Date: Fri, 8 Jan 2021 17:29:16 GMT Message-Id: <202101081729.108HTG7j066884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Chuck Tuffli Subject: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chuck X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6733401935f83754b4b2744bc3d33ef84b1271e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 17:29:16 -0000 The branch main has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=6733401935f83754b4b2744bc3d33ef84b1271e0 commit 6733401935f83754b4b2744bc3d33ef84b1271e0 Author: Chuck Tuffli AuthorDate: 2021-01-08 17:19:37 +0000 Commit: Chuck Tuffli CommitDate: 2021-01-08 17:27:56 +0000 nvmecontrol: add device self-test op and log page Add decoding of the Device Self-test log page and the ability to start or abort a test. Reviewed by: imp, mav Tested by: Muhammad Ahmad MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27517 --- sbin/nvmecontrol/Makefile | 1 + sbin/nvmecontrol/logpage.c | 103 ++++++++++++++++++++++++++++++- sbin/nvmecontrol/nvmecontrol.8 | 23 +++++++ sbin/nvmecontrol/selftest.c | 137 +++++++++++++++++++++++++++++++++++++++++ sys/dev/nvme/nvme.h | 39 ++++++++++++ 5 files changed, 302 insertions(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/Makefile b/sbin/nvmecontrol/Makefile index 71212930a6c4..b5ceb350ed0d 100644 --- a/sbin/nvmecontrol/Makefile +++ b/sbin/nvmecontrol/Makefile @@ -9,6 +9,7 @@ SRCS+= devlist.c firmware.c format.c identify.c logpage.c ns.c nsid.c SRCS+= perftest.c power.c reset.c resv.c sanitize.c SRCS+= passthru.c SRCS+= identify_ext.c nvme_util.c nc_util.c +SRCS+= selftest.c MAN= nvmecontrol.8 LDFLAGS+= -rdynamic LIBADD+= util diff --git a/sbin/nvmecontrol/logpage.c b/sbin/nvmecontrol/logpage.c index 2f7cec005592..f00d5d94897b 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -239,6 +239,10 @@ read_logpage(int fd, uint8_t log_page, uint32_t nsid, uint8_t lsp, case NVME_LOG_CHANGED_NAMESPACE: nvme_ns_list_swapbytes((struct nvme_ns_list *)payload); break; + case NVME_LOG_DEVICE_SELF_TEST: + nvme_device_self_test_swapbytes( + (struct nvme_device_self_test_page *)payload); + break; case NVME_LOG_COMMAND_EFFECT: nvme_command_effects_page_swapbytes( (struct nvme_command_effects_page *)payload); @@ -588,6 +592,103 @@ print_log_sanitize_status(const struct nvme_controller_data *cdata __unused, printf("Time For Crypto Erase No-Deallocate: %u sec\n", ss->etfcewnd); } +static const char * +self_test_res[] = { + [0] = "completed without error", + [1] = "aborted by a Device Self-test command", + [2] = "aborted by a Controller Level Reset", + [3] = "aborted due to namespace removal", + [4] = "aborted due to Format NVM command", + [5] = "failed due to fatal or unknown test error", + [6] = "completed with an unknown segment that failed", + [7] = "completed with one or more failed segments", + [8] = "aborted for unknown reason", + [9] = "aborted due to a sanitize operation", +}; +static uint32_t self_test_res_max = nitems(self_test_res); + +static void +print_log_self_test_status(const struct nvme_controller_data *cdata __unused, + void *buf, uint32_t size __unused) +{ + struct nvme_device_self_test_page *dst; + uint32_t r; + + dst = buf; + printf("Device Self-test Status\n"); + printf("=======================\n"); + + printf("Current Operation: "); + switch (dst->curr_operation) { + case 0x0: + printf("No device self-test operation in progress\n"); + break; + case 0x1: + printf("Short device self-test operation in progress\n"); + break; + case 0x2: + printf("Extended device self-test operation in progress\n"); + break; + case 0xe: + printf("Vendor specific\n"); + break; + default: + printf("Reserved (0x%x)\n", dst->curr_operation); + } + + if (dst->curr_operation != 0) + printf("Current Completion: %u%%\n", dst->curr_compl & 0x7f); + + printf("Results\n"); + for (r = 0; r < 20; r++) { + uint64_t failing_lba; + uint8_t code, res; + + code = (dst->result[r].status >> 4) & 0xf; + res = dst->result[r].status & 0xf; + + if (res == 0xf) + continue; + + printf("[%2u] ", r); + switch (code) { + case 0x1: + printf("Short device self-test"); + break; + case 0x2: + printf("Extended device self-test"); + break; + case 0xe: + printf("Vendor specific"); + break; + default: + printf("Reserved (0x%x)", code); + } + if (res < self_test_res_max) + printf(" %s", self_test_res[res]); + else + printf(" Reserved status 0x%x", res); + + if (res == 7) + printf(" starting in segment %u", dst->result[r].segment_num); + +#define BIT(b) (1 << (b)) + if (dst->result[r].valid_diag_info & BIT(0)) + printf(" NSID=0x%x", dst->result[r].nsid); + if (dst->result[r].valid_diag_info & BIT(1)) { + memcpy(&failing_lba, dst->result[r].failing_lba, + sizeof(failing_lba)); + printf(" FLBA=0x%lx", failing_lba); + } + if (dst->result[r].valid_diag_info & BIT(2)) + printf(" SCT=0x%x", dst->result[r].status_code_type); + if (dst->result[r].valid_diag_info & BIT(3)) + printf(" SC=0x%x", dst->result[r].status_code); +#undef BIT + printf("\n"); + } +} + /* * Table of log page printer / sizing. * @@ -611,7 +712,7 @@ NVME_LOGPAGE(ce, print_log_command_effects, sizeof(struct nvme_command_effects_page)); NVME_LOGPAGE(dst, NVME_LOG_DEVICE_SELF_TEST, NULL, "Device Self-test", - NULL, 564); + print_log_self_test_status, sizeof(struct nvme_device_self_test_page)); NVME_LOGPAGE(thi, NVME_LOG_TELEMETRY_HOST_INITIATED, NULL, "Telemetry Host-Initiated", NULL, DEFAULT_SIZE); diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index 976532932a69..2d634eb54216 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -177,6 +177,10 @@ .Op Fl p power_state .Op Fl w workload_hint .Nm +.Ic selftest +.Aq Fl c Ar code +.Aq Ar device-id | Ar namespace-id +.Nm .Ic wdc cap-diag .Op Fl o path_template .Aq Ar device-id @@ -254,6 +258,8 @@ Firmware Information Changed Namespace List .It Dv Page 0x05 Commands Supported and Effects +.It Dv Page 0x06 +Device Self-test .It Dv Page 0x80 Reservation Notification .It Dv Page 0x81 @@ -464,6 +470,23 @@ Run in mode. This will report status on a sanitize that is already running on the drive. .El +.Ss selftest +Start the specified device self-test: +.Bl -tag -width 6n +.It Fl c Ar code +Specify the device self-test command code. +Common codes are: +.Bl -tag -compact -width 6n +.It Dv 0x1 +Start a short device self-test operation +.It Dv 0x2 +Start an extended device self-test operation +.It Dv 0xe +Start a vendor specific device self-test operation +.It Dv 0xf +Abort the device self-test operation +.El +.El .Ss wdc The various wdc command retrieve log data from the wdc/hgst drives. The diff --git a/sbin/nvmecontrol/selftest.c b/sbin/nvmecontrol/selftest.c new file mode 100644 index 000000000000..17945248f8e3 --- /dev/null +++ b/sbin/nvmecontrol/selftest.c @@ -0,0 +1,137 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Chuck Tuffli + * + * 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 +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nvmecontrol.h" + +#define SELFTEST_CODE_NONE 0xffu +#define SELFTEST_CODE_MAX 0xfu + +static struct options { + const char *dev; + uint8_t stc; /* Self-test Code */ +} opt = { + .dev = NULL, + .stc = SELFTEST_CODE_NONE, +}; + +static void +selftest_op(int fd, uint32_t nsid, uint8_t stc) +{ + struct nvme_pt_command pt; + + memset(&pt, 0, sizeof(pt)); + pt.cmd.opc = NVME_OPC_DEVICE_SELF_TEST; + pt.cmd.nsid = htole32(nsid); + pt.cmd.cdw10 = htole32(stc); + + if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) + err(EX_IOERR, "self-test request failed"); + + if (NVME_STATUS_GET_SCT(pt.cpl.status) == NVME_SCT_COMMAND_SPECIFIC && + NVME_STATUS_GET_SC(pt.cpl.status) == NVME_SC_SELF_TEST_IN_PROGRESS) + errx(EX_UNAVAILABLE, "device self-test in progress"); + else if (nvme_completion_is_error(&pt.cpl)) + errx(EX_IOERR, "self-test request returned error"); +} + +static void +selftest(const struct cmd *f, int argc, char *argv[]) +{ + struct nvme_controller_data cdata; + int fd; + char *path; + uint32_t nsid; + + if (arg_parse(argc, argv, f)) + return; + + open_dev(opt.dev, &fd, 1, 1); + get_nsid(fd, &path, &nsid); + if (nsid != 0) { + close(fd); + open_dev(path, &fd, 1, 1); + } + free(path); + + if (opt.stc == SELFTEST_CODE_NONE) + errx(EX_USAGE, "must specify a Self-test Code"); + else if (opt.stc > SELFTEST_CODE_MAX) + errx(EX_DATAERR, "illegal Self-test Code 0x%x", opt.stc); + + if (read_controller_data(fd, &cdata)) + errx(EX_IOERR, "Identify request failed"); + + if (((cdata.oacs >> NVME_CTRLR_DATA_OACS_SELFTEST_SHIFT) & + NVME_CTRLR_DATA_OACS_SELFTEST_MASK) == 0) + errx(EX_UNAVAILABLE, "controller does not support self-test"); + + selftest_op(fd, nsid, opt.stc); + + close(fd); + exit(0); +} + +static const struct opts selftest_opts[] = { +#define OPT(l, s, t, opt, addr, desc) { l, s, t, &opt.addr, desc } + OPT("test-code", 'c', arg_uint8, opt, stc, + "Self-test Code to execute"), + { NULL, 0, arg_none, NULL, NULL } +}; +#undef OPT + +static struct args selftest_args[] = { + { arg_string, &opt.dev, "controller-id|namespace-id" }, + { arg_none, NULL, NULL }, +}; + +static struct cmd selftest_cmd = { + .name = "selftest", + .fn = selftest, + .descr = "Start device self-test", + .ctx_size = sizeof(opt), + .opts = selftest_opts, + .args = selftest_args, +}; + +CMD_COMMAND(selftest_cmd); diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 3c159b1fd0fc..67d02ba73fd8 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -1396,6 +1396,28 @@ struct nvme_command_effects_page { _Static_assert(sizeof(struct nvme_command_effects_page) == 4096, "bad size for nvme_command_effects_page"); +struct nvme_device_self_test_page { + uint8_t curr_operation; + uint8_t curr_compl; + uint8_t rsvd2[2]; + struct { + uint8_t status; + uint8_t segment_num; + uint8_t valid_diag_info; + uint8_t rsvd3; + uint64_t poh; + uint32_t nsid; + /* Define as an array to simplify alignment issues */ + uint8_t failing_lba[8]; + uint8_t status_code_type; + uint8_t status_code; + uint8_t vendor_specific[2]; + } __packed result[20]; +} __packed __aligned(4); + +_Static_assert(sizeof(struct nvme_device_self_test_page) == 564, + "bad size for nvme_device_self_test_page"); + struct nvme_res_notification_page { uint64_t log_page_count; uint8_t log_page_type; @@ -2016,4 +2038,21 @@ void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s __unused, #endif } +static inline void +nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s __unused) +{ +#if _BYTE_ORDER != _LITTLE_ENDIAN + uint64_t failing_lba; + uint32_t r; + + for (r = 0; r < 20; r++) { + s->result[r].poh = le64toh(s->result[r].poh); + s->result[r].nsid = le32toh(s->result[r].nsid); + /* Unaligned 64-bit loads fail on some architectures */ + memcpy(&failing_lba, s->result[r].failing_lba, sizeof(failing_lba)); + failing_lba = le64toh(failing_lba); + memcpy(s->result[r].failing_lba, &failing_lba, sizeof(failing_lba)); + } +#endif +} #endif /* __NVME_H__ */ From owner-dev-commits-src-all@freebsd.org Fri Jan 8 17:36:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 95E774D0B22; Fri, 8 Jan 2021 17:36:33 +0000 (UTC) (envelope-from git@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 4DC9JK3qMKz4hZT; Fri, 8 Jan 2021 17:36:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76167271A4; Fri, 8 Jan 2021 17:36:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108HaXFc079955; Fri, 8 Jan 2021 17:36:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108HaXpm079954; Fri, 8 Jan 2021 17:36:33 GMT (envelope-from git) Date: Fri, 8 Jan 2021 17:36:33 GMT Message-Id: <202101081736.108HaXpm079954@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 52df1d554f94 - stable/12 - MFC llvm fixes for building ceph on powerpc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 52df1d554f94504aed51abff71bd667be5c53802 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 17:36:33 -0000 The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=52df1d554f94504aed51abff71bd667be5c53802 commit 52df1d554f94504aed51abff71bd667be5c53802 Author: Dimitry Andric AuthorDate: 2021-01-08 16:35:18 +0000 Commit: Dimitry Andric CommitDate: 2021-01-08 17:31:40 +0000 MFC llvm fixes for building ceph on powerpc Merge commit 8f5e3c74b from llvm git (by Teresa Johnson): [PowerPC] Fix compile time issue in recursive CTR analysis code Summary: Avoid re-examining operands on recursive walk looking for CTR. This was causing huge compile time after some earlier optimization created a large expression. The start of the expression (created by IndVarSimplify) looked like: %469 = lshr i64 trunc (i128 xor (i128 udiv (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zex t (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011), i128 64), i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011)) to i64), i64 45) to i128) , i128 8192506886679785011), i128 64), i128 ! mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011), i128 64), i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011)) to i64), i64 45) to i128), ... with the _ZN4absl13hash_internal13CityHashState5kSeedE referenced many times. Reviewers: hfinkel Subscribers: nemanjai, hiraditya, kbarton, jsji, shchenz, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D75790 Merge commit 4f568fbd2 from llvm git (by Nemanja Ivanovic): [PowerPC] Do not emit HW loop when TLS var accessed in PHI of loop exit If any PHI nodes in loop exit blocks have incoming values from the loop that are accesses of TLS variables with local dynamic or general dynamic TLS model, the address will be computed inside the loop. Since this includes a call to __tls_get_addr, this will in turn cause the CTR loops verifier to complain. Disable CTR loops in such cases. Fixes: https://bugs.llvm.org/show_bug.cgi?id=48527 This should fix building ceph 12.2.12 on powerpc64, powerpc, powerpcspe and powerpc64le. Requested by: pkubaj (cherry picked from commit 543478be758fdfbf050eca5b58b7c74ba51b9175) --- .../lib/Target/PowerPC/PPCTargetTransformInfo.cpp | 72 ++++++++++++++-------- .../lib/Target/PowerPC/PPCTargetTransformInfo.h | 3 +- 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp index e05699cc95ec..db591fad39e7 100644 --- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp +++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp @@ -213,8 +213,31 @@ unsigned PPCTTIImpl::getUserCost(const User *U, return BaseT::getUserCost(U, Operands); } -bool PPCTTIImpl::mightUseCTR(BasicBlock *BB, - TargetLibraryInfo *LibInfo) { +// Determining the address of a TLS variable results in a function call in +// certain TLS models. +static bool memAddrUsesCTR(const Value *MemAddr, const PPCTargetMachine &TM, + SmallPtrSetImpl &Visited) { + // No need to traverse again if we already checked this operand. + if (!Visited.insert(MemAddr).second) + return false; + const auto *GV = dyn_cast(MemAddr); + if (!GV) { + // Recurse to check for constants that refer to TLS global variables. + if (const auto *CV = dyn_cast(MemAddr)) + for (const auto &CO : CV->operands()) + if (memAddrUsesCTR(CO, TM, Visited)) + return true; + return false; + } + + if (!GV->isThreadLocal()) + return false; + TLSModel::Model Model = TM.getTLSModel(GV); + return Model == TLSModel::GeneralDynamic || Model == TLSModel::LocalDynamic; +} + +bool PPCTTIImpl::mightUseCTR(BasicBlock *BB, TargetLibraryInfo *LibInfo, + SmallPtrSetImpl &Visited) { const PPCTargetMachine &TM = ST->getTargetMachine(); // Loop through the inline asm constraints and look for something that @@ -231,28 +254,6 @@ bool PPCTTIImpl::mightUseCTR(BasicBlock *BB, return false; }; - // Determining the address of a TLS variable results in a function call in - // certain TLS models. - std::function memAddrUsesCTR = - [&memAddrUsesCTR, &TM](const Value *MemAddr) -> bool { - const auto *GV = dyn_cast(MemAddr); - if (!GV) { - // Recurse to check for constants that refer to TLS global variables. - if (const auto *CV = dyn_cast(MemAddr)) - for (const auto &CO : CV->operands()) - if (memAddrUsesCTR(CO)) - return true; - - return false; - } - - if (!GV->isThreadLocal()) - return false; - TLSModel::Model Model = TM.getTLSModel(GV); - return Model == TLSModel::GeneralDynamic || - Model == TLSModel::LocalDynamic; - }; - auto isLargeIntegerTy = [](bool Is32Bit, Type *Ty) { if (IntegerType *ITy = dyn_cast(Ty)) return ITy->getBitWidth() > (Is32Bit ? 32U : 64U); @@ -468,7 +469,7 @@ bool PPCTTIImpl::mightUseCTR(BasicBlock *BB, } for (Value *Operand : J->operands()) - if (memAddrUsesCTR(Operand)) + if (memAddrUsesCTR(Operand, TM, Visited)) return true; } @@ -498,9 +499,10 @@ bool PPCTTIImpl::isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE, // We don't want to spill/restore the counter register, and so we don't // want to use the counter register if the loop contains calls. + SmallPtrSet Visited; for (Loop::block_iterator I = L->block_begin(), IE = L->block_end(); I != IE; ++I) - if (mightUseCTR(*I, LibInfo)) + if (mightUseCTR(*I, LibInfo, Visited)) return false; SmallVector ExitingBlocks; @@ -527,6 +529,24 @@ bool PPCTTIImpl::isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE, } } + // If an exit block has a PHI that accesses a TLS variable as one of the + // incoming values from the loop, we cannot produce a CTR loop because the + // address for that value will be computed in the loop. + SmallVector ExitBlocks; + L->getExitBlocks(ExitBlocks); + for (auto &BB : ExitBlocks) { + for (auto &PHI : BB->phis()) { + for (int Idx = 0, EndIdx = PHI.getNumIncomingValues(); Idx < EndIdx; + Idx++) { + const BasicBlock *IncomingBB = PHI.getIncomingBlock(Idx); + const Value *IncomingValue = PHI.getIncomingValue(Idx); + if (L->contains(IncomingBB) && + memAddrUsesCTR(IncomingValue, TM, Visited)) + return false; + } + } + } + LLVMContext &C = L->getHeader()->getContext(); HWLoopInfo.CountType = TM.isPPC64() ? Type::getInt64Ty(C) : Type::getInt32Ty(C); diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h index 35388d14f606..a709282bb76c 100644 --- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h +++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h @@ -33,7 +33,8 @@ class PPCTTIImpl : public BasicTTIImplBase { const PPCSubtarget *getST() const { return ST; } const PPCTargetLowering *getTLI() const { return TLI; } - bool mightUseCTR(BasicBlock *BB, TargetLibraryInfo *LibInfo); + bool mightUseCTR(BasicBlock *BB, TargetLibraryInfo *LibInfo, + SmallPtrSetImpl &Visited); public: explicit PPCTTIImpl(const PPCTargetMachine *TM, const Function &F) From owner-dev-commits-src-all@freebsd.org Fri Jan 8 17:37:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6B73B4D0A31; Fri, 8 Jan 2021 17:37:22 +0000 (UTC) (envelope-from git@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 4DC9KG2b0Rz4hbj; Fri, 8 Jan 2021 17:37:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B346271A5; Fri, 8 Jan 2021 17:37:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108HbMA1080178; Fri, 8 Jan 2021 17:37:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108HbMNQ080177; Fri, 8 Jan 2021 17:37:22 GMT (envelope-from git) Date: Fri, 8 Jan 2021 17:37:22 GMT Message-Id: <202101081737.108HbMNQ080177@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 431980466ff0 - main - Don't offset the UAR map twice in mlx5en(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 431980466ff05947975cae6a85188b6a54c05939 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 17:37:22 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=431980466ff05947975cae6a85188b6a54c05939 commit 431980466ff05947975cae6a85188b6a54c05939 Author: Hans Petter Selasky AuthorDate: 2021-01-08 17:32:16 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-08 17:35:49 +0000 Don't offset the UAR map twice in mlx5en(4). The new UAR API already offsets the UAR map pointer the mlx5en(4) is using. While at it remove some no longer needed variables for keeping track of the current BF offset. This fixes a regression issue after the new UAR allocation APIs were introduced. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/mlx5/mlx5_en/en.h | 8 +------- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 1 - sys/dev/mlx5/mlx5_en/mlx5_en_rl.c | 5 ----- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/en.h b/sys/dev/mlx5/mlx5_en/en.h index b7c05264008a..b990bb754962 100644 --- a/sys/dev/mlx5/mlx5_en/en.h +++ b/sys/dev/mlx5/mlx5_en/en.h @@ -807,7 +807,6 @@ struct mlx5e_sq { /* dirtied @xmit */ u16 pc __aligned(MLX5E_CACHELINE_SIZE); - u16 bf_offset; u16 cev_counter; /* completion event counter */ u16 cev_factor; /* completion event factor */ u16 cev_next_state; /* next completion event state */ @@ -830,7 +829,6 @@ struct mlx5e_sq { void __iomem *uar_map; struct ifnet *ifp; u32 sqn; - u32 bf_buf_size; u32 mkey_be; u16 max_inline; u8 min_inline_mode; @@ -1130,8 +1128,6 @@ void mlx5e_del_all_vlan_rules(struct mlx5e_priv *priv); static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe) { - u16 ofst = MLX5_BF_OFFSET + sq->bf_offset; - /* ensure wqe is visible to device before updating doorbell record */ wmb(); @@ -1143,10 +1139,8 @@ mlx5e_tx_notify_hw(struct mlx5e_sq *sq, u32 *wqe) */ wmb(); - mlx5_write64(wqe, sq->uar_map + ofst, + mlx5_write64(wqe, sq->uar_map, MLX5_GET_DOORBELL_LOCK(&sq->priv->doorbell_lock)); - - sq->bf_offset ^= sq->bf_buf_size; } static inline void diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 9fc3af186c0d..0d4028e240ca 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -1668,7 +1668,6 @@ mlx5e_create_sq(struct mlx5e_channel *c, goto err_free_dma_tag; sq->wq.db = &sq->wq.db[MLX5_SND_DBR]; - sq->bf_buf_size = (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2; err = mlx5e_alloc_sq_db(sq); if (err) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c index 7291253b8168..95fb59726e24 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c @@ -124,11 +124,6 @@ mlx5e_rl_create_sq(struct mlx5e_priv *priv, struct mlx5e_sq *sq, goto err_free_dma_tag; sq->wq.db = &sq->wq.db[MLX5_SND_DBR]; - /* - * The sq->bf_buf_size variable is intentionally left zero so - * that the doorbell writes will occur at the same memory - * location. - */ err = mlx5e_alloc_sq_db(sq); if (err) From owner-dev-commits-src-all@freebsd.org Fri Jan 8 17:39:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 22C2C4D0D6E; Fri, 8 Jan 2021 17:39:06 +0000 (UTC) (envelope-from git@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 4DC9MG0VGdz4hxV; Fri, 8 Jan 2021 17:39:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03C972738E; Fri, 8 Jan 2021 17:39:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108Hd5E4080529; Fri, 8 Jan 2021 17:39:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108Hd5L9080528; Fri, 8 Jan 2021 17:39:05 GMT (envelope-from git) Date: Fri, 8 Jan 2021 17:39:05 GMT Message-Id: <202101081739.108Hd5L9080528@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 15b3e1e51cb5 - stable/11 - MFC llvm fixes for building ceph on powerpc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 15b3e1e51cb59f69e3971e6c4ad010d27325a2d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 17:39:06 -0000 The branch stable/11 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=15b3e1e51cb59f69e3971e6c4ad010d27325a2d9 commit 15b3e1e51cb59f69e3971e6c4ad010d27325a2d9 Author: Dimitry Andric AuthorDate: 2021-01-08 17:37:25 +0000 Commit: Dimitry Andric CommitDate: 2021-01-08 17:38:04 +0000 MFC llvm fixes for building ceph on powerpc Merge commit 8f5e3c74b from llvm git (by Teresa Johnson): [PowerPC] Fix compile time issue in recursive CTR analysis code Summary: Avoid re-examining operands on recursive walk looking for CTR. This was causing huge compile time after some earlier optimization created a large expression. The start of the expression (created by IndVarSimplify) looked like: %469 = lshr i64 trunc (i128 xor (i128 udiv (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zex t (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011), i128 64), i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011)) to i64), i64 45) to i128) , i128 8192506886679785011), i128 64), i128 ! mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011), i128 64), i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011)) to i64), i64 45) to i128), ... with the _ZN4absl13hash_internal13CityHashState5kSeedE referenced many times. Reviewers: hfinkel Subscribers: nemanjai, hiraditya, kbarton, jsji, shchenz, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D75790 Merge commit 4f568fbd2 from llvm git (by Nemanja Ivanovic): [PowerPC] Do not emit HW loop when TLS var accessed in PHI of loop exit If any PHI nodes in loop exit blocks have incoming values from the loop that are accesses of TLS variables with local dynamic or general dynamic TLS model, the address will be computed inside the loop. Since this includes a call to __tls_get_addr, this will in turn cause the CTR loops verifier to complain. Disable CTR loops in such cases. Fixes: https://bugs.llvm.org/show_bug.cgi?id=48527 This should fix building ceph 12.2.12 on powerpc64, powerpc, powerpcspe and powerpc64le. Requested by: pkubaj (cherry picked from commit 543478be758fdfbf050eca5b58b7c74ba51b9175) --- .../lib/Target/PowerPC/PPCTargetTransformInfo.cpp | 72 ++++++++++++++-------- .../lib/Target/PowerPC/PPCTargetTransformInfo.h | 3 +- 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp index e05699cc95ec..db591fad39e7 100644 --- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp +++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp @@ -213,8 +213,31 @@ unsigned PPCTTIImpl::getUserCost(const User *U, return BaseT::getUserCost(U, Operands); } -bool PPCTTIImpl::mightUseCTR(BasicBlock *BB, - TargetLibraryInfo *LibInfo) { +// Determining the address of a TLS variable results in a function call in +// certain TLS models. +static bool memAddrUsesCTR(const Value *MemAddr, const PPCTargetMachine &TM, + SmallPtrSetImpl &Visited) { + // No need to traverse again if we already checked this operand. + if (!Visited.insert(MemAddr).second) + return false; + const auto *GV = dyn_cast(MemAddr); + if (!GV) { + // Recurse to check for constants that refer to TLS global variables. + if (const auto *CV = dyn_cast(MemAddr)) + for (const auto &CO : CV->operands()) + if (memAddrUsesCTR(CO, TM, Visited)) + return true; + return false; + } + + if (!GV->isThreadLocal()) + return false; + TLSModel::Model Model = TM.getTLSModel(GV); + return Model == TLSModel::GeneralDynamic || Model == TLSModel::LocalDynamic; +} + +bool PPCTTIImpl::mightUseCTR(BasicBlock *BB, TargetLibraryInfo *LibInfo, + SmallPtrSetImpl &Visited) { const PPCTargetMachine &TM = ST->getTargetMachine(); // Loop through the inline asm constraints and look for something that @@ -231,28 +254,6 @@ bool PPCTTIImpl::mightUseCTR(BasicBlock *BB, return false; }; - // Determining the address of a TLS variable results in a function call in - // certain TLS models. - std::function memAddrUsesCTR = - [&memAddrUsesCTR, &TM](const Value *MemAddr) -> bool { - const auto *GV = dyn_cast(MemAddr); - if (!GV) { - // Recurse to check for constants that refer to TLS global variables. - if (const auto *CV = dyn_cast(MemAddr)) - for (const auto &CO : CV->operands()) - if (memAddrUsesCTR(CO)) - return true; - - return false; - } - - if (!GV->isThreadLocal()) - return false; - TLSModel::Model Model = TM.getTLSModel(GV); - return Model == TLSModel::GeneralDynamic || - Model == TLSModel::LocalDynamic; - }; - auto isLargeIntegerTy = [](bool Is32Bit, Type *Ty) { if (IntegerType *ITy = dyn_cast(Ty)) return ITy->getBitWidth() > (Is32Bit ? 32U : 64U); @@ -468,7 +469,7 @@ bool PPCTTIImpl::mightUseCTR(BasicBlock *BB, } for (Value *Operand : J->operands()) - if (memAddrUsesCTR(Operand)) + if (memAddrUsesCTR(Operand, TM, Visited)) return true; } @@ -498,9 +499,10 @@ bool PPCTTIImpl::isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE, // We don't want to spill/restore the counter register, and so we don't // want to use the counter register if the loop contains calls. + SmallPtrSet Visited; for (Loop::block_iterator I = L->block_begin(), IE = L->block_end(); I != IE; ++I) - if (mightUseCTR(*I, LibInfo)) + if (mightUseCTR(*I, LibInfo, Visited)) return false; SmallVector ExitingBlocks; @@ -527,6 +529,24 @@ bool PPCTTIImpl::isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE, } } + // If an exit block has a PHI that accesses a TLS variable as one of the + // incoming values from the loop, we cannot produce a CTR loop because the + // address for that value will be computed in the loop. + SmallVector ExitBlocks; + L->getExitBlocks(ExitBlocks); + for (auto &BB : ExitBlocks) { + for (auto &PHI : BB->phis()) { + for (int Idx = 0, EndIdx = PHI.getNumIncomingValues(); Idx < EndIdx; + Idx++) { + const BasicBlock *IncomingBB = PHI.getIncomingBlock(Idx); + const Value *IncomingValue = PHI.getIncomingValue(Idx); + if (L->contains(IncomingBB) && + memAddrUsesCTR(IncomingValue, TM, Visited)) + return false; + } + } + } + LLVMContext &C = L->getHeader()->getContext(); HWLoopInfo.CountType = TM.isPPC64() ? Type::getInt64Ty(C) : Type::getInt32Ty(C); diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h index 35388d14f606..a709282bb76c 100644 --- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h +++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h @@ -33,7 +33,8 @@ class PPCTTIImpl : public BasicTTIImplBase { const PPCSubtarget *getST() const { return ST; } const PPCTargetLowering *getTLI() const { return TLI; } - bool mightUseCTR(BasicBlock *BB, TargetLibraryInfo *LibInfo); + bool mightUseCTR(BasicBlock *BB, TargetLibraryInfo *LibInfo, + SmallPtrSetImpl &Visited); public: explicit PPCTTIImpl(const PPCTargetMachine *TM, const Function &F) From owner-dev-commits-src-all@freebsd.org Fri Jan 8 18:32:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D94164D1CF9; Fri, 8 Jan 2021 18:32:31 +0000 (UTC) (envelope-from git@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 4DCBXv5rbpz4mG1; Fri, 8 Jan 2021 18:32:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB82827D47; Fri, 8 Jan 2021 18:32:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108IWVJa056778; Fri, 8 Jan 2021 18:32:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108IWVsE056777; Fri, 8 Jan 2021 18:32:31 GMT (envelope-from git) Date: Fri, 8 Jan 2021 18:32:31 GMT Message-Id: <202101081832.108IWVsE056777@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: adc0dcc352bb - main - mpr, mps: Fix an off-by-one bug in the BTDH_MAPPING ioctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: adc0dcc352bb9f5a67a054d95c6959ea5aa26d91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 18:32:31 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=adc0dcc352bb9f5a67a054d95c6959ea5aa26d91 commit adc0dcc352bb9f5a67a054d95c6959ea5aa26d91 Author: Mark Johnston AuthorDate: 2021-01-08 18:32:05 +0000 Commit: Mark Johnston CommitDate: 2021-01-08 18:32:05 +0000 mpr, mps: Fix an off-by-one bug in the BTDH_MAPPING ioctl The device mapping table contains sc->max_devices entries, so only indices in [0, sc->max_devices) are valid. MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27964 --- sys/dev/mpr/mpr_user.c | 2 +- sys/dev/mps/mps_user.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mpr/mpr_user.c b/sys/dev/mpr/mpr_user.c index 236e5c9715df..cab865e2e535 100644 --- a/sys/dev/mpr/mpr_user.c +++ b/sys/dev/mpr/mpr_user.c @@ -2226,7 +2226,7 @@ mpr_user_btdh(struct mpr_softc *sc, mpr_btdh_mapping_t *data) if (bus != 0) return (EINVAL); - if (target > sc->max_devices) { + if (target >= sc->max_devices) { mpr_dprint(sc, MPR_XINFO, "Target ID is out of range " "for Bus/Target to DevHandle mapping."); return (EINVAL); diff --git a/sys/dev/mps/mps_user.c b/sys/dev/mps/mps_user.c index c80fbc68cdf3..9d4aab54562f 100644 --- a/sys/dev/mps/mps_user.c +++ b/sys/dev/mps/mps_user.c @@ -2128,7 +2128,7 @@ mps_user_btdh(struct mps_softc *sc, mps_btdh_mapping_t *data) if (bus != 0) return (EINVAL); - if (target > sc->max_devices) { + if (target >= sc->max_devices) { mps_dprint(sc, MPS_FAULT, "Target ID is out of range " "for Bus/Target to DevHandle mapping."); return (EINVAL); From owner-dev-commits-src-all@freebsd.org Fri Jan 8 18:32:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EF56C4D2218; Fri, 8 Jan 2021 18:32:31 +0000 (UTC) (envelope-from git@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 4DCBXv6RkKz4mYj; Fri, 8 Jan 2021 18:32:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEC0E27DD4; Fri, 8 Jan 2021 18:32:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108IWVL8056796; Fri, 8 Jan 2021 18:32:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108IWVfr056795; Fri, 8 Jan 2021 18:32:31 GMT (envelope-from git) Date: Fri, 8 Jan 2021 18:32:31 GMT Message-Id: <202101081832.108IWVfr056795@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: de828a91db29 - main - mpr, mps: Fix a stack buffer overflow in the user passthru ioctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de828a91db29fb20440e0d92f3d3136b314a9584 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 18:32:32 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=de828a91db29fb20440e0d92f3d3136b314a9584 commit de828a91db29fb20440e0d92f3d3136b314a9584 Author: Mark Johnston AuthorDate: 2021-01-08 18:32:04 +0000 Commit: Mark Johnston CommitDate: 2021-01-08 18:32:04 +0000 mpr, mps: Fix a stack buffer overflow in the user passthru ioctl Previously we copied in the request into a stack-allocated structure that could be smaller than the request size. Furthermore, we checked the request size only after doing the copyin. Fix this by allocating a buffer to hold the request, then copying the buffer's contents into a command descriptor. This is a bit heavy-handed but I expect the overhead will not be noticeable. The approach of coping the header in first is susceptible to TOCTOU problems. Reviewed by: imp Reported by: maxpl0it@protonmail.com MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27963 --- sys/dev/mpr/mpr_user.c | 30 +++++++++++++++--------------- sys/dev/mps/mps_user.c | 32 ++++++++++++++++---------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/sys/dev/mpr/mpr_user.c b/sys/dev/mpr/mpr_user.c index c0d35237d2f7..236e5c9715df 100644 --- a/sys/dev/mpr/mpr_user.c +++ b/sys/dev/mpr/mpr_user.c @@ -737,11 +737,12 @@ RetFree: static int mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru_t *data) { - MPI2_REQUEST_HEADER *hdr, tmphdr; + MPI2_REQUEST_HEADER *hdr, *tmphdr; MPI2_DEFAULT_REPLY *rpl; Mpi26NVMeEncapsulatedErrorReply_t *nvme_error_reply = NULL; Mpi26NVMeEncapsulatedRequest_t *nvme_encap_request = NULL; struct mpr_command *cm = NULL; + void *req = NULL; int i, err = 0, dir = 0, sz; uint8_t tool, function = 0; u_int sense_len; @@ -793,22 +794,21 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru_t *data) data->ReplySize, data->PtrData, data->DataSize, data->PtrDataOut, data->DataOutSize, data->DataDirection); - /* - * copy in the header so we know what we're dealing with before we - * commit to allocating a command for it. - */ - err = copyin(PTRIN(data->PtrRequest), &tmphdr, data->RequestSize); - if (err != 0) - goto RetFreeUnlocked; - - if (data->RequestSize > (int)sc->reqframesz) { + if (data->RequestSize > sc->reqframesz) { err = EINVAL; goto RetFreeUnlocked; } - function = tmphdr.Function; + req = malloc(data->RequestSize, M_MPRUSER, M_WAITOK | M_ZERO); + tmphdr = (MPI2_REQUEST_HEADER *)req; + + err = copyin(PTRIN(data->PtrRequest), req, data->RequestSize); + if (err != 0) + goto RetFreeUnlocked; + + function = tmphdr->Function; mpr_dprint(sc, MPR_USER, "%s: Function %02X MsgFlags %02X\n", __func__, - function, tmphdr.MsgFlags); + function, tmphdr->MsgFlags); /* * Handle a passthru TM request. @@ -825,7 +825,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru_t *data) /* Copy the header in. Only a small fixup is needed. */ task = (MPI2_SCSI_TASK_MANAGE_REQUEST *)cm->cm_req; - bcopy(&tmphdr, task, data->RequestSize); + memcpy(task, req, data->RequestSize); task->TaskMID = cm->cm_desc.Default.SMID; cm->cm_data = NULL; @@ -872,7 +872,6 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru_t *data) mpr_lock(sc); cm = mpr_alloc_command(sc); - if (cm == NULL) { mpr_printf(sc, "%s: no mpr requests\n", __func__); err = ENOMEM; @@ -881,7 +880,7 @@ mpr_user_pass_thru(struct mpr_softc *sc, mpr_pass_thru_t *data) mpr_unlock(sc); hdr = (MPI2_REQUEST_HEADER *)cm->cm_req; - bcopy(&tmphdr, hdr, data->RequestSize); + memcpy(hdr, req, data->RequestSize); /* * Do some checking to make sure the IOCTL request contains a valid @@ -1154,6 +1153,7 @@ RetFree: Ret: sc->mpr_flags &= ~MPR_FLAGS_BUSY; mpr_unlock(sc); + free(req, M_MPRUSER); return (err); } diff --git a/sys/dev/mps/mps_user.c b/sys/dev/mps/mps_user.c index 650e5d5e3e87..c80fbc68cdf3 100644 --- a/sys/dev/mps/mps_user.c +++ b/sys/dev/mps/mps_user.c @@ -677,7 +677,7 @@ mps_user_command(struct mps_softc *sc, struct mps_usr_command *cmd) mps_dprint(sc, MPS_USER, "%s: req %p %d rpl %p %d\n", __func__, cmd->req, cmd->req_len, cmd->rpl, cmd->rpl_len); - if (cmd->req_len > (int)sc->reqframesz) { + if (cmd->req_len > sc->reqframesz) { err = EINVAL; goto RetFreeUnlocked; } @@ -750,9 +750,10 @@ RetFree: static int mps_user_pass_thru(struct mps_softc *sc, mps_pass_thru_t *data) { - MPI2_REQUEST_HEADER *hdr, tmphdr; + MPI2_REQUEST_HEADER *hdr, *tmphdr; MPI2_DEFAULT_REPLY *rpl = NULL; struct mps_command *cm = NULL; + void *req = NULL; int err = 0, dir = 0, sz; uint8_t function = 0; u_int sense_len; @@ -804,22 +805,21 @@ mps_user_pass_thru(struct mps_softc *sc, mps_pass_thru_t *data) data->ReplySize, data->PtrData, data->DataSize, data->PtrDataOut, data->DataOutSize, data->DataDirection); - /* - * copy in the header so we know what we're dealing with before we - * commit to allocating a command for it. - */ - err = copyin(PTRIN(data->PtrRequest), &tmphdr, data->RequestSize); - if (err != 0) - goto RetFreeUnlocked; - - if (data->RequestSize > (int)sc->reqframesz) { + if (data->RequestSize > sc->reqframesz) { err = EINVAL; goto RetFreeUnlocked; } - function = tmphdr.Function; + req = malloc(data->RequestSize, M_MPSUSER, M_WAITOK | M_ZERO); + tmphdr = (MPI2_REQUEST_HEADER *)req; + + err = copyin(PTRIN(data->PtrRequest), req, data->RequestSize); + if (err != 0) + goto RetFreeUnlocked; + + function = tmphdr->Function; mps_dprint(sc, MPS_USER, "%s: Function %02X MsgFlags %02X\n", __func__, - function, tmphdr.MsgFlags); + function, tmphdr->MsgFlags); /* * Handle a passthru TM request. @@ -836,7 +836,7 @@ mps_user_pass_thru(struct mps_softc *sc, mps_pass_thru_t *data) /* Copy the header in. Only a small fixup is needed. */ task = (MPI2_SCSI_TASK_MANAGE_REQUEST *)cm->cm_req; - bcopy(&tmphdr, task, data->RequestSize); + memcpy(task, req, data->RequestSize); task->TaskMID = cm->cm_desc.Default.SMID; cm->cm_data = NULL; @@ -883,7 +883,6 @@ mps_user_pass_thru(struct mps_softc *sc, mps_pass_thru_t *data) mps_lock(sc); cm = mps_alloc_command(sc); - if (cm == NULL) { mps_printf(sc, "%s: no mps requests\n", __func__); err = ENOMEM; @@ -892,7 +891,7 @@ mps_user_pass_thru(struct mps_softc *sc, mps_pass_thru_t *data) mps_unlock(sc); hdr = (MPI2_REQUEST_HEADER *)cm->cm_req; - bcopy(&tmphdr, hdr, data->RequestSize); + memcpy(hdr, req, data->RequestSize); /* * Do some checking to make sure the IOCTL request contains a valid @@ -1059,6 +1058,7 @@ RetFreeUnlocked: Ret: sc->mps_flags &= ~MPS_FLAGS_BUSY; mps_unlock(sc); + free(req, M_MPSUSER); return (err); } From owner-dev-commits-src-all@freebsd.org Fri Jan 8 18:32:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D1F714D23F8; Fri, 8 Jan 2021 18:32:31 +0000 (UTC) (envelope-from git@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 4DCBXv5dsrz4m9J; Fri, 8 Jan 2021 18:32:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B466827D46; Fri, 8 Jan 2021 18:32:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108IWVmA056761; Fri, 8 Jan 2021 18:32:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108IWVU9056760; Fri, 8 Jan 2021 18:32:31 GMT (envelope-from git) Date: Fri, 8 Jan 2021 18:32:31 GMT Message-Id: <202101081832.108IWVU9056760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e65e4e61f530 - main - vmd: Clean up resources properly when vmd_attach() fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e65e4e61f5302ddbba3b2a8c2186548072ba49ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 18:32:31 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e65e4e61f5302ddbba3b2a8c2186548072ba49ad commit e65e4e61f5302ddbba3b2a8c2186548072ba49ad Author: Mark Johnston AuthorDate: 2021-01-08 18:32:05 +0000 Commit: Mark Johnston CommitDate: 2021-01-08 18:32:05 +0000 vmd: Clean up resources properly when vmd_attach() fails - Free the resource container by calling rman_fini().[1] - Call device_delete_child() if device_probe_and_attach() fails. Reported by: nc [1] MFC after: 2 weeks --- sys/dev/vmd/vmd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/dev/vmd/vmd.c b/sys/dev/vmd/vmd.c index 2cc6f45bed9e..616fd4c8373e 100644 --- a/sys/dev/vmd/vmd.c +++ b/sys/dev/vmd/vmd.c @@ -101,6 +101,9 @@ vmd_free(struct vmd_softc *sc) int i; struct vmd_irq_handler *elm, *tmp; + if (sc->vmd_bus.rman.rm_end != 0) + rman_fini(&sc->vmd_bus.rman); + #ifdef TASK_QUEUE_INTR if (sc->vmd_irq_tq != NULL) { taskqueue_drain(sc->vmd_irq_tq, &sc->vmd_irq_task); @@ -334,10 +337,10 @@ vmd_attach(device_t dev) snprintf(buf, sizeof(buf), "%s bus numbers", device_get_nameunit(dev)); bus->rman.rm_descr = strdup(buf, M_DEVBUF); error = rman_init(&bus->rman); - if (error) { device_printf(dev, "Failed to initialize %s bus number rman\n", device_get_nameunit(dev)); + bus->rman.rm_end = 0; goto fail; } @@ -410,7 +413,6 @@ vmd_attach(device_t dev) } sc->vmd_child = device_add_child(dev, NULL, -1); - if (sc->vmd_child == NULL) { device_printf(dev, "Failed to attach child\n"); goto fail; @@ -418,7 +420,8 @@ vmd_attach(device_t dev) error = device_probe_and_attach(sc->vmd_child); if (error) { - device_printf(dev, "Failed to add probe child\n"); + device_printf(dev, "Failed to add probe child: %d\n", error); + (void)device_delete_child(dev, sc->vmd_child); goto fail; } @@ -444,9 +447,6 @@ vmd_detach(device_t dev) if (err) return (err); } - if (sc->vmd_bus.rman.rm_end != 0) - rman_fini(&sc->vmd_bus.rman); - vmd_free(sc); return (0); } From owner-dev-commits-src-all@freebsd.org Fri Jan 8 18:32:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0C74F4D1CFA; Fri, 8 Jan 2021 18:32:32 +0000 (UTC) (envelope-from git@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 4DCBXv6yhQz4mKq; Fri, 8 Jan 2021 18:32:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E075327DD5; Fri, 8 Jan 2021 18:32:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108IWVBo056814; Fri, 8 Jan 2021 18:32:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108IWVUA056813; Fri, 8 Jan 2021 18:32:31 GMT (envelope-from git) Date: Fri, 8 Jan 2021 18:32:31 GMT Message-Id: <202101081832.108IWVUA056813@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 092cf8d63f9f - main - safexcel: Fix a race around unblocking of crypto ops MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 092cf8d63f9fb9153c677f5793135926edc101d7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 18:32:32 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=092cf8d63f9fb9153c677f5793135926edc101d7 commit 092cf8d63f9fb9153c677f5793135926edc101d7 Author: Mark Johnston AuthorDate: 2021-01-08 18:32:04 +0000 Commit: Mark Johnston CommitDate: 2021-01-08 18:32:04 +0000 safexcel: Fix a race around unblocking of crypto ops safexcel_ring_intr() could fail to observed that sc_blocked is set after completing all outstanding ops for a ring, in which case blocked ops would be deferred forever. Request structures are managed by individual rings, so move the "blocked" flag into the per-ring state block and use the ring lock to synchronize with safexcel_process(). Remove sc_mtx since it is now unused. MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/dev/safexcel/safexcel.c | 27 +++++++++------------------ sys/dev/safexcel/safexcel_var.h | 4 ++-- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index 2fd13cd3f6da..ba65207eb588 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -160,8 +160,9 @@ safexcel_rdr_intr(struct safexcel_softc *sc, int ringidx) struct safexcel_res_descr *rdesc; struct safexcel_request *req; struct safexcel_ring *ring; - uint32_t error, i, ncdescs, nrdescs, nreqs; + uint32_t blocked, error, i, ncdescs, nrdescs, nreqs; + blocked = 0; ring = &sc->sc_ring[ringidx]; mtx_lock(&ring->mtx); @@ -231,6 +232,8 @@ safexcel_rdr_intr(struct safexcel_softc *sc, int ringidx) SAFEXCEL_HIA_RDR(sc, ringidx) + SAFEXCEL_HIA_xDR_PROC_COUNT, SAFEXCEL_xDR_PROC_xD_PKT(nreqs) | (sc->sc_config.rd_offset * nrdescs * sizeof(uint32_t))); + blocked = ring->blocked; + ring->blocked = 0; } out: if (!STAILQ_EMPTY(&ring->queued_requests)) { @@ -239,6 +242,9 @@ out: SAFEXCEL_HIA_CDR_THRESH_PKT_MODE | 1); } mtx_unlock(&ring->mtx); + + if (blocked) + crypto_unblock(sc->sc_cid, blocked); } static void @@ -248,7 +254,7 @@ safexcel_ring_intr(void *arg) struct safexcel_intr_handle *ih; uint32_t status, stat; int ring; - bool blocked, rdrpending; + bool rdrpending; ih = arg; sc = ih->sc; @@ -281,14 +287,6 @@ safexcel_ring_intr(void *arg) if (rdrpending) safexcel_rdr_intr(sc, ring); - - mtx_lock(&sc->sc_mtx); - blocked = sc->sc_blocked; - sc->sc_blocked = 0; - mtx_unlock(&sc->sc_mtx); - - if (blocked) - crypto_unblock(sc->sc_cid, blocked); } static int @@ -1100,8 +1098,6 @@ safexcel_alloc_dev_resources(struct safexcel_softc *sc) goto out; } - mtx_init(&sc->sc_mtx, "safexcel softc", NULL, MTX_DEF); - return (0); out: @@ -1118,8 +1114,6 @@ safexcel_free_dev_resources(struct safexcel_softc *sc) { int i; - mtx_destroy(&sc->sc_mtx); - for (i = 0; i < SAFEXCEL_MAX_RINGS && sc->sc_intr[i] != NULL; i++) bus_release_resource(sc->sc_dev, SYS_RES_IRQ, rman_get_rid(sc->sc_intr[i]), sc->sc_intr[i]); @@ -1157,7 +1151,6 @@ safexcel_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; - sc->sc_blocked = 0; sc->sc_cid = -1; if (safexcel_alloc_dev_resources(sc)) @@ -2569,10 +2562,8 @@ safexcel_process(device_t dev, struct cryptop *crp, int hint) mtx_lock(&ring->mtx); req = safexcel_alloc_request(sc, ring); if (__predict_false(req == NULL)) { - mtx_lock(&sc->sc_mtx); + ring->blocked = CRYPTO_SYMQ; mtx_unlock(&ring->mtx); - sc->sc_blocked = CRYPTO_SYMQ; - mtx_unlock(&sc->sc_mtx); return (ERESTART); } diff --git a/sys/dev/safexcel/safexcel_var.h b/sys/dev/safexcel/safexcel_var.h index 03e5e7da51fc..057f9e9be1d5 100644 --- a/sys/dev/safexcel/safexcel_var.h +++ b/sys/dev/safexcel/safexcel_var.h @@ -377,6 +377,8 @@ struct safexcel_ring { struct sglist *res_data; struct safexcel_res_descr_ring rdr; + int blocked; + struct safexcel_request *requests; STAILQ_HEAD(, safexcel_request) ready_requests; STAILQ_HEAD(, safexcel_request) queued_requests; @@ -405,9 +407,7 @@ struct safexcel_softc { struct safexcel_ring sc_ring[SAFEXCEL_MAX_RINGS]; int sc_ringidx; - struct mtx sc_mtx; - int sc_blocked; int32_t sc_cid; struct safexcel_reg_offsets sc_offsets; struct safexcel_config sc_config; From owner-dev-commits-src-all@freebsd.org Fri Jan 8 18:32:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4A0E24D2403; Fri, 8 Jan 2021 18:32:32 +0000 (UTC) (envelope-from git@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 4DCBXw15v6z4mWf; Fri, 8 Jan 2021 18:32:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1377627F93; Fri, 8 Jan 2021 18:32:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108IWWr5056848; Fri, 8 Jan 2021 18:32:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108IWW66056847; Fri, 8 Jan 2021 18:32:32 GMT (envelope-from git) Date: Fri, 8 Jan 2021 18:32:32 GMT Message-Id: <202101081832.108IWW66056847@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 501159696cb5 - main - igmp: Avoid leaking mbuf when source validation fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 501159696cb5204d94d03393e4bc5d82f2e348e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 18:32:32 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=501159696cb5204d94d03393e4bc5d82f2e348e6 commit 501159696cb5204d94d03393e4bc5d82f2e348e6 Author: Mark Johnston AuthorDate: 2021-01-08 18:32:04 +0000 Commit: Mark Johnston CommitDate: 2021-01-08 18:32:04 +0000 igmp: Avoid leaking mbuf when source validation fails PR: 252504 Submitted by: Panagiotis Tsolakos MFC after: 3 days --- sys/netinet/igmp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index ce4dc1c57842..21bce1ff885a 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -1589,6 +1589,7 @@ igmp_input(struct mbuf **mp, int *offp, int proto) if (nsrc * sizeof(in_addr_t) > UINT16_MAX - iphlen - IGMP_V3_QUERY_MINLEN) { IGMPSTAT_INC(igps_rcv_tooshort); + m_freem(m); return (IPPROTO_DONE); } /* From owner-dev-commits-src-all@freebsd.org Fri Jan 8 18:32:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 292E24D23FB; Fri, 8 Jan 2021 18:32:32 +0000 (UTC) (envelope-from git@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 4DCBXw0R3kz4mVx; Fri, 8 Jan 2021 18:32:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0057227DD6; Fri, 8 Jan 2021 18:32:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108IWVRO056831; Fri, 8 Jan 2021 18:32:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108IWV88056830; Fri, 8 Jan 2021 18:32:31 GMT (envelope-from git) Date: Fri, 8 Jan 2021 18:32:31 GMT Message-Id: <202101081832.108IWV88056830@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 8ba6acbbe699 - main - safexcel: Stop using a stack buffer for the ring lock name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ba6acbbe6995efcd12c375e1826d55e35a8bdc9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 18:32:32 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8ba6acbbe6995efcd12c375e1826d55e35a8bdc9 commit 8ba6acbbe6995efcd12c375e1826d55e35a8bdc9 Author: Mark Johnston AuthorDate: 2021-01-08 18:32:04 +0000 Commit: Mark Johnston CommitDate: 2021-01-08 18:32:04 +0000 safexcel: Stop using a stack buffer for the ring lock name mtx_init() does not make a copy of the name so the buffer must be valid for the lifetime of the driver instance. Store each ring's lock's name in the ring structure. MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/dev/safexcel/safexcel.c | 6 +++--- sys/dev/safexcel/safexcel_var.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index 2ed6bed64136..2fd13cd3f6da 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -783,15 +783,15 @@ safexcel_init_rings(struct safexcel_softc *sc) { struct safexcel_cmd_descr *cdesc; struct safexcel_ring *ring; - char buf[32]; uint64_t atok; int i, j; for (i = 0; i < sc->sc_config.rings; i++) { ring = &sc->sc_ring[i]; - snprintf(buf, sizeof(buf), "safexcel_ring%d", i); - mtx_init(&ring->mtx, buf, NULL, MTX_DEF); + snprintf(ring->lockname, sizeof(ring->lockname), + "safexcel_ring%d", i); + mtx_init(&ring->mtx, ring->lockname, NULL, MTX_DEF); STAILQ_INIT(&ring->free_requests); STAILQ_INIT(&ring->ready_requests); STAILQ_INIT(&ring->queued_requests); diff --git a/sys/dev/safexcel/safexcel_var.h b/sys/dev/safexcel/safexcel_var.h index 619bcff00c57..03e5e7da51fc 100644 --- a/sys/dev/safexcel/safexcel_var.h +++ b/sys/dev/safexcel/safexcel_var.h @@ -384,6 +384,8 @@ struct safexcel_ring { struct safexcel_dma_mem dma_atok; bus_dma_tag_t data_dtag; + + char lockname[32]; }; struct safexcel_intr_handle { From owner-dev-commits-src-all@freebsd.org Fri Jan 8 18:44:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6E2544D2BA2; Fri, 8 Jan 2021 18:44:12 +0000 (UTC) (envelope-from git@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 4DCBpN2kXdz4nj4; Fri, 8 Jan 2021 18:44:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50987207; Fri, 8 Jan 2021 18:44:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108IiCBd070536; Fri, 8 Jan 2021 18:44:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108IiCHg070535; Fri, 8 Jan 2021 18:44:12 GMT (envelope-from git) Date: Fri, 8 Jan 2021 18:44:12 GMT Message-Id: <202101081844.108IiCHg070535@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 52cd25eb1aa7 - main - mbuf: enable ext_pgs ("unmapped") mbufs by default MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 52cd25eb1aa75a28f6d3c3eb4757242c1f55d6cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 18:44:12 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=52cd25eb1aa75a28f6d3c3eb4757242c1f55d6cc commit 52cd25eb1aa75a28f6d3c3eb4757242c1f55d6cc Author: Andrew Gallatin AuthorDate: 2021-01-08 18:18:42 +0000 Commit: Andrew Gallatin CommitDate: 2021-01-08 18:43:30 +0000 mbuf: enable ext_pgs ("unmapped") mbufs by default Ext_pg mbufs allow carrying multiple pages per mbuf. This reduces mbuf linked list traversals, especially in socket buffers, thereby reducing cache misses and CPU use for applications using sendfile. Note that ext_pages use unmapped pages, eliminating KVA mapping costs on 32-bit platforms. Ext_pg mbufs are also required for ktls (KERN_TLS), and having them disabled by default is a stumbling block for those wishing to enable ktls. Reviewed-by: jhb, glebius Sponsored by: Netfix --- sys/kern/kern_mbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c index 84e068424427..a46c576bad90 100644 --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -116,7 +116,7 @@ int nmbjumbop; /* limits number of page size jumbo clusters */ int nmbjumbo9; /* limits number of 9k jumbo clusters */ int nmbjumbo16; /* limits number of 16k jumbo clusters */ -bool mb_use_ext_pgs; /* use M_EXTPG mbufs for sendfile & TLS */ +bool mb_use_ext_pgs = true; /* use M_EXTPG mbufs for sendfile & TLS */ SYSCTL_BOOL(_kern_ipc, OID_AUTO, mb_use_ext_pgs, CTLFLAG_RWTUN, &mb_use_ext_pgs, 0, "Use unmapped mbufs for sendfile(2) and TLS offload"); From owner-dev-commits-src-all@freebsd.org Fri Jan 8 18:53:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C2C914D318B; Fri, 8 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@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 4DCC1X57HPz4plR; Fri, 8 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2B143A7; Fri, 8 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108Irqhu083365; Fri, 8 Jan 2021 18:53:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108IrqRN083364; Fri, 8 Jan 2021 18:53:52 GMT (envelope-from git) Date: Fri, 8 Jan 2021 18:53:52 GMT Message-Id: <202101081853.108IrqRN083364@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: bbfa199cbc16 - main - arm64: gdb(4) machine-dependent bits MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bbfa199cbc1698631a0e932848e62dd76559d4d7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 18:53:52 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=bbfa199cbc1698631a0e932848e62dd76559d4d7 commit bbfa199cbc1698631a0e932848e62dd76559d4d7 Author: mhorne AuthorDate: 2020-12-09 20:38:42 +0000 Commit: Mitchell Horne CommitDate: 2021-01-08 18:53:44 +0000 arm64: gdb(4) machine-dependent bits Everything required for remote kernel debugging over a serial connection. For FDT-based systems, a debug port can be specified by setting hw.fdt.dbgport to the desired device tree node in loader.conf. For example, hw.fdt.dbgport="uart1", or hw.fdt.dbgport="serial@ff1a0000". Looks good: emaste Tested by: rwatson MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27727 --- sys/arm64/arm64/gdb_machdep.c | 112 ++++++++++++++++++++++++++++++++++++++++ sys/arm64/conf/GENERIC | 2 +- sys/arm64/include/gdb_machdep.h | 81 +++++++++++++++++++++++++++++ sys/conf/files.arm64 | 1 + 4 files changed, 195 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/gdb_machdep.c b/sys/arm64/arm64/gdb_machdep.c new file mode 100644 index 000000000000..dc0a7eeba692 --- /dev/null +++ b/sys/arm64/arm64/gdb_machdep.c @@ -0,0 +1,112 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Mitchell Horne 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 + +#include +#include +#include +#include + +#include + +void * +gdb_cpu_getreg(int regnum, size_t *regsz) +{ + + *regsz = gdb_cpu_regsz(regnum); + + if (kdb_thread == curthread) { + switch (regnum) { + case GDB_REG_LR: return (&kdb_frame->tf_lr); + case GDB_REG_SP: return (&kdb_frame->tf_sp); + case GDB_REG_PC: return (&kdb_frame->tf_elr); + case GDB_REG_CSPR: return (&kdb_frame->tf_spsr); + } + } + switch (regnum) { + case GDB_REG_SP: return (&kdb_thrctx->pcb_sp); + case GDB_REG_PC: /* FALLTHROUGH */ + case GDB_REG_LR: return (&kdb_thrctx->pcb_lr); + default: + if (regnum >= GDB_REG_X0 && regnum <= GDB_REG_X29) + return (&kdb_thrctx->pcb_x[regnum]); + break; + } + + return (NULL); +} + +void +gdb_cpu_setreg(int regnum, void *val) +{ + register_t regval = *(register_t *)val; + + /* For curthread, keep the pcb and trapframe in sync. */ + if (kdb_thread == curthread) { + switch (regnum) { + case GDB_REG_PC: kdb_frame->tf_elr = regval; break; + case GDB_REG_SP: kdb_frame->tf_sp = regval; break; + default: + if (regnum >= GDB_REG_X0 && regnum <= GDB_REG_X29) { + kdb_frame->tf_x[regnum] = regval; + } + break; + } + } + switch (regnum) { + case GDB_REG_PC: /* FALLTHROUGH */ + case GDB_REG_LR: kdb_thrctx->pcb_lr = regval; break; + case GDB_REG_SP: kdb_thrctx->pcb_sp = regval; break; + default: + if (regnum >= GDB_REG_X0 && regnum <= GDB_REG_X29) { + kdb_thrctx->pcb_x[regnum] = regval; + } + break; + } +} + +int +gdb_cpu_signal(int type, int code __unused) +{ + + switch (type) { + case EXCP_WATCHPT_EL1: + case EXCP_SOFTSTP_EL1: + case EXCP_BRK: + return (SIGTRAP); + } + return (SIGEMT); +} diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index 280a5efeeb0b..268089dba1fc 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -87,7 +87,7 @@ options KDB # Enable kernel debugger support. options KDB_TRACE # Print a stack trace for a panic. # For full debugger support use (turn off in stable branch): options DDB # Support DDB. -#options GDB # Support remote GDB. +options GDB # Support remote GDB. options DEADLKRES # Enable the deadlock resolver options INVARIANTS # Enable calls of extra sanity checking options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS diff --git a/sys/arm64/include/gdb_machdep.h b/sys/arm64/include/gdb_machdep.h new file mode 100644 index 000000000000..755c5d1657c0 --- /dev/null +++ b/sys/arm64/include/gdb_machdep.h @@ -0,0 +1,81 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Mitchell Horne 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. + */ + +#ifndef _MACHINE_GDB_MACHDEP_H_ +#define _MACHINE_GDB_MACHDEP_H_ + +#define GDB_BUFSZ 4096 +#define GDB_NREGS 68 +#define GDB_REG_X0 0 +#define GDB_REG_X29 29 +#define GDB_REG_LR 30 +#define GDB_REG_SP 31 +#define GDB_REG_PC 32 +#define GDB_REG_CSPR 33 +#define GDB_REG_V0 34 +#define GDB_REG_V31 65 +#define GDB_REG_FPSR 66 +#define GDB_REG_FPCR 67 +_Static_assert(GDB_BUFSZ >= (GDB_NREGS * 16), "buffer fits 'g' regs"); + +static __inline size_t +gdb_cpu_regsz(int regnum) +{ + if (regnum == GDB_REG_CSPR || regnum == GDB_REG_FPSR || + regnum == GDB_REG_FPCR) + return (4); + else if (regnum >= GDB_REG_V0 && regnum <= GDB_REG_V31) + return (16); + + return (8); +} + +static __inline int +gdb_cpu_query(void) +{ + return (0); +} + +static __inline void * +gdb_begin_write(void) +{ + return (NULL); +} + +static __inline void +gdb_end_write(void *arg __unused) +{ +} + +void *gdb_cpu_getreg(int, size_t *); +void gdb_cpu_setreg(int, void *); +int gdb_cpu_signal(int, int); + +#endif /* !_MACHINE_GDB_MACHDEP_H_ */ diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 4bb454fd4e2a..3cd34c170778 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -168,6 +168,7 @@ arm64/arm64/elf32_machdep.c optional compat_freebsd32 arm64/arm64/elf_machdep.c standard arm64/arm64/exception.S standard arm64/arm64/freebsd32_machdep.c optional compat_freebsd32 +arm64/arm64/gdb_machdep.c optional gdb arm64/arm64/gicv3_its.c optional intrng fdt arm64/arm64/gic_v3.c standard arm64/arm64/gic_v3_acpi.c optional acpi From owner-dev-commits-src-all@freebsd.org Fri Jan 8 18:53:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D2A924D3153; Fri, 8 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@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 4DCC1X5fxsz4plS; Fri, 8 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B54FB23A; Fri, 8 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108Irqvv083382; Fri, 8 Jan 2021 18:53:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108IrqgT083381; Fri, 8 Jan 2021 18:53:52 GMT (envelope-from git) Date: Fri, 8 Jan 2021 18:53:52 GMT Message-Id: <202101081853.108IrqgT083381@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 5f66d5a313bf - main - arm64: remove pcb_pc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5f66d5a313bf2b2254de92b2915e48e5cf528893 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 18:53:52 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=5f66d5a313bf2b2254de92b2915e48e5cf528893 commit 5f66d5a313bf2b2254de92b2915e48e5cf528893 Author: mhorne AuthorDate: 2020-12-21 16:16:09 +0000 Commit: Mitchell Horne CommitDate: 2021-01-08 18:53:44 +0000 arm64: remove pcb_pc The program counter field in the PCB is written in exactly one place, makectx(), upon entry to the debugger. For threads other than curthread, its value will be empty, or bogus. Rather than writing to this field in more places, it can be removed in favor of using the value in the link register. To make this clearer, pcb->pcb_x[30] is renamed to pcb->pcb_lr, similar to what already exists in struct trapframe. Also, prefer lr to x30 in assembly, as it better conveys intention. This improves PC_REGS() for kdb_thread != curthread. It is required for a functional gdb(4) stub, fixing the output of `info threads`, in particular. The space occupied by pcb_pc is retained, for compatibility with kgdb. Reviewed by: markj, jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27720 --- sys/arm64/arm64/db_trace.c | 2 +- sys/arm64/arm64/exception.S | 2 +- sys/arm64/arm64/genassym.c | 1 + sys/arm64/arm64/machdep.c | 6 +++--- sys/arm64/arm64/stack_machdep.c | 2 +- sys/arm64/arm64/swtch.S | 8 ++++---- sys/arm64/arm64/vm_machdep.c | 6 +++--- sys/arm64/include/db_machdep.h | 2 +- sys/arm64/include/pcb.h | 6 +++--- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/sys/arm64/arm64/db_trace.c b/sys/arm64/arm64/db_trace.c index 42f63ffdf4be..1743d7765861 100644 --- a/sys/arm64/arm64/db_trace.c +++ b/sys/arm64/arm64/db_trace.c @@ -109,7 +109,7 @@ db_trace_thread(struct thread *thr, int count) frame.sp = (uintptr_t)ctx->pcb_sp; frame.fp = (uintptr_t)ctx->pcb_x[29]; - frame.pc = (uintptr_t)ctx->pcb_x[30]; + frame.pc = (uintptr_t)ctx->pcb_lr; db_stack_trace_cmd(thr, &frame); } else db_trace_self(); diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S index 123f73b49734..bcb444ef2f55 100644 --- a/sys/arm64/arm64/exception.S +++ b/sys/arm64/arm64/exception.S @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); sub sp, sp, #128 .endif sub sp, sp, #(TF_SIZE + 16) - stp x29, x30, [sp, #(TF_SIZE)] + stp x29, lr, [sp, #(TF_SIZE)] stp x28, x29, [sp, #(TF_X + 28 * 8)] stp x26, x27, [sp, #(TF_X + 26 * 8)] stp x24, x25, [sp, #(TF_X + 24 * 8)] diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c index c211d121c06e..1575a0158dec 100644 --- a/sys/arm64/arm64/genassym.c +++ b/sys/arm64/arm64/genassym.c @@ -60,6 +60,7 @@ ASSYM(PC_SSBD, offsetof(struct pcpu, pc_ssbd)); ASSYM(PCB_SIZE, roundup2(sizeof(struct pcb), STACKALIGNBYTES + 1)); ASSYM(PCB_SINGLE_STEP_SHIFT, PCB_SINGLE_STEP_SHIFT); ASSYM(PCB_REGS, offsetof(struct pcb, pcb_x)); +ASSYM(PCB_LR, offsetof(struct pcb, pcb_lr)); ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp)); ASSYM(PCB_TPIDRRO, offsetof(struct pcb, pcb_tpidrro_el0)); ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 739257bed1db..90fc19d57415 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -732,11 +732,11 @@ makectx(struct trapframe *tf, struct pcb *pcb) { int i; - for (i = 0; i < PCB_LR; i++) + for (i = 0; i < nitems(pcb->pcb_x); i++) pcb->pcb_x[i] = tf->tf_x[i]; - pcb->pcb_x[PCB_LR] = tf->tf_lr; - pcb->pcb_pc = tf->tf_elr; + /* NB: pcb_lr is the PC, see PC_REGS() in db_machdep.h */ + pcb->pcb_lr = tf->tf_elr; pcb->pcb_sp = tf->tf_sp; } diff --git a/sys/arm64/arm64/stack_machdep.c b/sys/arm64/arm64/stack_machdep.c index 7ca64c9f3b2d..673da833afb4 100644 --- a/sys/arm64/arm64/stack_machdep.c +++ b/sys/arm64/arm64/stack_machdep.c @@ -71,7 +71,7 @@ stack_save_td(struct stack *st, struct thread *td) frame.sp = td->td_pcb->pcb_sp; frame.fp = td->td_pcb->pcb_x[29]; - frame.pc = td->td_pcb->pcb_x[30]; + frame.pc = td->td_pcb->pcb_lr; stack_capture(td, st, &frame); return (0); diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index 144cc0873f68..ee64f89502cc 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -101,7 +101,7 @@ ENTRY(cpu_throw) ldp x24, x25, [x4, #PCB_REGS + 24 * 8] ldp x26, x27, [x4, #PCB_REGS + 26 * 8] ldp x28, x29, [x4, #PCB_REGS + 28 * 8] - ldr x30, [x4, #PCB_REGS + 30 * 8] + ldr lr, [x4, #PCB_LR] ret END(cpu_throw) @@ -132,7 +132,7 @@ ENTRY(cpu_switch) stp x24, x25, [x4, #PCB_REGS + 24 * 8] stp x26, x27, [x4, #PCB_REGS + 26 * 8] stp x28, x29, [x4, #PCB_REGS + 28 * 8] - str x30, [x4, #PCB_REGS + 30 * 8] + str lr, [x4, #PCB_LR] /* And the old stack pointer */ mov x5, sp mrs x6, tpidrro_el0 @@ -198,7 +198,7 @@ ENTRY(cpu_switch) ldp x24, x25, [x4, #PCB_REGS + 24 * 8] ldp x26, x27, [x4, #PCB_REGS + 26 * 8] ldp x28, x29, [x4, #PCB_REGS + 28 * 8] - ldr x30, [x4, #PCB_REGS + 30 * 8] + ldr lr, [x4, #PCB_LR] str xzr, [x4, #PCB_REGS + 18 * 8] ret @@ -270,7 +270,7 @@ ENTRY(savectx) stp x24, x25, [x0, #PCB_REGS + 24 * 8] stp x26, x27, [x0, #PCB_REGS + 26 * 8] stp x28, x29, [x0, #PCB_REGS + 28 * 8] - str x30, [x0, #PCB_REGS + 30 * 8] + str lr, [x0, #PCB_LR] /* And the old stack pointer */ mov x5, sp mrs x6, tpidrro_el0 diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index b4a3e596f9ef..6a84dc023562 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -102,7 +102,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Set the return value registers for fork() */ td2->td_pcb->pcb_x[8] = (uintptr_t)fork_return; td2->td_pcb->pcb_x[9] = (uintptr_t)td2; - td2->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline; + td2->td_pcb->pcb_lr = (uintptr_t)fork_trampoline; td2->td_pcb->pcb_sp = (uintptr_t)td2->td_frame; td2->td_pcb->pcb_fpusaved = &td2->td_pcb->pcb_fpustate; td2->td_pcb->pcb_vfpcpu = UINT_MAX; @@ -173,7 +173,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) td->td_pcb->pcb_x[8] = (uintptr_t)fork_return; td->td_pcb->pcb_x[9] = (uintptr_t)td; - td->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline; + td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline; td->td_pcb->pcb_sp = (uintptr_t)td->td_frame; td->td_pcb->pcb_fpusaved = &td->td_pcb->pcb_fpustate; td->td_pcb->pcb_vfpcpu = UINT_MAX; @@ -265,7 +265,7 @@ cpu_fork_kthread_handler(struct thread *td, void (*func)(void *), void *arg) td->td_pcb->pcb_x[8] = (uintptr_t)func; td->td_pcb->pcb_x[9] = (uintptr_t)arg; - td->td_pcb->pcb_x[PCB_LR] = (uintptr_t)fork_trampoline; + td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline; td->td_pcb->pcb_sp = (uintptr_t)td->td_frame; td->td_pcb->pcb_fpusaved = &td->td_pcb->pcb_fpustate; td->td_pcb->pcb_vfpcpu = UINT_MAX; diff --git a/sys/arm64/include/db_machdep.h b/sys/arm64/include/db_machdep.h index 45d548c750bc..f2fd2a57a9c3 100644 --- a/sys/arm64/include/db_machdep.h +++ b/sys/arm64/include/db_machdep.h @@ -43,7 +43,7 @@ typedef vm_offset_t db_addr_t; typedef long db_expr_t; -#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_pc) +#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_lr) #define BKPT_INST (0xd4200000) #define BKPT_SIZE (4) diff --git a/sys/arm64/include/pcb.h b/sys/arm64/include/pcb.h index 25c1a5a7aff4..012ed2c92741 100644 --- a/sys/arm64/include/pcb.h +++ b/sys/arm64/include/pcb.h @@ -36,10 +36,10 @@ struct trapframe; -#define PCB_LR 30 struct pcb { - uint64_t pcb_x[31]; - uint64_t pcb_pc; + uint64_t pcb_x[30]; + uint64_t pcb_lr; + uint64_t _reserved; /* Was pcb_pc */ /* These two need to be in order as we access them together */ uint64_t pcb_sp; uint64_t pcb_tpidr_el0; From owner-dev-commits-src-all@freebsd.org Fri Jan 8 18:53:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 033D24D28A4; Fri, 8 Jan 2021 18:53:53 +0000 (UTC) (envelope-from git@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 4DCC1X6llmz4pr1; Fri, 8 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D967C328; Fri, 8 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108Irqcu083416; Fri, 8 Jan 2021 18:53:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108Irq42083415; Fri, 8 Jan 2021 18:53:52 GMT (envelope-from git) Date: Fri, 8 Jan 2021 18:53:52 GMT Message-Id: <202101081853.108Irq42083415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 088a7eef95b1 - main - ddb: add ability to print user registers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 088a7eef95b1f1919fe6eee722a57c4d4e1e0656 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 18:53:53 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=088a7eef95b1f1919fe6eee722a57c4d4e1e0656 commit 088a7eef95b1f1919fe6eee722a57c4d4e1e0656 Author: mhorne AuthorDate: 2020-12-18 20:06:46 +0000 Commit: Mitchell Horne CommitDate: 2021-01-08 18:53:06 +0000 ddb: add ability to print user registers The debugger is always entered after some kind of kernel trap, often a breakpoint in kdb_enter(). This means that the most recent trapframe will include kernel state at the time of the trap, when often it is desirable to the developer to view the contents of the previous trapframe. This trapframe often corresponds to the entry from userspace. The ddb(4) man page claims the ability to display user register state via the 'u' modifier to `show registers`, but this appears untrue. It is not obvious from a quick search of the history when this feature was added, or when it was removed. (Re)implement this feature in db_show_regs, noting that it is not necessarily populated with userspace state. Reviewed by: jhb (earlier version), markj, bcr (manpages) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27705 --- share/man/man4/ddb.4 | 10 +++------- sys/ddb/db_print.c | 24 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4 index 5dab5c42a2ce..91b179e4e6fa 100644 --- a/share/man/man4/ddb.4 +++ b/share/man/man4/ddb.4 @@ -955,14 +955,10 @@ at address Display the register set. If the .Cm u -modifier is specified, it displays user registers instead of -kernel registers or the currently saved one. +modifier is specified, the register contents of the thread's previous +trapframe are displayed instead. +Usually, this corresponds to the saved state from userspace. .Pp -.Sy Warning : -The support of the -.Cm u -modifier depends on the machine. -If not supported, incorrect information will be displayed. .\" .Pp .It Ic show Cm rman Ar addr diff --git a/sys/ddb/db_print.c b/sys/ddb/db_print.c index 3ff0b781532d..da929457984d 100644 --- a/sys/ddb/db_print.c +++ b/sys/ddb/db_print.c @@ -49,12 +49,32 @@ __FBSDID("$FreeBSD$"); #include void -db_show_regs(db_expr_t _1, bool _2, db_expr_t _3, char *_4) +db_show_regs(db_expr_t _1, bool _2, db_expr_t _3, char *modif) { + struct trapframe *oldtf; struct db_variable *regp; db_expr_t value, offset; const char *name; + /* + * The 'u' modifier instructs us to print the previous trapframe, most + * often containing state from userspace. This is done by temporarily + * switching out kdb_frame. + * + * NB: curthread is used instead of kdb_thread, so that behaviour is + * consistent with regular `show registers`, which always prints + * curthread's trapframe. + */ + oldtf = kdb_frame; + if (modif[0] == 'u') { + if (curthread->td_frame == NULL || + curthread->td_frame == oldtf) { + db_printf("previous trapframe unavailable"); + return; + } + kdb_frame = curthread->td_frame; + } + for (regp = db_regs; regp < db_eregs; regp++) { if (!db_read_variable(regp, &value)) continue; @@ -70,4 +90,6 @@ db_show_regs(db_expr_t _1, bool _2, db_expr_t _3, char *_4) db_printf("\n"); } db_print_loc_and_inst(PC_REGS()); + + kdb_frame = oldtf; } From owner-dev-commits-src-all@freebsd.org Fri Jan 8 18:53:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EF1AE4D318C; Fri, 8 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@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 4DCC1X6TLpz4pwY; Fri, 8 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D12612A9; Fri, 8 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108IrqB3083399; Fri, 8 Jan 2021 18:53:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108IrqeS083398; Fri, 8 Jan 2021 18:53:52 GMT (envelope-from git) Date: Fri, 8 Jan 2021 18:53:52 GMT Message-Id: <202101081853.108IrqeS083398@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: e9bb4ce3d0e7 - main - arm64: don't pass user trapframe to kdb_trap() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e9bb4ce3d0e714d35b12ffdc7ecb56cade01f4a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 18:53:53 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=e9bb4ce3d0e714d35b12ffdc7ecb56cade01f4a0 commit e9bb4ce3d0e714d35b12ffdc7ecb56cade01f4a0 Author: mhorne AuthorDate: 2020-12-18 18:43:52 +0000 Commit: Mitchell Horne CommitDate: 2021-01-08 18:53:20 +0000 arm64: don't pass user trapframe to kdb_trap() This effectively undoes the changes made in r321571. While useful, it is inconsistent with how other architectures pass trapframes to kdb. This change is also required to get a working gdb(4) stub on arm64, as otherwise the backtrace will begin too early. As of 088a7eef95b1, this information can still be obtained via "show registers/u". Reviewed by: jhb (slightly earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Pull Request: https://reviews.freebsd.org/D27719 --- sys/arm64/arm64/trap.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 1330838148d2..12d10ff1d261 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -360,7 +360,6 @@ print_registers(struct trapframe *frame) void do_el1h_sync(struct thread *td, struct trapframe *frame) { - struct trapframe *oframe; uint32_t exception; uint64_t esr, far; int dfsc; @@ -378,18 +377,6 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) "do_el1_sync: curthread: %p, esr %lx, elr: %lx, frame: %p", td, esr, frame->tf_elr, frame); - oframe = td->td_frame; - - switch (exception) { - case EXCP_BRK: - case EXCP_WATCHPT_EL1: - case EXCP_SOFTSTP_EL1: - break; - default: - td->td_frame = frame; - break; - } - switch (exception) { case EXCP_FP_SIMD: case EXCP_TRAP_FP: @@ -429,18 +416,15 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) } #endif #ifdef KDB - kdb_trap(exception, 0, - (td->td_frame != NULL) ? td->td_frame : frame); + kdb_trap(exception, 0, frame); #else panic("No debugger in kernel.\n"); #endif - frame->tf_elr += 4; break; case EXCP_WATCHPT_EL1: case EXCP_SOFTSTP_EL1: #ifdef KDB - kdb_trap(exception, 0, - (td->td_frame != NULL) ? td->td_frame : frame); + kdb_trap(exception, 0, frame); #else panic("No debugger in kernel.\n"); #endif @@ -455,8 +439,6 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) panic("Unknown kernel exception %x esr_el1 %lx\n", exception, esr); } - - td->td_frame = oframe; } void From owner-dev-commits-src-all@freebsd.org Fri Jan 8 19:13:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C23F74D367B for ; Fri, 8 Jan 2021 19:13:35 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 4DCCSH4qrdz4rMR for ; Fri, 8 Jan 2021 19:13:35 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f50.google.com with SMTP id c5so9998783wrp.6 for ; Fri, 08 Jan 2021 11:13:35 -0800 (PST) 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=ao7yUu6uUSCQfFpwdrgetMQ/2BdodVz0kiNZGM8tsPo=; b=mHmjPT4arc05vJljJim5KX2Hh2hY4lL9rSLzYGg9jTQ32b887lUNJRJ7W3Q1rHMvN7 QFdOEDPYyj0a8bY9iAAyrJCswoPq/5Mu1RZpI+aArtCNWCEfB2ttLNyy4YjtQvOteZjy cwcyFc+iEvpzzoFoHGkSVkOFIXmh9HZhCsnqAa0JD7KKRQB+V3T3/IHohsGIwjwP0Znp ONV4kVVKgQAnHsSXpaGSSpb/T2/0iU7jVw0/jGOgoGS+ky9+Ul4MsYJK56fbKKhMT8oA /NeX6RRJ2kh4sz2FtmFbOans+uStuO9M9eJ/Bg7KXUB3hsxXCq+T4qq7FYf5cW5z8hoi njUw== X-Gm-Message-State: AOAM532uXY741nHwaxYG7mMTYm3HyhrovWg4yQRXBItsLW47zBGVoSoB G99//iL/XEbZGYo7f7MrYmGKMg== X-Google-Smtp-Source: ABdhPJzT92NykaaEAJGqA7nO77LQ16J/ZHar76bQ4dcu4+Cz/iNb10Gpo/JsNZ/SdiDxNRz8HyfLnQ== X-Received: by 2002:adf:e541:: with SMTP id z1mr5077312wrm.143.1610133213544; Fri, 08 Jan 2021 11:13:33 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id h29sm14680836wrc.68.2021.01.08.11.13.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jan 2021 11:13:32 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page From: Jessica Clarke In-Reply-To: <202101081729.108HTG7j066884@gitrepo.freebsd.org> Date: Fri, 8 Jan 2021 19:13:31 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> References: <202101081729.108HTG7j066884@gitrepo.freebsd.org> To: Chuck Tuffli X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DCCSH4qrdz4rMR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 19:13:35 -0000 On 8 Jan 2021, at 17:29, Chuck Tuffli wrote: > diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h > index 3c159b1fd0fc..67d02ba73fd8 100644 > --- a/sys/dev/nvme/nvme.h > +++ b/sys/dev/nvme/nvme.h > @@ -1396,6 +1396,28 @@ struct nvme_command_effects_page { > _Static_assert(sizeof(struct nvme_command_effects_page) =3D=3D 4096, > "bad size for nvme_command_effects_page"); >=20 > +struct nvme_device_self_test_page { > + uint8_t curr_operation; > + uint8_t curr_compl; > + uint8_t rsvd2[2]; > + struct { > + uint8_t status; > + uint8_t segment_num; > + uint8_t valid_diag_info; > + uint8_t rsvd3; > + uint64_t poh; > + uint32_t nsid; > + /* Define as an array to simplify alignment issues */ > + uint8_t failing_lba[8]; > + uint8_t status_code_type; > + uint8_t status_code; > + uint8_t vendor_specific[2]; > + } __packed result[20]; > +} __packed __aligned(4); > + > +_Static_assert(sizeof(struct nvme_device_self_test_page) =3D=3D 564, > + "bad size for nvme_device_self_test_page"); > + > struct nvme_res_notification_page { > uint64_t log_page_count; > uint8_t log_page_type; > @@ -2016,4 +2038,21 @@ void nvme_resv_status_ext_swapbytes(struct = nvme_resv_status_ext *s __unused, > #endif > } >=20 > +static inline void > +nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s = __unused) > +{ > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN > + uint64_t failing_lba; > + uint32_t r; > + > + for (r =3D 0; r < 20; r++) { > + s->result[r].poh =3D le64toh(s->result[r].poh); > + s->result[r].nsid =3D le32toh(s->result[r].nsid); > + /* Unaligned 64-bit loads fail on some architectures */ > + memcpy(&failing_lba, s->result[r].failing_lba, = sizeof(failing_lba)); > + failing_lba =3D le64toh(failing_lba); > + memcpy(s->result[r].failing_lba, &failing_lba, = sizeof(failing_lba)); > + } > +#endif > +} > #endif /* __NVME_H__ */ Hi, This broke powerpc and powerpc64: In file included from ioctl.c:33: In file included from /home/jrtc27/src/sys/./cam/scsi/scsi_pass.h:35: In file included from /home/jrtc27/src/sys/cam/cam_ccb.h:46: In file included from /home/jrtc27/src/sys/cam/nvme/nvme_all.h:33: /home/jrtc27/src/sys/dev/nvme/nvme.h:2052:3: error: implicitly declaring = library function 'memcpy' with type 'void *(void *, const void *, = unsigned long)' [-Werror,-Wimplicit-function-declaration] memcpy(&failing_lba, s->result[r].failing_lba, = sizeof(failing_lba)); ^ /home/jrtc27/src/sys/dev/nvme/nvme.h:2052:3: note: include the header = or explicitly provide a declaration for 'memcpy' 1 error generated. --- ioctl.o --- *** [ioctl.o] Error code 1 make[7]: stopped in /home/jrtc27/src/lib/libsysdecode 1 error Jess From owner-dev-commits-src-all@freebsd.org Fri Jan 8 19:20:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8BBDF4D3C1D; Fri, 8 Jan 2021 19:20:36 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (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 4DCCcN0fk5z4rvB; Fri, 8 Jan 2021 19:20:35 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id xxJHkls3334axxxJIkfvuw; Fri, 08 Jan 2021 12:20:33 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5ff8b081 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=q70-2Ng7odlXIZddMxEA: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 30E0E1EA; Fri, 8 Jan 2021 11:20:30 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 108JKUd2003299; Fri, 8 Jan 2021 11:20:30 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101081920.108JKUd2003299@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: Jessica Clarke cc: Chuck Tuffli , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page In-reply-to: <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> References: <202101081729.108HTG7j066884@gitrepo.freebsd.org> <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> Comments: In-reply-to Jessica Clarke message dated "Fri, 08 Jan 2021 19:13:31 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 08 Jan 2021 11:20:30 -0800 X-CMAE-Envelope: MS4xfMHHSzvR8srN4yzs6ExQ+4xSAL4jsSEioRuEH5dos1dpXrAqaF/UTOVkHdAsAUGdT53wsSyIqNuHr/ygeWEB+cqtb9xQ30WGZW1QSNGGtlxT+GxeWYl+ FR6EaNp3p9JCOfKyQtOswwEKPNJZYphOP8TUb7vB7B9wWP+GIjDeOe5bsSYNN3l5E+zdvGbViJT6zpFWN0mu68yRS0LdmJJGKyfi1I/X6vVEaTNxUsoXBnOV PDNH0fnCKlpcFgX1Vln9dRv2pdZbfrp3z31Eugc8NK19I9a3i+XA2MlWMvNHlrC9tNnScOOBw1qQGO3HxmlfAdC5M3s1Lkf8j3c5LHhRKuIYk7XXuW2GKqKJ Tw4XsbeE X-Rspamd-Queue-Id: 4DCCcN0fk5z4rvB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 19:20:36 -0000 In message <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org>, Jessica Clarke w rites: > On 8 Jan 2021, at 17:29, Chuck Tuffli wrote: > > diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h > > index 3c159b1fd0fc..67d02ba73fd8 100644 > > --- a/sys/dev/nvme/nvme.h > > +++ b/sys/dev/nvme/nvme.h > > @@ -1396,6 +1396,28 @@ struct nvme_command_effects_page { > > _Static_assert(sizeof(struct nvme_command_effects_page) == 4096, > > "bad size for nvme_command_effects_page"); > > > > +struct nvme_device_self_test_page { > > + uint8_t curr_operation; > > + uint8_t curr_compl; > > + uint8_t rsvd2[2]; > > + struct { > > + uint8_t status; > > + uint8_t segment_num; > > + uint8_t valid_diag_info; > > + uint8_t rsvd3; > > + uint64_t poh; > > + uint32_t nsid; > > + /* Define as an array to simplify alignment issues */ > > + uint8_t failing_lba[8]; > > + uint8_t status_code_type; > > + uint8_t status_code; > > + uint8_t vendor_specific[2]; > > + } __packed result[20]; > > +} __packed __aligned(4); > > + > > +_Static_assert(sizeof(struct nvme_device_self_test_page) == 564, > > + "bad size for nvme_device_self_test_page"); > > + > > struct nvme_res_notification_page { > > uint64_t log_page_count; > > uint8_t log_page_type; > > @@ -2016,4 +2038,21 @@ void nvme_resv_status_ext_swapbytes(struct nvme_resv > _status_ext *s __unused, > > #endif > > } > > > > +static inline void > > +nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s __unu > sed) > > +{ > > +#if _BYTE_ORDER != _LITTLE_ENDIAN > > + uint64_t failing_lba; > > + uint32_t r; > > + > > + for (r = 0; r < 20; r++) { > > + s->result[r].poh = le64toh(s->result[r].poh); > > + s->result[r].nsid = le32toh(s->result[r].nsid); > > + /* Unaligned 64-bit loads fail on some architectures */ > > + memcpy(&failing_lba, s->result[r].failing_lba, sizeof(failing_l > ba)); > > + failing_lba = le64toh(failing_lba); > > + memcpy(s->result[r].failing_lba, &failing_lba, sizeof(failing_l > ba)); > > + } > > +#endif > > +} > > #endif /* __NVME_H__ */ > > Hi, > This broke powerpc and powerpc64: > > In file included from ioctl.c:33: > In file included from /home/jrtc27/src/sys/./cam/scsi/scsi_pass.h:35: > In file included from /home/jrtc27/src/sys/cam/cam_ccb.h:46: > In file included from /home/jrtc27/src/sys/cam/nvme/nvme_all.h:33: > /home/jrtc27/src/sys/dev/nvme/nvme.h:2052:3: error: implicitly declaring libr > ary function 'memcpy' with type 'void *(void *, const void *, unsigned long)' > [-Werror,-Wimplicit-function-declaration] > memcpy(&failing_lba, s->result[r].failing_lba, sizeof(failing > _lba)); > ^ > /home/jrtc27/src/sys/dev/nvme/nvme.h:2052:3: note: include the header .h> or explicitly provide a declaration for 'memcpy' > 1 error generated. > --- ioctl.o --- > *** [ioctl.o] Error code 1 > > make[7]: stopped in /home/jrtc27/src/lib/libsysdecode > 1 error > > Jess > > It also broke i386 (not amd64), needing a %jd instead of %ld. -- 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-dev-commits-src-all@freebsd.org Fri Jan 8 19:27:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3726A4D40FE; Fri, 8 Jan 2021 19:27:25 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (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 4DCCmC68JKz4sQp; Fri, 8 Jan 2021 19:27:23 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id xxPtklugy34axxxPukfxX9; Fri, 08 Jan 2021 12:27:22 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5ff8b21a a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=VxmjJ2MpAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=i3rduQodJLL-9NJ98xMA:9 a=CjuIK1q_8ugA:10 a=9oQxGDXC-HAA:10 a=7gXAzLPJhVmCkEl4_tsf:22 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 ADEB623D; Fri, 8 Jan 2021 11:27:20 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 108JRKxR084004; Fri, 8 Jan 2021 11:27:20 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101081927.108JRKxR084004@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: Jessica Clarke , Chuck Tuffli cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page In-reply-to: <202101081920.108JKUd2003299@slippy.cwsent.com> References: <202101081729.108HTG7j066884@gitrepo.freebsd.org> <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> <202101081920.108JKUd2003299@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Fri, 08 Jan 2021 11:20:30 -0800." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 08 Jan 2021 11:27:20 -0800 X-CMAE-Envelope: MS4xfLL5ySZymbUxIHy7VmXx6weBIIK4nkGp6avxMuaenOBF+R6Lilo8ipN7njghyl9AZdFOdeSRgWDjz7ValFigKalPjZdx17tIh7saBZHXYkVYNdHdq9Bj WhTbpIe+mLwgRT2rsEZljzM0kiMyz3IuYIW7KMiUFu5WLQ5yAgYZWwvhor/4UFnl1AGehep4kc4ECHc0Dh3B48UtX+v9V2I0dgXoOAp9ath0w1LYMHHCA1Dr SJg/eZ1u7j2OIAo7F5bwjKf9HZz7dV8dcuT/s7JXAaYdTauQBkTn8ssojc58iFIWogecI1EL/sA2FAXNoZmpeNVHLIRW48okKfzlETACL3DJksYRqHgtyeK3 uwJPn5yh X-Rspamd-Queue-Id: 4DCCmC68JKz4sQp 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.134.12) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [0.65 / 15.00]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; RWL_MAILSPIKE_GOOD(0.00)[64.59.134.12:from]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-0.65)[-0.654]; RECEIVED_SPAMHAUS_PBL(0.00)[70.67.229.168:received]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[64.59.134.12:from]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; AUTH_NA(1.00)[]; SPAMHAUS_ZRD(0.00)[64.59.134.12:from:127.0.2.255]; RCVD_IN_DNSWL_LOW(-0.10)[64.59.134.12:from]; RCVD_TLS_LAST(0.00)[]; NEURAL_SPAM_LONG(1.00)[1.000]; R_SPF_NA(0.00)[no SPF record]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 19:27:25 -0000 In message <202101081920.108JKUd2003299@slippy.cwsent.com>, Cy Schubert writes: > In message <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org>, Jessica > Clarke w > rites: > > On 8 Jan 2021, at 17:29, Chuck Tuffli wrote: > > > diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h > > > index 3c159b1fd0fc..67d02ba73fd8 100644 > > > --- a/sys/dev/nvme/nvme.h > > > +++ b/sys/dev/nvme/nvme.h > > > @@ -1396,6 +1396,28 @@ struct nvme_command_effects_page { > > > _Static_assert(sizeof(struct nvme_command_effects_page) == 4096, > > > "bad size for nvme_command_effects_page"); > > > > > > +struct nvme_device_self_test_page { > > > + uint8_t curr_operation; > > > + uint8_t curr_compl; > > > + uint8_t rsvd2[2]; > > > + struct { > > > + uint8_t status; > > > + uint8_t segment_num; > > > + uint8_t valid_diag_info; > > > + uint8_t rsvd3; > > > + uint64_t poh; > > > + uint32_t nsid; > > > + /* Define as an array to simplify alignment issues */ > > > + uint8_t failing_lba[8]; > > > + uint8_t status_code_type; > > > + uint8_t status_code; > > > + uint8_t vendor_specific[2]; > > > + } __packed result[20]; > > > +} __packed __aligned(4); > > > + > > > +_Static_assert(sizeof(struct nvme_device_self_test_page) == 564, > > > + "bad size for nvme_device_self_test_page"); > > > + > > > struct nvme_res_notification_page { > > > uint64_t log_page_count; > > > uint8_t log_page_type; > > > @@ -2016,4 +2038,21 @@ void nvme_resv_status_ext_swapbytes(struct n > vme_resv > > _status_ext *s __unused, > > > #endif > > > } > > > > > > +static inline void > > > +nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s __u > nu > > sed) > > > +{ > > > +#if _BYTE_ORDER != _LITTLE_ENDIAN > > > + uint64_t failing_lba; > > > + uint32_t r; > > > + > > > + for (r = 0; r < 20; r++) { > > > + s->result[r].poh = le64toh(s->result[r].poh); > > > + s->result[r].nsid = le32toh(s->result[r].nsid); > > > + /* Unaligned 64-bit loads fail on some architectures */ > > > + memcpy(&failing_lba, s->result[r].failing_lba, sizeof(failing_l > > ba)); > > > + failing_lba = le64toh(failing_lba); > > > + memcpy(s->result[r].failing_lba, &failing_lba, sizeof(failing_l > > ba)); > > > + } > > > +#endif > > > +} > > > #endif /* __NVME_H__ */ > > > > Hi, > > This broke powerpc and powerpc64: > > > > In file included from ioctl.c:33: > > In file included from /home/jrtc27/src/sys/./cam/scsi/scsi_pass.h:35: > > In file included from /home/jrtc27/src/sys/cam/cam_ccb.h:46: > > In file included from /home/jrtc27/src/sys/cam/nvme/nvme_all.h:33: > > /home/jrtc27/src/sys/dev/nvme/nvme.h:2052:3: error: implicitly declaring li > br > > ary function 'memcpy' with type 'void *(void *, const void *, unsigned long > )' > > [-Werror,-Wimplicit-function-declaration] > > memcpy(&failing_lba, s->result[r].failing_lba, sizeof(faili > ng > > _lba)); > > ^ > > /home/jrtc27/src/sys/dev/nvme/nvme.h:2052:3: note: include the header ng > > .h> or explicitly provide a declaration for 'memcpy' > > 1 error generated. > > --- ioctl.o --- > > *** [ioctl.o] Error code 1 > > > > make[7]: stopped in /home/jrtc27/src/lib/libsysdecode > > 1 error > > > > Jess > > > > > > It also broke i386 (not amd64), needing a %jd instead of %ld. The fsck_ffs commit (5cc52631b3b88dfc36d8049dc8bece8573c5f9af) has the same problem with i386. I'll go ahead and fix that one at noon. -- 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-dev-commits-src-all@freebsd.org Fri Jan 8 19:33:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9E7F84D435D; Fri, 8 Jan 2021 19:33:41 +0000 (UTC) (envelope-from git@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 4DCCvT47tjz4t9r; Fri, 8 Jan 2021 19:33:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81165B3B; Fri, 8 Jan 2021 19:33:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108JXfEZ034979; Fri, 8 Jan 2021 19:33:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108JXfpS034978; Fri, 8 Jan 2021 19:33:41 GMT (envelope-from git) Date: Fri, 8 Jan 2021 19:33:41 GMT Message-Id: <202101081933.108JXfpS034978@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: c6951fac7846 - main - Fix 32-bit build post 5cc52631b3b88dfc36d8049dc8bece8573c5f9af. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6951fac78467daf81df5e711ffca820f7608036 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 19:33:41 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=c6951fac78467daf81df5e711ffca820f7608036 commit c6951fac78467daf81df5e711ffca820f7608036 Author: Cy Schubert AuthorDate: 2021-01-08 19:28:30 +0000 Commit: Cy Schubert CommitDate: 2021-01-08 19:28:30 +0000 Fix 32-bit build post 5cc52631b3b88dfc36d8049dc8bece8573c5f9af. --- sbin/fsck_ffs/fsutil.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 64c4701d9b7f..77571deb38f4 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -1211,10 +1211,10 @@ static void prtbuf(const char *msg, struct bufarea *bp) { - printf("%s: bp %p, type %s, bno %ld, size %d, refcnt %d, flags %s, " - "index %d\n", msg, bp, BT_BUFTYPE(bp->b_type), bp->b_bno, + printf("%s: bp %p, type %s, bno %jd, size %d, refcnt %d, flags %s, " + "index %jd\n", msg, bp, BT_BUFTYPE(bp->b_type), (intmax_t) bp->b_bno, bp->b_size, bp->b_refcnt, bp->b_flags & B_DIRTY ? "dirty" : "clean", - bp->b_index); + (intmax_t) bp->b_index); } /* From owner-dev-commits-src-all@freebsd.org Fri Jan 8 19:59:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CC31E4D4BD0; Fri, 8 Jan 2021 19:59:16 +0000 (UTC) (envelope-from git@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 4DCDT05G7Jz4v26; Fri, 8 Jan 2021 19:59:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CC2DF18; Fri, 8 Jan 2021 19:59:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108JxGwo061972; Fri, 8 Jan 2021 19:59:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108JxGnb061971; Fri, 8 Jan 2021 19:59:16 GMT (envelope-from git) Date: Fri, 8 Jan 2021 19:59:16 GMT Message-Id: <202101081959.108JxGnb061971@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: d36b5dbe28d8 - main - libc: regex: rework unsafe pointer arithmetic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d36b5dbe28d8ebab219fa29db533734d47f0c4a3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 19:59:16 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d36b5dbe28d8ebab219fa29db533734d47f0c4a3 commit d36b5dbe28d8ebab219fa29db533734d47f0c4a3 Author: Miod Vallat AuthorDate: 2021-01-08 18:59:00 +0000 Commit: Kyle Evans CommitDate: 2021-01-08 19:58:35 +0000 libc: regex: rework unsafe pointer arithmetic regcomp.c uses the "start + count < end" idiom to check that there are "count" bytes available in an array of char "start" and "end" both point to. This is fine, unless "start + count" goes beyond the last element of the array. In this case, pedantic interpretation of the C standard makes the comparison of such a pointer against "end" undefined, and optimizers from hell will happily remove as much code as possible because of this. An example of this occurs in regcomp.c's bothcases(), which defines bracket[3], sets "next" to "bracket" and "end" to "bracket + 2". Then it invokes p_bracket(), which starts with "if (p->next + 5 < p->end)"... Because bothcases() and p_bracket() are static functions in regcomp.c, there is a real risk of miscompilation if aggressive inlining happens. The following diff rewrites the "start + count < end" constructs into "end - start > count". Assuming "end" and "start" are always pointing in the array (such as "bracket[3]" above), "end - start" is well-defined and can be compared without trouble. As a bonus, MORE2() implies MORE() therefore SEETWO() can be simplified a bit. PR: 252403 --- lib/libc/regex/regcomp.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index 076b9c525a65..970a448b649a 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -177,10 +177,10 @@ static char nuls[10]; /* place to point scanner in event of error */ */ #define PEEK() (*p->next) #define PEEK2() (*(p->next+1)) -#define MORE() (p->next < p->end) -#define MORE2() (p->next+1 < p->end) +#define MORE() (p->end - p->next > 0) +#define MORE2() (p->end - p->next > 1) #define SEE(c) (MORE() && PEEK() == (c)) -#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b)) +#define SEETWO(a, b) (MORE2() && PEEK() == (a) && PEEK2() == (b)) #define SEESPEC(a) (p->bre ? SEETWO('\\', a) : SEE(a)) #define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0) #define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0) @@ -1013,15 +1013,17 @@ p_bracket(struct parse *p) wint_t ch; /* Dept of Truly Sickening Special-Case Kludges */ - if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) { - EMIT(OBOW, 0); - NEXTn(6); - return; - } - if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) { - EMIT(OEOW, 0); - NEXTn(6); - return; + if (p->end - p->next > 5) { + if (strncmp(p->next, "[:<:]]", 6) == 0) { + EMIT(OBOW, 0); + NEXTn(6); + return; + } + if (strncmp(p->next, "[:>:]]", 6) == 0) { + EMIT(OEOW, 0); + NEXTn(6); + return; + } } if ((cs = allocset(p)) == NULL) From owner-dev-commits-src-all@freebsd.org Fri Jan 8 19:59:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F1D944D49B7; Fri, 8 Jan 2021 19:59:17 +0000 (UTC) (envelope-from git@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 4DCDT15vdRz4trJ; Fri, 8 Jan 2021 19:59:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDA0ED58; Fri, 8 Jan 2021 19:59:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108JxHiB061995; Fri, 8 Jan 2021 19:59:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108JxHR9061994; Fri, 8 Jan 2021 19:59:17 GMT (envelope-from git) Date: Fri, 8 Jan 2021 19:59:17 GMT Message-Id: <202101081959.108JxHR9061994@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 04a3ba363d13 - main - libregex: re-enable `make check` MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 04a3ba363d13cf5efaeb63f64cd3fdd6b9c71248 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 19:59:18 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=04a3ba363d13cf5efaeb63f64cd3fdd6b9c71248 commit 04a3ba363d13cf5efaeb63f64cd3fdd6b9c71248 Author: Kyle Evans AuthorDate: 2021-01-08 19:57:32 +0000 Commit: Kyle Evans CommitDate: 2021-01-08 19:58:35 +0000 libregex: re-enable `make check` The tests are generally expected to pass, uncomment the annotation that lets `make check` work. Note that `make check` currently requires kyua from ports or an appropriate symlink into /usr/local/bin. --- lib/libregex/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libregex/Makefile b/lib/libregex/Makefile index 186bb20088ce..5e54c3a5312a 100644 --- a/lib/libregex/Makefile +++ b/lib/libregex/Makefile @@ -14,7 +14,7 @@ WARNS?= 2 VERSION_DEF= ${.CURDIR}/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map -#HAS_TESTS= +HAS_TESTS= SUBDIR.${MK_TESTS}+= tests .include "../Makefile.inc" From owner-dev-commits-src-all@freebsd.org Fri Jan 8 20:24:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 67D3A4D5718; Fri, 8 Jan 2021 20:24:57 +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 4DCF2d0V40z3CwW; Fri, 8 Jan 2021 20:24:56 +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 108KOjKc044913 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 8 Jan 2021 22:24:48 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 108KOjKc044913 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 108KOjw9044912; Fri, 8 Jan 2021 22:24:45 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 8 Jan 2021 22:24:45 +0200 From: Konstantin Belousov To: Warner Losh Cc: Mateusz Piotrowski <0mp@freebsd.org>, src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 74bd20769706 - main - Reference newfs_msdos(8) from the newfs(8) manual Message-ID: References: <202101070924.1079OE4g081849@gitrepo.freebsd.org> <52e99dc8-cd75-a2ab-7670-b81d8aaa8134@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: 4DCF2d0V40z3CwW X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 20:24:57 -0000 On Fri, Jan 08, 2021 at 07:54:41AM -0700, Warner Losh wrote: > On Fri, Jan 8, 2021 at 5:51 AM Mateusz Piotrowski <0mp@freebsd.org> wrote: > > > Hello Konstantin, > > > > On 1/7/21 7:16 PM, Konstantin Belousov wrote: > > > On Thu, Jan 07, 2021 at 09:24:14AM +0000, Mateusz Piotrowski wrote: > > >> The branch main has been updated by 0mp (doc, ports committer): > > >> > > >> URL: > > https://cgit.FreeBSD.org/src/commit/?id=74bd20769706041108a573601cf0b61c755bdc56 > > >> > > >> commit 74bd20769706041108a573601cf0b61c755bdc56 > > >> Author: Mateusz Piotrowski <0mp@FreeBSD.org> > > >> AuthorDate: 2021-01-07 09:22:20 +0000 > > >> Commit: Mateusz Piotrowski <0mp@FreeBSD.org> > > >> CommitDate: 2021-01-07 09:24:07 +0000 > > >> > > >> Reference newfs_msdos(8) from the newfs(8) manual > > > Why ? newfs is not the interface to create arbitrary kind of filesystem, > > > it is just UFS writer. > > > > I think that it is beneficial nevertheless. Now users can discover other > > newfs_* commands FreeBSD > > offers. Also, newfs_msdos(8) already references newfs(8) (there are only > > two items in the SEE ALSO > > section there, the other one being gpart(8)). > > > > From my perspective it is not too bad to have this reference in the newfs > > manual. It seems like > > it's also something some FreeBSD users expect to see in the manual page as > > we received a bug report > > for that. > > > > I can revert this patch and also remove newfs(8) from the newfs_msdos > > manual while at it if desired. > > Perhaps newfs commands are easy enough to find so this patch only hurts > > the readability of the manual... > > > > I think it's a good change because many other filesystem manipulation > commands will do arbitrary filesystems. Since it breaks this symmetry, > having the xref is fine. Your reply just highlights my point. As is, the cross-reference is unmotivated and cause questions what is so special for msdosfs that UFS newfs requires mentioning of it. If there is some explanation along the lines that newfs is the common name prefix for utilities creating filesystems, with the suffix being the type of fs, for instance newfs_msdos(8) etc, then it becomes useful and reasonable. Note that it is not really true that 'many' utilities follow this pattern, I can only think of newfs, fsck, and partially mount (for mount it is more complicated and probably requires providing too much implementation details to explain). From owner-dev-commits-src-all@freebsd.org Fri Jan 8 20:34:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 54BFC4D643C; Fri, 8 Jan 2021 20:34:11 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) (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 4DCFFH1cv0z3FQk; Fri, 8 Jan 2021 20:34:11 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f172.google.com with SMTP id v3so11540072ilo.5; Fri, 08 Jan 2021 12:34:11 -0800 (PST) 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=HJdynBKCJjSMwoph/OzDPojwXDCELLvX/O7gp1cwglk=; b=LXdqlulC6mGJRyIiuVdlyvwwlsky1NJ/gWrmT6vMqIdRvW6T8s8i+v9cMBRvlydlq4 C96Rsu0QGbv2cQV/SRGl4EBfZW1B7JwVmv/OOIvDxa5mvR7LYz9nAkHM3uOKFAPxxA3Q +Cj//q5U7Y4uns0hFRzd4IFbmbDjKdi7v5lVxvVH5U/9lxG80pwnH4qOgAUC8/ZL8B1w Y6WHfMcnWhKVbPUepikGoOznALLqK13QCEgwdWidEfOpmQtwgGL0F938O6gVNKFR7Qxu 0Q/dmAy0KDFl0qa+e7L7yGE5HubwbW3S/LHCydcuFcFys5/qbFNjLnVMdknWhd/W8fcd BMRw== X-Gm-Message-State: AOAM533JITVN+PlzxB3YtfW0AqFKaxHLcgxl18WwwSDbp7ymwxES8mBa 4iPAKa3DLN6lEFX3HPTNGMZSi9K4Pnm/Rb21cHc= X-Google-Smtp-Source: ABdhPJy6uoSmwfOsMreC8mvyD+FPJ5YMVaBxsEeZwCC7UUqMI+44ivQO5xICPDU7x4CH7/nzJXvwkNpXIGOOrXCpykM= X-Received: by 2002:a92:d2ce:: with SMTP id w14mr5844753ilg.182.1610138049874; Fri, 08 Jan 2021 12:34:09 -0800 (PST) MIME-Version: 1.0 References: <202101070924.1079OE4g081849@gitrepo.freebsd.org> <52e99dc8-cd75-a2ab-7670-b81d8aaa8134@FreeBSD.org> In-Reply-To: From: Ed Maste Date: Fri, 8 Jan 2021 15:33:58 -0500 Message-ID: Subject: Re: git: 74bd20769706 - main - Reference newfs_msdos(8) from the newfs(8) manual To: Konstantin Belousov Cc: Warner Losh , Mateusz Piotrowski <0mp@freebsd.org>, src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DCFFH1cv0z3FQk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 20:34:11 -0000 On Fri, 8 Jan 2021 at 15:25, Konstantin Belousov wrote: > > If there is some explanation along the lines that newfs is the common > name prefix for utilities creating filesystems, with the suffix being > the type of fs, for instance newfs_msdos(8) etc, then it becomes useful > and reasonable. I agree. It would be useful to mention that newfs is "special" with respect to naming; presumably we would call it newfs_ufs if we were now adding it where it did not already exist. Perhaps this should be a NOTES or similar section before the SEE ALSO? From owner-dev-commits-src-all@freebsd.org Fri Jan 8 20:58:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6D59A4D6AC4; Fri, 8 Jan 2021 20:58: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 4DCFnV715Kz3Gcg; Fri, 8 Jan 2021 20:58: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 108KwUYw053366 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 8 Jan 2021 22:58:33 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 108KwUYw053366 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 108KwTjU053365; Fri, 8 Jan 2021 22:58:29 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 8 Jan 2021 22:58:29 +0200 From: Konstantin Belousov To: Kyle Evans Cc: Baptiste Daroussin , Vladimir Kondratyev , Ravi Pokala , Jessica Clarke , Vladimir Kondratyev , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. Message-ID: References: <202101072320.107NKpMS063374@gitrepo.freebsd.org> <7a7fa0fb-51c2-1b14-6d37-2c400f69d7dd@kondratyev.su> <3EA011C9-2EEC-4693-B36D-69E74DF8473C@panasas.com> <20210108092638.x2kkvpeftey2wk62@ivaldir.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: 4DCFnV715Kz3Gcg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 20:58:39 -0000 On Fri, Jan 08, 2021 at 07:46:31AM -0600, Kyle Evans wrote: > On Fri, Jan 8, 2021 at 3:27 AM Baptiste Daroussin wrote: > > > > On Fri, Jan 08, 2021 at 02:49:31AM +0300, Vladimir Kondratyev wrote: > > > On 08.01.2021 02:41, Ravi Pokala wrote: > > > > -----Original Message----- > > > > From: on behalf of Vladimir Kondratyev > > > > Date: 2021-01-07, Thursday at 15:33 > > > > To: Jessica Clarke , Vladimir Kondratyev > > > > Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" > > > > Subject: Re: git: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. > > > > > > > > On 08.01.2021 02:27, Jessica Clarke wrote: > > > > > On 7 Jan 2021, at 23:20, Vladimir Kondratyev wrote: > > > > >> +#include > > > > >> +#include > > > > >> +#include "xlocale_private.h" > > > > >> + > > > > >> +/* > > > > >> + * Find the first occurrence of find in s, ignore case. > > > > >> + */ > > > > >> +char * > > > > >> +strcasestr_l(const char *s, const char *find, locale_t locale) > > > > > > > > > > Locales in the kernel? This feels wrong. > > > > > > > > > > Jess > > > > > > > > > > > > > strcasestr.c was copied from userland unmodified just to allow > > > > "git log --follow" to work. Next commit removed locale support from this > > > > file and connected it to build. > > > > > > > > Unfortunately, about two-dozen commit messages from you arrived at the same time, and some were out of order; without incrementing change numbers in the subject line, figuring out the actual ordering is non-trivial. :-p > > > > > > > > -Ravi (rpokala@) > > > > > > > > > > I hope, commit hook will be improved some day. Pushing of two-dozen > > > commits one by one is too boring. > > > > The history is in the right order and gitlog/cgit/anything that reads the log > > show everything in the right order. > > > > mails are asynchronuous, expecting the mail to always arrive in a given order is > > wrong ;) > > > > pushing all those commits at once was imho the right thing to do. > > > > I've pointed this out a couple of times (with seemingly nothing coming > from it), but the mails are being sent in reverse order. Fixing that > would at least increase chances for some to receive them in order (and > the archives show them perfectly in reverse order most of the time). > > Picking out the message-ids from the last series I sent, this is the > correct order: > > 202101072237.107MbYaX002789@gitrepo.freebsd.org ("4832d2e8ae1d - main > - du: tests: fix the H_flag test (primarily grep usage)") > 202101072237.107MbYsM002771@gitrepo.freebsd.org ("3c5c39c7ad8f - main > - du: tests: make H_flag tests more strict about output requirements") > > 202101072237.107MbYaX002789 -> 2789 was the last pid that assigned a message-id > 202101072237.107MbYsM002771 -> 2771 was the last pid that assigned a message-id > > Given that this is clearly with kern.randompid=0 on the server, one > can conclude that these were sent in the reverse order based on the > pid sequence. If you pick a couple other series out, this holds true > (at least for all the series I've looked at) Might be instead of trying to establish ordering by date, sending machinery could set followup/in-reply-to headers to thread the whole batch. Basically emulate the 'git send-email' behavior. Then we can argue that only related patches should be committed in one push, but practically that matches common workflow of developing on topic branches and pushing them in one go. it is guaranteed From owner-dev-commits-src-all@freebsd.org Fri Jan 8 21:15:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CE5D24D7317; Fri, 8 Jan 2021 21:15:06 +0000 (UTC) (envelope-from ctuffli@gmail.com) Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (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 4DCG8T5gYkz3HND; Fri, 8 Jan 2021 21:15:05 +0000 (UTC) (envelope-from ctuffli@gmail.com) Received: by mail-qt1-f180.google.com with SMTP id u21so7543565qtw.11; Fri, 08 Jan 2021 13:15:05 -0800 (PST) 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=22xNq8EsfkbEoDA2ps5BrwY8aVNo2cnzdJ3mK9Wb3qw=; b=CEcFbnmkFbSCFwt6uutW9sHuukdPbcF6Tp3BY3gQAcuuu392qLQmwDJJATePF1e1XS 9QsoYkzmDEduB6y0lILObK3QIlSRC7+8NlFQEZ5JlyWlvebNyoGUFvjeDhkjpNfsMdTx KMRIgR7gCSrLNJ8lnB7K01x4HVOYJ8jZD7RKvb60h6lfVUDoWvy2jhhwY6ndwhY+4faL RqzXFsu/nzUwvVsnWw2tUHE/dmZtiNYE1mGb+ZZQor20GPmPAnr5EJ7+p9/8AxzqzJTA HNDeYPNu9vboZ7/p8vnHbjbBCbqhm00G4VDZQdERfUm2aXSxxiif3KTrcAuPlXJkN2Tj yJTw== X-Gm-Message-State: AOAM530afjmZL0GK6gIJaDoh9hsLGolGtx9FECxJIYSy5ihG/8c483TS o7YzbjbhOTm20oVAARR4UNvp/GOijTg= X-Google-Smtp-Source: ABdhPJxCCzp4Q1LWL5o6U1mqw9YWNZ2yX5OETaXuSX1X4fgEtlUQvBfPRGP63zG0qmcBaWMYehGfFA== X-Received: by 2002:ac8:470d:: with SMTP id f13mr5173503qtp.281.1610140504610; Fri, 08 Jan 2021 13:15:04 -0800 (PST) Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com. [209.85.219.174]) by smtp.gmail.com with ESMTPSA id i18sm5573427qkg.66.2021.01.08.13.15.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Jan 2021 13:15:04 -0800 (PST) Received: by mail-yb1-f174.google.com with SMTP id o144so10692332ybc.0; Fri, 08 Jan 2021 13:15:04 -0800 (PST) X-Received: by 2002:a25:500b:: with SMTP id e11mr8259164ybb.138.1610140504113; Fri, 08 Jan 2021 13:15:04 -0800 (PST) MIME-Version: 1.0 References: <202101081729.108HTG7j066884@gitrepo.freebsd.org> <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> <202101081920.108JKUd2003299@slippy.cwsent.com> <202101081927.108JRKxR084004@slippy.cwsent.com> In-Reply-To: <202101081927.108JRKxR084004@slippy.cwsent.com> From: Chuck Tuffli Date: Fri, 8 Jan 2021 13:14:53 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page To: Cy Schubert Cc: Jessica Clarke , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , "src-committers@freebsd.org" X-Rspamd-Queue-Id: 4DCG8T5gYkz3HND X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of ctuffli@gmail.com designates 209.85.160.180 as permitted sender) smtp.mailfrom=ctuffli@gmail.com X-Spamd-Result: default: False [-1.00 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; RWL_MAILSPIKE_GOOD(0.00)[209.85.160.180:from]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; FORGED_SENDER(0.30)[chuck@freebsd.org,ctuffli@gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.160.180:from]; R_DKIM_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[chuck@freebsd.org,ctuffli@gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(1.00)[0.997]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.160.180:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.160.180:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 21:15:06 -0000 On Fri, Jan 8, 2021 at 11:27 AM Cy Schubert wrote: > In message <202101081920.108JKUd2003299@slippy.cwsent.com>, Cy Schubert > writes: > > In message <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org>, Jessica > > Clarke w > > rites: > ... > > > This broke powerpc and powerpc64: Sorry about that. I'll fix this in a bit. --chuck From owner-dev-commits-src-all@freebsd.org Fri Jan 8 21:18:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3B4D54D6FDE; Fri, 8 Jan 2021 21:18:52 +0000 (UTC) (envelope-from git@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 4DCGDr1FWQz3HhJ; Fri, 8 Jan 2021 21:18:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DB32202F; Fri, 8 Jan 2021 21:18:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108LIq4k064904; Fri, 8 Jan 2021 21:18:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108LIqNd064903; Fri, 8 Jan 2021 21:18:52 GMT (envelope-from git) Date: Fri, 8 Jan 2021 21:18:52 GMT Message-Id: <202101082118.108LIqNd064903@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: de27805fee0b - main - linuxkpi: handle ARI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de27805fee0bbe3b714615b1df4cf0b8ebbc39b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 21:18:52 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=de27805fee0bbe3b714615b1df4cf0b8ebbc39b9 commit de27805fee0bbe3b714615b1df4cf0b8ebbc39b9 Author: Konstantin Belousov AuthorDate: 2021-01-04 21:41:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-08 21:17:21 +0000 linuxkpi: handle ARI Stop trying to manually calculate RID, which cannot be done correctly by PCI_DEVFN(). Use PCI_GET_RID() method instead. Do not use pci_find_dbsf() to go from the linux pci_dev to freebsd device_t. First, device is readily available as dev.bsddev. Second, using pci_find_dbsf() fails for ARI-enabled functions with large function numbers, because PCI_SLOT()/PCI_FUNC() are for non-ARI. Reviewed by: bz, hselasky, manu Tested by: manu (drm) Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27960 --- sys/compat/linuxkpi/common/src/linux_pci.c | 20 ++++++++++++++------ sys/conf/kmod.mk | 1 + 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 3fbe296a0f62..be61c2dba3d2 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include "backlight_if.h" +#include "pcib_if.h" static device_probe_t linux_pci_probe; static device_attach_t linux_pci_attach; @@ -247,12 +248,16 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, struct pci_bus *pbus; struct pci_devinfo *dinfo; device_t parent; + uintptr_t rid; int error; + bool isdrm; linux_set_current(curthread); - if (pdrv != NULL && pdrv->isdrm) { - parent = device_get_parent(dev); + parent = device_get_parent(dev); + isdrm = pdrv != NULL && pdrv->isdrm; + + if (isdrm) { dinfo = device_get_ivars(parent); device_set_ivars(dev, dinfo); } else { @@ -262,7 +267,11 @@ linux_pci_attach_device(device_t dev, struct pci_driver *pdrv, pdev->dev.parent = &linux_root_device; pdev->dev.bsddev = dev; INIT_LIST_HEAD(&pdev->dev.irqents); - pdev->devfn = PCI_DEVFN(pci_get_slot(dev), pci_get_function(dev)); + if (isdrm) + PCI_GET_ID(device_get_parent(parent), parent, PCI_ID_RID, &rid); + else + PCI_GET_ID(parent, dev, PCI_ID_RID, &rid); + pdev->devfn = rid; pdev->device = dinfo->cfg.device; pdev->vendor = dinfo->cfg.vendor; pdev->subsystem_vendor = dinfo->cfg.subvendor; @@ -487,9 +496,8 @@ pci_resource_start(struct pci_dev *pdev, int bar) if ((rle = linux_pci_get_bar(pdev, bar)) == NULL) return (0); - dev = pci_find_dbsf(pdev->bus->domain, pdev->bus->number, - PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); - MPASS(dev != NULL); + dev = pdev->pdrv != NULL && pdev->pdrv->isdrm ? + device_get_parent(pdev->dev.bsddev) : pdev->dev.bsddev; if (BUS_TRANSLATE_RESOURCE(dev, rle->type, rle->start, &newstart)) { device_printf(pdev->dev.bsddev, "translate of %#jx failed\n", (uintmax_t)rle->start); diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index dcc00829b831..b7ba121925ea 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -96,6 +96,7 @@ LINUXKPI_GENSRCS+= \ device_if.h \ pci_if.h \ pci_iov_if.h \ + pcib_if.h \ vnode_if.h \ usb_if.h \ opt_usb.h \ From owner-dev-commits-src-all@freebsd.org Fri Jan 8 21:28:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7CECD4D7875; Fri, 8 Jan 2021 21:28:23 +0000 (UTC) (envelope-from git@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 4DCGRq39Xtz3JL0; Fri, 8 Jan 2021 21:28:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 602C22246; Fri, 8 Jan 2021 21:28:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108LSNZh078192; Fri, 8 Jan 2021 21:28:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108LSNg5078191; Fri, 8 Jan 2021 21:28:23 GMT (envelope-from git) Date: Fri, 8 Jan 2021 21:28:23 GMT Message-Id: <202101082128.108LSNg5078191@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 7c6a71d16c22 - main - i386 kernel is not built with vt_vbefb MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c6a71d16c2200a9f580bdcd20b3e13edcc05904 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 21:28:23 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=7c6a71d16c2200a9f580bdcd20b3e13edcc05904 commit 7c6a71d16c2200a9f580bdcd20b3e13edcc05904 Author: Toomas Soome AuthorDate: 2021-01-08 18:57:00 +0000 Commit: Toomas Soome CommitDate: 2021-01-08 18:58:23 +0000 i386 kernel is not built with vt_vbefb Add vt_vbefb to GENERIC and NOTES --- sys/i386/conf/GENERIC | 1 + sys/i386/conf/NOTES | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index 2f1b8c545994..eac3a0af6c82 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -196,6 +196,7 @@ options SC_PIXEL_MODE # add support for the raster text mode # vt is the new video console driver device vt device vt_vga +device vt_vbefb device agp # support several AGP chipsets diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index c086d0fc704e..f39f8ab6b302 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -423,6 +423,7 @@ options VGA_DEBUG # vt(4) drivers. device vt_vga +device vt_vbefb # Linear framebuffer driver for S3 VESA 1.2 cards. Works on top of VESA. device s3pci From owner-dev-commits-src-all@freebsd.org Fri Jan 8 21:31:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E671A4D7566; Fri, 8 Jan 2021 21:31:04 +0000 (UTC) (envelope-from git@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 4DCGVw6CTvz3JT5; Fri, 8 Jan 2021 21:31:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C805121DF; Fri, 8 Jan 2021 21:31:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108LV4WA086025; Fri, 8 Jan 2021 21:31:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108LV4B1086024; Fri, 8 Jan 2021 21:31:04 GMT (envelope-from git) Date: Fri, 8 Jan 2021 21:31:04 GMT Message-Id: <202101082131.108LV4B1086024@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 936440560bde - main - sysctl: implement debug.kdb.panic_str MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 936440560bde54050e1ad9daae3b9103e05ad3fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 21:31:05 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=936440560bde54050e1ad9daae3b9103e05ad3fc commit 936440560bde54050e1ad9daae3b9103e05ad3fc Author: Warner Losh AuthorDate: 2021-01-08 16:34:31 +0000 Commit: Warner Losh CommitDate: 2021-01-08 21:30:28 +0000 sysctl: implement debug.kdb.panic_str This is just like debug.kdb.panic, except the string that's passed in is reported in the panic message. This allows people with automated systems to collect kernel panics over a large fleet of machines to flag panics better. Strings like "Warner look at this hang" or "see JIRA ABC-1234 for details" allow these automated systems to route the forced panic to the appropriate engineers like you can with other types of panics. Other users are likely possible. Relnotes: Yes Sponsored by: Netflix Reviewed by: allanjude (earlier version) Suggestions from review folded in by: 0mp, emaste, lwhsu Differential Revision: https://reviews.freebsd.org/D28041 --- share/man/man7/security.7 | 5 +++-- sys/kern/subr_kdb.c | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/share/man/man7/security.7 b/share/man/man7/security.7 index 587df4cb74e5..9ff39c74759c 100644 --- a/share/man/man7/security.7 +++ b/share/man/man7/security.7 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 28, 2020 +.Dd January 8, 2020 .Dt SECURITY 7 .Os .Sh NAME @@ -539,7 +539,8 @@ The kernel debugger may not be entered using the .Va debug.kdb.enter sysctl. A panic or trap cannot be forced using the -.Va debug.kdb.panic +.Va debug.kdb.panic , +.Va debug.kdb.panic_str and other sysctl's. .It Ic 2 Highly secure mode \- same as secure mode, plus disks may not be diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c index 576635e4a8dc..9de2d9de13e8 100644 --- a/sys/kern/subr_kdb.c +++ b/sys/kern/subr_kdb.c @@ -82,6 +82,7 @@ static int kdb_sysctl_available(SYSCTL_HANDLER_ARGS); static int kdb_sysctl_current(SYSCTL_HANDLER_ARGS); static int kdb_sysctl_enter(SYSCTL_HANDLER_ARGS); static int kdb_sysctl_panic(SYSCTL_HANDLER_ARGS); +static int kdb_sysctl_panic_str(SYSCTL_HANDLER_ARGS); static int kdb_sysctl_trap(SYSCTL_HANDLER_ARGS); static int kdb_sysctl_trap_code(SYSCTL_HANDLER_ARGS); static int kdb_sysctl_stack_overflow(SYSCTL_HANDLER_ARGS); @@ -109,6 +110,11 @@ SYSCTL_PROC(_debug_kdb, OID_AUTO, panic, kdb_sysctl_panic, "I", "set to panic the kernel"); +SYSCTL_PROC(_debug_kdb, OID_AUTO, panic_str, + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, + kdb_sysctl_panic_str, "A", + "set to panic the kernel with using the string as the panic message"); + SYSCTL_PROC(_debug_kdb, OID_AUTO, trap, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, kdb_sysctl_trap, "I", @@ -206,6 +212,20 @@ kdb_sysctl_panic(SYSCTL_HANDLER_ARGS) return (0); } +static int +kdb_sysctl_panic_str(SYSCTL_HANDLER_ARGS) +{ + int error; + static char buf[256]; /* static buffer to limit mallocs when panicing */ + + *buf = '\0'; + error = sysctl_handle_string(oidp, buf, sizeof(buf), req); + if (error != 0 || req->newptr == NULL) + return (error); + panic("kdb_sysctl_panic: %s", buf); + return (0); +} + static int kdb_sysctl_trap(SYSCTL_HANDLER_ARGS) { From owner-dev-commits-src-all@freebsd.org Fri Jan 8 21:36:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A1C844D76FB; Fri, 8 Jan 2021 21:36:35 +0000 (UTC) (envelope-from git@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 4DCGdH4C4yz3Jl6; Fri, 8 Jan 2021 21:36:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8306A2429; Fri, 8 Jan 2021 21:36:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108LaZeA090867; Fri, 8 Jan 2021 21:36:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108LaZj7090866; Fri, 8 Jan 2021 21:36:35 GMT (envelope-from git) Date: Fri, 8 Jan 2021 21:36:35 GMT Message-Id: <202101082136.108LaZj7090866@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: cbc9be948a3b - main - sifive_uart: quiet GCC -Werror=parentheses MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cbc9be948a3bd6ff0f142b8fe995c27d7a06b536 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 21:36:35 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=cbc9be948a3bd6ff0f142b8fe995c27d7a06b536 commit cbc9be948a3bd6ff0f142b8fe995c27d7a06b536 Author: Mitchell Horne AuthorDate: 2021-01-08 21:06:11 +0000 Commit: Mitchell Horne CommitDate: 2021-01-08 21:32:18 +0000 sifive_uart: quiet GCC -Werror=parentheses Add an additional set of braces to clarify intention. The '&' operator has a higher precedence than '|', but the reader may not always remember this. No functional change. --- sys/riscv/sifive/sifive_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/riscv/sifive/sifive_uart.c b/sys/riscv/sifive/sifive_uart.c index e06d1fc0b727..cee9ddd0bc25 100644 --- a/sys/riscv/sifive/sifive_uart.c +++ b/sys/riscv/sifive/sifive_uart.c @@ -279,7 +279,7 @@ sfuart_bus_flush(struct uart_softc *sc, int what) if (c) \ i |= ((i) & (s)) ? (s) : (s) | (d); \ else \ - i = ((i) & (s)) ? (i) & ~(s) | (d) : (i); \ + i = ((i) & (s)) ? ((i) & ~(s)) | (d) : (i); \ } while (0) static int From owner-dev-commits-src-all@freebsd.org Fri Jan 8 22:21:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 464094D8672; Fri, 8 Jan 2021 22:21:24 +0000 (UTC) (envelope-from jhb@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 4DCHd01FqSz3MFH; Fri, 8 Jan 2021 22:21:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:8974:ab93:8119:cfc9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id E4F044A65; Fri, 8 Jan 2021 22:21:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. To: Kyle Evans , Baptiste Daroussin Cc: Vladimir Kondratyev , Ravi Pokala , Jessica Clarke , Vladimir Kondratyev , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202101072320.107NKpMS063374@gitrepo.freebsd.org> <7a7fa0fb-51c2-1b14-6d37-2c400f69d7dd@kondratyev.su> <3EA011C9-2EEC-4693-B36D-69E74DF8473C@panasas.com> <20210108092638.x2kkvpeftey2wk62@ivaldir.net> From: John Baldwin Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <4628ea93-876c-be1c-1012-bc4353e0b31d@FreeBSD.org> Date: Fri, 8 Jan 2021 14:21:21 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 22:21:24 -0000 On 1/8/21 5:46 AM, Kyle Evans wrote: > On Fri, Jan 8, 2021 at 3:27 AM Baptiste Daroussin wrote: >> >> On Fri, Jan 08, 2021 at 02:49:31AM +0300, Vladimir Kondratyev wrote: >>> On 08.01.2021 02:41, Ravi Pokala wrote: >>>> -----Original Message----- >>>> From: on behalf of Vladimir Kondratyev >>>> Date: 2021-01-07, Thursday at 15:33 >>>> To: Jessica Clarke , Vladimir Kondratyev >>>> Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" >>>> Subject: Re: git: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. >>>> >>>> On 08.01.2021 02:27, Jessica Clarke wrote: >>>> > On 7 Jan 2021, at 23:20, Vladimir Kondratyev wrote: >>>> >> +#include >>>> >> +#include >>>> >> +#include "xlocale_private.h" >>>> >> + >>>> >> +/* >>>> >> + * Find the first occurrence of find in s, ignore case. >>>> >> + */ >>>> >> +char * >>>> >> +strcasestr_l(const char *s, const char *find, locale_t locale) >>>> > >>>> > Locales in the kernel? This feels wrong. >>>> > >>>> > Jess >>>> > >>>> >>>> strcasestr.c was copied from userland unmodified just to allow >>>> "git log --follow" to work. Next commit removed locale support from this >>>> file and connected it to build. >>>> >>>> Unfortunately, about two-dozen commit messages from you arrived at the same time, and some were out of order; without incrementing change numbers in the subject line, figuring out the actual ordering is non-trivial. :-p >>>> >>>> -Ravi (rpokala@) >>>> >>> >>> I hope, commit hook will be improved some day. Pushing of two-dozen >>> commits one by one is too boring. >> >> The history is in the right order and gitlog/cgit/anything that reads the log >> show everything in the right order. >> >> mails are asynchronuous, expecting the mail to always arrive in a given order is >> wrong ;) >> >> pushing all those commits at once was imho the right thing to do. >> > > I've pointed this out a couple of times (with seemingly nothing coming > from it), but the mails are being sent in reverse order. Fixing that > would at least increase chances for some to receive them in order (and > the archives show them perfectly in reverse order most of the time). > > Picking out the message-ids from the last series I sent, this is the > correct order: > > 202101072237.107MbYaX002789@gitrepo.freebsd.org ("4832d2e8ae1d - main > - du: tests: fix the H_flag test (primarily grep usage)") > 202101072237.107MbYsM002771@gitrepo.freebsd.org ("3c5c39c7ad8f - main > - du: tests: make H_flag tests more strict about output requirements") > > 202101072237.107MbYaX002789 -> 2789 was the last pid that assigned a message-id > 202101072237.107MbYsM002771 -> 2771 was the last pid that assigned a message-id > > Given that this is clearly with kern.randompid=0 on the server, one > can conclude that these were sent in the reverse order based on the > pid sequence. If you pick a couple other series out, this holds true > (at least for all the series I've looked at) I believe Li-wen and Uli tracked this down today and that this might be fixed going forward (needed to add --reverse to git rev-list to build the list of commits to generate e-mails for) -- John Baldwin From owner-dev-commits-src-all@freebsd.org Fri Jan 8 22:37:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 712364D90A2; Fri, 8 Jan 2021 22:37:43 +0000 (UTC) (envelope-from git@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 4DCHzq2q3lz3NDk; Fri, 8 Jan 2021 22:37:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F0AE3138; Fri, 8 Jan 2021 22:37:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108MbhjO068571; Fri, 8 Jan 2021 22:37:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108MbhVN068570; Fri, 8 Jan 2021 22:37:43 GMT (envelope-from git) Date: Fri, 8 Jan 2021 22:37:43 GMT Message-Id: <202101082237.108MbhVN068570@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: 44b8b2a00d7e - main - Makefile.inc1: Avoid using release/Makefile for VERSION. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 44b8b2a00d7e2e98c83141a5c0e6b9b4e3c2ddb4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 22:37:43 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=44b8b2a00d7e2e98c83141a5c0e6b9b4e3c2ddb4 commit 44b8b2a00d7e2e98c83141a5c0e6b9b4e3c2ddb4 Author: Bryan Drewery AuthorDate: 2020-12-16 20:34:38 +0000 Commit: Bryan Drewery CommitDate: 2021-01-08 22:33:35 +0000 Makefile.inc1: Avoid using release/Makefile for VERSION. release/Makefile.inc1 has git executions that were being ran for each of these lookups. The results were not needed so just lookup what we want directly instead. Reviewed by: gjb, rlibby, emaste (maybe) Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D27643 --- Makefile.inc1 | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index c4e656c79ceb..5a9eff870dd5 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -540,14 +540,12 @@ OSRELDATE= 0 .endif # Set VERSION for CTFMERGE to use via the default CTFFLAGS=-L VERSION. -.if !defined(_REVISION) -_REVISION!= ${MAKE} -C ${SRCDIR}/release MK_AUTO_OBJ=no -V REVISION -.export _REVISION -.endif -.if !defined(_BRANCH) -_BRANCH!= ${MAKE} -C ${SRCDIR}/release MK_AUTO_OBJ=no -V BRANCH -.export _BRANCH +.for _V in BRANCH REVISION +.if !defined(_${_V}) +_${_V}!= eval $$(awk '/^${_V}=/{print}' ${SRCTOP}/sys/conf/newvers.sh); echo $$${_V} +.export _${_V} .endif +.endfor .if !defined(SRCRELDATE) SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ ${SRCDIR}/sys/sys/param.h From owner-dev-commits-src-all@freebsd.org Fri Jan 8 22:37:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 836554D887F; Fri, 8 Jan 2021 22:37:44 +0000 (UTC) (envelope-from git@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 4DCHzr3MY3z3NNL; Fri, 8 Jan 2021 22:37:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6634330D8; Fri, 8 Jan 2021 22:37:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108MbijH068594; Fri, 8 Jan 2021 22:37:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108MbinX068593; Fri, 8 Jan 2021 22:37:44 GMT (envelope-from git) Date: Fri, 8 Jan 2021 22:37:44 GMT Message-Id: <202101082237.108MbinX068593@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: 556fcdce5b44 - main - bsd.compat.mk: Allow finding non-internal libraries MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 556fcdce5b44d29a7da851d9f89c224dd45eb3f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 22:37:44 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=556fcdce5b44d29a7da851d9f89c224dd45eb3f3 commit 556fcdce5b44d29a7da851d9f89c224dd45eb3f3 Author: Bryan Drewery AuthorDate: 2020-12-16 22:06:15 +0000 Commit: Bryan Drewery CommitDate: 2021-01-08 22:34:21 +0000 bsd.compat.mk: Allow finding non-internal libraries Currently only libexec/rtld-elf32 uses internal LIBC_NOSSP_PIC during the build but it gets it directly from the objdir rather than a sysroot. For example, /usr/obj/usr/src/amd64.amd64/obj-lib32/lib/libc/libc_nossp_pic.a. We don't stage lib32 libraries in WORLDTMP/usr/lib32 and doing so doesn't buy much. If we want to use a staged lib32 library then we need to look in LIBCOMPATTMP where they were staged. For example if LIBC_PIC were wanted then look for /usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/usr/lib32/libc_pic.a. Reported by: rlibby Reviewed by: rlibby Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D27648 --- share/mk/bsd.compat.mk | 1 + share/mk/bsd.libnames.mk | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/share/mk/bsd.compat.mk b/share/mk/bsd.compat.mk index 9b3d2c2d22eb..d7d63bfe55db 100644 --- a/share/mk/bsd.compat.mk +++ b/share/mk/bsd.compat.mk @@ -161,6 +161,7 @@ LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} .if defined(WANT_COMPAT) LIBDIR_BASE:= /usr/lib${libcompat} _LIB_OBJTOP= ${LIBCOMPAT_OBJTOP} +LIBDESTDIR:= ${LIBCOMPATTMP} CFLAGS+= ${LIBCOMPATCFLAGS} LDFLAGS+= ${CFLAGS} ${LIBCOMPATLDFLAGS} MACHINE= ${LIBCOMPAT_MACHINE} diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk index feb7f4c4070e..d030292d3c5e 100644 --- a/share/mk/bsd.libnames.mk +++ b/share/mk/bsd.libnames.mk @@ -8,7 +8,7 @@ .error bsd.libnames.mk cannot be included directly. .endif -LIBDESTDIR= ${SYSROOT:U${DESTDIR}} +LIBDESTDIR?= ${SYSROOT:U${DESTDIR}} .sinclude From owner-dev-commits-src-all@freebsd.org Fri Jan 8 22:37:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B58F34D8CE8; Fri, 8 Jan 2021 22:37:45 +0000 (UTC) (envelope-from git@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 4DCHzs4cgJz3NDq; Fri, 8 Jan 2021 22:37:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F6B83139; Fri, 8 Jan 2021 22:37:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108MbjtY068612; Fri, 8 Jan 2021 22:37:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108MbjU1068611; Fri, 8 Jan 2021 22:37:45 GMT (envelope-from git) Date: Fri, 8 Jan 2021 22:37:45 GMT Message-Id: <202101082237.108MbjU1068611@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: f222a6b88614 - main - dtrace: Fix /"string" == NULL/ comparisons using an uninitialized value. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f222a6b88614db13ae83c8110281e690d1381a4c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 22:37:45 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=f222a6b88614db13ae83c8110281e690d1381a4c commit f222a6b88614db13ae83c8110281e690d1381a4c Author: Bryan Drewery AuthorDate: 2020-12-18 17:58:03 +0000 Commit: Bryan Drewery CommitDate: 2021-01-08 22:37:17 +0000 dtrace: Fix /"string" == NULL/ comparisons using an uninitialized value. A test of this is funcs/tst.strtok.d which has this filter: BEGIN /(this->field = strtok(this->str, ",")) == NULL/ { exit(1); } The test will randomly fail with exit status of 1 indicating that this->field was NULL even though printing it out shows it is not. This is compiled to the DTrace instruction set: // Pushed arguments not shown here // call strtok() and set result into %r1 07: 2f001f01 call DIF_SUBR(31), %r1 ! strtok // set thread local scalar this->field from %r1 08: 39050101 stls %r1, DT_VAR(1281) ! DT_VAR(1281) = "field" // Prepare for the == comparison // Set right side of %r2 to NULL 09: 25000102 setx DT_INTEGER[1], %r2 ! 0x0 // string compare %r1 (strtok result) to %r2 10: 27010200 scmp %r1, %r2 In this case only %r1 is loaded with a string limit set to lim1. %r2 being NULL does not get loaded and does not set lim2. Then we call dtrace_strncmp() with MIN(lim1, lim2) resulting in passing 0 and comparing neither side. dtrace_strncmp() handles this case fine and it already has been while being lucky with what lim2 was [un]initialized as. Reviewed by: markj, Don Morris Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D27671 --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 8 ++++++++ sys/modules/dtrace/dtrace/Makefile | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index 3d68a68ba819..b212185a4578 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -6374,6 +6374,14 @@ dtrace_dif_emulate(dtrace_difo_t *difo, dtrace_mstate_t *mstate, uintptr_t s2 = regs[r2]; size_t lim1, lim2; + /* + * If one of the strings is NULL then the limit becomes + * 0 which compares 0 characters in dtrace_strncmp() + * resulting in a false positive. dtrace_strncmp() + * treats a NULL as an empty 1-char string. + */ + lim1 = lim2 = 1; + if (s1 != 0 && !dtrace_strcanload(s1, sz, &lim1, mstate, vstate)) break; diff --git a/sys/modules/dtrace/dtrace/Makefile b/sys/modules/dtrace/dtrace/Makefile index 80278fc83a32..55f9f4f66f36 100644 --- a/sys/modules/dtrace/dtrace/Makefile +++ b/sys/modules/dtrace/dtrace/Makefile @@ -61,6 +61,5 @@ CFLAGS+= -include ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h CFLAGS.dtrace_asm.S+= -D_SYS_ERRNO_H_ -D_SYS_PARAM_H_ -DLOCORE CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} CWARNFLAGS+= -Wno-parentheses -CWARNFLAGS+= -Wno-uninitialized CWARNFLAGS+= -Wno-cast-qual CWARNFLAGS+= -Wno-unused From owner-dev-commits-src-all@freebsd.org Fri Jan 8 22:38:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A79D24D8EC9; Fri, 8 Jan 2021 22:38:13 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 4DCJ0P443bz3Np1; Fri, 8 Jan 2021 22:38:13 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x32c.google.com with SMTP id a6so8948572wmc.2; Fri, 08 Jan 2021 14:38:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=isw29QWebro5hRcmPl1RwBQX504+wDF7/QBZ5LU0/Hs=; b=APVaDHfNFqWg3KhqBkZhZ+EIPyPsTQSsQVFZNcwFwzHHfufgQS6Dy6fJky/76LRV2K Y0+oeHyFfc5S4q4VZjuiZWRr2KgpXEiBd1l/0yXATzGedZ8M2AddzXhCOp579XmoeeqV 1KdBGQV9XYLyq6ADcY7sYSb4BBJVcSKtPTcrNJVNq8mV2d85mDuvjz72itGKSCJOxaGu 9mY7SuCEIlFYtvgPMj+ehchq71xEp3lK+V+cViFf49g+Aw8RBKEGEbEaZPTHw/hzzAWX Z/VOunTnwJDrFMkM63PkdGAAj3AKKxTqhtuOveTwS2EKIv7CH5DpLXZ6PAN6qRrcdWQ4 r8uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=isw29QWebro5hRcmPl1RwBQX504+wDF7/QBZ5LU0/Hs=; b=lIaA1biQSZtLreafdRiFJmpzhbSdNfyRvQmSf3dep+f90EGrDyWZw6gq2O9HafnqGo DdKO4buLgOqwE9h1fgKU8zOjPLqS+HyZYCgSDsAGbuQgudYUYfYO0EeJ+fV53Gip0qqo gtEZLkwtIMPN63d1ce3RfWCUQFVDIwPJVXVD24uILp9ufS1GiXxHCQWDUuxMFWkbif6i njs+I9qgL0TLGnmj4J5aoq/ZCrKxpf54pedy9IvTNlGMenpLcTDkdbQeJRi47+y+9M7t uiyu38XLcQ4ZJmbHhpcYN3Wt95vsqvpPGwW1nh84IRK23mEGIDeG2OY2JLcUSwcZDr78 tIvg== X-Gm-Message-State: AOAM533SF+rLFgDwCSOnlnZlL63BnHguHO+j9A+bgQpoypybLb7h33pq t2Y3SCJopQlEK5Yy+9p4P8TBs1FDUmrI09d5HQflybdkuUc= X-Google-Smtp-Source: ABdhPJxvJe8Z+KAeSytDShaO8QInILg2RSN82NdOO2eZCC7dtn9IKpgTcwxNIsfIQyWUtGnpaMsZvt9dqoSOm8+3xC4= X-Received: by 2002:a7b:c773:: with SMTP id x19mr4757692wmk.127.1610145491621; Fri, 08 Jan 2021 14:38:11 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:f811:0:0:0:0:0 with HTTP; Fri, 8 Jan 2021 14:38:10 -0800 (PST) In-Reply-To: <252b68ff-3021-470f-3bc7-c6c809fa4958@FreeBSD.org> References: <202101072330.107NUM8u075841@gitrepo.freebsd.org> <252b68ff-3021-470f-3bc7-c6c809fa4958@FreeBSD.org> From: Mateusz Guzik Date: Fri, 8 Jan 2021 23:38:10 +0100 Message-ID: Subject: Re: git: 20ac5cda965e - main - fd: make fd/fp mandatory To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DCJ0P443bz3Np1 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 22:38:13 -0000 It definitely should have stated +/-: fd: make fd/fp mandatory in falloc I don't know how I dropped that part, it was reshuffled from a bigger patchset. On 1/8/21, John Baldwin wrote: > On 1/7/21 3:30 PM, Mateusz Guzik wrote: >> The branch main has been updated by mjg: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=20ac5cda965eccc34f975674c6efc97c3615a234 >> >> commit 20ac5cda965eccc34f975674c6efc97c3615a234 >> Author: Mateusz Guzik >> AuthorDate: 2020-12-23 13:50:34 +0000 >> Commit: Mateusz Guzik >> CommitDate: 2021-01-07 23:30:04 +0000 >> >> fd: make fd/fp mandatory >> >> They are both always passed anyway. > > Perhaps say which part of the API this affects (seems to be falloc*() from > the diff?) next time? As it reads now, the log implies it applies to all > functions in the file descriptor API which can't possibly be true (fdrop > doesn't take 'fd' for example). > > -- > John Baldwin > -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Fri Jan 8 22:39:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BDAE64D90E8; Fri, 8 Jan 2021 22:39:16 +0000 (UTC) (envelope-from git@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 4DCJ1c50BFz3NyY; Fri, 8 Jan 2021 22:39:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E40030DB; Fri, 8 Jan 2021 22:39:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108MdGiY068971; Fri, 8 Jan 2021 22:39:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108MdGDR068970; Fri, 8 Jan 2021 22:39:16 GMT (envelope-from git) Date: Fri, 8 Jan 2021 22:39:16 GMT Message-Id: <202101082239.108MdGDR068970@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: a82f07fc2e24 - main - Fix 32-bit build post 6733401935f83754b4b2744bc3d33ef84b1271e0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a82f07fc2e2456b0ddc847d611f56a3152a6f940 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 22:39:16 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=a82f07fc2e2456b0ddc847d611f56a3152a6f940 commit a82f07fc2e2456b0ddc847d611f56a3152a6f940 Author: Dimitry Andric AuthorDate: 2021-01-08 22:38:21 +0000 Commit: Dimitry Andric CommitDate: 2021-01-08 22:38:30 +0000 Fix 32-bit build post 6733401935f83754b4b2744bc3d33ef84b1271e0 The general style in sbin/nvmecontrol apppears to print uint64_t types using %j, so I'm using that instead of the more general (but admittedly ugly) PRIu64. --- sbin/nvmecontrol/logpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/nvmecontrol/logpage.c b/sbin/nvmecontrol/logpage.c index f00d5d94897b..7daf012499a2 100644 --- a/sbin/nvmecontrol/logpage.c +++ b/sbin/nvmecontrol/logpage.c @@ -678,7 +678,7 @@ print_log_self_test_status(const struct nvme_controller_data *cdata __unused, if (dst->result[r].valid_diag_info & BIT(1)) { memcpy(&failing_lba, dst->result[r].failing_lba, sizeof(failing_lba)); - printf(" FLBA=0x%lx", failing_lba); + printf(" FLBA=0x%jx", failing_lba); } if (dst->result[r].valid_diag_info & BIT(2)) printf(" SCT=0x%x", dst->result[r].status_code_type); From owner-dev-commits-src-all@freebsd.org Fri Jan 8 22:44:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C1BCC4D95A6; Fri, 8 Jan 2021 22:44:48 +0000 (UTC) (envelope-from git@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 4DCJ804kMDz3PkW; Fri, 8 Jan 2021 22:44:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95455338D; Fri, 8 Jan 2021 22:44:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 108MimAA081102; Fri, 8 Jan 2021 22:44:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 108MimTL081101; Fri, 8 Jan 2021 22:44:48 GMT (envelope-from git) Date: Fri, 8 Jan 2021 22:44:48 GMT Message-Id: <202101082244.108MimTL081101@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Chuck Tuffli Subject: git: e83fdf8bb391 - main - fix big-endian platforms after 6733401935f8 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chuck X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e83fdf8bb391579fa422d34663cd8c1f82a00dc0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 22:44:48 -0000 The branch main has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=e83fdf8bb391579fa422d34663cd8c1f82a00dc0 commit e83fdf8bb391579fa422d34663cd8c1f82a00dc0 Author: Chuck Tuffli AuthorDate: 2021-01-08 22:36:37 +0000 Commit: Chuck Tuffli CommitDate: 2021-01-08 22:41:45 +0000 fix big-endian platforms after 6733401935f8 The NVMe byte-swap routines for big-endian platforms used memcpy() to move the unaligned 64-bit value into a temp register to byte swap it. Instead of introducing a dependency, manually byte-swap the values in place. Point hat: me --- sys/dev/nvme/nvme.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h index 67d02ba73fd8..b28a8d4348db 100644 --- a/sys/dev/nvme/nvme.h +++ b/sys/dev/nvme/nvme.h @@ -2042,16 +2042,20 @@ static inline void nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN - uint64_t failing_lba; - uint32_t r; + uint8_t *tmp; + uint32_t r, i; + uint8_t b; for (r = 0; r < 20; r++) { s->result[r].poh = le64toh(s->result[r].poh); s->result[r].nsid = le32toh(s->result[r].nsid); /* Unaligned 64-bit loads fail on some architectures */ - memcpy(&failing_lba, s->result[r].failing_lba, sizeof(failing_lba)); - failing_lba = le64toh(failing_lba); - memcpy(s->result[r].failing_lba, &failing_lba, sizeof(failing_lba)); + tmp = s->result[r].failing_lba; + for (i = 0; i < 4; i++) { + b = tmp[i]; + tmp[i] = tmp[7-i]; + tmp[7-i] = b; + } } #endif } From owner-dev-commits-src-all@freebsd.org Fri Jan 8 22:48:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9AC064D95C4; Fri, 8 Jan 2021 22:48:13 +0000 (UTC) (envelope-from ctuffli@gmail.com) Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 4DCJCx2wptz3PgL; Fri, 8 Jan 2021 22:48:13 +0000 (UTC) (envelope-from ctuffli@gmail.com) Received: by mail-qk1-f175.google.com with SMTP id c7so10011974qke.1; Fri, 08 Jan 2021 14:48:13 -0800 (PST) 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=AQRYE+V1tmLlU0/ZSunyPOCa5SwS34e9/3MWFLp/ktQ=; b=ZmQ7BEWm6jWN+vLZ6zU3T+TfK4ikz8NXHuyymzWX/dLxl931mxG2zYKj71fCTyP0mq CUOEoIAMib4MI6GhCk1mMN68FqtrEPi0lhzzljRyPGGkaPmWUiZg3His0E1S/DN9iZuC O4Zl6a4IiM6SpeQs4iSJYuXIVoFphN1kpHbMDMn0ZrfywMUpU6ukc5+J/JtwqBLMA0Qa 5RYC2pJJ7fqAkxFmJYkFgbzCClJGok7Cn9I4dUhf//flHr8zgrGMqwPpXFp6YVx0kfEu COqvGG8Gc9+DsWTpy9E8VO6Klbt4+PxLbLVEZKF8SM4a975020uK1iYP8H5n4/hADxYI SlHg== X-Gm-Message-State: AOAM532PoGUI5mxDK3X0fQMjAkbTD7jZhtkB8e545X3nRqBXY+FUyV7v 0RlhBJdQJXz++WtEzIE0GcrNtya1FnI= X-Google-Smtp-Source: ABdhPJw8LjOCa0bHZx9ks0OVTwEr971H1PGNNmtlPeJZ7iYUUlvAnXL2H9xfdp7ozzHmgpCxsQpN2A== X-Received: by 2002:a05:620a:528:: with SMTP id h8mr6447252qkh.40.1610146092361; Fri, 08 Jan 2021 14:48:12 -0800 (PST) Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com. [209.85.219.174]) by smtp.gmail.com with ESMTPSA id n62sm5590971qkn.125.2021.01.08.14.48.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Jan 2021 14:48:12 -0800 (PST) Received: by mail-yb1-f174.google.com with SMTP id b64so10837656ybg.7; Fri, 08 Jan 2021 14:48:12 -0800 (PST) X-Received: by 2002:a25:500b:: with SMTP id e11mr8732514ybb.138.1610146091849; Fri, 08 Jan 2021 14:48:11 -0800 (PST) MIME-Version: 1.0 References: <202101081729.108HTG7j066884@gitrepo.freebsd.org> <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> In-Reply-To: <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> From: Chuck Tuffli Date: Fri, 8 Jan 2021 14:48:00 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DCJCx2wptz3PgL X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 22:48:13 -0000 On Fri, Jan 8, 2021 at 11:13 AM Jessica Clarke wrote: ... > Hi, > This broke powerpc and powerpc64: Fixed in e83fdf8bb391 --chuck From owner-dev-commits-src-all@freebsd.org Fri Jan 8 22:53:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BB3224D9B15; Fri, 8 Jan 2021 22:53:58 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (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 4DCJLZ202sz3QTm; Fri, 8 Jan 2021 22:53:57 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id y0dmkn9qB34axy0dnkgfRQ; Fri, 08 Jan 2021 15:53:56 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5ff8e284 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=YxBL1-UpAAAA:8 a=VxmjJ2MpAAAA:8 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=8uUnpHl5pD3AqIP_JIMA:9 a=CjuIK1q_8ugA:10 a=9oQxGDXC-HAA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=7gXAzLPJhVmCkEl4_tsf:22 a=IjZwj45LgO3ly-622nXo:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 46DC736E; Fri, 8 Jan 2021 14:53:53 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 108MrrUL003251; Fri, 8 Jan 2021 14:53:53 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101082253.108MrrUL003251@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: Chuck Tuffli cc: Cy Schubert , Jessica Clarke , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , "src-committers@freebsd.org" Subject: Re: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page In-reply-to: References: <202101081729.108HTG7j066884@gitrepo.freebsd.org> <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> <202101081920.108JKUd2003299@slippy.cwsent.com> <202101081927.108JRKxR084004@slippy.cwsent.com> Comments: In-reply-to Chuck Tuffli message dated "Fri, 08 Jan 2021 13:14:53 -0800." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 08 Jan 2021 14:53:53 -0800 X-CMAE-Envelope: MS4xfPLJcmw0ciBX8B04k0CfIB9pueUQJL4PPPc4pZOpRn3XcrvTLOMGhs14KX3nAzgd3m8Dj8pcd6+RCUu35lS73ikhgdJcHGT/U7yJdoRW98tuHQG61Frz MGgYVLpOC0iFgBDrV2Su6APrrdG04eJacETzP5WxMU5QoAFOVrMFuh0j16YaCv/De3pX/IlmxQLd2zLN8cSVJq8+Cia3REcIonlcmIYF1ajVpZjzU0z+5Ucj rWyx3EzFkG6fcbnA6Zecyxdz1i6U3UDnOdW66JOhVx2fpHWquc6ktDPRNAVPUBTbjb/qbvlJmi8bl1UKCPeCchpSyEknq638sJ/bAFutcan5l1u34/lyj1Hj I/mKaJRA X-Rspamd-Queue-Id: 4DCJLZ202sz3QTm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 22:53:58 -0000 In message , Chuck Tuffli writes: > --000000000000c9481f05b86a0c60 > Content-Type: text/plain; charset="UTF-8" > > On Fri, Jan 8, 2021 at 11:27 AM Cy Schubert > wrote: > > > In message <202101081920.108JKUd2003299@slippy.cwsent.com>, Cy Schubert > > writes: > > > In message <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org>, Jessica > > > Clarke w > > > rites: > > > ... > > > > > This broke powerpc and powerpc64: > > > Sorry about that. I'll fix this in a bit. > > --chuck Looks like dim@ already did. The time before last I fixed one of these it was pointed out to me privately that when we use %jd that we should also cast to intmax_t or uintmax_t, and that jhb@ told him. This was to future-proof, assuming we'd have 128-bit processors one day. -- 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-dev-commits-src-all@freebsd.org Sat Jan 9 00:49:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 668044DB7E6; Sat, 9 Jan 2021 00:49:31 +0000 (UTC) (envelope-from rpokala@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 4DCLvv2b35z3lv4; Sat, 9 Jan 2021 00:49:31 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (c-98-207-126-143.hsd1.ca.comcast.net [98.207.126.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id BD7EA5F8B; Sat, 9 Jan 2021 00:49:30 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.44.20121301 Date: Fri, 08 Jan 2021 16:49:26 -0800 Subject: Re: 936440560bde - main - sysctl: implement debug.kdb.panic_str From: Ravi Pokala To: Warner Losh , , , Message-ID: Thread-Topic: 936440560bde - main - sysctl: implement debug.kdb.panic_str References: <202101082131.108LV4B1086024@gitrepo.freebsd.org> In-Reply-To: <202101082131.108LV4B1086024@gitrepo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 00:49:31 -0000 -----Original Message----- From: on behalf of Warner Losh Date: 2021-01-08, Friday at 13:31 To: , , Subject: git: 936440560bde - main - sysctl: implement debug.kdb.panic_str The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=936440560bde54050e1ad9daae3b9103e05ad3fc commit 936440560bde54050e1ad9daae3b9103e05ad3fc Author: Warner Losh AuthorDate: 2021-01-08 16:34:31 +0000 Commit: Warner Losh CommitDate: 2021-01-08 21:30:28 +0000 sysctl: implement debug.kdb.panic_str ... --- a/sys/kern/subr_kdb.c +++ b/sys/kern/subr_kdb.c @@ -109,6 +110,11 @@ SYSCTL_PROC(_debug_kdb, OID_AUTO, panic, kdb_sysctl_panic, "I", "set to panic the kernel"); +SYSCTL_PROC(_debug_kdb, OID_AUTO, panic_str, + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, + kdb_sysctl_panic_str, "A", + "set to panic the kernel with using the string as the panic message"); Might I suggest "trigger a kernel panic, using the provided string as the panic message". Thanks, Ravi (rpokala@) + SYSCTL_PROC(_debug_kdb, OID_AUTO, trap, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, kdb_sysctl_trap, "I", From owner-dev-commits-src-all@freebsd.org Sat Jan 9 01:04:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 654B64DC032; Sat, 9 Jan 2021 01:04:21 +0000 (UTC) (envelope-from git@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 4DCMF12Pcqz3n77; Sat, 9 Jan 2021 01:04:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43CEE4FD0; Sat, 9 Jan 2021 01:04:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10914LCi061614; Sat, 9 Jan 2021 01:04:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10914LXZ061613; Sat, 9 Jan 2021 01:04:21 GMT (envelope-from git) Date: Sat, 9 Jan 2021 01:04:21 GMT Message-Id: <202101090104.10914LXZ061613@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 01839668ce4b - stable/12 - rtld: call close(2) after errno is saved MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 01839668ce4b594c9495911549abde86878a708d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 01:04:21 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=01839668ce4b594c9495911549abde86878a708d commit 01839668ce4b594c9495911549abde86878a708d Author: Konstantin Belousov AuthorDate: 2021-01-01 22:24:46 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-09 01:02:22 +0000 rtld: call close(2) after errno is saved (cherry picked from commit 741d78126b5584e860811c78f87f51597e375592) --- libexec/rtld-elf/libmap.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libexec/rtld-elf/libmap.c b/libexec/rtld-elf/libmap.c index 627928a9a61b..8ff28af260f3 100644 --- a/libexec/rtld-elf/libmap.c +++ b/libexec/rtld-elf/libmap.c @@ -102,7 +102,7 @@ lmc_parse_file(const char *path) char *lm_map; struct stat st; ssize_t retval; - int fd; + int fd, saved_errno; TAILQ_FOREACH(p, &lmc_head, next) { if (strcmp(p->path, path) == 0) @@ -116,9 +116,9 @@ lmc_parse_file(const char *path) return; } if (fstat(fd, &st) == -1) { - close(fd); dbg("lm_parse_file: fstat(\"%s\") failed, %s", path, rtld_strerror(errno)); + close(fd); return; } @@ -131,14 +131,19 @@ lmc_parse_file(const char *path) lm_map = xmalloc(st.st_size); retval = read(fd, lm_map, st.st_size); + saved_errno = errno; + close(fd); if (retval != st.st_size) { - close(fd); + if (retval == -1) { + dbg("lm_parse_file: read(\"%s\") failed, %s", path, + rtld_strerror(saved_errno)); + } else { + dbg("lm_parse_file: short read(\"%s\"), %zd vs %jd", + path, retval, (uintmax_t)st.st_size); + } free(lm_map); - dbg("lm_parse_file: read(\"%s\") failed, %s", path, - rtld_strerror(errno)); return; } - close(fd); p = xmalloc(sizeof(struct lmc)); p->path = xstrdup(path); p->dev = st.st_dev; From owner-dev-commits-src-all@freebsd.org Sat Jan 9 01:29:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3DD654DD37B; Sat, 9 Jan 2021 01:29:39 +0000 (UTC) (envelope-from git@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 4DCMpC1Cyqz3qC3; Sat, 9 Jan 2021 01:29:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CBB255F4; Sat, 9 Jan 2021 01:29:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1091Tdtf087944; Sat, 9 Jan 2021 01:29:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1091TdoF087943; Sat, 9 Jan 2021 01:29:39 GMT (envelope-from git) Date: Sat, 9 Jan 2021 01:29:39 GMT Message-Id: <202101090129.1091TdoF087943@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Guangyuan Yang Subject: git: 91006937a3b9 - stable/12 - dump(8): clarify the recommended use of cache and snapshots MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 91006937a3b9535476a9291dbc816ccb2883ccde Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 01:29:39 -0000 The branch stable/12 has been updated by ygy (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=91006937a3b9535476a9291dbc816ccb2883ccde commit 91006937a3b9535476a9291dbc816ccb2883ccde Author: Guangyuan Yang AuthorDate: 2020-12-28 21:54:36 +0000 Commit: Guangyuan Yang CommitDate: 2021-01-09 01:29:12 +0000 dump(8): clarify the recommended use of cache and snapshots PR: 131626 Submitted by: Andrew Hamilton-Wright Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D27775 (cherry picked from commit 70a2e109bd486f97e6fa5f969be9d90e404de016) --- sbin/dump/dump.8 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sbin/dump/dump.8 b/sbin/dump/dump.8 index 56aea04551f8..80e8eae21d19 100644 --- a/sbin/dump/dump.8 +++ b/sbin/dump/dump.8 @@ -29,7 +29,7 @@ .\" @(#)dump.8 8.3 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd June 13, 2019 +.Dd December 28, 2020 .Dt DUMP 8 .Os .Sh NAME @@ -134,9 +134,11 @@ Specify the cache size in megabytes. This will greatly improve performance at the cost of .Nm -possibly not noticing changes in the file system between passes. -It is -recommended that you always use this option when dumping a snapshot. +possibly not noticing changes in the file system between passes +unless a snapshot is being used. +The potential for performance improvement indicates that +use of this option together with snapshots is the recommended +course of action. Beware that .Nm forks, and the actual memory use may be larger than the specified cache From owner-dev-commits-src-all@freebsd.org Sat Jan 9 01:34:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6CEF54DD861; Sat, 9 Jan 2021 01:34:11 +0000 (UTC) (envelope-from git@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 4DCMvR2dYPz3qbW; Sat, 9 Jan 2021 01:34:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D4FF5660; Sat, 9 Jan 2021 01:34:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1091YBaA000744; Sat, 9 Jan 2021 01:34:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1091YBIg000743; Sat, 9 Jan 2021 01:34:11 GMT (envelope-from git) Date: Sat, 9 Jan 2021 01:34:11 GMT Message-Id: <202101090134.1091YBIg000743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f6be8e515519 - stable/12 - nfs server: improve use of the VFS KPI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f6be8e5155195f5eeac763fa24d6afa2d5417fa0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 01:34:11 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f6be8e5155195f5eeac763fa24d6afa2d5417fa0 commit f6be8e5155195f5eeac763fa24d6afa2d5417fa0 Author: Konstantin Belousov AuthorDate: 2021-01-01 15:35:44 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-09 01:33:55 +0000 nfs server: improve use of the VFS KPI (cherry picked from commit 51a9b978e75021415fdced616b4e4bc373a20a8a) --- sys/fs/nfsserver/nfs_nfsdport.c | 33 ++++++++++++++++++++------------- sys/fs/nfsserver/nfs_nfsdsocket.c | 6 ++---- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index f159e9c89a87..0bb3edbddec9 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -3086,28 +3086,35 @@ nfsd_fhtovp(struct nfsrv_descript *nd, struct nfsrvfh *nfp, int lktype, struct vnode **vpp, struct nfsexstuff *exp, struct mount **mpp, int startwrite, struct thread *p) { - struct mount *mp; + struct mount *mp, *mpw; struct ucred *credanon; fhandle_t *fhp; + int error; + if (mpp != NULL) + *mpp = NULL; + *vpp = NULL; fhp = (fhandle_t *)nfp->nfsrvfh_data; - /* - * Check for the special case of the nfsv4root_fh. - */ mp = vfs_busyfs(&fhp->fh_fsid); - if (mpp != NULL) - *mpp = mp; if (mp == NULL) { - *vpp = NULL; nd->nd_repstat = ESTALE; goto out; } if (startwrite) { - vn_start_write(NULL, mpp, V_WAIT); + mpw = mp; + error = vn_start_write(NULL, &mpw, V_WAIT); + if (error != 0) { + mpw = NULL; + vfs_unbusy(mp); + nd->nd_repstat = ESTALE; + goto out; + } if (lktype == LK_SHARED && !(MNT_SHARED_WRITES(mp))) lktype = LK_EXCLUSIVE; - } + } else + mpw = NULL; + nd->nd_repstat = nfsvno_fhtovp(mp, fhp, nd->nd_nam, lktype, vpp, exp, &credanon); vfs_unbusy(mp); @@ -3119,6 +3126,7 @@ nfsd_fhtovp(struct nfsrv_descript *nd, struct nfsrvfh *nfp, int lktype, if (!nd->nd_repstat && exp->nes_exflag == 0 && !(nd->nd_flag & ND_NFSV4)) { vput(*vpp); + *vpp = NULL; nd->nd_repstat = EACCES; } @@ -3166,11 +3174,10 @@ nfsd_fhtovp(struct nfsrv_descript *nd, struct nfsrvfh *nfp, int lktype, if (credanon != NULL) crfree(credanon); if (nd->nd_repstat) { - if (startwrite) - vn_finished_write(mp); + vn_finished_write(mpw); *vpp = NULL; - if (mpp != NULL) - *mpp = NULL; + } else if (mpp != NULL) { + *mpp = mpw; } out: diff --git a/sys/fs/nfsserver/nfs_nfsdsocket.c b/sys/fs/nfsserver/nfs_nfsdsocket.c index 718737ec184c..a678e3acfeab 100644 --- a/sys/fs/nfsserver/nfs_nfsdsocket.c +++ b/sys/fs/nfsserver/nfs_nfsdsocket.c @@ -543,8 +543,7 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, int isdgram, u_char *tag, int taglen, nfsrvd_statstart(nfsv3to4op[nd->nd_procnum], /*now*/ NULL); nfsrvd_statend(nfsv3to4op[nd->nd_procnum], /*bytes*/ 0, /*now*/ NULL, /*then*/ NULL); - if (mp != NULL && nfsrv_writerpc[nd->nd_procnum] != 0) - vn_finished_write(mp); + vn_finished_write(mp); goto out; } @@ -574,8 +573,7 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, int isdgram, u_char *tag, int taglen, error = (*(nfsrv3_procs0[nd->nd_procnum]))(nd, isdgram, vp, p, &nes); } - if (mp != NULL && nfsrv_writerpc[nd->nd_procnum] != 0) - vn_finished_write(mp); + vn_finished_write(mp); nfsrvd_statend(nfsv3to4op[nd->nd_procnum], /*bytes*/ 0, /*now*/ NULL, /*then*/ &start_time); From owner-dev-commits-src-all@freebsd.org Sat Jan 9 01:43:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 81B064DE04B; Sat, 9 Jan 2021 01:43:36 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (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 4DCN6H5Tb0z3rLG; Sat, 9 Jan 2021 01:43:35 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x435.google.com with SMTP id d13so10602643wrc.13; Fri, 08 Jan 2021 17:43:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=WL7VIt4j9suNjr6ET8OO41rKw/L8jPuLyuhlKCmj0fo=; b=q41HNwQTbzOyT+YNZ4LoG7w9mRcNv6tdbYk6rVgCnx9tRyHBiqYbfnj9TRE2cwDH8o YGRnZdM6yPBALJI87RE8KUFSttCjlfsqhi71J3Y5tqrGziTAGzKrOULv0qI2pkeXtHWl NQT/CCYmx9BESIYi3Kz7+03VO8LCbRDahv5kvdxa+DfCVt2ad6liHL9sci5SpLBndxFC 30Isgh0+LEzfluKSnXgQpG9SdObzyVu4EsQv2KkckZgpQbI1jGai4lk9SAilKKOq9Voy 8BpazYssq6aENgMyw5yn1cyAyquYBgHuSdyQZLUNkJBPDwYKJaK9WCGJQhjuxqw/FtFO CLmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=WL7VIt4j9suNjr6ET8OO41rKw/L8jPuLyuhlKCmj0fo=; b=NCXnVJDY7iF182InW+npEiu1VmiQsxRw5S939KqZHmUVhGBA9/8CHjtTIK9os/QDhe myf8tTdHf8H8nxlHbUM3AwFQir+XGx5o9rLL14b7lS6jyGl1LgfQn4eYqJ+j5ntMhBbH ogdL+nKCTjL+8ndfJ/8509VGHRyHQHeHzs2r3LgY+sqv7mYRDEKQNQpJIDamlljQyRbJ k+QmQpSvYY9QjLv/Xalb+WVZPs2APQch1p5EfQnovuJ5GU9iNzFxBvrneFiuKejyihkI 924JfrXZIvgebjm5Watu8AU+uzQVjHkc8bipbfo9Woc5zymjJsvxE2KhzpRVRcPatp3U KjKA== X-Gm-Message-State: AOAM530u19mV27kZfabVOovWUJwZZ1Jpgj26+b/boHG6ddm3cejaM5Ij Hi9Er6y8Ov06OZ7HjrUhU5+CrsvAcSiZh3AIt2hhSIabW04= X-Google-Smtp-Source: ABdhPJyEUnnXGUuQ/5UQdtuhbng4mjyXVlCrf4jB2CDIJsLgzZrtC/thE9rWPddWPcBTd6xD5/v52lvMz0JIWs1KNDI= X-Received: by 2002:a5d:47a5:: with SMTP id 5mr6165552wrb.109.1610156613480; Fri, 08 Jan 2021 17:43:33 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:f811:0:0:0:0:0 with HTTP; Fri, 8 Jan 2021 17:43:32 -0800 (PST) In-Reply-To: <202101072320.107NKp3k063340@gitrepo.freebsd.org> References: <202101072320.107NKp3k063340@gitrepo.freebsd.org> From: Mateusz Guzik Date: Sat, 9 Jan 2021 02:43:32 +0100 Message-ID: Subject: Re: git: 1ffa5c63f449 - main - Copy HID over USB support files to new sys/dev/hid directory To: Vladimir Kondratyev Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DCN6H5Tb0z3rLG X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=q41HNwQT; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::435 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::435:from]; TO_DN_SOME(0.00)[]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::435:from:127.0.2.255]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::435:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 01:43:36 -0000 I don't know which commit is ultimately responsible from the series, but LINT kernels fail to build in tinderbox. For example LINT-NOINET6: ld: error: undefined symbol: hid_report_size_max >>> referenced by uaudio.c >>> uaudio.o:(uaudio_attach) >>> referenced by ugold.c >>> ugold.o:(ugold_attach) >>> referenced by atp.c >>> atp.o:(atp_attach) >>> referenced 7 more times ld: error: undefined symbol: hid_locate >>> referenced by uaudio.c >>> uaudio.o:(uaudio_attach) >>> referenced by uaudio.c >>> uaudio.o:(uaudio_attach) >>> referenced by uaudio.c >>> uaudio.o:(uaudio_attach) >>> referenced 19 more times ld: error: undefined symbol: hid_get_data >>> referenced by uaudio.c >>> uaudio.o:(uaudio_hid_rx_callback) >>> referenced by uaudio.c >>> uaudio.o:(uaudio_hid_rx_callback) >>> referenced by uaudio.c >>> uaudio.o:(uaudio_hid_rx_callback) >>> referenced 12 more times ld: error: undefined symbol: hid_is_keyboard >>> referenced by ukbd.c >>> ukbd.o:(ukbd_probe) ld: error: undefined symbol: hid_is_mouse >>> referenced by ukbd.c >>> ukbd.o:(ukbd_probe) >>> referenced by ums.c >>> ums.o:(ums_probe) ld: error: undefined symbol: hid_get_udata >>> referenced by ukbd.c >>> ukbd.o:(ukbd_intr_callback) ld: error: undefined symbol: hid_put_udata >>> referenced by ukbd.c >>> ukbd.o:(ukbd_set_leds_callback) >>> referenced by ukbd.c >>> ukbd.o:(ukbd_set_leds_callback) >>> referenced by ukbd.c >>> ukbd.o:(ukbd_set_leds_callback) On 1/8/21, Vladimir Kondratyev wrote: > The branch main has been updated by wulf: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=1ffa5c63f449866e030b2130dfa5c633d9062074 > > commit 1ffa5c63f449866e030b2130dfa5c633d9062074 > Author: Vladimir Kondratyev > AuthorDate: 2020-10-06 14:58:31 +0000 > Commit: Vladimir Kondratyev > CommitDate: 2021-01-07 23:18:42 +0000 > > Copy HID over USB support files to new sys/dev/hid directory > --- > sys/dev/hid/hid.c | 1015 > ++++++++++++++++++++++++++++++++++++++++++++++++ > sys/dev/hid/hid.h | 284 ++++++++++++++ > sys/dev/hid/hidrdesc.h | 306 +++++++++++++++ > 3 files changed, 1605 insertions(+) > > diff --git a/sys/dev/hid/hid.c b/sys/dev/hid/hid.c > new file mode 100644 > index 000000000000..22e5fb5446c3 > --- /dev/null > +++ b/sys/dev/hid/hid.c > @@ -0,0 +1,1015 @@ > +/* $FreeBSD$ */ > +/* $NetBSD: hid.c,v 1.17 2001/11/13 06:24:53 lukem Exp $ */ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-NetBSD > + * > + * Copyright (c) 1998 The NetBSD Foundation, Inc. > + * All rights reserved. > + * > + * This code is derived from software contributed to The NetBSD Foundation > + * by Lennart Augustsson (lennart@augustsson.net) at > + * Carlstedt Research & Technology. > + * > + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. > + */ > + > +#ifdef USB_GLOBAL_INCLUDE_FILE > +#include USB_GLOBAL_INCLUDE_FILE > +#else > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > + > +#define USB_DEBUG_VAR usb_debug > + > +#include > +#include > +#include > +#include > +#include > +#endif /* USB_GLOBAL_INCLUDE_FILE */ > + > +static void hid_clear_local(struct hid_item *); > +static uint8_t hid_get_byte(struct hid_data *s, const uint16_t wSize); > + > +#define MAXUSAGE 64 > +#define MAXPUSH 4 > +#define MAXID 16 > +#define MAXLOCCNT 2048 > + > +struct hid_pos_data { > + int32_t rid; > + uint32_t pos; > +}; > + > +struct hid_data { > + const uint8_t *start; > + const uint8_t *end; > + const uint8_t *p; > + struct hid_item cur[MAXPUSH]; > + struct hid_pos_data last_pos[MAXID]; > + int32_t usages_min[MAXUSAGE]; > + int32_t usages_max[MAXUSAGE]; > + int32_t usage_last; /* last seen usage */ > + uint32_t loc_size; /* last seen size */ > + uint32_t loc_count; /* last seen count */ > + uint32_t ncount; /* end usage item count */ > + uint32_t icount; /* current usage item count */ > + uint8_t kindset; /* we have 5 kinds so 8 bits are enough */ > + uint8_t pushlevel; /* current pushlevel */ > + uint8_t nusage; /* end "usages_min/max" index */ > + uint8_t iusage; /* current "usages_min/max" index */ > + uint8_t ousage; /* current "usages_min/max" offset */ > + uint8_t susage; /* usage set flags */ > +}; > + > +/*------------------------------------------------------------------------* > + * hid_clear_local > + > *------------------------------------------------------------------------*/ > +static void > +hid_clear_local(struct hid_item *c) > +{ > + > + c->loc.count = 0; > + c->loc.size = 0; > + c->nusages = 0; > + memset(c->usages, 0, sizeof(c->usages)); > + c->usage_minimum = 0; > + c->usage_maximum = 0; > + c->designator_index = 0; > + c->designator_minimum = 0; > + c->designator_maximum = 0; > + c->string_index = 0; > + c->string_minimum = 0; > + c->string_maximum = 0; > + c->set_delimiter = 0; > +} > + > +static void > +hid_switch_rid(struct hid_data *s, struct hid_item *c, int32_t next_rID) > +{ > + uint8_t i; > + > + /* check for same report ID - optimise */ > + > + if (c->report_ID == next_rID) > + return; > + > + /* save current position for current rID */ > + > + if (c->report_ID == 0) { > + i = 0; > + } else { > + for (i = 1; i != MAXID; i++) { > + if (s->last_pos[i].rid == c->report_ID) > + break; > + if (s->last_pos[i].rid == 0) > + break; > + } > + } > + if (i != MAXID) { > + s->last_pos[i].rid = c->report_ID; > + s->last_pos[i].pos = c->loc.pos; > + } > + > + /* store next report ID */ > + > + c->report_ID = next_rID; > + > + /* lookup last position for next rID */ > + > + if (next_rID == 0) { > + i = 0; > + } else { > + for (i = 1; i != MAXID; i++) { > + if (s->last_pos[i].rid == next_rID) > + break; > + if (s->last_pos[i].rid == 0) > + break; > + } > + } > + if (i != MAXID) { > + s->last_pos[i].rid = next_rID; > + c->loc.pos = s->last_pos[i].pos; > + } else { > + DPRINTF("Out of RID entries, position is set to zero!\n"); > + c->loc.pos = 0; > + } > +} > + > +/*------------------------------------------------------------------------* > + * hid_start_parse > + > *------------------------------------------------------------------------*/ > +struct hid_data * > +hid_start_parse(const void *d, usb_size_t len, int kindset) > +{ > + struct hid_data *s; > + > + if ((kindset-1) & kindset) { > + DPRINTFN(0, "Only one bit can be " > + "set in the kindset\n"); > + return (NULL); > + } > + > + s = malloc(sizeof *s, M_TEMP, M_WAITOK | M_ZERO); > + s->start = s->p = d; > + s->end = ((const uint8_t *)d) + len; > + s->kindset = kindset; > + return (s); > +} > + > +/*------------------------------------------------------------------------* > + * hid_end_parse > + > *------------------------------------------------------------------------*/ > +void > +hid_end_parse(struct hid_data *s) > +{ > + if (s == NULL) > + return; > + > + free(s, M_TEMP); > +} > + > +/*------------------------------------------------------------------------* > + * get byte from HID descriptor > + > *------------------------------------------------------------------------*/ > +static uint8_t > +hid_get_byte(struct hid_data *s, const uint16_t wSize) > +{ > + const uint8_t *ptr; > + uint8_t retval; > + > + ptr = s->p; > + > + /* check if end is reached */ > + if (ptr == s->end) > + return (0); > + > + /* read out a byte */ > + retval = *ptr; > + > + /* check if data pointer can be advanced by "wSize" bytes */ > + if ((s->end - ptr) < wSize) > + ptr = s->end; > + else > + ptr += wSize; > + > + /* update pointer */ > + s->p = ptr; > + > + return (retval); > +} > + > +/*------------------------------------------------------------------------* > + * hid_get_item > + > *------------------------------------------------------------------------*/ > +int > +hid_get_item(struct hid_data *s, struct hid_item *h) > +{ > + struct hid_item *c; > + unsigned int bTag, bType, bSize; > + uint32_t oldpos; > + int32_t mask; > + int32_t dval; > + > + if (s == NULL) > + return (0); > + > + c = &s->cur[s->pushlevel]; > + > + top: > + /* check if there is an array of items */ > + if (s->icount < s->ncount) { > + /* get current usage */ > + if (s->iusage < s->nusage) { > + dval = s->usages_min[s->iusage] + s->ousage; > + c->usage = dval; > + s->usage_last = dval; > + if (dval == s->usages_max[s->iusage]) { > + s->iusage ++; > + s->ousage = 0; > + } else { > + s->ousage ++; > + } > + } else { > + DPRINTFN(1, "Using last usage\n"); > + dval = s->usage_last; > + } > + c->nusages = 1; > + /* array type HID item may have multiple usages */ > + while ((c->flags & HIO_VARIABLE) == 0 && s->ousage == 0 && > + s->iusage < s->nusage && c->nusages < HID_ITEM_MAXUSAGE) > + c->usages[c->nusages++] = s->usages_min[s->iusage++]; > + if ((c->flags & HIO_VARIABLE) == 0 && s->ousage == 0 && > + s->iusage < s->nusage) > + DPRINTFN(0, "HID_ITEM_MAXUSAGE should be increased " > + "up to %hhu to parse the HID report descriptor\n", > + s->nusage); > + s->icount ++; > + /* > + * Only copy HID item, increment position and return > + * if correct kindset! > + */ > + if (s->kindset & (1 << c->kind)) { > + *h = *c; > + DPRINTFN(1, "%u,%u,%u\n", h->loc.pos, > + h->loc.size, h->loc.count); > + c->loc.pos += c->loc.size * c->loc.count; > + return (1); > + } > + } > + > + /* reset state variables */ > + s->icount = 0; > + s->ncount = 0; > + s->iusage = 0; > + s->nusage = 0; > + s->susage = 0; > + s->ousage = 0; > + hid_clear_local(c); > + > + /* get next item */ > + while (s->p != s->end) { > + bSize = hid_get_byte(s, 1); > + if (bSize == 0xfe) { > + /* long item */ > + bSize = hid_get_byte(s, 1); > + bSize |= hid_get_byte(s, 1) << 8; > + bTag = hid_get_byte(s, 1); > + bType = 0xff; /* XXX what should it be */ > + } else { > + /* short item */ > + bTag = bSize >> 4; > + bType = (bSize >> 2) & 3; > + bSize &= 3; > + if (bSize == 3) > + bSize = 4; > + } > + switch (bSize) { > + case 0: > + dval = 0; > + mask = 0; > + break; > + case 1: > + dval = (int8_t)hid_get_byte(s, 1); > + mask = 0xFF; > + break; > + case 2: > + dval = hid_get_byte(s, 1); > + dval |= hid_get_byte(s, 1) << 8; > + dval = (int16_t)dval; > + mask = 0xFFFF; > + break; > + case 4: > + dval = hid_get_byte(s, 1); > + dval |= hid_get_byte(s, 1) << 8; > + dval |= hid_get_byte(s, 1) << 16; > + dval |= hid_get_byte(s, 1) << 24; > + mask = 0xFFFFFFFF; > + break; > + default: > + dval = hid_get_byte(s, bSize); > + DPRINTFN(0, "bad length %u (data=0x%02x)\n", > + bSize, dval); > + continue; > + } > + > + switch (bType) { > + case 0: /* Main */ > + switch (bTag) { > + case 8: /* Input */ > + c->kind = hid_input; > + ret: > + c->flags = dval; > + c->loc.count = s->loc_count; > + c->loc.size = s->loc_size; > + > + if (c->flags & HIO_VARIABLE) { > + /* range check usage count */ > + if (c->loc.count > MAXLOCCNT) { > + DPRINTFN(0, "Number of " > + "items(%u) truncated to %u\n", > + (unsigned)(c->loc.count), > + MAXLOCCNT); > + s->ncount = MAXLOCCNT; > + } else > + s->ncount = c->loc.count; > + > + /* > + * The "top" loop will return > + * one and one item: > + */ > + c->loc.count = 1; > + } else { > + s->ncount = 1; > + } > + goto top; > + > + case 9: /* Output */ > + c->kind = hid_output; > + goto ret; > + case 10: /* Collection */ > + c->kind = hid_collection; > + c->collection = dval; > + c->collevel++; > + c->usage = s->usage_last; > + c->nusages = 1; > + *h = *c; > + return (1); > + case 11: /* Feature */ > + c->kind = hid_feature; > + goto ret; > + case 12: /* End collection */ > + c->kind = hid_endcollection; > + if (c->collevel == 0) { > + DPRINTFN(0, "invalid end collection\n"); > + return (0); > + } > + c->collevel--; > + *h = *c; > + return (1); > + default: > + DPRINTFN(0, "Main bTag=%d\n", bTag); > + break; > + } > + break; > + case 1: /* Global */ > + switch (bTag) { > + case 0: > + c->_usage_page = dval << 16; > + break; > + case 1: > + c->logical_minimum = dval; > + break; > + case 2: > + c->logical_maximum = dval; > + break; > + case 3: > + c->physical_minimum = dval; > + break; > + case 4: > + c->physical_maximum = dval; > + break; > + case 5: > + c->unit_exponent = dval; > + break; > + case 6: > + c->unit = dval; > + break; > + case 7: > + /* mask because value is unsigned */ > + s->loc_size = dval & mask; > + break; > + case 8: > + hid_switch_rid(s, c, dval & mask); > + break; > + case 9: > + /* mask because value is unsigned */ > + s->loc_count = dval & mask; > + break; > + case 10: /* Push */ > + /* stop parsing, if invalid push level */ > + if ((s->pushlevel + 1) >= MAXPUSH) { > + DPRINTFN(0, "Cannot push item @ %d\n", s->pushlevel); > + return (0); > + } > + s->pushlevel ++; > + s->cur[s->pushlevel] = *c; > + /* store size and count */ > + c->loc.size = s->loc_size; > + c->loc.count = s->loc_count; > + /* update current item pointer */ > + c = &s->cur[s->pushlevel]; > + break; > + case 11: /* Pop */ > + /* stop parsing, if invalid push level */ > + if (s->pushlevel == 0) { > + DPRINTFN(0, "Cannot pop item @ 0\n"); > + return (0); > + } > + s->pushlevel --; > + /* preserve position */ > + oldpos = c->loc.pos; > + c = &s->cur[s->pushlevel]; > + /* restore size and count */ > + s->loc_size = c->loc.size; > + s->loc_count = c->loc.count; > + /* set default item location */ > + c->loc.pos = oldpos; > + c->loc.size = 0; > + c->loc.count = 0; > + break; > + default: > + DPRINTFN(0, "Global bTag=%d\n", bTag); > + break; > + } > + break; > + case 2: /* Local */ > + switch (bTag) { > + case 0: > + if (bSize != 4) > + dval = (dval & mask) | c->_usage_page; > + > + /* set last usage, in case of a collection */ > + s->usage_last = dval; > + > + if (s->nusage < MAXUSAGE) { > + s->usages_min[s->nusage] = dval; > + s->usages_max[s->nusage] = dval; > + s->nusage ++; > + } else { > + DPRINTFN(0, "max usage reached\n"); > + } > + > + /* clear any pending usage sets */ > + s->susage = 0; > + break; > + case 1: > + s->susage |= 1; > + > + if (bSize != 4) > + dval = (dval & mask) | c->_usage_page; > + c->usage_minimum = dval; > + > + goto check_set; > + case 2: > + s->susage |= 2; > + > + if (bSize != 4) > + dval = (dval & mask) | c->_usage_page; > + c->usage_maximum = dval; > + > + check_set: > + if (s->susage != 3) > + break; > + > + /* sanity check */ > + if ((s->nusage < MAXUSAGE) && > + (c->usage_minimum <= c->usage_maximum)) { > + /* add usage range */ > + s->usages_min[s->nusage] = > + c->usage_minimum; > + s->usages_max[s->nusage] = > + c->usage_maximum; > + s->nusage ++; > + } else { > + DPRINTFN(0, "Usage set dropped\n"); > + } > + s->susage = 0; > + break; > + case 3: > + c->designator_index = dval; > + break; > + case 4: > + c->designator_minimum = dval; > + break; > + case 5: > + c->designator_maximum = dval; > + break; > + case 7: > + c->string_index = dval; > + break; > + case 8: > + c->string_minimum = dval; > + break; > + case 9: > + c->string_maximum = dval; > + break; > + case 10: > + c->set_delimiter = dval; > + break; > + default: > + DPRINTFN(0, "Local bTag=%d\n", bTag); > + break; > + } > + break; > + default: > + DPRINTFN(0, "default bType=%d\n", bType); > + break; > + } > + } > + return (0); > +} > + > +/*------------------------------------------------------------------------* > + * hid_report_size > + > *------------------------------------------------------------------------*/ > +int > +hid_report_size(const void *buf, usb_size_t len, enum hid_kind k, uint8_t > *id) > +{ > + struct hid_data *d; > + struct hid_item h; > + uint32_t temp; > + uint32_t hpos; > + uint32_t lpos; > + uint8_t any_id; > + > + any_id = 0; > + hpos = 0; > + lpos = 0xFFFFFFFF; > + > + for (d = hid_start_parse(buf, len, 1 << k); hid_get_item(d, &h);) { > + if (h.kind == k) { > + /* check for ID-byte presence */ > + if ((h.report_ID != 0) && !any_id) { > + if (id != NULL) > + *id = h.report_ID; > + any_id = 1; > + } > + /* compute minimum */ > + if (lpos > h.loc.pos) > + lpos = h.loc.pos; > + /* compute end position */ > + temp = h.loc.pos + (h.loc.size * h.loc.count); > + /* compute maximum */ > + if (hpos < temp) > + hpos = temp; > + } > + } > + hid_end_parse(d); > + > + /* safety check - can happen in case of currupt descriptors */ > + if (lpos > hpos) > + temp = 0; > + else > + temp = hpos - lpos; > + > + /* check for ID byte */ > + if (any_id) > + temp += 8; > + else if (id != NULL) > + *id = 0; > + > + /* return length in bytes rounded up */ > + return ((temp + 7) / 8); > +} > + > +/*------------------------------------------------------------------------* > + * hid_locate > + > *------------------------------------------------------------------------*/ > +int > +hid_locate(const void *desc, usb_size_t size, int32_t u, enum hid_kind k, > + uint8_t index, struct hid_location *loc, uint32_t *flags, uint8_t *id) > +{ > + struct hid_data *d; > + struct hid_item h; > + int i; > + > + for (d = hid_start_parse(desc, size, 1 << k); hid_get_item(d, &h);) { > + for (i = 0; i < h.nusages; i++) { > + if (h.kind == k && h.usages[i] == u) { > + if (index--) > + break; > + if (loc != NULL) > + *loc = h.loc; > + if (flags != NULL) > + *flags = h.flags; > + if (id != NULL) > + *id = h.report_ID; > + hid_end_parse(d); > + return (1); > + } > + } > + } > + if (loc != NULL) > + loc->size = 0; > + if (flags != NULL) > + *flags = 0; > + if (id != NULL) > + *id = 0; > + hid_end_parse(d); > + return (0); > +} > + > +/*------------------------------------------------------------------------* > + * hid_get_data > + > *------------------------------------------------------------------------*/ > +static uint32_t > +hid_get_data_sub(const uint8_t *buf, usb_size_t len, struct hid_location > *loc, > + int is_signed) > +{ > + uint32_t hpos = loc->pos; > + uint32_t hsize = loc->size; > + uint32_t data; > + uint32_t rpos; > + uint8_t n; > + > + DPRINTFN(11, "hid_get_data: loc %d/%d\n", hpos, hsize); > + > + /* Range check and limit */ > + if (hsize == 0) > + return (0); > + if (hsize > 32) > + hsize = 32; > + > + /* Get data in a safe way */ > + data = 0; > + rpos = (hpos / 8); > + n = (hsize + 7) / 8; > + rpos += n; > + while (n--) { > + rpos--; > + if (rpos < len) > + data |= buf[rpos] << (8 * n); > + } > + > + /* Correctly shift down data */ > + data = (data >> (hpos % 8)); > + n = 32 - hsize; > + > + /* Mask and sign extend in one */ > + if (is_signed != 0) > + data = (int32_t)((int32_t)data << n) >> n; > + else > + data = (uint32_t)((uint32_t)data << n) >> n; > + > + DPRINTFN(11, "hid_get_data: loc %d/%d = %lu\n", > + loc->pos, loc->size, (long)data); > + return (data); > +} > + > +int32_t > +hid_get_data(const uint8_t *buf, usb_size_t len, struct hid_location *loc) > +{ > + return (hid_get_data_sub(buf, len, loc, 1)); > +} > + > +uint32_t > +hid_get_data_unsigned(const uint8_t *buf, usb_size_t len, struct > hid_location *loc) > +{ > + return (hid_get_data_sub(buf, len, loc, 0)); > +} > + > +/*------------------------------------------------------------------------* > + * hid_put_data > + > *------------------------------------------------------------------------*/ > +void > +hid_put_data_unsigned(uint8_t *buf, usb_size_t len, > + struct hid_location *loc, unsigned int value) > +{ > + uint32_t hpos = loc->pos; > + uint32_t hsize = loc->size; > + uint64_t data; > + uint64_t mask; > + uint32_t rpos; > + uint8_t n; > + > + DPRINTFN(11, "hid_put_data: loc %d/%d = %u\n", hpos, hsize, value); > + > + /* Range check and limit */ > + if (hsize == 0) > + return; > + if (hsize > 32) > + hsize = 32; > + > + /* Put data in a safe way */ > + rpos = (hpos / 8); > + n = (hsize + 7) / 8; > + data = ((uint64_t)value) << (hpos % 8); > + mask = ((1ULL << hsize) - 1ULL) << (hpos % 8); > + rpos += n; > + while (n--) { > + rpos--; > + if (rpos < len) { > + buf[rpos] &= ~(mask >> (8 * n)); > + buf[rpos] |= (data >> (8 * n)); > + } > + } > +} > + > +/*------------------------------------------------------------------------* > + * hid_is_collection > + > *------------------------------------------------------------------------*/ > +int > +hid_is_collection(const void *desc, usb_size_t size, int32_t usage) > +{ > + struct hid_data *hd; > + struct hid_item hi; > + int err; > + > + hd = hid_start_parse(desc, size, hid_input); > + if (hd == NULL) > + return (0); > + > + while ((err = hid_get_item(hd, &hi))) { > + if (hi.kind == hid_collection && > + hi.usage == usage) > + break; > + } > + hid_end_parse(hd); > + return (err); > +} > + > +/*------------------------------------------------------------------------* > + * hid_get_descriptor_from_usb > + * > + * This function will search for a HID descriptor between two USB > + * interface descriptors. > + * > + * Return values: > + * NULL: No more HID descriptors. > + * Else: Pointer to HID descriptor. > + > *------------------------------------------------------------------------*/ > +struct usb_hid_descriptor * > +hid_get_descriptor_from_usb(struct usb_config_descriptor *cd, > + struct usb_interface_descriptor *id) > +{ > + struct usb_descriptor *desc = (void *)id; > + > + if (desc == NULL) { > + return (NULL); > + } > + while ((desc = usb_desc_foreach(cd, desc))) { > + if ((desc->bDescriptorType == UDESC_HID) && > + (desc->bLength >= USB_HID_DESCRIPTOR_SIZE(0))) { > + return (void *)desc; > + } > + if (desc->bDescriptorType == UDESC_INTERFACE) { > + break; > + } > + } > + return (NULL); > +} > + > +/*------------------------------------------------------------------------* > + * usbd_req_get_hid_desc > + * > + * This function will read out an USB report descriptor from the USB > + * device. > + * > + * Return values: > + * NULL: Failure. > + * Else: Success. The pointer should eventually be passed to free(). > + > *------------------------------------------------------------------------*/ > +usb_error_t > +usbd_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx, > + void **descp, uint16_t *sizep, > + struct malloc_type *mem, uint8_t iface_index) > +{ > + struct usb_interface *iface = usbd_get_iface(udev, iface_index); > + struct usb_hid_descriptor *hid; > + usb_error_t err; > + > + if ((iface == NULL) || (iface->idesc == NULL)) { > + return (USB_ERR_INVAL); > + } > + hid = hid_get_descriptor_from_usb > + (usbd_get_config_descriptor(udev), iface->idesc); > + > + if (hid == NULL) { > + return (USB_ERR_IOERROR); > + } > + *sizep = UGETW(hid->descrs[0].wDescriptorLength); > + if (*sizep == 0) { > + return (USB_ERR_IOERROR); > + } > + if (mtx) > + mtx_unlock(mtx); > + > + *descp = malloc(*sizep, mem, M_ZERO | M_WAITOK); > + > + if (mtx) > + mtx_lock(mtx); > + > + if (*descp == NULL) { > + return (USB_ERR_NOMEM); > + } > + err = usbd_req_get_report_descriptor > + (udev, mtx, *descp, *sizep, iface_index); > + > + if (err) { > + free(*descp, mem); > + *descp = NULL; > + return (err); > + } > + return (USB_ERR_NORMAL_COMPLETION); > +} > + > +/*------------------------------------------------------------------------* > + * calculate HID item resolution. unit/mm for distances, unit/rad for > angles > + > *------------------------------------------------------------------------*/ > +int32_t > +hid_item_resolution(struct hid_item *hi) > +{ > + /* > + * hid unit scaling table according to HID Usage Table Review > + * Request 39 Tbl 17 http://www.usb.org/developers/hidpage/HUTRR39b.pdf > + */ > + static const int64_t scale[0x10][2] = { > + [0x00] = { 1, 1 }, > + [0x01] = { 1, 10 }, > + [0x02] = { 1, 100 }, > + [0x03] = { 1, 1000 }, > + [0x04] = { 1, 10000 }, > + [0x05] = { 1, 100000 }, > + [0x06] = { 1, 1000000 }, > + [0x07] = { 1, 10000000 }, > + [0x08] = { 100000000, 1 }, > + [0x09] = { 10000000, 1 }, > + [0x0A] = { 1000000, 1 }, > + [0x0B] = { 100000, 1 }, > + [0x0C] = { 10000, 1 }, > + [0x0D] = { 1000, 1 }, > + [0x0E] = { 100, 1 }, > + [0x0F] = { 10, 1 }, > + }; > + int64_t logical_size; > + int64_t physical_size; > + int64_t multiplier; > + int64_t divisor; > + int64_t resolution; > + > + switch (hi->unit) { > + case HUM_CENTIMETER: > + multiplier = 1; > + divisor = 10; > + break; > + case HUM_INCH: > + multiplier = 10; > + divisor = 254; > + break; > + case HUM_RADIAN: > + multiplier = 1; > + divisor = 1; > + break; > + case HUM_DEGREE: > + multiplier = 573; > + divisor = 10; > + break; > + default: > + return (0); > + } > + > + if ((hi->logical_maximum <= hi->logical_minimum) || > + (hi->physical_maximum <= hi->physical_minimum) || > + (hi->unit_exponent < 0) || (hi->unit_exponent >= nitems(scale))) > + return (0); > + > + logical_size = (int64_t)hi->logical_maximum - > + (int64_t)hi->logical_minimum; > + physical_size = (int64_t)hi->physical_maximum - > + (int64_t)hi->physical_minimum; > + /* Round to ceiling */ > + resolution = logical_size * multiplier * scale[hi->unit_exponent][0] / > + (physical_size * divisor * scale[hi->unit_exponent][1]); > + > + if (resolution > INT32_MAX) > + return (0); > + > + return (resolution); > +} > + > +/*------------------------------------------------------------------------* > + * hid_is_mouse > + * > + * This function will decide if a USB descriptor belongs to a USB mouse. > + * > + * Return values: > + * Zero: Not a USB mouse. > + * Else: Is a USB mouse. > + > *------------------------------------------------------------------------*/ > +int > +hid_is_mouse(const void *d_ptr, uint16_t d_len) > +{ > + struct hid_data *hd; > + struct hid_item hi; > + int mdepth; > + int found; > + > + hd = hid_start_parse(d_ptr, d_len, 1 << hid_input); > + if (hd == NULL) > + return (0); > + > + mdepth = 0; > + found = 0; > + > *** 653 LINES SKIPPED *** > -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Sat Jan 9 02:05:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8E8434DED8C; Sat, 9 Jan 2021 02:05:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 4DCNbz3WP4z3sHx; Sat, 9 Jan 2021 02:05:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x42c.google.com with SMTP id d26so10644130wrb.12; Fri, 08 Jan 2021 18:05:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Aus77BpKwLdqksQ3tLicJMVnZh/aYcMTLGCobYuYR58=; b=WOtP1/Mtgr2nqrR13rMJ4znyH/zDTt2X/vyN7KfpYNiRZxk8vqPoLHBjZ3P2JPgOjO DSFiP0G1Mj0AmYinoZkXQ4HxAXp2NBgOBCeEyQr5cFR0b2xR2czDVLfKazHHIVDlaswh amemKNhlEgMg6AuOR3QVAWRk7c4r9MYf89Sy5u7cr4EdCiVk/HBtDNnEu62xtyGKgmOA moaJc8kpztOLnnriGizETLgx2iWojKw3KelodD1vo2hIgvE3/6MMiHa+S92ZhG5x579u NlgSG8gRj5BfrH6k0sPdKNy3vqjZSnGmXUb0EvyyKuKlL0as/JmQ1mMOuEGiZSerIOAr rmDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Aus77BpKwLdqksQ3tLicJMVnZh/aYcMTLGCobYuYR58=; b=opwYvFs26sh6m0JFu3WMmMLReJYQc4FQWsmt48Y2PVQRWmWsHZQjXclgBBqfJHaE1p /hGneYQrO+8UvwL68TAydXX6GHjXugT6kvgJsz7pDJMqim7gPrRRBdZFQwaYHwiBGs9h pAksgcUjfSeDnmkKO6T+fsVKN4TzlFgNt8fg8wJYbkH0piNsETDk6kTeEK1gZvXNJyPG Us8VZTtTwNFSgWzdi4ATftZj1+FEkfh03iuM/FRdc7wv0YstNHOlWbl8eLeGd44vo3jw eZBHqulN7J5r5UnWEvDZ2cZyfiEsgxVsXK43n22zU3OZYsp9aV/FgazgwdEln0y7Y+VM vOoQ== X-Gm-Message-State: AOAM5320+8PH5TGxHKf7WYkrEstirArZoQTxNbHNqT/rbO6MeXU+36ym UUvDyMSoEzSHYNiFEHZQ0KJpTxUkPHj/FvPI+flbQeJC3To= X-Google-Smtp-Source: ABdhPJyoTjAHJ7q/4SdshmgwwSyMrIEnXGDNilwGLHXHJCPcBUwYLeaHFEAGd0XyIggtwbXvlt37YC3uddD1U6uhr6s= X-Received: by 2002:adf:ec86:: with SMTP id z6mr6103136wrn.17.1610157949607; Fri, 08 Jan 2021 18:05:49 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:f811:0:0:0:0:0 with HTTP; Fri, 8 Jan 2021 18:05:48 -0800 (PST) In-Reply-To: <202101082237.108MbjU1068611@gitrepo.freebsd.org> References: <202101082237.108MbjU1068611@gitrepo.freebsd.org> From: Mateusz Guzik Date: Sat, 9 Jan 2021 03:05:48 +0100 Message-ID: Subject: Re: git: f222a6b88614 - main - dtrace: Fix /"string" == NULL/ comparisons using an uninitialized value. To: Bryan Drewery Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DCNbz3WP4z3sHx X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 02:05:51 -0000 tinderbox fails to build riscv kernels with: In file included from /usr/src/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c:18434: /usr/src/sys/cddl/dev/dtrace/riscv/dtrace_isa.c:155:13: error: variable 'oldfp' is uninitialized when used here [-Werror,-Wuninitialized] if (fp == oldfp) { ^~~~~ /usr/src/sys/cddl/dev/dtrace/riscv/dtrace_isa.c:122:17: note: initialize the variable 'oldfp' to silence this warning uintptr_t oldfp; ^ = 0 1 error generated. which stems from the Makefile change. On 1/8/21, Bryan Drewery wrote: > The branch main has been updated by bdrewery: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=f222a6b88614db13ae83c8110281e690d1381a4c > > commit f222a6b88614db13ae83c8110281e690d1381a4c > Author: Bryan Drewery > AuthorDate: 2020-12-18 17:58:03 +0000 > Commit: Bryan Drewery > CommitDate: 2021-01-08 22:37:17 +0000 > > dtrace: Fix /"string" == NULL/ comparisons using an uninitialized > value. > > A test of this is funcs/tst.strtok.d which has this filter: > > BEGIN > /(this->field = strtok(this->str, ",")) == NULL/ > { > exit(1); > } > The test will randomly fail with exit status of 1 indicating that > this->field > was NULL even though printing it out shows it is not. > > This is compiled to the DTrace instruction set: > // Pushed arguments not shown here > // call strtok() and set result into %r1 > 07: 2f001f01 call DIF_SUBR(31), %r1 ! strtok > // set thread local scalar this->field from %r1 > 08: 39050101 stls %r1, DT_VAR(1281) ! DT_VAR(1281) = > "field" > // Prepare for the == comparison > // Set right side of %r2 to NULL > 09: 25000102 setx DT_INTEGER[1], %r2 ! 0x0 > // string compare %r1 (strtok result) to %r2 > 10: 27010200 scmp %r1, %r2 > > In this case only %r1 is loaded with a string limit set to lim1. %r2 > being > NULL does not get loaded and does not set lim2. Then we call > dtrace_strncmp() > with MIN(lim1, lim2) resulting in passing 0 and comparing neither side. > dtrace_strncmp() handles this case fine and it already has been while > being lucky with what lim2 was [un]initialized as. > > Reviewed by: markj, Don Morris > Sponsored by: Dell EMC > Differential Revision: https://reviews.freebsd.org/D27671 > --- > sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 8 ++++++++ > sys/modules/dtrace/dtrace/Makefile | 1 - > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > index 3d68a68ba819..b212185a4578 100644 > --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > @@ -6374,6 +6374,14 @@ dtrace_dif_emulate(dtrace_difo_t *difo, > dtrace_mstate_t *mstate, > uintptr_t s2 = regs[r2]; > size_t lim1, lim2; > > + /* > + * If one of the strings is NULL then the limit becomes > + * 0 which compares 0 characters in dtrace_strncmp() > + * resulting in a false positive. dtrace_strncmp() > + * treats a NULL as an empty 1-char string. > + */ > + lim1 = lim2 = 1; > + > if (s1 != 0 && > !dtrace_strcanload(s1, sz, &lim1, mstate, vstate)) > break; > diff --git a/sys/modules/dtrace/dtrace/Makefile > b/sys/modules/dtrace/dtrace/Makefile > index 80278fc83a32..55f9f4f66f36 100644 > --- a/sys/modules/dtrace/dtrace/Makefile > +++ b/sys/modules/dtrace/dtrace/Makefile > @@ -61,6 +61,5 @@ CFLAGS+= -include > ${SYSDIR}/cddl/compat/opensolaris/sys/debug_compat.h > CFLAGS.dtrace_asm.S+= -D_SYS_ERRNO_H_ -D_SYS_PARAM_H_ -DLOCORE > CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} > CWARNFLAGS+= -Wno-parentheses > -CWARNFLAGS+= -Wno-uninitialized > CWARNFLAGS+= -Wno-cast-qual > CWARNFLAGS+= -Wno-unused > -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Sat Jan 9 02:33:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 009124DF67C for ; Sat, 9 Jan 2021 02:33:49 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 4DCPDD6RKkz3tX8 for ; Sat, 9 Jan 2021 02:33:48 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f51.google.com with SMTP id t30so10751002wrb.0 for ; Fri, 08 Jan 2021 18:33:48 -0800 (PST) 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=HXiuTS90L4OvbB1NrkOpdeRCA1voLIuyvVs0WxTN9pg=; b=cF2XG6ZLMOMcG6F+pYO/Dnhm3gkDf/AE8y3wk38BwrBL4WpiaicaiINmGuO8tPeFut +ydWIRwO0Rk9aT+jimdhdCt8Oo8ylyIplwH43VaxzzgLc+USArxVqUZDNehHmTLtAlCO ZHBxfUuJWpFEtj/hBES44OBQgcaDII+pBx4Uk/6xXtyXDkm/vVo6IugsGSh864Ao65dm uBdKCkLZCqZlbocjvnb53W4G/RNh2j0xvo+9Ui4zXqzFTXzUhFRXYa7Fx5C1Mk/ojcSQ eMBuRVULO0ryUiDgjtNWmFo8iaXvG9SjGtKYQGa4PMShcBBZySSZQD3YYgiRCDK9ZmEG XJDg== X-Gm-Message-State: AOAM530W924wo5YFty0qTzOUVCdGsYDP0Z5pSPi8q6SDXjfwQxIzZOCy mViDr0delRISQx1CvT5/Fx5hDg== X-Google-Smtp-Source: ABdhPJy+6+yrsJNbgkcOYeID9F4BddntZXCUoGarwjpJZ22E0Etw4Ni23yKoXfSBIT45II+aXbuWcQ== X-Received: by 2002:a5d:6909:: with SMTP id t9mr5980177wru.327.1610159627185; Fri, 08 Jan 2021 18:33:47 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id g5sm15661833wro.60.2021.01.08.18.33.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jan 2021 18:33:46 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: f222a6b88614 - main - dtrace: Fix /"string" == NULL/ comparisons using an uninitialized value. From: Jessica Clarke In-Reply-To: Date: Sat, 9 Jan 2021 02:33:45 +0000 Cc: Bryan Drewery , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <59FB1716-7322-4F7F-B60B-95B583F40448@freebsd.org> References: <202101082237.108MbjU1068611@gitrepo.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DCPDD6RKkz3tX8 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 02:33:49 -0000 On 9 Jan 2021, at 02:05, Mateusz Guzik wrote: > > tinderbox fails to build riscv kernels with: > > In file included from > /usr/src/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c:18434: > /usr/src/sys/cddl/dev/dtrace/riscv/dtrace_isa.c:155:13: error: > variable 'oldfp' is uninitialized when used here > [-Werror,-Wuninitialized] > if (fp == oldfp) { > ^~~~~ > /usr/src/sys/cddl/dev/dtrace/riscv/dtrace_isa.c:122:17: note: > initialize the variable 'oldfp' to silence this warning > uintptr_t oldfp; > ^ > = 0 > 1 error generated. > > which stems from the Makefile change. https://reviews.freebsd.org/D28054 Jess From owner-dev-commits-src-all@freebsd.org Sat Jan 9 03:11:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 621C54DFF8C; Sat, 9 Jan 2021 03:11:00 +0000 (UTC) (envelope-from martin@vx.sk) Received: from mail.vx.sk (mail.vx.sk [IPv6:2a01:4f8:191:9029::4]) by mx1.freebsd.org (Postfix) with ESMTP id 4DCQ3738dtz3wXS; Sat, 9 Jan 2021 03:10:59 +0000 (UTC) (envelope-from martin@vx.sk) Received: from mail.vx.sk (localhost [127.0.0.1]) by mail.vx.sk (Postfix) with ESMTP id 3D1A41C48F0; Sat, 9 Jan 2021 04:10:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=vx.sk; h= content-transfer-encoding:mime-version:content-type:content-type :user-agent:in-reply-to:subject:subject:from:from:message-id :date:date:received:received:received; s=1; t=1610161857; x= 1611976258; bh=+KfKXbmo88sn9yeYJ4w0ShBYEsT/sdrufngcuLc0jgU=; b=U g9ffXC0jjDooKpLAPy6WCJBT3+nmi3c1d28PTEek+gUiOu4IC5FKkmEBO8EaO/Rw qXACzRpTRvpnPoYOzdCm/xeLPWtnv+h9vy6FV665WyBsVRhrhCrksqr/3MOo4i08 JJTmuq14bq8Vhn9mGdPdm4k5Fi1SjZ6stKOYq7AKyIGDekbbEsa67VjghQDjKuTS mngPbeBq+WY6tglTn0Pl/FEAqjwtuDM783Tt2eAJExj5nWq9fjsGq1BimR4UYy5w xHt/jOjXYLetUyZzKBBmNHlXxBetebs+zIgW+4JZOIn3CP7LZDlRmxzSaXCo/dOh z9pyr5WHdLDgHV/OpxsQQ== X-Virus-Scanned: amavisd-new at mail.vx.sk Received: from mail.vx.sk by mail.vx.sk (amavisd-new, unix socket) with LMTP id wlJR5VLxnR-6; Sat, 9 Jan 2021 04:10:57 +0100 (CET) Received: from mail.vx.sk (localhost [IPv6:::1]) by mail.vx.sk (Postfix) with ESMTPSA id 0D0D51C4A29; Sat, 9 Jan 2021 04:10:57 +0100 (CET) Received: from 188-167-136-198.dynamic.chello.sk (188-167-136-198.dynamic.chello.sk [188.167.136.198]) by mail.vx.sk (Horde Framework) with HTTPS; Sat, 09 Jan 2021 04:10:57 +0100 Date: Sat, 09 Jan 2021 04:10:57 +0100 Message-ID: <20210109041057.Horde.WvM1H5V7lVke29OxjiPGOme@mail.vx.sk> From: martin@vx.sk To: Matt Macy Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 7877fdebeeb3 - main - OpenZFS merge main-gf11b09 In-Reply-To: <202101080056.1080u6Ie085632@gitrepo.freebsd.org> User-Agent: Horde Application Framework 5 MIME-Version: 1.0 X-Rspamd-Queue-Id: 4DCQ3738dtz3wXS X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=vx.sk header.s=1 header.b=U g9ffXC; dmarc=none; spf=pass (mx1.freebsd.org: domain of martin@vx.sk designates 2a01:4f8:191:9029::4 as permitted sender) smtp.mailfrom=martin@vx.sk X-Spamd-Result: default: False [-3.40 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; FREEFALL_USER(0.00)[martin]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[vx.sk]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[vx.sk:s=1]; SPAMHAUS_ZRD(0.00)[2a01:4f8:191:9029::4:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DKIM_TRACE(0.00)[vx.sk:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_NO_DN(0.00)[]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a01:4f8:191:9029::4:from]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RECEIVED_SPAMHAUS_PBL(0.00)[188.167.136.198:received] Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-Description: =?utf-8?b?U3Byw6F2YQ==?= s =?utf-8?b?xI1pc3TDvW0=?= textom X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 03:11:00 -0000 Hi matt, could you please bump vfs.zfs.version.module to something 2.0-ish or =20 2.0.1-ish like 2.0-gf11b09? The 0.8.0-1 is very misleading. Maybe the =20 version string could contain something that also notes that we are =20 using the module bundled with FreeBSD and not the one from ports. Thanks, mm Quoting Matt Macy : > The branch main has been updated by mmacy: > > URL: =20 > https://cgit.FreeBSD.org/src/commit/?id=3D7877fdebeeb35fad1cbbafce22598= b1bdf97c786 > > commit 7877fdebeeb35fad1cbbafce22598b1bdf97c786 > Author:=C2=A0 =C2=A0 =C2=A0Matt Macy > AuthorDate: 2021-01-07 23:27:17 +0000 > Commit:=C2=A0 =C2=A0 =C2=A0Matt Macy > CommitDate: 2021-01-08 00:55:59 +0000 > > =C2=A0 =C2=A0OpenZFS merge main-gf11b09 > > =C2=A0 =C2=A0- add dRAID support > =C2=A0 =C2=A0- fix duplicate close handling > =C2=A0 =C2=A0- fix memory leak in prefetch > =C2=A0 =C2=A0- fix problem with SIMD benchmarking on FreeBSD boot > =C2=A0 =C2=A0... From owner-dev-commits-src-all@freebsd.org Sat Jan 9 05:26:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EE2BA4CA206; Sat, 9 Jan 2021 05:26:16 +0000 (UTC) (envelope-from git@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 4DCT3D5Cxbz4Xj7; Sat, 9 Jan 2021 05:26:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5C1E107E2; Sat, 9 Jan 2021 05:26:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1095QGfO001432; Sat, 9 Jan 2021 05:26:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1095QG48001431; Sat, 9 Jan 2021 05:26:16 GMT (envelope-from git) Date: Sat, 9 Jan 2021 05:26:16 GMT Message-Id: <202101090526.1095QG48001431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: b799d38a2ad1 - main - certctl: replace hardcoded uses of /usr/local MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b799d38a2ad10ec84c8ffa4a554a1816465c0d12 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 05:26:17 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b799d38a2ad10ec84c8ffa4a554a1816465c0d12 commit b799d38a2ad10ec84c8ffa4a554a1816465c0d12 Author: Kyle Evans AuthorDate: 2021-01-09 04:00:41 +0000 Commit: Kyle Evans CommitDate: 2021-01-09 04:06:42 +0000 certctl: replace hardcoded uses of /usr/local Use the new user.localbase sysctl here as well, to reduce the number of hardcoded localbase by one (1). MFC after: 3 days (note: just use a literal /usr/local default) --- usr.sbin/certctl/certctl.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.sbin/certctl/certctl.sh b/usr.sbin/certctl/certctl.sh index f317064a6dfe..c2f9c7dc8438 100755 --- a/usr.sbin/certctl/certctl.sh +++ b/usr.sbin/certctl/certctl.sh @@ -264,8 +264,9 @@ shift $(( $OPTIND - 1 )) : ${METALOG:=${DESTDIR}/METALOG} INSTALLFLAGS= [ $UNPRIV -eq 1 ] && INSTALLFLAGS="-U -M ${METALOG} -D ${DESTDIR}" -: ${TRUSTPATH:=${DESTDIR}/usr/share/certs/trusted:${DESTDIR}/usr/local/share/certs:${DESTDIR}/usr/local/etc/ssl/certs} -: ${BLACKLISTPATH:=${DESTDIR}/usr/share/certs/blacklisted:${DESTDIR}/usr/local/etc/ssl/blacklisted} +: ${LOCALBASE:=$(sysctl -n user.localbase)} +: ${TRUSTPATH:=${DESTDIR}/usr/share/certs/trusted:${DESTDIR}${LOCALBASE}/share/certs:${DESTDIR}${LOCALBASE}/etc/ssl/certs} +: ${BLACKLISTPATH:=${DESTDIR}/usr/share/certs/blacklisted:${DESTDIR}${LOCALBASE}/etc/ssl/blacklisted} : ${CERTDESTDIR:=${DESTDIR}/etc/ssl/certs} : ${BLACKLISTDESTDIR:=${DESTDIR}/etc/ssl/blacklisted} From owner-dev-commits-src-all@freebsd.org Sat Jan 9 05:26:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DD9904C9F41; Sat, 9 Jan 2021 05:26:17 +0000 (UTC) (envelope-from git@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 4DCT3F5ss9z4XCY; Sat, 9 Jan 2021 05:26:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC76010C06; Sat, 9 Jan 2021 05:26:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1095QHdp001454; Sat, 9 Jan 2021 05:26:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1095QHB7001453; Sat, 9 Jan 2021 05:26:17 GMT (envelope-from git) Date: Sat, 9 Jan 2021 05:26:17 GMT Message-Id: <202101090526.1095QHB7001453@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 8c4094f38c7b - main - certctl: factor out certname resolution MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c4094f38c7b0e95af91d92a563bfedc1249950d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 05:26:17 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=8c4094f38c7b0e95af91d92a563bfedc1249950d commit 8c4094f38c7b0e95af91d92a563bfedc1249950d Author: Kyle Evans AuthorDate: 2021-01-09 04:34:44 +0000 Commit: Kyle Evans CommitDate: 2021-01-09 04:36:22 +0000 certctl: factor out certname resolution create_blacklisted() will identify a cert whether it's provided a path to a cert or the hash.serial format that is shown by `certctl list`. Factor this logic out into a resolve_certname() so that it may be reused elsewhere. --- usr.sbin/certctl/certctl.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/usr.sbin/certctl/certctl.sh b/usr.sbin/certctl/certctl.sh index c2f9c7dc8438..1a491cf3a047 100755 --- a/usr.sbin/certctl/certctl.sh +++ b/usr.sbin/certctl/certctl.sh @@ -92,7 +92,8 @@ create_trusted_link() install ${INSTALLFLAGS} -lrs $(realpath "$1") "$CERTDESTDIR/$hash.$suffix" } -create_blacklisted() +# Accepts either dot-hash form from `certctl list` or a path to a valid cert. +resolve_certname() { local hash srcfile filename local suffix @@ -103,14 +104,28 @@ create_blacklisted() srcfile=$(realpath "$1") suffix=$(get_decimal "$BLACKLISTDESTDIR" "$hash") filename="$hash.$suffix" + echo "$srcfile" "$hash.$suffix" elif [ -e "${CERTDESTDIR}/$1" ]; then srcfile=$(realpath "${CERTDESTDIR}/$1") hash=$(echo "$1" | sed -Ee 's/\.([0-9])+$//') suffix=$(get_decimal "$BLACKLISTDESTDIR" "$hash") filename="$hash.$suffix" - else + echo "$srcfile" "$hash.$suffix" + fi +} + +create_blacklisted() +{ + local srcfile filename + + set -- $(resolve_certname "$1") + srcfile=$1 + filename=$2 + + if [ -z "$srcfile" -o -z "$filename" ]; then return fi + [ $VERBOSE -gt 0 ] && echo "Adding $filename to blacklist" [ $NOOP -eq 0 ] && install ${INSTALLFLAGS} -lrs "$srcfile" "$BLACKLISTDESTDIR/$filename" } From owner-dev-commits-src-all@freebsd.org Fri Jan 8 21:11:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E5C394D6DF3 for ; Fri, 8 Jan 2021 21:11:57 +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 4DCG4s5W6Kz3HCm for ; Fri, 8 Jan 2021 21:11:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72f.google.com with SMTP id v126so9737099qkd.11 for ; Fri, 08 Jan 2021 13:11:57 -0800 (PST) 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=ZeBBHI892XNjzcUYk57KuxuZ02IGXQL9hnzlJBUYhD4=; b=l6UuT/BryyIXVafQKZbc8YZSKe888SJE4meaHqGYhvdy0jc6md+CQJ9//44rZxYJ8S yhkmFEb0+54kOOGVgLmpWoVBkCiToTWlhdr8c81o3NTH4yAY2tnpOPyxuTJJgH0zYt8T ECmaT1fwbE18aoc6J9wsEka/wt9FwrEZJc1bGa+f2KxSjdJPSNwOUjv8NKm+TsAnO/9f PlvsKgBVd9UPH0/OLbtDP8pWnyyMVV0lDsodgiMRJLP9dEZyLrSzL2yC9Pd2VStz87F0 fw8qgrmOipht4CsLTw3vb6Ny04PRMbCTm0lUymeg7NTPqZai/sQ3DcutH5qrNBFpW5sg 6xYA== 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=ZeBBHI892XNjzcUYk57KuxuZ02IGXQL9hnzlJBUYhD4=; b=YuUbmqUc8k7cLwZXG3W6phvffkqV0iYdZL2h2V3iwD7pcIW+aOHjuyjIeBBeB4WNwq 8Wl4TgUCuBqcAC8mlIACIlkLIW3IXINzt0wj1/3ZNGyPVdGm/rWwLnYHpALzQB6O0nVr ZkFL0VkIBtYFswLV+fY0uKdTcNK6/8G19a271BMF8Im93f9dXhpVxCgkXU6TKpqlEh5g SJ9TixxFb3dedq5It9l64TPiPJJFxWXYdwVZhWAXBbRSjVaEULEbaE6a9dq0l+BkTE2t L3OW5O7XnB+jwdjmZvGGYXLEfAqExKtBHMY/UpE+ETs4PAskZD2SAdMw6vkDvPj1eC/i xPSg== X-Gm-Message-State: AOAM5335Y6iMusGXb3XdO1QjdkdpQWt1V1PjBFNYInRjKEFx3WuC8k8E dUlBFkYDaVsYWY6ldPNuUuuEHPqieqpz4//mQYR5EA== X-Google-Smtp-Source: ABdhPJxX538toa6CHpGSlQF98+Wx/3fk1A/ZXyFeK7pSHObM5MmuVF89iGlQth5KimPyvUKadtZoKzXdb2d8PwxccJA= X-Received: by 2002:a37:4a4e:: with SMTP id x75mr5865575qka.89.1610140316849; Fri, 08 Jan 2021 13:11:56 -0800 (PST) MIME-Version: 1.0 References: <202101072320.107NKpMS063374@gitrepo.freebsd.org> <7a7fa0fb-51c2-1b14-6d37-2c400f69d7dd@kondratyev.su> <3EA011C9-2EEC-4693-B36D-69E74DF8473C@panasas.com> <20210108092638.x2kkvpeftey2wk62@ivaldir.net> In-Reply-To: From: Warner Losh Date: Fri, 8 Jan 2021 14:11:46 -0700 Message-ID: Subject: Re: 92cf602e3809 - main - Copy strcasestr.c from libc to libkern. To: Konstantin Belousov Cc: Kyle Evans , Baptiste Daroussin , Vladimir Kondratyev , Ravi Pokala , Jessica Clarke , Vladimir Kondratyev , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4DCG4s5W6Kz3HCm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-Mailman-Approved-At: Sat, 09 Jan 2021 07:51:09 +0000 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 21:11:58 -0000 On Fri, Jan 8, 2021 at 1:58 PM Konstantin Belousov wrote: > On Fri, Jan 08, 2021 at 07:46:31AM -0600, Kyle Evans wrote: > > On Fri, Jan 8, 2021 at 3:27 AM Baptiste Daroussin > wrote: > > > > > > On Fri, Jan 08, 2021 at 02:49:31AM +0300, Vladimir Kondratyev wrote: > > > > On 08.01.2021 02:41, Ravi Pokala wrote: > > > > > -----Original Message----- > > > > > From: on behalf of Vladimir > Kondratyev > > > > > Date: 2021-01-07, Thursday at 15:33 > > > > > To: Jessica Clarke , Vladimir Kondratyev > > > > > > Cc: "src-committers@freebsd.org" , " > dev-commits-src-all@freebsd.org" , " > dev-commits-src-main@freebsd.org" > > > > > Subject: Re: git: 92cf602e3809 - main - Copy strcasestr.c from > libc to libkern. > > > > > > > > > > On 08.01.2021 02:27, Jessica Clarke wrote: > > > > > > On 7 Jan 2021, at 23:20, Vladimir Kondratyev > wrote: > > > > > >> +#include > > > > > >> +#include > > > > > >> +#include "xlocale_private.h" > > > > > >> + > > > > > >> +/* > > > > > >> + * Find the first occurrence of find in s, ignore case. > > > > > >> + */ > > > > > >> +char * > > > > > >> +strcasestr_l(const char *s, const char *find, locale_t > locale) > > > > > > > > > > > > Locales in the kernel? This feels wrong. > > > > > > > > > > > > Jess > > > > > > > > > > > > > > > > strcasestr.c was copied from userland unmodified just to allow > > > > > "git log --follow" to work. Next commit removed locale support > from this > > > > > file and connected it to build. > > > > > > > > > > Unfortunately, about two-dozen commit messages from you arrived at > the same time, and some were out of order; without incrementing change > numbers in the subject line, figuring out the actual ordering is > non-trivial. :-p > > > > > > > > > > -Ravi (rpokala@) > > > > > > > > > > > > > I hope, commit hook will be improved some day. Pushing of two-dozen > > > > commits one by one is too boring. > > > > > > The history is in the right order and gitlog/cgit/anything that reads > the log > > > show everything in the right order. > > > > > > mails are asynchronuous, expecting the mail to always arrive in a > given order is > > > wrong ;) > > > > > > pushing all those commits at once was imho the right thing to do. > > > > > > > I've pointed this out a couple of times (with seemingly nothing coming > > from it), but the mails are being sent in reverse order. Fixing that > > would at least increase chances for some to receive them in order (and > > the archives show them perfectly in reverse order most of the time). > > > > Picking out the message-ids from the last series I sent, this is the > > correct order: > > > > 202101072237.107MbYaX002789@gitrepo.freebsd.org ("4832d2e8ae1d - main > > - du: tests: fix the H_flag test (primarily grep usage)") > > 202101072237.107MbYsM002771@gitrepo.freebsd.org ("3c5c39c7ad8f - main > > - du: tests: make H_flag tests more strict about output requirements") > > > > 202101072237.107MbYaX002789 -> 2789 was the last pid that assigned a > message-id > > 202101072237.107MbYsM002771 -> 2771 was the last pid that assigned a > message-id > > > > Given that this is clearly with kern.randompid=0 on the server, one > > can conclude that these were sent in the reverse order based on the > > pid sequence. If you pick a couple other series out, this holds true > > (at least for all the series I've looked at) > > Might be instead of trying to establish ordering by date, sending machinery > could set followup/in-reply-to headers to thread the whole batch. > Basically > emulate the 'git send-email' behavior. > > Then we can argue that only related patches should be committed in one > push, but practically that matches common workflow of developing on > topic branches and pushing them in one go. > it is guaranteed > I believe that https://github.com/git-multimail/git-multimail is being considered. It does what you suggest (or something similar). I'm not sure how well supported it is (it was written years ago, but has had some recent commits), or how well it meets our needs, but in the long run we'll need to do something like this. Warner From owner-dev-commits-src-all@freebsd.org Sat Jan 9 10:02:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 018A74CFF90; Sat, 9 Jan 2021 10:02:33 +0000 (UTC) (envelope-from git@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 4DCbB05bwjz4lYw; Sat, 9 Jan 2021 10:02:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B315C1411C; Sat, 9 Jan 2021 10:02:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109A2Wmc062614; Sat, 9 Jan 2021 10:02:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109A2Wvp062613; Sat, 9 Jan 2021 10:02:32 GMT (envelope-from git) Date: Sat, 9 Jan 2021 10:02:32 GMT Message-Id: <202101091002.109A2Wvp062613@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: a898ee51c41d - main - Fix LINT kernel build after 01f2e864f79584c0cd250a8e7cfb501a9985768a. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a898ee51c41d57805da6b969ee019a39f348c4e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 10:02:33 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a898ee51c41d57805da6b969ee019a39f348c4e4 commit a898ee51c41d57805da6b969ee019a39f348c4e4 Author: Hans Petter Selasky AuthorDate: 2021-01-09 09:48:13 +0000 Commit: Hans Petter Selasky CommitDate: 2021-01-09 09:49:21 +0000 Fix LINT kernel build after 01f2e864f79584c0cd250a8e7cfb501a9985768a. Differential revision: https://reviews.freebsd.org/D27893 Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/conf/NOTES | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 4a9e09184caa..5033cc63524f 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2412,7 +2412,10 @@ options NSFBUFS=1024 # options DEBUG_LOCKS - +##################################################################### +# Generic HID support +device hid + ##################################################################### # USB support # UHCI controller From owner-dev-commits-src-all@freebsd.org Sat Jan 9 11:10:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F338D4D1016; Sat, 9 Jan 2021 11:10:33 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp.infotel.ru (corp.infotel.ru [195.170.219.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4DCchT5mzxz4ptt; Sat, 9 Jan 2021 11:10:33 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp (corp.infotel.ru [195.170.219.3]) by corp.infotel.ru (Postfix) with ESMTP id 0C07617BDAF; Sat, 9 Jan 2021 14:10:26 +0300 (MSK) X-Virus-Scanned: amavisd-new at corp.infotel.ru Received: from corp.infotel.ru ([195.170.219.3]) by corp (corp.infotel.ru [195.170.219.3]) (amavisd-new, port 10024) with ESMTP id UTCI-UgWCPRD; Sat, 9 Jan 2021 14:10:25 +0300 (MSK) Received: from mail.cicgroup.ru (unknown [195.170.219.74]) by corp.infotel.ru (Postfix) with ESMTP id 4656417BDA2; Sat, 9 Jan 2021 14:10:25 +0300 (MSK) Received: from mail.cicgroup.ru (localhost [127.0.0.1]) by mail.cicgroup.ru (Postfix) with ESMTP id 275AE42211F; Sat, 9 Jan 2021 14:10:22 +0300 (MSK) Received: from mail.cicgroup.ru ([127.0.0.1]) by mail.cicgroup.ru (mail.cicgroup.ru [127.0.0.1]) (amavisd-new, port 10024) with SMTP id ELWemME1rgOC; Sat, 9 Jan 2021 14:10:19 +0300 (MSK) Received: from [192.168.0.30] (gateway [10.0.2.2]) by mail.cicgroup.ru (Postfix) with ESMTPA id 87E5E42211C; Sat, 9 Jan 2021 14:10:19 +0300 (MSK) Subject: Re: git: 1ffa5c63f449 - main - Copy HID over USB support files to new sys/dev/hid directory To: Mateusz Guzik , Vladimir Kondratyev Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202101072320.107NKp3k063340@gitrepo.freebsd.org> From: Vladimir Kondratyev Message-ID: Date: Sat, 9 Jan 2021 14:10:14 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DCchT5mzxz4ptt X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 11:10:34 -0000 On 09.01.2021 04:43, Mateusz Guzik wrote: > I don't know which commit is ultimately responsible from the series, > but LINT kernels fail to build in tinderbox. For example LINT-NOINET6: > > ld: error: undefined symbol: hid_report_size_max >>>> referenced by uaudio.c >>>> uaudio.o:(uaudio_attach) >>>> referenced by ugold.c >>>> ugold.o:(ugold_attach) >>>> referenced by atp.c >>>> atp.o:(atp_attach) >>>> referenced 7 more times > ld: error: undefined symbol: hid_locate I'll fix it soon: https://reviews.freebsd.org/D28060 Sorry for breakage. From owner-dev-commits-src-all@freebsd.org Sat Jan 9 11:12:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B36F64D12CF; Sat, 9 Jan 2021 11:12:46 +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 4DCcl23kvRz4qJL; Sat, 9 Jan 2021 11:12:46 +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 E717326035B; Sat, 9 Jan 2021 12:12:43 +0100 (CET) Subject: Re: git: 1ffa5c63f449 - main - Copy HID over USB support files to new sys/dev/hid directory To: Vladimir Kondratyev , Mateusz Guzik , Vladimir Kondratyev Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202101072320.107NKp3k063340@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: <45e704e6-154f-45e6-3169-d97af67f34fb@selasky.org> Date: Sat, 9 Jan 2021 12:12:35 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.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: 4DCcl23kvRz4qJL X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 11:12:46 -0000 On 1/9/21 12:10 PM, Vladimir Kondratyev wrote: > On 09.01.2021 04:43, Mateusz Guzik wrote: >> I don't know which commit is ultimately responsible from the series, >> but LINT kernels fail to build in tinderbox. For example LINT-NOINET6: >> >> ld: error: undefined symbol: hid_report_size_max >>>>> referenced by uaudio.c >>>>> uaudio.o:(uaudio_attach) >>>>> referenced by ugold.c >>>>> ugold.o:(ugold_attach) >>>>> referenced by atp.c >>>>> atp.o:(atp_attach) >>>>> referenced 7 more times >> ld: error: undefined symbol: hid_locate > > I'll fix it soon: https://reviews.freebsd.org/D28060 > > Sorry for breakage. I made a temporary fix, so no rush: https://cgit.freebsd.org/src/commit/?id=a898ee51c41d57805da6b969ee019a39f348c4e4 --HPS From owner-dev-commits-src-all@freebsd.org Sat Jan 9 12:51:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 454BA4D36EB; Sat, 9 Jan 2021 12:51:37 +0000 (UTC) (envelope-from git@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 4DCfx51Sfgz4vZp; Sat, 9 Jan 2021 12:51:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24F4B16311; Sat, 9 Jan 2021 12:51:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109CpbxW082318; Sat, 9 Jan 2021 12:51:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109CpbLZ082315; Sat, 9 Jan 2021 12:51:37 GMT (envelope-from git) Date: Sat, 9 Jan 2021 12:51:37 GMT Message-Id: <202101091251.109CpbLZ082315@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 537d13437314 - main - Bring DPDK route lookups to FreeBSD. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 537d134373141c2d25bfb24af6d661d0e6102927 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 12:51:37 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=537d134373141c2d25bfb24af6d661d0e6102927 commit 537d134373141c2d25bfb24af6d661d0e6102927 Author: Alexander V. Chernikov AuthorDate: 2021-01-09 12:08:00 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-01-09 12:41:04 +0000 Bring DPDK route lookups to FreeBSD. This change introduces loadable fib lookup modules based on DPDK rte_lpm lib targeted for high-speed lookups in large-scale tables. It is based on the lookup framework described in D27401. IPv4 module is called dpdk_lpm4. It wraps around rte_lpm [1] library. This library implements variation of DIR24-8 [2] lookup algorithm. Module provide lockless route lookups and in-place incremental updates, allowing for good RIB performance. IPv6 module is called dpdk_lpm6. It wraps around rte_lpm6 [3] library. Implementation can be seen as multi-bit trie where the stride or number of bits inspected on each level varies from level to level. It can vary from 1 to 14 memory accesses, with 5 being the average value for the lengths that are most commonly used in IPv6. Module provide lockless route lookups for global unicast addresses and in-place incremental updates, allowing for good RIB performance. Implementation details: * wrapper code lives in `sys/contrib/dpdk_rte_lpm/dpdk_lpm[6].c`. * rte_lpm[6] implementation contains both RIB and FIB code. . RIB ("rule_") code, backed by array of hash tables part has been commented out, as base radix already provides all the necessary primitives. * link-local lookups are currently implemented as base radix lookup. This part should be converted to something like read-only radix trie. Usage detail: Compile kernel with option FIB_ALGO and load dpdk_lpm4/dpdk_lpm6 module at any time. They will be picked up automatically when amount of routes raises to several thousand. [1]: https://doc.dpdk.org/guides/prog_guide/lpm_lib.html [2]: http://yuba.stanford.edu/~nickm/papers/Infocom98_lookup.pdf [3]: https://doc.dpdk.org/guides/prog_guide/lpm6_lib.html Differential Revision: https://reviews.freebsd.org/D27412 --- sys/contrib/dpdk_rte_lpm/dpdk_lpm.c | 423 +++++++ sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c | 487 ++++++++ sys/contrib/dpdk_rte_lpm/dpdk_lpm6.h | 57 + sys/contrib/dpdk_rte_lpm/rte_branch_prediction.h | 41 + sys/contrib/dpdk_rte_lpm/rte_common.h | 838 +++++++++++++ sys/contrib/dpdk_rte_lpm/rte_debug.h | 83 ++ sys/contrib/dpdk_rte_lpm/rte_jhash.h | 379 ++++++ sys/contrib/dpdk_rte_lpm/rte_log.h | 383 ++++++ sys/contrib/dpdk_rte_lpm/rte_lpm.c | 1107 +++++++++++++++++ sys/contrib/dpdk_rte_lpm/rte_lpm.h | 403 ++++++ sys/contrib/dpdk_rte_lpm/rte_lpm6.c | 1415 ++++++++++++++++++++++ sys/contrib/dpdk_rte_lpm/rte_lpm6.h | 209 ++++ sys/contrib/dpdk_rte_lpm/rte_shim.h | 31 + sys/contrib/dpdk_rte_lpm/rte_tailq.h | 140 +++ sys/modules/Makefile | 10 + sys/modules/dpdk_lpm4/Makefile | 12 + sys/modules/dpdk_lpm6/Makefile | 12 + 17 files changed, 6030 insertions(+) diff --git a/sys/contrib/dpdk_rte_lpm/dpdk_lpm.c b/sys/contrib/dpdk_rte_lpm/dpdk_lpm.c new file mode 100644 index 000000000000..af145997c4d6 --- /dev/null +++ b/sys/contrib/dpdk_rte_lpm/dpdk_lpm.c @@ -0,0 +1,423 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Alexander V. Chernikov + * + * 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 +__FBSDID("$FreeBSD$"); +#include "opt_inet.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include "rte_shim.h" +#include "rte_lpm.h" + +#define LPM_MIN_TBL8 8 /* 2 pages of memory */ +#define LPM_MAX_TBL8 65536 * 16 /* 256M */ + +MALLOC_DECLARE(M_RTABLE); + +struct dpdk_lpm_data { + struct rte_lpm *lpm; + uint64_t routes_added; + uint64_t routes_failed; + uint32_t number_tbl8s; + uint32_t fibnum; + uint8_t hit_tables; + uint8_t hit_records; + struct fib_data *fd; +}; + +/* + * Main datapath routing + */ +static struct nhop_object * +lookup_ptr(void *algo_data, const struct flm_lookup_key key, uint32_t scopeid) +{ + struct rte_lpm *lpm; + const struct rte_lpm_external *rte_ext; + uint32_t nhidx = 0; + int ret; + + lpm = (struct rte_lpm *)algo_data; + rte_ext = (const struct rte_lpm_external *)lpm; + + ret = rte_lpm_lookup(lpm, ntohl(key.addr4.s_addr), &nhidx); + if (ret == 0) { + /* Success! */ + return (rte_ext->nh_idx[nhidx]); + } else { + /* Not found. Check default route */ + return (rte_ext->nh_idx[rte_ext->default_idx]); + } + + return (NULL); +} + +static uint8_t +rte_get_pref(const struct rib_rtable_info *rinfo) +{ + + if (rinfo->num_prefixes < 10) + return (1); + else if (rinfo->num_prefixes < 1000) + return (rinfo->num_prefixes / 10); + else if (rinfo->num_prefixes < 500000) + return (100 + rinfo->num_prefixes / 3334); + else + return (250); +} + +static enum flm_op_result +handle_default_change(struct dpdk_lpm_data *dd, struct rib_cmd_info *rc) +{ + struct rte_lpm_external *rte_ext; + rte_ext = (struct rte_lpm_external *)dd->lpm; + + if (rc->rc_cmd != RTM_DELETE) { + /* Reference new */ + uint32_t nhidx = fib_get_nhop_idx(dd->fd, rc->rc_nh_new); + + if (nhidx == 0) + return (FLM_REBUILD); + rte_ext->default_idx = nhidx; + } else { + /* No default route */ + rte_ext->default_idx = 0; + } + + return (FLM_SUCCESS); +} + +static void +get_parent_rule(struct dpdk_lpm_data *dd, struct in_addr addr, uint8_t *plen, uint32_t *nhop_idx) +{ + struct route_nhop_data rnd; + struct rtentry *rt; + + rt = fib4_lookup_rt(dd->fibnum, addr, 0, NHR_UNLOCKED, &rnd); + if (rt != NULL) { + struct in_addr addr4; + uint32_t scopeid; + int inet_plen; + rt_get_inet_prefix_plen(rt, &addr4, &inet_plen, &scopeid); + if (inet_plen > 0) { + *plen = inet_plen; + *nhop_idx = fib_get_nhop_idx(dd->fd, rnd.rnd_nhop); + return; + } + } + + *nhop_idx = 0; + *plen = 0; +} + +static enum flm_op_result +handle_gu_change(struct dpdk_lpm_data *dd, const struct rib_cmd_info *rc, + const struct in_addr addr, int plen) +{ + uint32_t nhidx = 0; + int ret; + char abuf[INET_ADDRSTRLEN]; + uint32_t ip; + + ip = ntohl(addr.s_addr); + inet_ntop(AF_INET, &addr, abuf, sizeof(abuf)); + + /* So we get sin, plen and nhidx */ + if (rc->rc_cmd != RTM_DELETE) { + /* + * Addition or change. Save nhop in the internal table + * and get index. + */ + nhidx = fib_get_nhop_idx(dd->fd, rc->rc_nh_new); + if (nhidx == 0) { + FIB_PRINTF(LOG_INFO, dd->fd, "nhop limit reached, need rebuild"); + return (FLM_REBUILD); + } + + ret = rte_lpm_add(dd->lpm, ip, plen, nhidx); + FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop %u = %d", + (rc->rc_cmd == RTM_ADD) ? "ADD" : "UPDATE", + abuf, plen, nhidx, ret); + } else { + /* + * Need to lookup parent. Assume deletion happened already + */ + uint8_t parent_plen; + uint32_t parent_nhop_idx; + get_parent_rule(dd, addr, &parent_plen, &parent_nhop_idx); + + ret = rte_lpm_delete(dd->lpm, ip, plen, parent_plen, parent_nhop_idx); + FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK: %s %s/%d nhop %u = %d", + "DEL", abuf, plen, nhidx, ret); + } + + if (ret != 0) { + FIB_PRINTF(LOG_INFO, dd->fd, "error: %d", ret); + if (ret == -ENOSPC) + return (FLM_REBUILD); + return (FLM_ERROR); + } + return (FLM_SUCCESS); +} + +static enum flm_op_result +handle_rtable_change_cb(struct rib_head *rnh, struct rib_cmd_info *rc, + void *_data) +{ + struct dpdk_lpm_data *dd; + enum flm_op_result ret; + struct in_addr addr4; + uint32_t scopeid; + int plen; + + dd = (struct dpdk_lpm_data *)_data; + rt_get_inet_prefix_plen(rc->rc_rt, &addr4, &plen, &scopeid); + + if (plen != 0) + ret = handle_gu_change(dd, rc, addr4, plen); + else + ret = handle_default_change(dd, rc); + + if (ret != 0) + FIB_PRINTF(LOG_INFO, dd->fd, "error handling route"); + return (ret); +} + +static void +destroy_table(void *_data) +{ + struct dpdk_lpm_data *dd = (struct dpdk_lpm_data *)_data; + + if (dd->lpm != NULL) + rte_lpm_free(dd->lpm); + free(dd, M_RTABLE); +} + +static enum flm_op_result +add_route_cb(struct rtentry *rt, void *_data) +{ + struct dpdk_lpm_data *dd = (struct dpdk_lpm_data *)_data; + struct nhop_object *nh; + int plen, ret; + struct in_addr addr4; + uint32_t scopeid; + + nh = rt_get_raw_nhop(rt); + rt_get_inet_prefix_plen(rt, &addr4, &plen, &scopeid); + + char abuf[INET_ADDRSTRLEN]; + inet_ntop(AF_INET, &addr4, abuf, sizeof(abuf)); + + FIB_PRINTF(LOG_DEBUG, dd->fd, "Operating on %s/%d", abuf, plen); + + if (plen == 0) { + struct rib_cmd_info rc = { + .rc_cmd = RTM_ADD, + .rc_nh_new = nh, + }; + + FIB_PRINTF(LOG_DEBUG, dd->fd, "Adding default route"); + return (handle_default_change(dd, &rc)); + } + + uint32_t nhidx = fib_get_nhop_idx(dd->fd, nh); + if (nhidx == 0) { + FIB_PRINTF(LOG_INFO, dd->fd, "unable to get nhop index"); + return (FLM_REBUILD); + } + ret = rte_lpm_add(dd->lpm, ntohl(addr4.s_addr), plen, nhidx); + FIB_PRINTF(LOG_DEBUG, dd->fd, "ADD %p %s/%d nh %u = %d", + dd->lpm, abuf, plen, nhidx, ret); + + if (ret != 0) { + FIB_PRINTF(LOG_INFO, dd->fd, "rte_lpm_add() returned %d", ret); + if (ret == -ENOSPC) { + dd->hit_tables = 1; + return (FLM_REBUILD); + } + dd->routes_failed++; + return (FLM_ERROR); + } else + dd->routes_added++; + + return (FLM_SUCCESS); +} + +static enum flm_op_result +check_dump_success(void *_data, struct fib_dp *dp) +{ + struct dpdk_lpm_data *dd; + + dd = (struct dpdk_lpm_data *)_data; + + FIB_PRINTF(LOG_INFO, dd->fd, "scan completed. added: %zu failed: %zu", + dd->routes_added, dd->routes_failed); + if (dd->hit_tables || dd->routes_failed > 0) + return (FLM_REBUILD); + + FIB_PRINTF(LOG_INFO, dd->fd, + "DPDK lookup engine synced with IPv4 RIB id %u, %zu routes", + dd->fibnum, dd->routes_added); + + dp->f = lookup_ptr; + dp->arg = dd->lpm; + + return (FLM_SUCCESS); +} + +static void +estimate_scale(const struct dpdk_lpm_data *dd_src, struct dpdk_lpm_data *dd) +{ + + /* XXX: update at 75% capacity */ + if (dd_src->hit_tables) + dd->number_tbl8s = dd_src->number_tbl8s * 2; + else + dd->number_tbl8s = dd_src->number_tbl8s; + + /* TODO: look into the appropriate RIB to adjust */ +} + +static struct dpdk_lpm_data * +build_table(struct dpdk_lpm_data *dd_prev, struct fib_data *fd) +{ + struct dpdk_lpm_data *dd; + struct rte_lpm *lpm; + + dd = malloc(sizeof(struct dpdk_lpm_data), M_RTABLE, M_NOWAIT | M_ZERO); + if (dd == NULL) { + FIB_PRINTF(LOG_INFO, fd, "Unable to allocate base datastructure"); + return (NULL); + } + dd->fibnum = dd_prev->fibnum; + dd->fd = fd; + + estimate_scale(dd_prev, dd); + + struct rte_lpm_config cfg = {.number_tbl8s = dd->number_tbl8s}; + lpm = rte_lpm_create("test", 0, &cfg); + if (lpm == NULL) { + FIB_PRINTF(LOG_INFO, fd, "unable to create lpm"); + free(dd, M_RTABLE); + return (NULL); + } + dd->lpm = lpm; + struct rte_lpm_external *ext = (struct rte_lpm_external *)lpm; + ext->nh_idx = fib_get_nhop_array(dd->fd); + + FIB_PRINTF(LOG_INFO, fd, "allocated %u tbl8s", dd->number_tbl8s); + + return (dd); +} + +static enum flm_op_result +init_table(uint32_t fibnum, struct fib_data *fd, void *_old_data, void **data) +{ + struct dpdk_lpm_data *dd, dd_base; + + if (_old_data == NULL) { + bzero(&dd_base, sizeof(struct dpdk_lpm_data)); + dd_base.fibnum = fibnum; + /* TODO: get rib statistics */ + dd_base.number_tbl8s = LPM_MIN_TBL8; + dd = &dd_base; + } else { + FIB_PRINTF(LOG_DEBUG, fd, "Starting with old data"); + dd = (struct dpdk_lpm_data *)_old_data; + } + + /* Guaranteed to be in epoch */ + dd = build_table(dd, fd); + if (dd == NULL) { + FIB_PRINTF(LOG_NOTICE, fd, "table creation failed"); + return (FLM_REBUILD); + } + + *data = dd; + return (FLM_SUCCESS); +} + +static struct fib_lookup_module dpdk_lpm4 = { + .flm_name = "dpdk_lpm4", + .flm_family = AF_INET, + .flm_init_cb = init_table, + .flm_destroy_cb = destroy_table, + .flm_dump_rib_item_cb = add_route_cb, + .flm_dump_end_cb = check_dump_success, + .flm_change_rib_item_cb = handle_rtable_change_cb, + .flm_get_pref = rte_get_pref, +}; + +static int +lpm4_modevent(module_t mod, int type, void *unused) +{ + int error = 0; + + switch (type) { + case MOD_LOAD: + fib_module_register(&dpdk_lpm4); + break; + case MOD_UNLOAD: + error = fib_module_unregister(&dpdk_lpm4); + break; + default: + error = EOPNOTSUPP; + break; + } + return (error); +} + +static moduledata_t lpm4mod = { + "dpdk_lpm4", + lpm4_modevent, + 0 +}; + +DECLARE_MODULE(lpm4mod, lpm4mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +MODULE_VERSION(lpm4mod, 1); diff --git a/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c b/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c new file mode 100644 index 000000000000..250e3e1bde4a --- /dev/null +++ b/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c @@ -0,0 +1,487 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Alexander V. Chernikov + * + * 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 +__FBSDID("$FreeBSD$"); +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#define RTDEBUG + +#include "rte_lpm6.h" + +#define LPM6_MIN_TBL8 8 /* 2 pages of memory */ +#define LPM6_MAX_TBL8 65536 * 16 /* 256M */ + +struct fib_algo_calldata { + void *lookup; + void *arg; +}; + +struct dpdk_lpm6_data { + struct rte_lpm6 *lpm6; + uint64_t routes_added; + uint64_t routes_failed; + uint32_t number_tbl8s; + uint32_t fibnum; + uint8_t hit_tables; + struct fib_data *fd; +}; + +static struct nhop_object * +lookup_ptr_ll(const struct rte_lpm6 *lpm6, const struct in6_addr *dst6, + uint32_t scopeid) +{ + const struct rte_lpm6_external *rte_ext; + + rte_ext = (const struct rte_lpm6_external *)lpm6; + + return (fib6_radix_lookup_nh(rte_ext->fibnum, dst6, scopeid)); +} + +/* + * Main datapath routing + */ +static struct nhop_object * +lookup_ptr(void *algo_data, const struct flm_lookup_key key, uint32_t scopeid) +{ + const struct rte_lpm6 *lpm6; + const struct rte_lpm6_external *rte_ext; + const struct in6_addr *addr6; + uint32_t nhidx = 0; + int ret; + + lpm6 = (const struct rte_lpm6 *)algo_data; + addr6 = key.addr6; + rte_ext = (const struct rte_lpm6_external *)lpm6; + + if (!IN6_IS_SCOPE_LINKLOCAL(addr6)) { + ret = rte_lpm6_lookup(lpm6, (const uint8_t *)addr6, &nhidx); + if (ret == 0) { + /* Success! */ + return (rte_ext->nh_idx[nhidx]); + } else { + /* Not found. Check default route */ + if (rte_ext->default_idx > 0) + return (rte_ext->nh_idx[rte_ext->default_idx]); + else + return (NULL); + } + } else { + /* LL */ + return (lookup_ptr_ll(lpm6, addr6, scopeid)); + } +} + +static uint8_t +rte6_get_pref(const struct rib_rtable_info *rinfo) +{ + + if (rinfo->num_prefixes < 10) + return (1); + else if (rinfo->num_prefixes < 1000) + return (rinfo->num_prefixes / 10); + else if (rinfo->num_prefixes < 500000) + return (100 + rinfo->num_prefixes / 3334); + else + return (250); +} + +static enum flm_op_result +handle_default_change(struct dpdk_lpm6_data *dd, struct rib_cmd_info *rc) +{ + struct rte_lpm6_external *rte_ext; + rte_ext = (struct rte_lpm6_external *)dd->lpm6; + + if (rc->rc_cmd != RTM_DELETE) { + /* Reference new */ + uint32_t nhidx = fib_get_nhop_idx(dd->fd, rc->rc_nh_new); + + if (nhidx == 0) + return (FLM_REBUILD); + rte_ext->default_idx = nhidx; + } else { + /* No default route */ + rte_ext->default_idx = 0; + } + + return (FLM_SUCCESS); +} + +static enum flm_op_result +handle_ll_change(struct dpdk_lpm6_data *dd, struct rib_cmd_info *rc, + const struct in6_addr addr6, int plen, uint32_t scopeid) +{ + + return (FLM_SUCCESS); +} + +static struct rte_lpm6_rule * +pack_parent_rule(struct dpdk_lpm6_data *dd, const struct in6_addr *addr6, + char *buffer) +{ + struct rte_lpm6_rule *lsp_rule = NULL; + struct route_nhop_data rnd; + struct rtentry *rt; + int plen; + + rt = fib6_lookup_rt(dd->fibnum, addr6, 0, NHR_UNLOCKED, &rnd); + /* plen = 0 means default route and it's out of scope */ + if (rt != NULL) { + uint32_t scopeid; + struct in6_addr new_addr6; + rt_get_inet6_prefix_plen(rt, &new_addr6, &plen, &scopeid); + if (plen > 0) { + uint32_t nhidx = fib_get_nhop_idx(dd->fd, rnd.rnd_nhop); + if (nhidx == 0) { + /* + * shouldn't happen as we already have parent route. + * It will trigger rebuild automatically. + */ + return (NULL); + } + lsp_rule = fill_rule6(buffer, (uint8_t *)&new_addr6, plen, nhidx); + } + } + + return (lsp_rule); +} + +static enum flm_op_result +handle_gu_change(struct dpdk_lpm6_data *dd, const struct rib_cmd_info *rc, + const struct in6_addr *addr6, int plen) +{ + int ret; + char abuf[INET6_ADDRSTRLEN]; + inet_ntop(AF_INET6, addr6, abuf, sizeof(abuf)); + + /* So we get sin6, plen and nhidx */ + if (rc->rc_cmd != RTM_DELETE) { + /* + * Addition or change. Save nhop in the internal table + * and get index. + */ + uint32_t nhidx = fib_get_nhop_idx(dd->fd, rc->rc_nh_new); + if (nhidx == 0) { + FIB_PRINTF(LOG_INFO, dd->fd, "nhop limit reached, need rebuild"); + return (FLM_REBUILD); + } + + ret = rte_lpm6_add(dd->lpm6, (const uint8_t *)addr6, + plen, nhidx, (rc->rc_cmd == RTM_ADD) ? 1 : 0); + FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop %u = %d", + (rc->rc_cmd == RTM_ADD) ? "ADD" : "UPDATE", + abuf, plen, nhidx, ret); + } else { + /* + * Need to lookup parent. Assume deletion happened already + */ + char buffer[RTE_LPM6_RULE_SIZE]; + struct rte_lpm6_rule *lsp_rule = NULL; + lsp_rule = pack_parent_rule(dd, addr6, buffer); + + ret = rte_lpm6_delete(dd->lpm6, (const uint8_t *)addr6, plen, lsp_rule); + FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop ? = %d", + "DEL", abuf, plen, ret); + } + + if (ret != 0) { + FIB_PRINTF(LOG_INFO, dd->fd, "error: %d", ret); + if (ret == -ENOSPC) + return (FLM_REBUILD); + return (FLM_ERROR); + } + return (FLM_SUCCESS); +} + +static enum flm_op_result +handle_any_change(struct dpdk_lpm6_data *dd, struct rib_cmd_info *rc) +{ + enum flm_op_result ret; + struct in6_addr addr6; + uint32_t scopeid; + int plen; + + rt_get_inet6_prefix_plen(rc->rc_rt, &addr6, &plen, &scopeid); + + if (IN6_IS_SCOPE_LINKLOCAL(&addr6)) + ret = handle_ll_change(dd, rc, addr6, plen, scopeid); + else if (plen == 0) + ret = handle_default_change(dd, rc); + else + ret = handle_gu_change(dd, rc, &addr6, plen); + + if (ret != 0) + FIB_PRINTF(LOG_INFO, dd->fd, "error handling route"); + return (ret); +} + +static enum flm_op_result +handle_rtable_change_cb(struct rib_head *rnh, struct rib_cmd_info *rc, + void *_data) +{ + struct dpdk_lpm6_data *dd; + + dd = (struct dpdk_lpm6_data *)_data; + + return (handle_any_change(dd, rc)); +} + +static void +destroy_dd(struct dpdk_lpm6_data *dd) +{ + + FIB_PRINTF(LOG_INFO, dd->fd, "destroy dd %p", dd); + if (dd->lpm6 != NULL) + rte_lpm6_free(dd->lpm6); + free(dd, M_TEMP); +} + +static void +destroy_table(void *_data) +{ + + destroy_dd((struct dpdk_lpm6_data *)_data); +} + +static enum flm_op_result +add_route_cb(struct rtentry *rt, void *_data) +{ + struct dpdk_lpm6_data *dd = (struct dpdk_lpm6_data *)_data; + struct in6_addr addr6; + struct nhop_object *nh; + uint32_t scopeid; + int plen; + int ret; + + rt_get_inet6_prefix_plen(rt, &addr6, &plen, &scopeid); + nh = rt_get_raw_nhop(rt); + + if (IN6_IS_SCOPE_LINKLOCAL(&addr6)) { + + /* + * We don't operate on LL directly, however + * reference them to maintain guarantee on + * ability to refcount nhops in epoch. + */ + fib_get_nhop_idx(dd->fd, nh); + return (FLM_SUCCESS); + } + + char abuf[INET6_ADDRSTRLEN]; + inet_ntop(AF_INET6, &addr6, abuf, sizeof(abuf)); + FIB_PRINTF(LOG_DEBUG, dd->fd, "Operating on %s/%d", abuf, plen); + + if (plen == 0) { + struct rib_cmd_info rc = { + .rc_cmd = RTM_ADD, + .rc_nh_new = nh, + }; + + FIB_PRINTF(LOG_DEBUG, dd->fd, "Adding default route"); + return (handle_default_change(dd, &rc)); + } + + uint32_t nhidx = fib_get_nhop_idx(dd->fd, nh); + if (nhidx == 0) { + FIB_PRINTF(LOG_INFO, dd->fd, "unable to get nhop index"); + return (FLM_REBUILD); + } + ret = rte_lpm6_add(dd->lpm6, (const uint8_t *)&addr6, plen, nhidx, 1); + FIB_PRINTF(LOG_DEBUG, dd->fd, "ADD %p %s/%d nh %u = %d", + dd->lpm6, abuf, plen, nhidx, ret); + + if (ret != 0) { + FIB_PRINTF(LOG_INFO, dd->fd, "rte_lpm6_add() returned %d", ret); + if (ret == -ENOSPC) { + dd->hit_tables = 1; + return (FLM_REBUILD); + } + dd->routes_failed++; + return (FLM_ERROR); + } else + dd->routes_added++; + + return (FLM_SUCCESS); +} + +static enum flm_op_result +check_dump_success(void *_data, struct fib_dp *dp) +{ + struct dpdk_lpm6_data *dd; + + dd = (struct dpdk_lpm6_data *)_data; + + FIB_PRINTF(LOG_INFO, dd->fd, "scan completed. added: %zu failed: %zu", + dd->routes_added, dd->routes_failed); + if (dd->hit_tables || dd->routes_failed > 0) + return (FLM_REBUILD); + + FIB_PRINTF(LOG_INFO, dd->fd, + "DPDK lookup engine synced with IPv6 RIB id %u, %zu routes", + dd->fibnum, dd->routes_added); + + dp->f = lookup_ptr; + dp->arg = dd->lpm6; + + return (FLM_SUCCESS); +} + +static void +estimate_scale(const struct dpdk_lpm6_data *dd_src, struct dpdk_lpm6_data *dd) +{ + + /* XXX: update at 75% capacity */ + if (dd_src->hit_tables) + dd->number_tbl8s = dd_src->number_tbl8s * 2; + else + dd->number_tbl8s = dd_src->number_tbl8s; + + /* TODO: look into the appropriate RIB to adjust */ +} + +static struct dpdk_lpm6_data * +build_table(struct dpdk_lpm6_data *dd_prev, struct fib_data *fd) +{ + struct dpdk_lpm6_data *dd; + struct rte_lpm6 *lpm6; + + dd = malloc(sizeof(struct dpdk_lpm6_data), M_TEMP, M_NOWAIT | M_ZERO); + if (dd == NULL) { + FIB_PRINTF(LOG_INFO, fd, "Unable to allocate base datastructure"); + return (NULL); + } + dd->fibnum = dd_prev->fibnum; + dd->fd = fd; + + estimate_scale(dd_prev, dd); + + struct rte_lpm6_config cfg = {.number_tbl8s = dd->number_tbl8s}; + lpm6 = rte_lpm6_create("test", 0, &cfg); + if (lpm6 == NULL) { + FIB_PRINTF(LOG_INFO, fd, "unable to create lpm6"); + free(dd, M_TEMP); + return (NULL); + } + dd->lpm6 = lpm6; + struct rte_lpm6_external *ext = (struct rte_lpm6_external *)lpm6; + ext->nh_idx = fib_get_nhop_array(dd->fd); + + FIB_PRINTF(LOG_INFO, fd, "allocated %u tbl8s", dd->number_tbl8s); + + return (dd); +} + +static enum flm_op_result +init_table(uint32_t fibnum, struct fib_data *fd, void *_old_data, void **data) +{ + struct dpdk_lpm6_data *dd, dd_base; + + if (_old_data == NULL) { + bzero(&dd_base, sizeof(struct dpdk_lpm6_data)); + dd_base.fibnum = fibnum; + /* TODO: get rib statistics */ + dd_base.number_tbl8s = LPM6_MIN_TBL8; + dd = &dd_base; + } else { + FIB_PRINTF(LOG_INFO, fd, "Starting with old data"); + dd = (struct dpdk_lpm6_data *)_old_data; + } + + /* Guaranteed to be in epoch */ + dd = build_table(dd, fd); + if (dd == NULL) { + FIB_PRINTF(LOG_INFO, fd, "table creation failed"); + return (FLM_REBUILD); + } + + *data = dd; + return (FLM_SUCCESS); +} + +static struct fib_lookup_module dpdk_lpm6 = { + .flm_name = "dpdk_lpm6", + .flm_family = AF_INET6, + .flm_init_cb = init_table, + .flm_destroy_cb = destroy_table, + .flm_dump_rib_item_cb = add_route_cb, + .flm_dump_end_cb = check_dump_success, + .flm_change_rib_item_cb = handle_rtable_change_cb, + .flm_get_pref = rte6_get_pref, +}; + +static int +lpm6_modevent(module_t mod, int type, void *unused) +{ + int error = 0; + + switch (type) { + case MOD_LOAD: + fib_module_register(&dpdk_lpm6); + break; + case MOD_UNLOAD: + error = fib_module_unregister(&dpdk_lpm6); + break; + default: + error = EOPNOTSUPP; + break; + } + return (error); +} + +static moduledata_t lpm6mod = { + "dpdk_lpm6", + lpm6_modevent, + 0 +}; + *** 5224 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Jan 9 13:20:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 41BE74D4469; Sat, 9 Jan 2021 13:20:54 +0000 (UTC) (envelope-from git@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 4DCgZt1NsHz3DLm; Sat, 9 Jan 2021 13:20:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22A161647C; Sat, 9 Jan 2021 13:20:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109DKsJr016796; Sat, 9 Jan 2021 13:20:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109DKsMg016795; Sat, 9 Jan 2021 13:20:54 GMT (envelope-from git) Date: Sat, 9 Jan 2021 13:20:54 GMT Message-Id: <202101091320.109DKsMg016795@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 0433870efefc - main - Add fib lookup testing module. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0433870efefc7875eb3cc4b2896cfc74dffb0eeb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 13:20:54 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=0433870efefc7875eb3cc4b2896cfc74dffb0eeb commit 0433870efefc7875eb3cc4b2896cfc74dffb0eeb Author: Alexander V. Chernikov AuthorDate: 2021-01-09 12:55:04 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-01-09 13:20:30 +0000 Add fib lookup testing module. This module intended to measure performance of routing lookups. Uses a list of IP addresses specified by sysctl one-by-one. Performance testing is triggered by changing sysctl OID with a number of lookups to execute. Lookups are done by the chunks of 10K routes, entering/exiting epoch on chunk granularity to amortise cost. Example: make -C sys/modules/test/fib_lookup unload load for i in `cat ~/ip4.txt`; do sysctl net.route.test.add_inet_addr=$i; done for i in `cat ~/ip6.txt`; do sysctl net.route.test.add_inet6_addr=$i; done sysctl net.route.test.run_inet=10000000 dmesg | tail Dec 13 23:24:05 current kernel: 10000000 packets in 417240173 nanoseconds, 23967011 pps Dec 13 23:24:06 current kernel: run: 10000000 packets vnet 0xfffff80003073f00 Dec 13 23:24:07 current kernel: 10000000 packets in 423086254 nanoseconds, 23635842 pps Differential Revision: https://reviews.freebsd.org/D27604 --- sys/modules/tests/fib_lookup/Makefile | 11 + sys/tests/fib_lookup/fib_lookup.c | 537 ++++++++++++++++++++++++++++++++++ 2 files changed, 548 insertions(+) diff --git a/sys/modules/tests/fib_lookup/Makefile b/sys/modules/tests/fib_lookup/Makefile new file mode 100644 index 000000000000..06404ff928e6 --- /dev/null +++ b/sys/modules/tests/fib_lookup/Makefile @@ -0,0 +1,11 @@ +# $FreeBSD$ + +SYSDIR?=${SRCTOP}/sys +.include "${SYSDIR}/conf/kern.opts.mk" + +.PATH: ${SYSDIR}/tests/fib_lookup + +KMOD= test_lookup +SRCS= opt_inet.h opt_inet6.h fib_lookup.c + +.include diff --git a/sys/tests/fib_lookup/fib_lookup.c b/sys/tests/fib_lookup/fib_lookup.c new file mode 100644 index 000000000000..b48fdfb5630e --- /dev/null +++ b/sys/tests/fib_lookup/fib_lookup.c @@ -0,0 +1,537 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Alexander V. Chernikov + * + * 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 +__FBSDID("$FreeBSD$"); +#include "opt_inet.h" +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#define CHUNK_SIZE 10000 + +VNET_DEFINE_STATIC(struct in_addr *, inet_addr_list); +#define V_inet_addr_list VNET(inet_addr_list) +VNET_DEFINE_STATIC(int, inet_list_size); +#define V_inet_list_size VNET(inet_list_size) + +VNET_DEFINE_STATIC(struct in6_addr *, inet6_addr_list); +#define V_inet6_addr_list VNET(inet6_addr_list) +VNET_DEFINE_STATIC(int, inet6_list_size); +#define V_inet6_list_size VNET(inet6_list_size) + +SYSCTL_DECL(_net_route); +SYSCTL_NODE(_net_route, OID_AUTO, test, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "Route algorithm lookups"); + +static int +add_addr(int family, char *addr_str) +{ + + if (family == AF_INET) { + struct in_addr *paddr_old = V_inet_addr_list; + int size_old = V_inet_list_size; + struct in_addr addr; + + if (inet_pton(AF_INET, addr_str, &addr) != 1) + return (EINVAL); + + struct in_addr *paddr = mallocarray(size_old + 1, + sizeof(struct in_addr), M_TEMP, M_ZERO | M_WAITOK); + + if (paddr_old != NULL) { + memcpy(paddr, paddr_old, size_old * sizeof(struct in_addr)); + free(paddr_old, M_TEMP); + } + paddr[size_old] = addr; + + V_inet_addr_list = paddr; + V_inet_list_size = size_old + 1; + inet_ntop(AF_INET, &addr, addr_str, sizeof(addr_str)); + } else if (family == AF_INET6) { + struct in6_addr *paddr_old = V_inet6_addr_list; + int size_old = V_inet6_list_size; + struct in6_addr addr6; + + if (inet_pton(AF_INET6, addr_str, &addr6) != 1) + return (EINVAL); + + struct in6_addr *paddr = mallocarray(size_old + 1, + sizeof(struct in6_addr), M_TEMP, M_ZERO | M_WAITOK); + + if (paddr_old != NULL) { + memcpy(paddr, paddr_old, size_old * sizeof(struct in6_addr)); + free(paddr_old, M_TEMP); + } + paddr[size_old] = addr6; + + V_inet6_addr_list = paddr; + V_inet6_list_size = size_old + 1; + inet_ntop(AF_INET6, &addr6, addr_str, sizeof(addr_str)); + } + + return (0); +} + +static int +add_addr_sysctl_handler(struct sysctl_oid *oidp, struct sysctl_req *req, int family) +{ + char addr_str[INET6_ADDRSTRLEN]; + int error; + + bzero(addr_str, sizeof(addr_str)); + + error = sysctl_handle_string(oidp, addr_str, sizeof(addr_str), req); + if (error != 0 || req->newptr == NULL) + return (error); + + error = add_addr(family, addr_str); + + return (0); +} + +static int +add_inet_addr_sysctl_handler(SYSCTL_HANDLER_ARGS) +{ + + return (add_addr_sysctl_handler(oidp, req, AF_INET)); +} +SYSCTL_PROC(_net_route_test, OID_AUTO, add_inet_addr, + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0, + add_inet_addr_sysctl_handler, "A", "Set"); + +static int +add_inet6_addr_sysctl_handler(SYSCTL_HANDLER_ARGS) +{ + + return (add_addr_sysctl_handler(oidp, req, AF_INET6)); +} +SYSCTL_PROC(_net_route_test, OID_AUTO, add_inet6_addr, + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 0, + add_inet6_addr_sysctl_handler, "A", "Set"); + +static uint64_t +run_test_inet_one_pass() +{ + /* Assume epoch */ + int sz = V_inet_list_size; + int tries = CHUNK_SIZE / sz; + const struct in_addr *a = V_inet_addr_list; + uint64_t count = 0; + + for (int pass = 0; pass < tries; pass++) { + for (int i = 0; i < sz; i++) { + fib4_lookup(RT_DEFAULT_FIB, a[i], 0, NHR_NONE, 0); + count++; + } + } + return (count); +} + +static int +run_test_inet(SYSCTL_HANDLER_ARGS) +{ + struct epoch_tracker et; + + int count = 0; + int error = sysctl_handle_int(oidp, &count, 0, req); + if (error != 0) + return (error); + + if (count == 0) + return (0); + + if (V_inet_list_size <= 0) + return (ENOENT); + + printf("run: %d packets vnet %p\n", count, curvnet); + if (count < CHUNK_SIZE) + count = CHUNK_SIZE; + + struct timespec ts_pre, ts_post; + int64_t pass_diff, total_diff = 0; + uint64_t pass_packets, total_packets = 0; + + for (int pass = 0; pass < count / CHUNK_SIZE; pass++) { + NET_EPOCH_ENTER(et); + nanouptime(&ts_pre); + pass_packets = run_test_inet_one_pass(); + nanouptime(&ts_post); + NET_EPOCH_EXIT(et); + + pass_diff = (ts_post.tv_sec - ts_pre.tv_sec) * 1000000000 + + (ts_post.tv_nsec - ts_pre.tv_nsec); + total_diff += pass_diff; + total_packets += pass_packets; + } + + printf("%zu packets in %zu nanoseconds, %zu pps\n", + total_packets, total_diff, total_packets * 1000000000 / total_diff); + + return (0); +} +SYSCTL_PROC(_net_route_test, OID_AUTO, run_inet, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + 0, 0, run_test_inet, "I", "Execute fib4_lookup test"); + +static uint64_t +run_test_inet6_one_pass() +{ + /* Assume epoch */ + int sz = V_inet6_list_size; + int tries = CHUNK_SIZE / sz; + const struct in6_addr *a = V_inet6_addr_list; + uint64_t count = 0; + + for (int pass = 0; pass < tries; pass++) { + for (int i = 0; i < sz; i++) { + fib6_lookup(RT_DEFAULT_FIB, &a[i], 0, NHR_NONE, 0); + count++; + } + } + return (count); +} + +static int +run_test_inet6(SYSCTL_HANDLER_ARGS) +{ + struct epoch_tracker et; + + int count = 0; + int error = sysctl_handle_int(oidp, &count, 0, req); + if (error != 0) + return (error); + + if (count == 0) + return (0); + + if (V_inet6_list_size <= 0) + return (ENOENT); + + printf("run: %d packets vnet %p\n", count, curvnet); + if (count < CHUNK_SIZE) + count = CHUNK_SIZE; + + struct timespec ts_pre, ts_post; + int64_t pass_diff, total_diff = 0; + uint64_t pass_packets, total_packets = 0; + + for (int pass = 0; pass < count / CHUNK_SIZE; pass++) { + NET_EPOCH_ENTER(et); + nanouptime(&ts_pre); + pass_packets = run_test_inet6_one_pass(); + nanouptime(&ts_post); + NET_EPOCH_EXIT(et); + + pass_diff = (ts_post.tv_sec - ts_pre.tv_sec) * 1000000000 + + (ts_post.tv_nsec - ts_pre.tv_nsec); + total_diff += pass_diff; + total_packets += pass_packets; + } + + printf("%zu packets in %zu nanoseconds, %zu pps\n", + total_packets, total_diff, total_packets * 1000000000 / total_diff); + + return (0); +} +SYSCTL_PROC(_net_route_test, OID_AUTO, run_inet6, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + 0, 0, run_test_inet6, "I", "Execute fib6_lookup test"); + +static bool +cmp_dst(uint32_t fibnum, struct in_addr a) +{ + struct nhop_object *nh_fib; + struct rtentry *rt; + struct route_nhop_data rnd = {}; + + nh_fib = fib4_lookup(fibnum, a, 0, NHR_NONE, 0); + rt = fib4_lookup_rt(fibnum, a, 0, NHR_NONE, &rnd); + + if (nh_fib == NULL && rt == NULL) { + return (true); + } else if (nh_fib == nhop_select(rnd.rnd_nhop, 0)) { + return (true); + } + + struct in_addr dst; + int plen; + uint32_t scopeid; + char key_str[INET_ADDRSTRLEN], dst_str[INET_ADDRSTRLEN]; + + inet_ntop(AF_INET, &a, key_str, sizeof(key_str)); + if (rnd.rnd_nhop == NULL) { + printf("[RT BUG] lookup for %s: RIB: ENOENT FIB: nh=%u\n", + key_str, nhop_get_idx(nh_fib)); + } else { + rt_get_inet_prefix_plen(rt, &dst, &plen, &scopeid); + inet_ntop(AF_INET, &dst, dst_str, sizeof(dst_str)); + printf("[RT BUG] lookup for %s: RIB: %s/%d,nh=%u FIB: nh=%u\n", + key_str, dst_str, plen, + nhop_get_idx(nhop_select(rnd.rnd_nhop, 0)), + nhop_get_idx(nh_fib)); + } + + return (false); +} + +/* Random lookups: correctness verification */ +static uint64_t +run_test_inet_one_pass_random() +{ + /* Assume epoch */ + struct in_addr a[64]; + int sz = 64; + uint64_t count = 0; + + for (int pass = 0; pass < CHUNK_SIZE / sz; pass++) { + arc4random_buf(a, sizeof(a)); + for (int i = 0; i < sz; i++) { + if (!cmp_dst(RT_DEFAULT_FIB, a[i])) + return (0); + count++; + } + } + return (count); +} + +static int +run_test_inet_random(SYSCTL_HANDLER_ARGS) +{ + struct epoch_tracker et; + + int count = 0; + int error = sysctl_handle_int(oidp, &count, 0, req); + if (error != 0) + return (error); + + if (count == 0) + return (0); + + if (count < CHUNK_SIZE) + count = CHUNK_SIZE; + + struct timespec ts_pre, ts_post; + int64_t pass_diff, total_diff = 1; + uint64_t pass_packets, total_packets = 0; + + for (int pass = 0; pass < count / CHUNK_SIZE; pass++) { + NET_EPOCH_ENTER(et); + nanouptime(&ts_pre); + pass_packets = run_test_inet_one_pass_random(); + nanouptime(&ts_post); + NET_EPOCH_EXIT(et); + + pass_diff = (ts_post.tv_sec - ts_pre.tv_sec) * 1000000000 + + (ts_post.tv_nsec - ts_pre.tv_nsec); + total_diff += pass_diff; + total_packets += pass_packets; + + if (pass_packets == 0) + break; + } + + /* Signal error to userland */ + if (pass_packets == 0) + return (EINVAL); + + printf("%zu packets in %zu nanoseconds, %zu pps\n", + total_packets, total_diff, total_packets * 1000000000 / total_diff); + + return (0); +} +SYSCTL_PROC(_net_route_test, OID_AUTO, run_inet_random, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + 0, 0, run_test_inet_random, "I", "Execute fib4_lookup random check tests"); + + +struct inet_array { + uint32_t alloc_items; + uint32_t num_items; + struct in_addr *arr; + int error; +}; + +/* + * For each prefix, add the following records to the lookup array: + * * prefix-1, prefix, prefix + 1, prefix_end, prefix_end + 1 + */ +static int +add_prefix(struct rtentry *rt, void *_data) +{ + struct inet_array *pa = (struct inet_array *)_data; + struct in_addr addr; + int plen; + uint32_t scopeid, haddr; + + if (pa->num_items + 5 >= pa->alloc_items) { + if (pa->error == 0) + pa->error = EINVAL; + return (0); + } + + rt_get_inet_prefix_plen(rt, &addr, &plen, &scopeid); + + pa->arr[pa->num_items++] = addr; + haddr = ntohl(addr.s_addr); + if (haddr > 0) { + pa->arr[pa->num_items++].s_addr = htonl(haddr - 1); + pa->arr[pa->num_items++].s_addr = htonl(haddr + 1); + /* assume mask != 0 */ + uint32_t mlen = (1 << (32 - plen)) - 1; + pa->arr[pa->num_items++].s_addr = htonl(haddr + mlen); + /* can overflow, but who cares */ + pa->arr[pa->num_items++].s_addr = htonl(haddr + mlen + 1); + } + + return (0); +} + +static bool +prepare_list(uint32_t fibnum, struct inet_array *pa) +{ + struct rib_head *rh; + + rh = rt_tables_get_rnh(fibnum, AF_INET); + + uint32_t num_prefixes = (rh->rnh_prefixes + 10) * 5; + bzero(pa, sizeof(struct inet_array)); + pa->alloc_items = num_prefixes; + pa->arr = mallocarray(num_prefixes, sizeof(struct in_addr), + M_TEMP, M_ZERO | M_WAITOK); + + rib_walk(RT_DEFAULT_FIB, AF_INET, false, add_prefix, pa); + + return (pa->error == 0); +} + +static int +run_test_inet_scan(SYSCTL_HANDLER_ARGS) +{ + struct epoch_tracker et; + + int count = 0; + int error = sysctl_handle_int(oidp, &count, 0, req); + if (error != 0) + return (error); + + if (count == 0) + return (0); + + struct inet_array pa = {}; + + if (!prepare_list(RT_DEFAULT_FIB, &pa)) + return (pa.error); + + struct timespec ts_pre, ts_post; + int64_t total_diff = 1; + uint64_t total_packets = 0; + + NET_EPOCH_ENTER(et); + nanouptime(&ts_pre); + for (int i = 0; i < pa.num_items; i++) { + if (!cmp_dst(RT_DEFAULT_FIB, pa.arr[i])) { + error = EINVAL; + break; + } + total_packets++; + } + nanouptime(&ts_post); + NET_EPOCH_EXIT(et); + + if (pa.arr != NULL) + free(pa.arr, M_TEMP); + + /* Signal error to userland */ + if (error != 0) + return (error); + + total_diff = (ts_post.tv_sec - ts_pre.tv_sec) * 1000000000 + + (ts_post.tv_nsec - ts_pre.tv_nsec); + printf("%zu packets in %zu nanoseconds, %zu pps\n", + total_packets, total_diff, total_packets * 1000000000 / total_diff); + + return (0); +} +SYSCTL_PROC(_net_route_test, OID_AUTO, run_inet_scan, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + 0, 0, run_test_inet_scan, "I", "Execute fib4_lookup scan tests"); + + +static int +test_fib_lookup_modevent(module_t mod, int type, void *unused) +{ + int error = 0; + + switch (type) { + case MOD_LOAD: + break; + case MOD_UNLOAD: + if (V_inet_addr_list != NULL) + free(V_inet_addr_list, M_TEMP); + if (V_inet6_addr_list != NULL) + free(V_inet6_addr_list, M_TEMP); + break; + default: + error = EOPNOTSUPP; + break; + } + return (error); +} + +static moduledata_t testfiblookupmod = { + "test_fib_lookup", + test_fib_lookup_modevent, + 0 +}; + +DECLARE_MODULE(testfiblookupmod, testfiblookupmod, SI_SUB_PSEUDO, SI_ORDER_ANY); +MODULE_VERSION(testfiblookup, 1); From owner-dev-commits-src-all@freebsd.org Sat Jan 9 15:07:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 75BE24D79FD; Sat, 9 Jan 2021 15:07:41 +0000 (UTC) (envelope-from git@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 4DCjy52yj5z3LRG; Sat, 9 Jan 2021 15:07:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58DA017D9C; Sat, 9 Jan 2021 15:07:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109F7fqE051707; Sat, 9 Jan 2021 15:07:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109F7fnO051706; Sat, 9 Jan 2021 15:07:41 GMT (envelope-from git) Date: Sat, 9 Jan 2021 15:07:41 GMT Message-Id: <202101091507.109F7fnO051706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 109260d202fb - main - mvneta: Acquire the softc lock before clearing the MIB MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 109260d202fb64be6f2efcf243c25090c1f64420 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 15:07:41 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=109260d202fb64be6f2efcf243c25090c1f64420 commit 109260d202fb64be6f2efcf243c25090c1f64420 Author: Mark Johnston AuthorDate: 2021-01-09 15:03:46 +0000 Commit: Mark Johnston CommitDate: 2021-01-09 15:04:17 +0000 mvneta: Acquire the softc lock before clearing the MIB Reported by: Andrei Martin MFC with: caf552a60719 --- sys/dev/neta/if_mvneta.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c index da364900f120..4ff830731e94 100644 --- a/sys/dev/neta/if_mvneta.c +++ b/sys/dev/neta/if_mvneta.c @@ -1190,7 +1190,9 @@ mvneta_initreg(struct ifnet *ifp) MVNETA_WRITE(sc, MVNETA_PXCX, reg); /* clear MIB counter registers(clear by read) */ + mvneta_sc_lock(sc); mvneta_clear_mib(sc); + mvneta_sc_unlock(sc); /* Set SDC register except IPGINT bits */ reg = MVNETA_SDC_RXBSZ_16_64BITWORDS; From owner-dev-commits-src-all@freebsd.org Sat Jan 9 17:06:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5E8514DCD24; Sat, 9 Jan 2021 17:06:32 +0000 (UTC) (envelope-from git@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 4DCmbD2DPZz3jnF; Sat, 9 Jan 2021 17:06:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F7A8196E2; Sat, 9 Jan 2021 17:06:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109H6W1P006947; Sat, 9 Jan 2021 17:06:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109H6Wks006946; Sat, 9 Jan 2021 17:06:32 GMT (envelope-from git) Date: Sat, 9 Jan 2021 17:06:32 GMT Message-Id: <202101091706.109H6Wks006946@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando Apesteguía Subject: git: df965a6829f0 - main - man(1): Add EXAMPLES section MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df965a6829f058b7a9999c39bc229616520645c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 17:06:32 -0000 The branch main has been updated by fernape (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=df965a6829f058b7a9999c39bc229616520645c2 commit df965a6829f058b7a9999c39bc229616520645c2 Author: Fernando Apesteguía AuthorDate: 2021-01-09 16:55:21 +0000 Commit: Fernando Apesteguía CommitDate: 2021-01-09 16:57:47 +0000 man(1): Add EXAMPLES section Add some examples showing the use of the flags: a, k, P, w Reviewed by: gbe@, yuripv@ Approved by: manpages (gbe@) Differential Revision: https://reviews.freebsd.org/D27545 --- usr.bin/man/man.1 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/usr.bin/man/man.1 b/usr.bin/man/man.1 index 89bef50d718a..79821c405416 100644 --- a/usr.bin/man/man.1 +++ b/usr.bin/man/man.1 @@ -357,6 +357,41 @@ Local configuration files. .El .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Show the manual page for +.Xr stat 2 : +.Bd -literal -offset indent +$ man 2 stat +.Ed +.Pp +Show all manual pages for +.Ql stat . +.Bd -literal -offset indent +$ man -a stat +.Ed +.Pp +List manual pages which match the regular expression either in the title or in +the body: +.Bd -literal -offset indent +$ man -k '\e.*archive' +.Ed +.Pp +Show the manual page for +.Xr ls 1 +and use +.Xr cat 1 +as pager: +.Bd -literal -offset indent +$ man -P cat ls +.Ed +.Pp +Show the location of the +.Xr ls 1 +manual page: +.Bd -literal -offset indent +$ man -w ls +.Ed +.Pp .Sh SEE ALSO .Xr apropos 1 , .Xr intro 1 , From owner-dev-commits-src-all@freebsd.org Sat Jan 9 17:26:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DE42F4DD58B; Sat, 9 Jan 2021 17:26:31 +0000 (UTC) (envelope-from git@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 4DCn2H621Qz3lHq; Sat, 9 Jan 2021 17:26:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1DA319C0B; Sat, 9 Jan 2021 17:26:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109HQV0v032502; Sat, 9 Jan 2021 17:26:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109HQVAn032501; Sat, 9 Jan 2021 17:26:31 GMT (envelope-from git) Date: Sat, 9 Jan 2021 17:26:31 GMT Message-Id: <202101091726.109HQVAn032501@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando Apesteguía Subject: git: 9e2300402379 - main - man(1): Bump .Dd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e23004023791963526bec16a85d3124b1bc4d5d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 17:26:31 -0000 The branch main has been updated by fernape (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9e23004023791963526bec16a85d3124b1bc4d5d commit 9e23004023791963526bec16a85d3124b1bc4d5d Author: Fernando Apesteguía AuthorDate: 2021-01-09 17:22:08 +0000 Commit: Fernando Apesteguía CommitDate: 2021-01-09 17:22:08 +0000 man(1): Bump .Dd From commit df965a6829f058b7a9999c39bc229616520645c2 --- usr.bin/man/man.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/man/man.1 b/usr.bin/man/man.1 index 79821c405416..42fd60a86164 100644 --- a/usr.bin/man/man.1 +++ b/usr.bin/man/man.1 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2020 +.Dd January 9, 2021 .Dt MAN 1 .Os .Sh NAME From owner-dev-commits-src-all@freebsd.org Sat Jan 9 17:43:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6A79B4DDBB8; Sat, 9 Jan 2021 17:43:54 +0000 (UTC) (envelope-from git@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 4DCnQL2crdz3msr; Sat, 9 Jan 2021 17:43:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B13419C61; Sat, 9 Jan 2021 17:43:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109Hhs6h058279; Sat, 9 Jan 2021 17:43:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109HhsOx058278; Sat, 9 Jan 2021 17:43:54 GMT (envelope-from git) Date: Sat, 9 Jan 2021 17:43:54 GMT Message-Id: <202101091743.109HhsOx058278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando Apesteguía Subject: git: 53c8d22495cf - main - last(1): Add EXAMPLES section MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53c8d22495cf81cf53b5631df860e3d7de00343f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 17:43:54 -0000 The branch main has been updated by fernape (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=53c8d22495cf81cf53b5631df860e3d7de00343f commit 53c8d22495cf81cf53b5631df860e3d7de00343f Author: Fernando Apesteguía AuthorDate: 2021-01-09 17:28:23 +0000 Commit: Fernando Apesteguía CommitDate: 2021-01-09 17:37:25 +0000 last(1): Add EXAMPLES section Add two simple examples showing the use of the flags: d, n, s, t While here, reorder cross references properly by section Bump .Dd Approved by: manpages (gbe@) Differential Revision: https://reviews.freebsd.org/D27540 last(1): Bump .Dd --- usr.bin/last/last.1 | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/usr.bin/last/last.1 b/usr.bin/last/last.1 index b819f4f8dbfd..d9442dad75cb 100644 --- a/usr.bin/last/last.1 +++ b/usr.bin/last/last.1 @@ -28,7 +28,7 @@ .\" @(#)last.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd August 28, 2018 +.Dd January 9, 2021 .Dt LAST 1 .Os .Sh NAME @@ -204,13 +204,31 @@ far the search has progressed and then continues. .It Pa /var/log/utx.log login data base .El +.Sh EXAMPLES +Show logins in pts/14 with the duration in seconds and limit the report to +two lines: +.Bd -literal -offset indent +$ last -n2 -s -t pts/14 +bob pts/1 Wed Dec 9 11:08 still logged in +bob pts/2 Mon Dec 7 20:10 - 20:23 ( 776) +.Ed +.Pp +Show active logins at +.Ql December 7th 20:23 +of the current year: +.Bd -literal -offset indent +$ last -d 12072023 +bob pts/1 Mon Dec 7 20:10 - 20:23 (00:12) +bob pts/6 Mon Dec 7 19:24 - 22:27 (03:03) +alice ttyv0 Mon Dec 7 19:18 - 22:27 (03:09) +.Ed .Sh SEE ALSO .Xr lastcomm 1 , .Xr getutxent 3 , -.Xr ac 8 , -.Xr lastlogin 8 , .Xr libxo 3 , -.Xr xo_parse_args 3 +.Xr xo_parse_args 3 , +.Xr ac 8 , +.Xr lastlogin 8 .Sh HISTORY .Nm utility first appeared in From owner-dev-commits-src-all@freebsd.org Sat Jan 9 18:11:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A48F24DE830; Sat, 9 Jan 2021 18:11:56 +0000 (UTC) (envelope-from git@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 4DCp2h4L9Xz3pjL; Sat, 9 Jan 2021 18:11:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 863D61A421; Sat, 9 Jan 2021 18:11:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109IBuOV093868; Sat, 9 Jan 2021 18:11:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109IBu3J093867; Sat, 9 Jan 2021 18:11:56 GMT (envelope-from git) Date: Sat, 9 Jan 2021 18:11:56 GMT Message-Id: <202101091811.109IBu3J093867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 40e6e2c2f711 - main - sysctl: improve debug.kdb.panic_str description MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40e6e2c2f711f95cb623691aacc235a79c1cfaeb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 18:11:56 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=40e6e2c2f711f95cb623691aacc235a79c1cfaeb commit 40e6e2c2f711f95cb623691aacc235a79c1cfaeb Author: Warner Losh AuthorDate: 2021-01-09 18:10:42 +0000 Commit: Warner Losh CommitDate: 2021-01-09 18:10:42 +0000 sysctl: improve debug.kdb.panic_str description Improve the wording for this sysctl. Submitted by: rpokala@ --- sys/kern/subr_kdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c index 9de2d9de13e8..1fabb4044eb1 100644 --- a/sys/kern/subr_kdb.c +++ b/sys/kern/subr_kdb.c @@ -113,7 +113,7 @@ SYSCTL_PROC(_debug_kdb, OID_AUTO, panic, SYSCTL_PROC(_debug_kdb, OID_AUTO, panic_str, CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, kdb_sysctl_panic_str, "A", - "set to panic the kernel with using the string as the panic message"); + "trigger a kernel panic, using the provided string as the panic message"); SYSCTL_PROC(_debug_kdb, OID_AUTO, trap, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, From owner-dev-commits-src-all@freebsd.org Sat Jan 9 18:15:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1369E4DE87F; Sat, 9 Jan 2021 18:15:59 +0000 (UTC) (envelope-from andriy.gapon@uabsd.com) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 4DCp7K01D9z3q1J; Sat, 9 Jan 2021 18:15:56 +0000 (UTC) (envelope-from andriy.gapon@uabsd.com) X-Originating-IP: 195.64.148.76 Received: from [192.168.0.24] (unknown [195.64.148.76]) (Authenticated sender: andriy.gapon@uabsd.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 861CE1BF206; Sat, 9 Jan 2021 18:15:51 +0000 (UTC) Subject: Re: git: 82c7abe7785b - main - The "unsigned" type is the same like "unsigned int". To: Hans Petter Selasky , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202101081137.108Bbs7N013971@gitrepo.freebsd.org> From: Andriy Gapon Message-ID: <1d08f668-bd19-dd77-01b8-e138209865d9@uabsd.com> Date: Sat, 9 Jan 2021 20:15:49 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <202101081137.108Bbs7N013971@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DCp7K01D9z3q1J X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of andriy.gapon@uabsd.com designates 217.70.183.201 as permitted sender) smtp.mailfrom=andriy.gapon@uabsd.com X-Spamd-Result: default: False [-1.40 / 15.00]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_SPAM_SHORT(1.00)[1.000]; HAS_XOIP(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip4:217.70.183.192/28]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; SPAMHAUS_ZRD(0.00)[217.70.183.201:from:127.0.2.255]; RWL_MAILSPIKE_POSSIBLE(0.00)[217.70.183.201:from]; DMARC_NA(0.00)[uabsd.com]; RBL_DBL_DONT_QUERY_IPS(0.00)[217.70.183.201:from]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:29169, ipnet:217.70.176.0/20, country:FR]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_IN_DNSWL_LOW(-0.10)[217.70.183.201:from] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 18:15:59 -0000 On 2021-01-08 13:37, Hans Petter Selasky wrote: > The branch main has been updated by hselasky: > > URL: https://cgit.FreeBSD.org/src/commit/?id=82c7abe7785bd8aeb290d91f80ddeb31e81407a5 > > commit 82c7abe7785bd8aeb290d91f80ddeb31e81407a5 > Author: Hans Petter Selasky > AuthorDate: 2021-01-08 10:58:10 +0000 > Commit: Hans Petter Selasky > CommitDate: 2021-01-08 11:35:54 +0000 > > The "unsigned" type is the same like "unsigned int". > > MFC after: 1 week > Sponsored by: Mellanox Technologies // NVIDIA Networking > --- > sys/dev/mlx5/mlx5_core/mlx5_main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c > index d0b4027165ea..40cba09106f0 100644 > --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c > +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c > @@ -708,7 +708,7 @@ static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili, > if (warn_time_mili && time_after(jiffies, warn)) { > mlx5_core_warn(dev, > "Waiting for FW initialization, timeout abort in %u s\n", > - (unsigned int)(jiffies_to_msecs(end - warn) / 1000)); > + (unsigned)(jiffies_to_msecs(end - warn) / 1000)); I am not sure that we actually prefer "unsigned" over "unsigned int". If you just wanted to make the line a bit shorter then u_int is what is typically used in FreeBSD code. > warn = jiffies + msecs_to_jiffies(warn_time_mili); > } > msleep(FW_INIT_WAIT_MS); > From owner-dev-commits-src-all@freebsd.org Sat Jan 9 18:34:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 446E44DF428; Sat, 9 Jan 2021 18:34:35 +0000 (UTC) (envelope-from git@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 4DCpXq1XKXz3r3P; Sat, 9 Jan 2021 18:34:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 230261AB59; Sat, 9 Jan 2021 18:34:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109IYZv6023076; Sat, 9 Jan 2021 18:34:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109IYZv8023075; Sat, 9 Jan 2021 18:34:35 GMT (envelope-from git) Date: Sat, 9 Jan 2021 18:34:35 GMT Message-Id: <202101091834.109IYZv8023075@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 12a8d3027d41 - main - diff: honour flags with -q MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 12a8d3027d414abd15798de1b6d8b01151bdac50 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 18:34:35 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=12a8d3027d414abd15798de1b6d8b01151bdac50 commit 12a8d3027d414abd15798de1b6d8b01151bdac50 Author: Ed Maste AuthorDate: 2021-01-09 16:22:28 +0000 Commit: Ed Maste CommitDate: 2021-01-09 18:34:06 +0000 diff: honour flags with -q Previously -q (just print a line when files differ) ignored flags like -w (ignore whitespace). Avoid the D_BRIEF short-circuit when flags are in effect. PR: 252515 Reported by: Scott Aitken Reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28064 --- usr.bin/diff/diffreg.c | 4 +++- usr.bin/diff/tests/diff_test.sh | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 74c0df7dce30..7d2b20b43def 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -369,7 +369,9 @@ diffreg(char *file1, char *file2, int flags, int capsicum) goto closem; } - if (diff_format == D_BRIEF && ignore_pats == NULL) { + if (diff_format == D_BRIEF && ignore_pats == NULL && + (flags & (D_FOLDBLANKS|D_IGNOREBLANKS|D_IGNORECASE|D_STRIPCR)) == 0) + { rval = D_DIFFER; status |= 1; goto closem; diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh index 9f460231f480..7ee88d1fe607 100755 --- a/usr.bin/diff/tests/diff_test.sh +++ b/usr.bin/diff/tests/diff_test.sh @@ -9,6 +9,7 @@ atf_test_case group_format atf_test_case side_by_side atf_test_case brief_format atf_test_case b230049 +atf_test_case b252515 atf_test_case Bflag atf_test_case Nflag atf_test_case tabsize @@ -65,6 +66,14 @@ b230049_body() b230049_a.in b230049_b.in } +b252515_body() +{ + printf 'a b\n' > b252515_a.in + printf 'a b\n' > b252515_b.in + atf_check -o empty -s eq:0 \ + diff -qw b252515_a.in b252515_b.in +} + header_body() { export TZ=UTC @@ -228,6 +237,7 @@ atf_init_test_cases() atf_add_test_case side_by_side atf_add_test_case brief_format atf_add_test_case b230049 + atf_add_test_case b252515 atf_add_test_case Bflag atf_add_test_case Nflag atf_add_test_case tabsize From owner-dev-commits-src-all@freebsd.org Sat Jan 9 18:35:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BF4A74DF344; Sat, 9 Jan 2021 18:35:46 +0000 (UTC) (envelope-from git@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 4DCpZB55YFz3rFS; Sat, 9 Jan 2021 18:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1CA81A570; Sat, 9 Jan 2021 18:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109IZkId023411; Sat, 9 Jan 2021 18:35:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109IZk1X023410; Sat, 9 Jan 2021 18:35:46 GMT (envelope-from git) Date: Sat, 9 Jan 2021 18:35:46 GMT Message-Id: <202101091835.109IZk1X023410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: c8eee7c0bf9a - main - ldd: renumber executable type constants MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8eee7c0bf9a01303c75b4c3ac644b99adc70ca9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 18:35:46 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c8eee7c0bf9a01303c75b4c3ac644b99adc70ca9 commit c8eee7c0bf9a01303c75b4c3ac644b99adc70ca9 Author: Ed Maste AuthorDate: 2021-01-09 18:34:58 +0000 Commit: Ed Maste CommitDate: 2021-01-09 18:34:58 +0000 ldd: renumber executable type constants ldd had #defines for AOUT, ELF, and ELF32. The removal of AOUT left a possibly confusing gap. These are not used anywhere but this file so renumber to avoid the gap. Reported by: allanjude --- usr.bin/ldd/ldd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/ldd/ldd.c b/usr.bin/ldd/ldd.c index 892cf9bb3cc5..08c91d829bd7 100644 --- a/usr.bin/ldd/ldd.c +++ b/usr.bin/ldd/ldd.c @@ -72,9 +72,9 @@ static int is_executable(const char *fname, int fd, int *is_shlib, static void usage(void); #define TYPE_UNKNOWN 0 -#define TYPE_ELF 2 /* Architecture default */ +#define TYPE_ELF 1 /* Architecture default */ #if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) -#define TYPE_ELF32 3 /* Explicit 32 bits on architectures >32 bits */ +#define TYPE_ELF32 2 /* Explicit 32 bits on architectures >32 bits */ #define _PATH_LDD32 "/usr/bin/ldd32" From owner-dev-commits-src-all@freebsd.org Sat Jan 9 18:56:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BEACD4DFE76; Sat, 9 Jan 2021 18:56:22 +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 4DCq1y3Q4Fz3sLS; Sat, 9 Jan 2021 18:56:21 +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 D981C2600D9; Sat, 9 Jan 2021 19:56:13 +0100 (CET) Subject: Re: git: 82c7abe7785b - main - The "unsigned" type is the same like "unsigned int". To: Andriy Gapon , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202101081137.108Bbs7N013971@gitrepo.freebsd.org> <1d08f668-bd19-dd77-01b8-e138209865d9@uabsd.com> From: Hans Petter Selasky Message-ID: <12943359-e2fc-2a5d-6cbe-fe0d7093eb42@selasky.org> Date: Sat, 9 Jan 2021 19:56:03 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <1d08f668-bd19-dd77-01b8-e138209865d9@uabsd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DCq1y3Q4Fz3sLS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 18:56:22 -0000 On 1/9/21 7:15 PM, Andriy Gapon wrote: > On 2021-01-08 13:37, Hans Petter Selasky wrote: >> The branch main has been updated by hselasky: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=82c7abe7785bd8aeb290d91f80ddeb31e81407a5 >> >> commit 82c7abe7785bd8aeb290d91f80ddeb31e81407a5 >> Author: Hans Petter Selasky >> AuthorDate: 2021-01-08 10:58:10 +0000 >> Commit: Hans Petter Selasky >> CommitDate: 2021-01-08 11:35:54 +0000 >> >> The "unsigned" type is the same like "unsigned int". >> >> MFC after: 1 week >> Sponsored by: Mellanox Technologies // NVIDIA Networking >> --- >> sys/dev/mlx5/mlx5_core/mlx5_main.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c >> index d0b4027165ea..40cba09106f0 100644 >> --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c >> +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c >> @@ -708,7 +708,7 @@ static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili, >> if (warn_time_mili && time_after(jiffies, warn)) { >> mlx5_core_warn(dev, >> "Waiting for FW initialization, timeout abort in %u s\n", >> - (unsigned int)(jiffies_to_msecs(end - warn) / 1000)); >> + (unsigned)(jiffies_to_msecs(end - warn) / 1000)); > > I am not sure that we actually prefer "unsigned" over "unsigned int". > If you just wanted to make the line a bit shorter then u_int is what is > typically used in FreeBSD code. > I just wanted to reduce diffs with internal code. --HPS From owner-dev-commits-src-all@freebsd.org Sat Jan 9 19:07:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 898624E0129; Sat, 9 Jan 2021 19:07:59 +0000 (UTC) (envelope-from git@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 4DCqHM3T4Gz3sym; Sat, 9 Jan 2021 19:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69F161B02A; Sat, 9 Jan 2021 19:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109J7xTx062590; Sat, 9 Jan 2021 19:07:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109J7xua062589; Sat, 9 Jan 2021 19:07:59 GMT (envelope-from git) Date: Sat, 9 Jan 2021 19:07:59 GMT Message-Id: <202101091907.109J7xua062589@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 4d0c33be634a - main - kevent(2): Bugfix for wrong EVFILT_TIMER timeouts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4d0c33be634a929f323117f04e6b1670776f9e37 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 19:07:59 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4d0c33be634a929f323117f04e6b1670776f9e37 commit 4d0c33be634a929f323117f04e6b1670776f9e37 Author: Jan Kokemüller AuthorDate: 2021-01-09 19:00:25 +0000 Commit: Gordon Bergling CommitDate: 2021-01-09 19:00:25 +0000 kevent(2): Bugfix for wrong EVFILT_TIMER timeouts When using NOTE_NSECONDS in the kevent(2) API, US_TO_SBT should be used instead of NS_TO_SBT, otherwise the timeout results are misleading. PR: 252539 Reviewed by: kevans, kib Approved by: kevans MFC after: 3 weeks --- sys/kern/kern_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index a1a4a3c470b8..e22c987f8a08 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -665,7 +665,7 @@ timer2sbintime(int64_t data, int flags) if (secs > (SBT_MAX / SBT_1S)) return (SBT_MAX); #endif - return (secs << 32 | US_TO_SBT(data % 1000000000)); + return (secs << 32 | NS_TO_SBT(data % 1000000000)); } return (NS_TO_SBT(data)); default: From owner-dev-commits-src-all@freebsd.org Sat Jan 9 19:16:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 602D44E014C; Sat, 9 Jan 2021 19:16:42 +0000 (UTC) (envelope-from gbe@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 4DCqTQ2HmKz3tsx; Sat, 9 Jan 2021 19:16:42 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p200300d5d72fc84fe0405c097ab6e24c.dip0.t-ipconnect.de [IPv6:2003:d5:d72f:c84f:e040:5c09:7ab6:e24c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id D7B33E84A; Sat, 9 Jan 2021 19:16:41 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Sat, 9 Jan 2021 20:16:41 +0100 From: Gordon Bergling To: Gordon Bergling Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 4d0c33be634a - main - kevent(2): Bugfix for wrong EVFILT_TIMER timeouts Message-ID: References: <202101091907.109J7xua062589@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202101091907.109J7xua062589@gitrepo.freebsd.org> X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 8:14PM up 6:25, 4 users, load averages: 0.21, 0.21, 0.23 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 19:16:42 -0000 On Sat, Jan 09, 2021 at 07:07:59PM +0000, Gordon Bergling wrote: > The branch main has been updated by gbe (doc committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=4d0c33be634a929f323117f04e6b1670776f9e37 > > commit 4d0c33be634a929f323117f04e6b1670776f9e37 > Author: Jan Kokemüller > AuthorDate: 2021-01-09 19:00:25 +0000 > Commit: Gordon Bergling > CommitDate: 2021-01-09 19:00:25 +0000 > > kevent(2): Bugfix for wrong EVFILT_TIMER timeouts > > When using NOTE_NSECONDS in the kevent(2) API, US_TO_SBT should be > used instead of NS_TO_SBT, otherwise the timeout results are > misleading. > > PR: 252539 > Reviewed by: kevans, kib > Approved by: kevans > MFC after: 3 weeks [...] Should be read, 'use NS_TO_SBT instead of US_TO_SBT...'. --Gordon From owner-dev-commits-src-all@freebsd.org Sat Jan 9 20:20:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9956E4E1E8B; Sat, 9 Jan 2021 20:20:07 +0000 (UTC) (envelope-from git@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 4DCrtb3yCYz4RxG; Sat, 9 Jan 2021 20:20:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A81D1BEA6; Sat, 9 Jan 2021 20:20:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109KK7w9055601; Sat, 9 Jan 2021 20:20:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109KK7JY055598; Sat, 9 Jan 2021 20:20:07 GMT (envelope-from git) Date: Sat, 9 Jan 2021 20:20:07 GMT Message-Id: <202101092020.109KK7JY055598@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: da77382f5512 - main - arm: revert MAXDSIZ change from 202aea9c82ea MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da77382f55129a0304af8985e32d0632eba7cd74 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 20:20:07 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=da77382f55129a0304af8985e32d0632eba7cd74 commit da77382f55129a0304af8985e32d0632eba7cd74 Author: Kyle Evans AuthorDate: 2021-01-09 20:14:00 +0000 Commit: Kyle Evans CommitDate: 2021-01-09 20:14:00 +0000 arm: revert MAXDSIZ change from 202aea9c82ea This imposes a fairly severe limitation on space available for mmap that was not noticed prior to commit. Unfixed mmap will only map from [data + MAXSIZE, end of user VA space], bringing the amount of usable space down way too low for non-trivial link jobs (for instance). Reported by: mmel --- sys/arm/include/vmparam.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/include/vmparam.h b/sys/arm/include/vmparam.h index d37a81ae6212..75c61fff803a 100644 --- a/sys/arm/include/vmparam.h +++ b/sys/arm/include/vmparam.h @@ -50,7 +50,7 @@ #define DFLDSIZ (128UL*1024*1024) /* initial data size limit */ #endif #ifndef MAXDSIZ -#define MAXDSIZ (1856UL*1024*1024) /* max data size */ +#define MAXDSIZ (512UL*1024*1024) /* max data size */ #endif #ifndef DFLSSIZ #define DFLSSIZ (4UL*1024*1024) /* initial stack size limit */ From owner-dev-commits-src-all@freebsd.org Sat Jan 9 20:27:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 28AC94E1EAD; Sat, 9 Jan 2021 20:27:39 +0000 (UTC) (envelope-from git@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 4DCs3H0jnGz4SJk; Sat, 9 Jan 2021 20:27:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B6FA1C186; Sat, 9 Jan 2021 20:27:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109KRcXY066622; Sat, 9 Jan 2021 20:27:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109KRcTC066621; Sat, 9 Jan 2021 20:27:38 GMT (envelope-from git) Date: Sat, 9 Jan 2021 20:27:38 GMT Message-Id: <202101092027.109KRcTC066621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 6685e259e319 - main - tcp: don't use KTLS socket option on listening sockets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6685e259e31995e20fa2f9cd7e19a292fcdc6877 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 20:27:39 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=6685e259e31995e20fa2f9cd7e19a292fcdc6877 commit 6685e259e31995e20fa2f9cd7e19a292fcdc6877 Author: Michael Tuexen AuthorDate: 2021-01-08 07:51:39 +0000 Commit: Michael Tuexen CommitDate: 2021-01-08 07:57:11 +0000 tcp: don't use KTLS socket option on listening sockets KTLS socket options make use of socket buffers, which are not available for listening sockets. Reported by: syzbot+a8829e888a93a4a04619@syzkaller.appspotmail.com Reviewed by: jhb@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D27948 --- sys/kern/uipc_ktls.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 6ea14e8aa9e2..e430afdabc23 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1014,6 +1014,8 @@ ktls_enable_rx(struct socket *so, struct tls_enable *en) if (!ktls_offload_enable) return (ENOTSUP); + if (SOLISTENING(so)) + return (EINVAL); counter_u64_add(ktls_offload_enable_calls, 1); @@ -1079,6 +1081,8 @@ ktls_enable_tx(struct socket *so, struct tls_enable *en) if (!ktls_offload_enable) return (ENOTSUP); + if (SOLISTENING(so)) + return (EINVAL); counter_u64_add(ktls_offload_enable_calls, 1); @@ -1155,6 +1159,8 @@ ktls_get_rx_mode(struct socket *so) struct inpcb *inp; int mode; + if (SOLISTENING(so)) + return (EINVAL); inp = so->so_pcb; INP_WLOCK_ASSERT(inp); SOCKBUF_LOCK(&so->so_rcv); @@ -1174,6 +1180,8 @@ ktls_get_tx_mode(struct socket *so) struct inpcb *inp; int mode; + if (SOLISTENING(so)) + return (EINVAL); inp = so->so_pcb; INP_WLOCK_ASSERT(inp); SOCKBUF_LOCK(&so->so_snd); @@ -1196,6 +1204,8 @@ ktls_set_tx_mode(struct socket *so, int mode) struct inpcb *inp; int error; + if (SOLISTENING(so)) + return (EINVAL); switch (mode) { case TCP_TLS_MODE_SW: case TCP_TLS_MODE_IFNET: From owner-dev-commits-src-all@freebsd.org Sat Jan 9 20:56:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F09C84E3181; Sat, 9 Jan 2021 20:56:48 +0000 (UTC) (envelope-from git@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 4DCshw6SD7z4V5Y; Sat, 9 Jan 2021 20:56:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D05D51C467; Sat, 9 Jan 2021 20:56:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109KumkO004934; Sat, 9 Jan 2021 20:56:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109Kum0h004933; Sat, 9 Jan 2021 20:56:48 GMT (envelope-from git) Date: Sat, 9 Jan 2021 20:56:48 GMT Message-Id: <202101092056.109Kum0h004933@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: faaf43b2a750 - main - fileargs: add tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: faaf43b2a750aabeaa7cec434625fe1f2094a001 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 20:56:49 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=faaf43b2a750aabeaa7cec434625fe1f2094a001 commit faaf43b2a750aabeaa7cec434625fe1f2094a001 Author: Mariusz Zaborski AuthorDate: 2021-01-09 20:56:09 +0000 Commit: Mariusz Zaborski CommitDate: 2021-01-09 20:56:09 +0000 fileargs: add tests --- lib/libcasper/services/cap_fileargs/Makefile | 3 + lib/libcasper/services/cap_fileargs/tests/Makefile | 16 + .../services/cap_fileargs/tests/fileargs_test.c | 606 +++++++++++++++++++++ 3 files changed, 625 insertions(+) diff --git a/lib/libcasper/services/cap_fileargs/Makefile b/lib/libcasper/services/cap_fileargs/Makefile index fd815a87aa05..04787c01db35 100644 --- a/lib/libcasper/services/cap_fileargs/Makefile +++ b/lib/libcasper/services/cap_fileargs/Makefile @@ -21,6 +21,9 @@ LIBADD= nv CFLAGS+=-I${.CURDIR} +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + MAN+= cap_fileargs.3 MLINKS+=cap_fileargs.3 libcap_fileargs.3 diff --git a/lib/libcasper/services/cap_fileargs/tests/Makefile b/lib/libcasper/services/cap_fileargs/tests/Makefile new file mode 100644 index 000000000000..51674c5f778e --- /dev/null +++ b/lib/libcasper/services/cap_fileargs/tests/Makefile @@ -0,0 +1,16 @@ +# $FreeBSD$ + +.include + +ATF_TESTS_C= fileargs_test + +.if ${MK_CASPER} != "no" +LIBADD+= casper +LIBADD+= cap_fileargs +CFLAGS+=-DWITH_CASPER +.endif +LIBADD+= nv + +WARNS?= 3 + +.include diff --git a/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c b/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c new file mode 100644 index 000000000000..ad889bb2986f --- /dev/null +++ b/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c @@ -0,0 +1,606 @@ +/*- + * Copyright (c) 2021 Mariusz Zaborski + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#define MAX_FILES 200 + +static char *files[MAX_FILES]; +static int fds[MAX_FILES]; + +#define TEST_FILE "/etc/passwd" + +static void +prepare_files(size_t num, bool create) +{ + const char template[] = "testsfiles.XXXXXXXX"; + size_t i; + + for (i = 0; i < num; i++) { + files[i] = calloc(1, sizeof(template)); + ATF_REQUIRE(files[i] != NULL); + strncpy(files[i], template, sizeof(template) - 1); + + if (create) { + fds[i] = mkstemp(files[i]); + ATF_REQUIRE(fds[i] >= 0); + } else { + fds[i] = -1; + ATF_REQUIRE(mktemp(files[i]) != NULL); + } + } +} + +static void +clear_files(void) +{ + size_t i; + + + for (i = 0; files[i] != NULL; i++) { + unlink(files[i]); + free(files[i]); + if (fds[i] != -1) + close(fds[i]); + } +} + +static int +test_file_open(fileargs_t *fa, const char *file, int *fdp) +{ + int fd; + + fd = fileargs_open(fa, file); + if (fd < 0) + return (errno); + + if (fdp != NULL) { + *fdp = fd; + } + + return (0); +} + +static int +test_file_fopen(fileargs_t *fa, const char *file, const char *mode, + FILE **retfile) +{ + FILE *pfile; + + pfile = fileargs_fopen(fa, file, mode); + if (pfile == NULL) + return (errno); + + if (retfile != NULL) { + *retfile = pfile; + } + + return (0); +} + +static int +test_file_lstat(fileargs_t *fa, const char *file) +{ + struct stat fasb, origsb; + bool equals; + + if (fileargs_lstat(fa, file, &fasb) < 0) + return (errno); + + ATF_REQUIRE(lstat(file, &origsb) == 0); + + equals = true; + equals &= (origsb.st_dev == fasb.st_dev); + equals &= (origsb.st_ino == fasb.st_ino); + equals &= (origsb.st_nlink == fasb.st_nlink); + equals &= (origsb.st_flags == fasb.st_flags); + equals &= (memcmp(&origsb.st_ctim, &fasb.st_ctim, + sizeof(fasb.st_ctim)) == 0); + equals &= (memcmp(&origsb.st_birthtim, &fasb.st_birthtim, + sizeof(fasb.st_birthtim)) == 0); + if (!equals) { + return (EINVAL); + } + + return (0); +} + +static int +test_file_mode(int fd, int mode) +{ + int flags; + + flags = fcntl(fd, F_GETFL, 0); + if (flags < 0) + return (errno); + + if ((flags & O_ACCMODE) != mode) + return (errno); + + return (0); +} + +static bool +test_file_cap(int fd, cap_rights_t *rights) +{ + cap_rights_t fdrights; + + ATF_REQUIRE(cap_rights_get(fd, &fdrights) == 0); + + return (cap_rights_contains(&fdrights, rights)); +} + +static int +test_file_write(int fd) +{ + char buf; + + buf = 't'; + if (write(fd, &buf, sizeof(buf)) != sizeof(buf)) { + return (errno); + } + + return (0); +} + +static int +test_file_read(int fd) +{ + char buf; + + if (read(fd, &buf, sizeof(buf)) < 0) { + return (errno); + } + + return (0); +} + +static int +test_file_fwrite(FILE *pfile) +{ + char buf; + + buf = 't'; + if (fwrite(&buf, sizeof(buf), 1, pfile) != sizeof(buf)) + return (errno); + + return (0); +} + +static int +test_file_fread(FILE *pfile) +{ + char buf; + int ret, serrno; + + errno = 0; + ret = fread(&buf, sizeof(buf), 1, pfile); + serrno = errno; + if (ret < 0) { + return (serrno); + } else if (ret == 0 && feof(pfile) == 0) { + return (serrno != 0 ? serrno : EINVAL); + } + + return (0); +} + +ATF_TC_WITH_CLEANUP(fileargs__open_read); +ATF_TC_HEAD(fileargs__open_read, tc) {} +ATF_TC_BODY(fileargs__open_read, tc) +{ + cap_rights_t rights, norights; + fileargs_t *fa; + size_t i; + int fd; + + prepare_files(MAX_FILES, true); + + cap_rights_init(&rights, CAP_READ | CAP_FCNTL); + cap_rights_init(&norights, CAP_WRITE); + fa = fileargs_init(MAX_FILES, files, O_RDONLY, 0, &rights, + FA_OPEN); + ATF_REQUIRE(fa != NULL); + + for (i = 0; i < MAX_FILES; i++) { + /* ALLOWED */ + /* We open file twice to check if we can. */ + ATF_REQUIRE(test_file_open(fa, files[i], &fd) == 0); + ATF_REQUIRE(close(fd) == 0); + + ATF_REQUIRE(test_file_open(fa, files[i], &fd) == 0); + ATF_REQUIRE(test_file_mode(fd, O_RDONLY) == 0); + ATF_REQUIRE(test_file_cap(fd, &rights) == true); + ATF_REQUIRE(test_file_read(fd) == 0); + + /* DISALLOWED */ + ATF_REQUIRE(test_file_lstat(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_open(fa, TEST_FILE, NULL) == ENOTCAPABLE); + ATF_REQUIRE(test_file_cap(fd, &norights) == false); + ATF_REQUIRE(test_file_write(fd) == ENOTCAPABLE); + + /* CLOSE */ + ATF_REQUIRE(close(fd) == 0); + } +} +ATF_TC_CLEANUP(fileargs__open_read, tc) +{ + clear_files(); +} + +ATF_TC_WITH_CLEANUP(fileargs__open_write); +ATF_TC_HEAD(fileargs__open_write, tc) {} +ATF_TC_BODY(fileargs__open_write, tc) +{ + cap_rights_t rights, norights; + fileargs_t *fa; + size_t i; + int fd; + + prepare_files(MAX_FILES, true); + + cap_rights_init(&rights, CAP_WRITE | CAP_FCNTL); + cap_rights_init(&norights, CAP_READ); + fa = fileargs_init(MAX_FILES, files, O_WRONLY, 0, &rights, + FA_OPEN); + ATF_REQUIRE(fa != NULL); + + for (i = 0; i < MAX_FILES; i++) { + /* ALLOWED */ + /* We open file twice to check if we can. */ + ATF_REQUIRE(test_file_open(fa, files[i], &fd) == 0); + ATF_REQUIRE(close(fd) == 0); + + ATF_REQUIRE(test_file_open(fa, files[i], &fd) == 0); + ATF_REQUIRE(test_file_mode(fd, O_WRONLY) == 0); + ATF_REQUIRE(test_file_cap(fd, &rights) == true); + ATF_REQUIRE(test_file_write(fd) == 0); + + /* DISALLOWED */ + ATF_REQUIRE(test_file_lstat(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_open(fa, TEST_FILE, NULL) == ENOTCAPABLE); + ATF_REQUIRE(test_file_cap(fd, &norights) == false); + ATF_REQUIRE(test_file_read(fd) == ENOTCAPABLE); + + /* CLOSE */ + ATF_REQUIRE(close(fd) == 0); + } +} +ATF_TC_CLEANUP(fileargs__open_write, tc) +{ + clear_files(); +} + +ATF_TC_WITH_CLEANUP(fileargs__open_create); +ATF_TC_HEAD(fileargs__open_create, tc) {} +ATF_TC_BODY(fileargs__open_create, tc) +{ + cap_rights_t rights, norights; + fileargs_t *fa; + size_t i; + int fd; + + prepare_files(MAX_FILES, false); + + cap_rights_init(&rights, CAP_WRITE | CAP_FCNTL | CAP_READ); + cap_rights_init(&norights, CAP_FCHMOD); + fa = fileargs_init(MAX_FILES, files, O_RDWR | O_CREAT, 666, + &rights, FA_OPEN); + ATF_REQUIRE(fa != NULL); + + for (i = 0; i < MAX_FILES; i++) { + /* ALLOWED */ + ATF_REQUIRE(test_file_open(fa, files[i], &fd) == 0); + + ATF_REQUIRE(test_file_mode(fd, O_RDWR) == 0); + ATF_REQUIRE(test_file_cap(fd, &rights) == true); + ATF_REQUIRE(test_file_write(fd) == 0); + ATF_REQUIRE(test_file_read(fd) == 0); + + /* DISALLOWED */ + ATF_REQUIRE(test_file_lstat(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_open(fa, TEST_FILE, NULL) == ENOTCAPABLE); + ATF_REQUIRE(test_file_cap(fd, &norights) == false); + + /* CLOSE */ + ATF_REQUIRE(close(fd) == 0); + } +} +ATF_TC_CLEANUP(fileargs__open_create, tc) +{ + clear_files(); +} + +ATF_TC_WITH_CLEANUP(fileargs__open_with_casper); +ATF_TC_HEAD(fileargs__open_with_casper, tc) {} +ATF_TC_BODY(fileargs__open_with_casper, tc) +{ + cap_channel_t *capcas; + cap_rights_t rights; + fileargs_t *fa; + size_t i; + int fd; + + prepare_files(MAX_FILES, true); + + capcas = cap_init(); + ATF_REQUIRE(capcas != NULL); + + cap_rights_init(&rights, CAP_READ); + fa = fileargs_cinit(capcas, MAX_FILES, files, O_RDONLY, 0, &rights, + FA_OPEN); + ATF_REQUIRE(fa != NULL); + + for (i = 0; i < MAX_FILES; i++) { + /* ALLOWED */ + ATF_REQUIRE(test_file_open(fa, files[i], &fd) == 0); + ATF_REQUIRE(test_file_read(fd) == 0); + + /* CLOSE */ + ATF_REQUIRE(close(fd) == 0); + } +} +ATF_TC_CLEANUP(fileargs__open_with_casper, tc) +{ + clear_files(); +} + +ATF_TC_WITH_CLEANUP(fileargs__fopen_read); +ATF_TC_HEAD(fileargs__fopen_read, tc) {} +ATF_TC_BODY(fileargs__fopen_read, tc) +{ + cap_rights_t rights, norights; + fileargs_t *fa; + size_t i; + FILE *pfile; + int fd; + + prepare_files(MAX_FILES, true); + + cap_rights_init(&rights, CAP_READ | CAP_FCNTL); + cap_rights_init(&norights, CAP_WRITE); + fa = fileargs_init(MAX_FILES, files, O_RDONLY, 0, &rights, + FA_OPEN); + ATF_REQUIRE(fa != NULL); + + for (i = 0; i < MAX_FILES; i++) { + /* ALLOWED */ + /* We fopen file twice to check if we can. */ + ATF_REQUIRE(test_file_fopen(fa, files[i], "r", &pfile) == 0); + ATF_REQUIRE(fclose(pfile) == 0); + + ATF_REQUIRE(test_file_fopen(fa, files[i], "r", &pfile) == 0); + fd = fileno(pfile); + ATF_REQUIRE(test_file_mode(fd, O_RDONLY) == 0); + ATF_REQUIRE(test_file_cap(fd, &rights) == true); + ATF_REQUIRE(test_file_fread(pfile) == 0); + + /* DISALLOWED */ + ATF_REQUIRE(test_file_lstat(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_fopen(fa, TEST_FILE, "r", NULL) == + ENOTCAPABLE); + ATF_REQUIRE(test_file_cap(fd, &norights) == false); + ATF_REQUIRE(test_file_fwrite(pfile) == EBADF); + + /* CLOSE */ + ATF_REQUIRE(fclose(pfile) == 0); + } +} +ATF_TC_CLEANUP(fileargs__fopen_read, tc) +{ + clear_files(); +} + +ATF_TC_WITH_CLEANUP(fileargs__fopen_write); +ATF_TC_HEAD(fileargs__fopen_write, tc) {} +ATF_TC_BODY(fileargs__fopen_write, tc) +{ + cap_rights_t rights, norights; + fileargs_t *fa; + size_t i; + FILE *pfile; + int fd; + + prepare_files(MAX_FILES, true); + + cap_rights_init(&rights, CAP_WRITE | CAP_FCNTL); + cap_rights_init(&norights, CAP_READ); + fa = fileargs_init(MAX_FILES, files, O_WRONLY, 0, &rights, + FA_OPEN); + ATF_REQUIRE(fa != NULL); + + for (i = 0; i < MAX_FILES; i++) { + /* ALLOWED */ + /* We fopen file twice to check if we can. */ + ATF_REQUIRE(test_file_fopen(fa, files[i], "w", &pfile) == 0); + ATF_REQUIRE(fclose(pfile) == 0); + + ATF_REQUIRE(test_file_fopen(fa, files[i], "w", &pfile) == 0); + fd = fileno(pfile); + ATF_REQUIRE(test_file_mode(fd, O_WRONLY) == 0); + ATF_REQUIRE(test_file_cap(fd, &rights) == true); + ATF_REQUIRE(test_file_fwrite(pfile) == 0); + + /* DISALLOWED */ + ATF_REQUIRE(test_file_lstat(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_fopen(fa, TEST_FILE, "w", NULL) == + ENOTCAPABLE); + ATF_REQUIRE(test_file_cap(fd, &norights) == false); + ATF_REQUIRE(test_file_fread(pfile) == EBADF); + + /* CLOSE */ + ATF_REQUIRE(fclose(pfile) == 0); + } +} +ATF_TC_CLEANUP(fileargs__fopen_write, tc) +{ + clear_files(); +} + +ATF_TC_WITH_CLEANUP(fileargs__fopen_create); +ATF_TC_HEAD(fileargs__fopen_create, tc) {} +ATF_TC_BODY(fileargs__fopen_create, tc) +{ + cap_rights_t rights; + fileargs_t *fa; + size_t i; + FILE *pfile; + int fd; + + prepare_files(MAX_FILES, false); + + cap_rights_init(&rights, CAP_READ | CAP_WRITE | CAP_FCNTL); + fa = fileargs_init(MAX_FILES, files, O_RDWR | O_CREAT, 0, &rights, + FA_OPEN); + ATF_REQUIRE(fa != NULL); + + for (i = 0; i < MAX_FILES; i++) { + /* ALLOWED */ + /* We fopen file twice to check if we can. */ + ATF_REQUIRE(test_file_fopen(fa, files[i], "w+", &pfile) == 0); + fd = fileno(pfile); + ATF_REQUIRE(test_file_mode(fd, O_RDWR) == 0); + ATF_REQUIRE(test_file_cap(fd, &rights) == true); + ATF_REQUIRE(test_file_fwrite(pfile) == 0); + ATF_REQUIRE(test_file_fread(pfile) == 0); + + /* DISALLOWED */ + ATF_REQUIRE(test_file_lstat(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_fopen(fa, TEST_FILE, "w+", NULL) == + ENOTCAPABLE); + + /* CLOSE */ + ATF_REQUIRE(fclose(pfile) == 0); + } +} +ATF_TC_CLEANUP(fileargs__fopen_create, tc) +{ + clear_files(); +} + +ATF_TC_WITH_CLEANUP(fileargs__lstat); +ATF_TC_HEAD(fileargs__lstat, tc) {} +ATF_TC_BODY(fileargs__lstat, tc) +{ + fileargs_t *fa; + size_t i; + int fd; + + prepare_files(MAX_FILES, true); + + fa = fileargs_init(MAX_FILES, files, 0, 0, NULL, FA_LSTAT); + ATF_REQUIRE(fa != NULL); + + for (i = 0; i < MAX_FILES; i++) { + /* ALLOWED */ + ATF_REQUIRE(test_file_lstat(fa, files[i]) == 0); + + /* DISALLOWED */ + ATF_REQUIRE(test_file_open(fa, files[i], &fd) == ENOTCAPABLE); + ATF_REQUIRE(test_file_lstat(fa, TEST_FILE) == ENOTCAPABLE); + ATF_REQUIRE(test_file_open(fa, TEST_FILE, &fd) == ENOTCAPABLE); + } +} +ATF_TC_CLEANUP(fileargs__lstat, tc) +{ + clear_files(); +} + +ATF_TC_WITH_CLEANUP(fileargs__open_lstat); +ATF_TC_HEAD(fileargs__open_lstat, tc) {} +ATF_TC_BODY(fileargs__open_lstat, tc) +{ + cap_rights_t rights, norights; + fileargs_t *fa; + size_t i; + int fd; + + prepare_files(MAX_FILES, true); + + cap_rights_init(&rights, CAP_READ | CAP_FCNTL); + cap_rights_init(&norights, CAP_WRITE); + fa = fileargs_init(MAX_FILES, files, O_RDONLY, 0, &rights, + FA_OPEN | FA_LSTAT); + ATF_REQUIRE(fa != NULL); + + for (i = 0; i < MAX_FILES; i++) { + /* ALLOWED */ + /* We open file twice to check if we can. */ + ATF_REQUIRE(test_file_lstat(fa, files[i]) == 0); + ATF_REQUIRE(test_file_open(fa, files[i], &fd) == 0); + ATF_REQUIRE(close(fd) == 0); + + ATF_REQUIRE(test_file_open(fa, files[i], &fd) == 0); + ATF_REQUIRE(test_file_lstat(fa, files[i]) == 0); + ATF_REQUIRE(test_file_mode(fd, O_RDONLY) == 0); + ATF_REQUIRE(test_file_cap(fd, &rights) == true); + ATF_REQUIRE(test_file_read(fd) == 0); + + /* DISALLOWED */ + ATF_REQUIRE(test_file_open(fa, TEST_FILE, NULL) == ENOTCAPABLE); + ATF_REQUIRE(test_file_cap(fd, &norights) == false); + ATF_REQUIRE(test_file_write(fd) == ENOTCAPABLE); + + /* CLOSE */ + ATF_REQUIRE(close(fd) == 0); + } +} +ATF_TC_CLEANUP(fileargs__open_lstat, tc) +{ + clear_files(); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, fileargs__open_create); + ATF_TP_ADD_TC(tp, fileargs__open_read); + ATF_TP_ADD_TC(tp, fileargs__open_write); + ATF_TP_ADD_TC(tp, fileargs__open_with_casper); + + ATF_TP_ADD_TC(tp, fileargs__fopen_create); + ATF_TP_ADD_TC(tp, fileargs__fopen_read); + ATF_TP_ADD_TC(tp, fileargs__fopen_write); + + ATF_TP_ADD_TC(tp, fileargs__lstat); + + ATF_TP_ADD_TC(tp, fileargs__open_lstat); + + return (atf_no_error()); +} From owner-dev-commits-src-all@freebsd.org Sat Jan 9 21:02:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DC2164E2D69; Sat, 9 Jan 2021 21:02:06 +0000 (UTC) (envelope-from git@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 4DCsq25xWjz4Vls; Sat, 9 Jan 2021 21:02:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF0841C47B; Sat, 9 Jan 2021 21:02:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109L26HQ017632; Sat, 9 Jan 2021 21:02:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109L26Fu017631; Sat, 9 Jan 2021 21:02:06 GMT (envelope-from git) Date: Sat, 9 Jan 2021 21:02:06 GMT Message-Id: <202101092102.109L26Fu017631@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 1d238b07d5d4 - main - netmap: iflib: stop krings during interface reset MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1d238b07d5d4d9660ae0e08daede6da7e91c7853 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 21:02:06 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=1d238b07d5d4d9660ae0e08daede6da7e91c7853 commit 1d238b07d5d4d9660ae0e08daede6da7e91c7853 Author: Vincenzo Maffione AuthorDate: 2021-01-09 20:54:11 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-09 21:01:46 +0000 netmap: iflib: stop krings during interface reset When different processes open separate subsets of the available rings of a same netmap interface, a device reset may be performed while one of the processes is actively using some rings (e.g., caused by another process executing a nmport_open()). With this patch, such situation will cause the active process to get a POLLERR, so that it can have a chance to detect the situation. We also guarantee that no process is running a txsync or rxsync (ioctl or poll) while an iflib device reset is in progress. PR: 252453 MFC after: 1 week --- sys/dev/netmap/netmap.c | 2 +- sys/net/iflib.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index d2c0f8f1c5c4..aa3bb1843ba5 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -4236,7 +4236,7 @@ nm_set_native_flags(struct netmap_adapter *na) struct ifnet *ifp = na->ifp; /* We do the setup for intercepting packets only if we are the - * first user of this adapapter. */ + * first user of this adapter. */ if (na->active_fds > 0) { return; } diff --git a/sys/net/iflib.c b/sys/net/iflib.c index cc401a5db24d..1b86fd670ac4 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -809,6 +809,13 @@ iflib_netmap_register(struct netmap_adapter *na, int onoff) if (!CTX_IS_VF(ctx)) IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip); + /* + * Stop any pending txsync/rxsync and prevent new ones + * form starting. Processes blocked in poll() will get + * POLLERR. + */ + netmap_disable_all_rings(ifp); + iflib_stop(ctx); /* @@ -828,6 +835,8 @@ iflib_netmap_register(struct netmap_adapter *na, int onoff) if (status) nm_clear_native_flags(na); CTX_UNLOCK(ctx); + /* Re-enable txsync/rxsync. */ + netmap_enable_all_rings(ifp); return (status); } From owner-dev-commits-src-all@freebsd.org Sat Jan 9 21:43:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B8F6E4E3FE0; Sat, 9 Jan 2021 21:43:01 +0000 (UTC) (envelope-from git@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 4DCtkF4h99z4XTm; Sat, 9 Jan 2021 21:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 939391D075; Sat, 9 Jan 2021 21:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109Lh1YI069437; Sat, 9 Jan 2021 21:43:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109Lh1XJ069436; Sat, 9 Jan 2021 21:43:01 GMT (envelope-from git) Date: Sat, 9 Jan 2021 21:43:01 GMT Message-Id: <202101092143.109Lh1XJ069436@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 3189ba61673a - main - netmap: iflib: fix asserts in netmap_fl_refill() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3189ba61673af5bd3ed2ee9e33be92bc0b9995ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 21:43:01 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=3189ba61673af5bd3ed2ee9e33be92bc0b9995ba commit 3189ba61673af5bd3ed2ee9e33be92bc0b9995ba Author: Vincenzo Maffione AuthorDate: 2021-01-09 21:35:07 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-09 21:35:07 +0000 netmap: iflib: fix asserts in netmap_fl_refill() When netmap_fl_refill() is called at initialization time (e.g., during netmap_iflib_register()), nic_i must be 0, since the free list is reinitialized. At the end of the refill cycle, nic_i must still be zero, because exactly N descriptors (N is the ring size) are refilled. This patch therefore fixes the assertions to check on nic_i rather than on nm_i. The current netmap_reset() may in fact cause nm_i to be != 0 while the device is resetting: this may happen when multiple non-cooperating processes open different subsets of the available netmap rings. PR: 252518 MFC after: 1 week --- sys/net/iflib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 1b86fd670ac4..cf02b1574c10 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -883,6 +883,7 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init) iru_init(&iru, rxq, 0 /* flid */); map = fl->ifl_sds.ifsd_map; nic_i = fl->ifl_pidx; + MPASS(!init || nic_i == 0); /* on init/reset, nic_i must be 0 */ MPASS(nic_i == netmap_idx_k2n(kring, nm_i)); DBG_COUNTER_INC(fl_refills); while (n > 0) { @@ -923,7 +924,7 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init) ctx->isc_rxd_refill(ctx->ifc_softc, &iru); } fl->ifl_pidx = nic_i; - MPASS(!init || nm_i == 0); + MPASS(!init || nic_i == 0); /* on init/reset nic_i wraps around to 0 */ MPASS(nm_i == kring->rhead); kring->nr_hwcur = nm_i; From owner-dev-commits-src-all@freebsd.org Sat Jan 9 22:17:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C98804E49CB; Sat, 9 Jan 2021 22:17:43 +0000 (UTC) (envelope-from git@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 4DCvVH52Nbz4Z85; Sat, 9 Jan 2021 22:17:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AC9F1D6B2; Sat, 9 Jan 2021 22:17:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109MHhlQ008681; Sat, 9 Jan 2021 22:17:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109MHhHt008680; Sat, 9 Jan 2021 22:17:43 GMT (envelope-from git) Date: Sat, 9 Jan 2021 22:17:43 GMT Message-Id: <202101092217.109MHhHt008680@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 7ba6ecf216fb - main - netmap: refactor netmap_reset MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7ba6ecf216fb15e8b147db268b91d9b82c5a0682 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 22:17:43 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=7ba6ecf216fb15e8b147db268b91d9b82c5a0682 commit 7ba6ecf216fb15e8b147db268b91d9b82c5a0682 Author: Vincenzo Maffione AuthorDate: 2021-01-09 22:07:24 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-09 22:07:24 +0000 netmap: refactor netmap_reset The netmap_reset() function is meant to be called by the driver when they initialize (or re-initialize) a hardware ring. However, since the introduction of support for opening (in netmap mode) a subset of the available rings, netmap_reset() may be called multiple times on actively used rings, causing both kring and netmap ring to transition to an inconsistent state. This changes improves the situation by resetting all the indices fields of the kring to 0, as expected after the reinitialization of a hardware ring. PR: 252518 MFC after: 1 week --- sys/dev/netmap/netmap.c | 65 +++++++++++++++---------------------------------- 1 file changed, 20 insertions(+), 45 deletions(-) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index aa3bb1843ba5..cf85671cae55 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -4066,75 +4066,50 @@ done: /* - * netmap_reset() is called by the driver routines when reinitializing - * a ring. The driver is in charge of locking to protect the kring. - * If native netmap mode is not set just return NULL. - * If native netmap mode is set, in particular, we have to set nr_mode to - * NKR_NETMAP_ON. + * Reset function to be called by the driver routines when reinitializing + * a hardware ring. The driver is in charge of locking to protect the kring + * while this operation is being performed. + * This is normally done by calling netmap_disable_all_rings() before + * triggering a reset. + * If the kring is not in netmap mode, return NULL to inform the caller + * that this is the case. + * If the kring is in netmap mode, reset the kring indices to 0. + * In any case, adjust kring->nr_mode. */ struct netmap_slot * netmap_reset(struct netmap_adapter *na, enum txrx tx, u_int n, u_int new_cur) { struct netmap_kring *kring; - int new_hwofs, lim; if (!nm_native_on(na)) { nm_prdis("interface not in native netmap mode"); return NULL; /* nothing to reinitialize */ } - /* XXX note- in the new scheme, we are not guaranteed to be - * under lock (e.g. when called on a device reset). - * In this case, we should set a flag and do not trust too - * much the values. In practice: TODO - * - set a RESET flag somewhere in the kring - * - do the processing in a conservative way - * - let the *sync() fixup at the end. - */ if (tx == NR_TX) { if (n >= na->num_tx_rings) return NULL; kring = na->tx_rings[n]; - if (kring->nr_pending_mode == NKR_NETMAP_OFF) { - kring->nr_mode = NKR_NETMAP_OFF; - return NULL; - } - - // XXX check whether we should use hwcur or rcur - new_hwofs = kring->nr_hwcur - new_cur; } else { if (n >= na->num_rx_rings) return NULL; kring = na->rx_rings[n]; - - if (kring->nr_pending_mode == NKR_NETMAP_OFF) { - kring->nr_mode = NKR_NETMAP_OFF; - return NULL; - } - - new_hwofs = kring->nr_hwtail - new_cur; } - lim = kring->nkr_num_slots - 1; - if (new_hwofs > lim) - new_hwofs -= lim + 1; - - /* Always set the new offset value and realign the ring. */ - if (netmap_debug & NM_DEBUG_ON) - nm_prinf("%s %s%d hwofs %d -> %d, hwtail %d -> %d", - na->name, - tx == NR_TX ? "TX" : "RX", n, - kring->nkr_hwofs, new_hwofs, - kring->nr_hwtail, - tx == NR_TX ? lim : kring->nr_hwtail); - kring->nkr_hwofs = new_hwofs; - if (tx == NR_TX) { - kring->nr_hwtail = kring->nr_hwcur + lim; - if (kring->nr_hwtail > lim) - kring->nr_hwtail -= lim + 1; + if (kring->nr_pending_mode == NKR_NETMAP_OFF) { + kring->nr_mode = NKR_NETMAP_OFF; + return NULL; + } + if (netmap_verbose) { + nm_prinf("%s, was: hc %u h %u c %u ht %u", kring->name, + kring->nr_hwcur, kring->ring->head, + kring->ring->cur, kring->nr_hwtail); } + /* For the moment being, nkr_hwofs is not used. */ + kring->rhead = kring->rcur = kring->nr_hwcur = kring->nkr_hwofs = 0; + kring->nr_hwtail = (tx == NR_TX) ? (kring->nkr_num_slots - 1) : 0; /* * Wakeup on the individual and global selwait From owner-dev-commits-src-all@freebsd.org Sat Jan 9 22:56:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 80F554E5C2E; Sat, 9 Jan 2021 22:56:41 +0000 (UTC) (envelope-from git@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 4DCwMF3J99z4ccw; Sat, 9 Jan 2021 22:56:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 642FD1DF21; Sat, 9 Jan 2021 22:56:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109MufK2060089; Sat, 9 Jan 2021 22:56:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109Muf3s060088; Sat, 9 Jan 2021 22:56:41 GMT (envelope-from git) Date: Sat, 9 Jan 2021 22:56:41 GMT Message-Id: <202101092256.109Muf3s060088@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 9ac59d42c0b4 - main - netmap: vtnet: stop krings during interface reset MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ac59d42c0b4b6cd9c36a5dace7f49753c2e175a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 22:56:41 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=9ac59d42c0b4b6cd9c36a5dace7f49753c2e175a commit 9ac59d42c0b4b6cd9c36a5dace7f49753c2e175a Author: Vincenzo Maffione AuthorDate: 2021-01-09 22:34:10 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-09 22:34:52 +0000 netmap: vtnet: stop krings during interface reset Similarly to what done for iflib in 1d238b07d5d4d9660ae0e, this patch prevents access to the krings during the interface reset triggered by netmap_register(). MFC after: 1 week --- sys/dev/netmap/if_vtnet_netmap.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/dev/netmap/if_vtnet_netmap.h b/sys/dev/netmap/if_vtnet_netmap.h index 0f686ed60788..a44cc13baae2 100644 --- a/sys/dev/netmap/if_vtnet_netmap.h +++ b/sys/dev/netmap/if_vtnet_netmap.h @@ -40,6 +40,9 @@ vtnet_netmap_reg(struct netmap_adapter *na, int state) struct ifnet *ifp = na->ifp; struct vtnet_softc *sc = ifp->if_softc; + /* Stop all txsync/rxsync and disable them. */ + netmap_disable_all_rings(ifp); + /* * Trigger a device reinit, asking vtnet_init_locked() to * also enter or exit netmap mode. @@ -50,7 +53,10 @@ vtnet_netmap_reg(struct netmap_adapter *na, int state) : VTNET_INIT_NETMAP_EXIT); VTNET_CORE_UNLOCK(sc); - return 0; + /* Enable txsync/rxsync again. */ + netmap_enable_all_rings(ifp); + + return (0); } From owner-dev-commits-src-all@freebsd.org Sat Jan 9 23:28:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2A2214E5D72; Sat, 9 Jan 2021 23:28:07 +0000 (UTC) (envelope-from git@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 4DCx3W0kDwz4f21; Sat, 9 Jan 2021 23:28:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B47D1E463; Sat, 9 Jan 2021 23:28:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 109NS6dM099291; Sat, 9 Jan 2021 23:28:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 109NS6cW099290; Sat, 9 Jan 2021 23:28:06 GMT (envelope-from git) Date: Sat, 9 Jan 2021 23:28:06 GMT Message-Id: <202101092328.109NS6cW099290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Neel Chauhan Subject: git: 408c514f7398 - main - linuxkpi: Fix the "error: unknown type name 'u32'" compilation issue when building the Intel QAT/QuickAssist driver. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 408c514f7398c457c580465ede2107a0325126ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 23:28:07 -0000 The branch main has been updated by nc (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=408c514f7398c457c580465ede2107a0325126ef commit 408c514f7398c457c580465ede2107a0325126ef Author: Neel Chauhan AuthorDate: 2021-01-09 23:25:55 +0000 Commit: Neel Chauhan CommitDate: 2021-01-09 23:27:04 +0000 linuxkpi: Fix the "error: unknown type name 'u32'" compilation issue when building the Intel QAT/QuickAssist driver. Approved by: hselasky, kib Differential Revision: https://reviews.freebsd.org/D28055 --- sys/compat/linuxkpi/common/include/linux/random.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/include/linux/random.h b/sys/compat/linuxkpi/common/include/linux/random.h index 14ea88237e1b..31d8b996aa0b 100644 --- a/sys/compat/linuxkpi/common/include/linux/random.h +++ b/sys/compat/linuxkpi/common/include/linux/random.h @@ -32,6 +32,7 @@ #ifndef _LINUX_RANDOM_H_ #define _LINUX_RANDOM_H_ +#include #include #include From owner-dev-commits-src-all@freebsd.org Sun Jan 10 00:17:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DA9374E7716; Sun, 10 Jan 2021 00:17:30 +0000 (UTC) (envelope-from git@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 4DCy8V5hL6z4hJ7; Sun, 10 Jan 2021 00:17:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B55DB1EFAF; Sun, 10 Jan 2021 00:17:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A0HUoH063965; Sun, 10 Jan 2021 00:17:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A0HUpU063964; Sun, 10 Jan 2021 00:17:30 GMT (envelope-from git) Date: Sun, 10 Jan 2021 00:17:30 GMT Message-Id: <202101100017.10A0HUpU063964@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 19cca0b9613d - main - aio: fix the tests when ZFS is not available MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 19cca0b9613d7c3058e41baf0204245119732235 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 00:17:30 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=19cca0b9613d7c3058e41baf0204245119732235 commit 19cca0b9613d7c3058e41baf0204245119732235 Author: Alan Somers AuthorDate: 2021-01-10 00:14:55 +0000 Commit: Alan Somers CommitDate: 2021-01-10 00:16:38 +0000 aio: fix the tests when ZFS is not available Don't try to cleanup the zpool if we couldn't create a zpool in the first place. Submitted by: tmunro MFC-with: 022ca2fc7fe08d51f33a1d23a9be49e6d132914e --- sys/contrib/openzfs/module/zfs/vdev.c | 1 + tests/sys/aio/aio_test.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/sys/contrib/openzfs/module/zfs/vdev.c b/sys/contrib/openzfs/module/zfs/vdev.c index 7ffe924212da..0b96c52669bd 100644 --- a/sys/contrib/openzfs/module/zfs/vdev.c +++ b/sys/contrib/openzfs/module/zfs/vdev.c @@ -3263,6 +3263,7 @@ vdev_load(vdev_t *vd) /* * Recursively load all children. + * TODO: parallelize. */ for (int c = 0; c < vd->vdev_children; c++) { error = vdev_load(vd->vdev_child[c]); diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c index f563ec5fa5d9..b34e7c13f5a4 100644 --- a/tests/sys/aio/aio_test.c +++ b/tests/sys/aio/aio_test.c @@ -943,6 +943,10 @@ aio_zvol_cleanup(void) char cmd[160]; pidfile = fopen("pidfile", "r"); + if (pidfile == NULL && errno == ENOENT) { + /* Setup probably failed */ + return; + } ATF_REQUIRE_MSG(NULL != pidfile, "fopen: %s", strerror(errno)); ATF_REQUIRE_EQ(1, fscanf(pidfile, "%d", &testpid)); fclose(pidfile); From owner-dev-commits-src-all@freebsd.org Sun Jan 10 00:45:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DE4914E7F8F; Sun, 10 Jan 2021 00:45:17 +0000 (UTC) (envelope-from git@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 4DCymY4Cncz4j4D; Sun, 10 Jan 2021 00:45:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C22E1F599; Sun, 10 Jan 2021 00:45:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A0jFCO002887; Sun, 10 Jan 2021 00:45:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A0jFIb002886; Sun, 10 Jan 2021 00:45:15 GMT (envelope-from git) Date: Sun, 10 Jan 2021 00:45:15 GMT Message-Id: <202101100045.10A0jFIb002886@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 811f08c1cf41 - main - amd64 pmap: add comment explaining TLB invalidation modes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 811f08c1cf417306fd9590e062625ca847cb572c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 00:45:18 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=811f08c1cf417306fd9590e062625ca847cb572c commit 811f08c1cf417306fd9590e062625ca847cb572c Author: Konstantin Belousov AuthorDate: 2020-12-21 17:51:02 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 00:44:42 +0000 amd64 pmap: add comment explaining TLB invalidation modes. Requested and reviewed by: alc Discussed with: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25815 --- sys/amd64/amd64/pmap.c | 161 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 144 insertions(+), 17 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 245a94f1d5b9..5267203d7473 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -2693,28 +2693,155 @@ pmap_update_pde_invalidate(pmap_t pmap, vm_offset_t va, pd_entry_t newpde) invltlb_glob(); } } -#ifdef SMP /* - * For SMP, these functions have to use the IPI mechanism for coherence. + * The amd64 pmap uses different approaches to TLB invalidation + * depending on the kernel configuration, available hardware features, + * and known hardware errata. The kernel configuration option that + * has the greatest operational impact on TLB invalidation is PTI, + * which is enabled automatically on affected Intel CPUs. The most + * impactful hardware features are first PCID, and then INVPCID + * instruction presence. PCID usage is quite different for PTI + * vs. non-PTI. * - * N.B.: Before calling any of the following TLB invalidation functions, - * the calling processor must ensure that all stores updating a non- - * kernel page table are globally performed. Otherwise, another - * processor could cache an old, pre-update entry without being - * invalidated. This can happen one of two ways: (1) The pmap becomes - * active on another processor after its pm_active field is checked by - * one of the following functions but before a store updating the page - * table is globally performed. (2) The pmap becomes active on another - * processor before its pm_active field is checked but due to - * speculative loads one of the following functions stills reads the - * pmap as inactive on the other processor. - * - * The kernel page table is exempt because its pm_active field is - * immutable. The kernel page table is always active on every - * processor. + * * Kernel Page Table Isolation (PTI or KPTI) is used to mitigate + * the Meltdown bug in some Intel CPUs. Under PTI, each user address + * space is served by two page tables, user and kernel. The user + * page table only maps user space and a kernel trampoline. The + * kernel trampoline includes the entirety of the kernel text but + * only the kernel data that is needed to switch from user to kernel + * mode. The kernel page table maps the user and kernel address + * spaces in their entirety. It is identical to the per-process + * page table used in non-PTI mode. + * + * User page tables are only used when the CPU is in user mode. + * Consequently, some TLB invalidations can be postponed until the + * switch from kernel to user mode. In contrast, the user + * space part of the kernel page table is used for copyout(9), so + * TLB invalidations on this page table cannot be similarly postponed. + * + * The existence of a user mode page table for the given pmap is + * indicated by a pm_ucr3 value that differs from PMAP_NO_CR3, in + * which case pm_ucr3 contains the %cr3 register value for the user + * mode page table's root. + * + * * The pm_active bitmask indicates which CPUs currently have the + * pmap active. A CPU's bit is set on context switch to the pmap, and + * cleared on switching off this CPU. For the kernel page table, + * the pm_active field is immutable and contains all CPUs. The + * kernel page table is always logically active on every processor, + * but not necessarily in use by the hardware, e.g., in PTI mode. + * + * When requesting invalidation of virtual addresses with + * pmap_invalidate_XXX() functions, the pmap sends shootdown IPIs to + * all CPUs recorded as active in pm_active. Updates to and reads + * from pm_active are not synchronized, and so they may race with + * each other. Shootdown handlers are prepared to handle the race. + * + * * PCID is an optional feature of the long mode x86 MMU where TLB + * entries are tagged with the 'Process ID' of the address space + * they belong to. This feature provides a limited namespace for + * process identifiers, 12 bits, supporting 4095 simultaneous IDs + * total. + * + * Allocation of a PCID to a pmap is done by an algorithm described + * in section 15.12, "Other TLB Consistency Algorithms", of + * Vahalia's book "Unix Internals". A PCID cannot be allocated for + * the whole lifetime of a pmap in pmap_pinit() due to the limited + * namespace. Instead, a per-CPU, per-pmap PCID is assigned when + * the CPU is about to start caching TLB entries from a pmap, + * i.e., on the context switch that activates the pmap on the CPU. + * + * The PCID allocator maintains a per-CPU, per-pmap generation + * count, pm_gen, which is incremented each time a new PCID is + * allocated. On TLB invalidation, the generation counters for the + * pmap are zeroed, which signals the context switch code that the + * previously allocated PCID is no longer valid. Effectively, + * zeroing any of these counters triggers a TLB shootdown for the + * given CPU/address space, due to the allocation of a new PCID. + * + * Zeroing can be performed remotely. Consequently, if a pmap is + * inactive on a CPU, then a TLB shootdown for that pmap and CPU can + * be initiated by an ordinary memory access to reset the target + * CPU's generation count within the pmap. The CPU initiating the + * TLB shootdown does not need to send an IPI to the target CPU. + * + * * PTI + PCID. The available PCIDs are divided into two sets: PCIDs + * for complete (kernel) page tables, and PCIDs for user mode page + * tables. A user PCID value is obtained from the kernel PCID value + * by setting the highest bit, 11, to 1 (0x800 == PMAP_PCID_USER_PT). + * + * User space page tables are activated on return to user mode, by + * loading pm_ucr3 into %cr3. If the PCPU(ucr3_load_mask) requests + * clearing bit 63 of the loaded ucr3, this effectively causes + * complete invalidation of the user mode TLB entries for the + * current pmap. In which case, local invalidations of individual + * pages in the user page table are skipped. + * + * * Local invalidation, all modes. If the requested invalidation is + * for a specific address or the total invalidation of a currently + * active pmap, then the TLB is flushed using INVLPG for a kernel + * page table, and INVPCID(INVPCID_CTXGLOB)/invltlb_glob() for a + * user space page table(s). + * + * If the INVPCID instruction is available, it is used to flush entries + * from the kernel page table. + * + * * mode: PTI disabled, PCID present. The kernel reserves PCID 0 for its + * address space, all other 4095 PCIDs are used for user mode spaces + * as described above. A context switch allocates a new PCID if + * the recorded PCID is zero or the recorded generation does not match + * the CPU's generation, effectively flushing the TLB for this address space. + * Total remote invalidation is performed by zeroing pm_gen for all CPUs. + * local user page: INVLPG + * local kernel page: INVLPG + * local user total: INVPCID(CTX) + * local kernel total: INVPCID(CTXGLOB) or invltlb_glob() + * remote user page, inactive pmap: zero pm_gen + * remote user page, active pmap: zero pm_gen + IPI:INVLPG + * (Both actions are required to handle the aforementioned pm_active races.) + * remote kernel page: IPI:INVLPG + * remote user total, inactive pmap: zero pm_gen + * remote user total, active pmap: zero pm_gen + IPI:(INVPCID(CTX) or + * reload %cr3) + * (See note above about pm_active races.) + * remote kernel total: IPI:(INVPCID(CTXGLOB) or invltlb_glob()) + * + * PTI enabled, PCID present. + * local user page: INVLPG for kpt, INVPCID(ADDR) or (INVLPG for ucr3) + * for upt + * local kernel page: INVLPG + * local user total: INVPCID(CTX) or reload %cr3 for kpt, clear PCID_SAVE + * on loading UCR3 into %cr3 for upt + * local kernel total: INVPCID(CTXGLOB) or invltlb_glob() + * remote user page, inactive pmap: zero pm_gen + * remote user page, active pmap: zero pm_gen + IPI:(INVLPG for kpt, + * INVPCID(ADDR) for upt) + * remote kernel page: IPI:INVLPG + * remote user total, inactive pmap: zero pm_gen + * remote user total, active pmap: zero pm_gen + IPI:(INVPCID(CTX) for kpt, + * clear PCID_SAVE on loading UCR3 into $cr3 for upt) + * remote kernel total: IPI:(INVPCID(CTXGLOB) or invltlb_glob()) + * + * No PCID. + * local user page: INVLPG + * local kernel page: INVLPG + * local user total: reload %cr3 + * local kernel total: invltlb_glob() + * remote user page, inactive pmap: - + * remote user page, active pmap: IPI:INVLPG + * remote kernel page: IPI:INVLPG + * remote user total, inactive pmap: - + * remote user total, active pmap: IPI:(reload %cr3) + * remote kernel total: IPI:invltlb_glob() + * Since on return to user mode, the reload of %cr3 with ucr3 causes + * TLB invalidation, no specific action is required for user page table. + * + * EPT. EPT pmaps do not map KVA, all mappings are userspace. + * XXX TODO */ +#ifdef SMP /* * Interrupt the cpus that are executing in the guest context. * This will force the vcpu to exit and the cached EPT mappings From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:41:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 192BE4EAAC4; Sun, 10 Jan 2021 02:41:51 +0000 (UTC) (envelope-from git@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 4DD1M30DS2z4pSC; Sun, 10 Jan 2021 02:41:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4D6820D25; Sun, 10 Jan 2021 02:41:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2foDX056858; Sun, 10 Jan 2021 02:41:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2foTj056857; Sun, 10 Jan 2021 02:41:50 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:41:50 GMT Message-Id: <202101100241.10A2foTj056857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 993a1699b194 - main - Style. Improve some KASSERTs messages. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 993a1699b1948d30c4903440e8d8b23a7d5fc6c5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:41:51 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=993a1699b1948d30c4903440e8d8b23a7d5fc6c5 commit 993a1699b1948d30c4903440e8d8b23a7d5fc6c5 Author: Konstantin Belousov AuthorDate: 2020-12-31 00:45:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:41:19 +0000 Style. Improve some KASSERTs messages. Reviewed by: jilles Tested by: pho MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27871 --- sys/kern/kern_proc.c | 8 +++----- sys/kern/kern_sig.c | 12 ++++++------ sys/kern/tty.c | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index abc3206c5a26..ea34631995b1 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -629,12 +629,10 @@ enterthispgrp(struct proc *p, struct pgrp *pgrp) PGRP_LOCK_ASSERT(p->p_pgrp, MA_NOTOWNED); SESS_LOCK_ASSERT(p->p_session, MA_NOTOWNED); KASSERT(pgrp->pg_session == p->p_session, - ("%s: pgrp's session %p, p->p_session %p.\n", - __func__, - pgrp->pg_session, - p->p_session)); + ("%s: pgrp's session %p, p->p_session %p proc %p\n", + __func__, pgrp->pg_session, p->p_session, p)); KASSERT(pgrp != p->p_pgrp, - ("%s: p belongs to pgrp.", __func__)); + ("%s: p %p belongs to pgrp %p", __func__, p, pgrp)); doenterpgrp(p, pgrp); diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index ed4dd52b66d3..b1b4ccf4357c 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2227,9 +2227,9 @@ tdsendsignal(struct proc *p, struct thread *td, int sig, ksiginfo_t *ksi) * is default; don't stop the process below if sleeping, * and don't clear any pending SIGCONT. */ - if ((prop & SIGPROP_TTYSTOP) && - (p->p_pgrp->pg_jobc == 0) && - (action == SIG_DFL)) { + if ((prop & SIGPROP_TTYSTOP) != 0 && + p->p_pgrp->pg_jobc == 0 && + action == SIG_DFL) { if (ksi && (ksi->ksi_flags & KSI_INS)) ksiginfo_tryfree(ksi); return (ret); @@ -2984,10 +2984,10 @@ issignal(struct thread *td) * should ignore tty stops. */ if (prop & SIGPROP_STOP) { - if (p->p_flag & - (P_TRACED | P_WEXIT | P_SINGLE_EXIT) || + if ((p->p_flag & (P_TRACED | P_WEXIT | + P_SINGLE_EXIT)) != 0 || (p->p_pgrp->pg_jobc == 0 && - prop & SIGPROP_TTYSTOP)) + (prop & SIGPROP_TTYSTOP) != 0)) break; /* == ignore */ if (TD_SBDRY_INTR(td)) { KASSERT((td->td_flags & TDF_SBDRY) != 0, diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 8d4d25a4ac0b..af4aebd18979 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -456,7 +456,7 @@ tty_wait_background(struct tty *tp, struct thread *td, int sig) } pg = p->p_pgrp; - if (p->p_flag & P_PPWAIT || pg->pg_jobc == 0) { + if ((p->p_flag & P_PPWAIT) != 0 || pg->pg_jobc == 0) { /* Don't allow the action to happen. */ PROC_UNLOCK(p); return (EIO); From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:41:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2B2A54EA9ED; Sun, 10 Jan 2021 02:41:52 +0000 (UTC) (envelope-from git@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 4DD1M40d11z4pSF; Sun, 10 Jan 2021 02:41:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 083E820B40; Sun, 10 Jan 2021 02:41:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2fp2q057382; Sun, 10 Jan 2021 02:41:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2fpe3057372; Sun, 10 Jan 2021 02:41:51 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:41:51 GMT Message-Id: <202101100241.10A2fpe3057372@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e0d83cd3e49f - main - issignal(): when handling STOP-like signals, drop sigacts mutex earlier. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e0d83cd3e49f0b9e16bc82ced7bd3b0ef9aa6a71 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:41:52 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e0d83cd3e49f0b9e16bc82ced7bd3b0ef9aa6a71 commit e0d83cd3e49f0b9e16bc82ced7bd3b0ef9aa6a71 Author: Konstantin Belousov AuthorDate: 2020-12-31 01:45:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:41:19 +0000 issignal(): when handling STOP-like signals, drop sigacts mutex earlier. Reviewed by: jilles Tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27871 --- sys/kern/kern_sig.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index b1b4ccf4357c..c5899f19ee08 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2984,17 +2984,20 @@ issignal(struct thread *td) * should ignore tty stops. */ if (prop & SIGPROP_STOP) { + mtx_unlock(&ps->ps_mtx); if ((p->p_flag & (P_TRACED | P_WEXIT | P_SINGLE_EXIT)) != 0 || (p->p_pgrp->pg_jobc == 0 && - (prop & SIGPROP_TTYSTOP) != 0)) + (prop & SIGPROP_TTYSTOP) != 0)) { + mtx_lock(&ps->ps_mtx); break; /* == ignore */ + } if (TD_SBDRY_INTR(td)) { KASSERT((td->td_flags & TDF_SBDRY) != 0, ("lost TDF_SBDRY")); + mtx_lock(&ps->ps_mtx); return (-1); } - mtx_unlock(&ps->ps_mtx); WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &p->p_mtx.lock_object, "Catching SIGSTOP"); sigqueue_delete(&td->td_sigqueue, sig); From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:41:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B4B804EA97B; Sun, 10 Jan 2021 02:41:53 +0000 (UTC) (envelope-from git@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 4DD1M53VP0z4pMH; Sun, 10 Jan 2021 02:41:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A2D72097F; Sun, 10 Jan 2021 02:41:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2fr0Q057587; Sun, 10 Jan 2021 02:41:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2frrf057586; Sun, 10 Jan 2021 02:41:53 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:41:53 GMT Message-Id: <202101100241.10A2frrf057586@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ef739c7373d8 - main - pgrp: Prevent use after free. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ef739c7373d8b3833979ad471b31cb9e215411fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:41:55 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ef739c7373d8b3833979ad471b31cb9e215411fd commit ef739c7373d8b3833979ad471b31cb9e215411fd Author: Konstantin Belousov AuthorDate: 2020-12-31 13:44:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:41:19 +0000 pgrp: Prevent use after free. Often, we have a process locked and need to get locked process group. In this case, because progress group lock is before process lock, unlocking process allows the group to be freed. See for instance tty_wait_background(). Make pgrp structures allocated from nofree zone, and ensure type stability of the pgrp mutex. Reviewed by: jilles Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27871 --- sys/kern/kern_proc.c | 20 +++++++++++++++----- sys/kern/kern_prot.c | 13 +++++-------- sys/sys/proc.h | 2 +- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index ea34631995b1..fab1df795799 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -98,7 +98,6 @@ __FBSDID("$FreeBSD$"); SDT_PROVIDER_DEFINE(proc); -MALLOC_DEFINE(M_PGRP, "pgrp", "process group header"); MALLOC_DEFINE(M_SESSION, "session", "session header"); static MALLOC_DEFINE(M_PROC, "proc", "Proc structures"); MALLOC_DEFINE(M_SUBPROC, "subproc", "Proc sub-structures"); @@ -112,6 +111,7 @@ static void fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp, int preferthread); static void pgadjustjobc(struct pgrp *pgrp, bool entering); static void pgdelete(struct pgrp *); +static int pgrp_init(void *mem, int size, int flags); static int proc_ctor(void *mem, int size, void *arg, int flags); static void proc_dtor(void *mem, int size, void *arg); static int proc_init(void *mem, int size, int flags); @@ -133,6 +133,7 @@ struct sx __exclusive_cache_line proctree_lock; struct mtx __exclusive_cache_line ppeers_lock; struct mtx __exclusive_cache_line procid_lock; uma_zone_t proc_zone; +uma_zone_t pgrp_zone; /* * The offset of various fields in struct proc and struct thread. @@ -196,6 +197,8 @@ procinit(void) proc_zone = uma_zcreate("PROC", sched_sizeof_proc(), proc_ctor, proc_dtor, proc_init, proc_fini, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + pgrp_zone = uma_zcreate("PGRP", sizeof(struct pgrp), NULL, NULL, + pgrp_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); uihashinit(); } @@ -299,6 +302,16 @@ proc_fini(void *mem, int size) #endif } +static int +pgrp_init(void *mem, int size, int flags) +{ + struct pgrp *pg; + + pg = mem; + mtx_init(&pg->pg_mtx, "process group", NULL, MTX_DEF | MTX_DUPOK); + return (0); +} + /* * PID space management. * @@ -570,8 +583,6 @@ enterpgrp(struct proc *p, pid_t pgid, struct pgrp *pgrp, struct session *sess) KASSERT(!SESS_LEADER(p), ("enterpgrp: session leader attempted setpgrp")); - mtx_init(&pgrp->pg_mtx, "process group", NULL, MTX_DEF | MTX_DUPOK); - if (sess != NULL) { /* * new session @@ -798,8 +809,7 @@ pgdelete(struct pgrp *pgrp) } proc_id_clear(PROC_ID_GROUP, pgrp->pg_id); - mtx_destroy(&pgrp->pg_mtx); - free(pgrp, M_PGRP); + uma_zfree(pgrp_zone, pgrp); sess_release(savesess); } diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 529a6de4b2c8..170e9598835e 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -333,7 +333,7 @@ sys_setsid(struct thread *td, struct setsid_args *uap) error = 0; pgrp = NULL; - newpgrp = malloc(sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); + newpgrp = uma_zalloc(pgrp_zone, M_WAITOK); newsess = malloc(sizeof(struct session), M_SESSION, M_WAITOK | M_ZERO); sx_xlock(&proctree_lock); @@ -351,10 +351,8 @@ sys_setsid(struct thread *td, struct setsid_args *uap) sx_xunlock(&proctree_lock); - if (newpgrp != NULL) - free(newpgrp, M_PGRP); - if (newsess != NULL) - free(newsess, M_SESSION); + uma_zfree(pgrp_zone, newpgrp); + free(newsess, M_SESSION); return (error); } @@ -393,7 +391,7 @@ sys_setpgid(struct thread *td, struct setpgid_args *uap) error = 0; - newpgrp = malloc(sizeof(struct pgrp), M_PGRP, M_WAITOK | M_ZERO); + newpgrp = uma_zalloc(pgrp_zone, M_WAITOK); sx_xlock(&proctree_lock); if (uap->pid != 0 && uap->pid != curp->p_pid) { @@ -456,8 +454,7 @@ done: sx_xunlock(&proctree_lock); KASSERT((error == 0) || (newpgrp != NULL), ("setpgid failed and newpgrp is NULL")); - if (newpgrp != NULL) - free(newpgrp, M_PGRP); + uma_zfree(pgrp_zone, newpgrp); return (error); } diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 33da4969c6ae..2a7f0740a0c3 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -864,7 +864,6 @@ struct proc { #ifdef MALLOC_DECLARE MALLOC_DECLARE(M_PARGS); -MALLOC_DECLARE(M_PGRP); MALLOC_DECLARE(M_SESSION); MALLOC_DECLARE(M_SUBPROC); #endif @@ -1022,6 +1021,7 @@ extern struct proclist allproc; /* List of all processes. */ extern struct proc *initproc, *pageproc; /* Process slots for init, pager. */ extern struct uma_zone *proc_zone; +extern struct uma_zone *pgrp_zone; struct proc *pfind(pid_t); /* Find process by id. */ struct proc *pfind_any(pid_t); /* Find (zombie) process by id. */ From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:41:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B23A04EAAD7; Sun, 10 Jan 2021 02:41:56 +0000 (UTC) (envelope-from git@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 4DD1M71t7Hz4pGs; Sun, 10 Jan 2021 02:41:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 513A0209C6; Sun, 10 Jan 2021 02:41:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2fsCx057606; Sun, 10 Jan 2021 02:41:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2fsDu057605; Sun, 10 Jan 2021 02:41:54 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:41:54 GMT Message-Id: <202101100241.10A2fsDu057605@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a008bdeda3b8 - main - tty_wait_background: improve locking. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a008bdeda3b8278fe600cf83ecf44acd1ccb30b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:41:57 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a008bdeda3b8278fe600cf83ecf44acd1ccb30b6 commit a008bdeda3b8278fe600cf83ecf44acd1ccb30b6 Author: Konstantin Belousov AuthorDate: 2020-12-31 13:45:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:41:20 +0000 tty_wait_background: improve locking. Increase the scope of the process group lock ownership. This ensures that we are consistent in returning EIO for tty write from an orphan and delivery of TTYOUT signals. Reviewed by: jilles Tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27871 --- sys/kern/tty.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/sys/kern/tty.c b/sys/kern/tty.c index af4aebd18979..1f86507a6025 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -423,7 +423,7 @@ tty_is_ctty(struct tty *tp, struct proc *p) int tty_wait_background(struct tty *tp, struct thread *td, int sig) { - struct proc *p = td->td_proc; + struct proc *p; struct pgrp *pg; ksiginfo_t ksi; int error; @@ -431,8 +431,22 @@ tty_wait_background(struct tty *tp, struct thread *td, int sig) MPASS(sig == SIGTTIN || sig == SIGTTOU); tty_assert_locked(tp); + p = td->td_proc; for (;;) { + pg = p->p_pgrp; + PGRP_LOCK(pg); PROC_LOCK(p); + + /* + * pg may no longer be our process group. + * Re-check after locking. + */ + if (p->p_pgrp != pg) { + PROC_UNLOCK(p); + PGRP_UNLOCK(pg); + continue; + } + /* * The process should only sleep, when: * - This terminal is the controlling terminal @@ -445,6 +459,7 @@ tty_wait_background(struct tty *tp, struct thread *td, int sig) if (!tty_is_ctty(tp, p) || p->p_pgrp == tp->t_pgrp) { /* Allow the action to happen. */ PROC_UNLOCK(p); + PGRP_UNLOCK(pg); return (0); } @@ -452,13 +467,14 @@ tty_wait_background(struct tty *tp, struct thread *td, int sig) SIGISMEMBER(td->td_sigmask, sig)) { /* Only allow them in write()/ioctl(). */ PROC_UNLOCK(p); + PGRP_UNLOCK(pg); return (sig == SIGTTOU ? 0 : EIO); } - pg = p->p_pgrp; if ((p->p_flag & P_PPWAIT) != 0 || pg->pg_jobc == 0) { /* Don't allow the action to happen. */ PROC_UNLOCK(p); + PGRP_UNLOCK(pg); return (EIO); } PROC_UNLOCK(p); @@ -473,20 +489,7 @@ tty_wait_background(struct tty *tp, struct thread *td, int sig) ksi.ksi_signo = sig; sig = 0; } - PGRP_LOCK(pg); - - /* - * pg may no longer be our process group. - * Re-check after locking process group. - */ - PROC_LOCK(p); - if (p->p_pgrp != pg) { - PROC_UNLOCK(p); - PGRP_UNLOCK(pg); - continue; - } - PROC_UNLOCK(p); pgsignal(pg, ksi.ksi_signo, 1, &ksi); PGRP_UNLOCK(pg); From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:42:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CA6EA4EACE9; Sun, 10 Jan 2021 02:42:00 +0000 (UTC) (envelope-from git@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 4DD1M81RhXz4pYd; Sun, 10 Jan 2021 02:41:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 765AA209C7; Sun, 10 Jan 2021 02:41:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2ftMs057624; Sun, 10 Jan 2021 02:41:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2ft9Q057623; Sun, 10 Jan 2021 02:41:55 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:41:55 GMT Message-Id: <202101100241.10A2ft9Q057623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 4daea938130b - main - Lock proctree in around fill_kinfo_proc(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4daea938130b4a219e01d678e9499f0bdb715f82 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:42:00 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4daea938130b4a219e01d678e9499f0bdb715f82 commit 4daea938130b4a219e01d678e9499f0bdb715f82 Author: Konstantin Belousov AuthorDate: 2020-12-31 22:29:40 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:41:20 +0000 Lock proctree in around fill_kinfo_proc(). Proctree lock is needed for correct calculation and collection of the job-control related data in kinfo_proc. There was even an XXX comment about it. Satisfy locking and lock ordering requirements by taking proctree lock around pass over each bucket in proc_iterate(), and in sysctl_kern_proc() and note_procstat_proc() for individual process reporting. Reviewed by: jilles Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27871 --- sys/kern/imgact_elf.c | 2 ++ sys/kern/kern_proc.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index f6482bfcfb21..4f5d5a9a0736 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -2386,8 +2386,10 @@ __elfN(note_procstat_proc)(void *arg, struct sbuf *sb, size_t *sizep) KASSERT(*sizep == size, ("invalid size")); structsize = sizeof(elf_kinfo_proc_t); sbuf_bcat(sb, &structsize, sizeof(structsize)); + sx_slock(&proctree_lock); PROC_LOCK(p); kern_proc_out(p, sb, ELF_KERN_PROC_MASK); + sx_sunlock(&proctree_lock); } *sizep = size; } diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index fab1df795799..c63d136a3046 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1653,6 +1653,7 @@ proc_iterate(int (*cb)(struct proc *, void *), void *cbarg) int error, i, j; for (i = 0; i < pidhashlock + 1; i++) { + sx_slock(&proctree_lock); sx_slock(&pidhashtbl_lock[i]); for (j = i; j <= pidhash; j += pidhashlock + 1) { LIST_FOREACH(p, &pidhashtbl[j], p_hash) { @@ -1662,11 +1663,13 @@ proc_iterate(int (*cb)(struct proc *, void *), void *cbarg) PROC_LOCK_ASSERT(p, MA_NOTOWNED); if (error != 0) { sx_sunlock(&pidhashtbl_lock[i]); + sx_sunlock(&proctree_lock); return (error); } } } sx_sunlock(&pidhashtbl_lock[i]); + sx_sunlock(&proctree_lock); } return (0); } @@ -1792,9 +1795,11 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) error = sysctl_wire_old_buffer(req, 0); if (error) return (error); + sx_slock(&proctree_lock); error = pget((pid_t)name[0], PGET_CANSEE, &p); if (error == 0) error = sysctl_out_proc(p, req, flags); + sx_sunlock(&proctree_lock); return (error); } From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:42:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8FA294EAB9E; Sun, 10 Jan 2021 02:42:03 +0000 (UTC) (envelope-from git@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 4DD1MB3pfWz4pbN; Sun, 10 Jan 2021 02:41:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A87BA20BCE; Sun, 10 Jan 2021 02:41:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2fuqu057642; Sun, 10 Jan 2021 02:41:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2fupG057641; Sun, 10 Jan 2021 02:41:56 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:41:56 GMT Message-Id: <202101100241.10A2fupG057641@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: cf4f802e77a3 - main - kinfo_proc: move job-control related data collection into a new helper. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf4f802e77a3a438bce5335b67c88ac6f0e21a6e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:42:04 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cf4f802e77a3a438bce5335b67c88ac6f0e21a6e commit cf4f802e77a3a438bce5335b67c88ac6f0e21a6e Author: Konstantin Belousov AuthorDate: 2020-12-31 22:46:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:41:20 +0000 kinfo_proc: move job-control related data collection into a new helper. This improves code structure and allows to put the lock asserts right into place where the locks are needed. Also move zeroing of the kinfo_proc structure from fill_kinfo_proc_only() to fill_kinfo_proc(), this looks more symmetrical. Reviewed by: jilles Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27871 --- sys/kern/kern_proc.c | 86 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 35 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index c63d136a3046..552a17d32abc 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1133,22 +1133,18 @@ fill_kinfo_aggregate(struct proc *p, struct kinfo_proc *kp) } /* - * Clear kinfo_proc and fill in any information that is common - * to all threads in the process. + * Fill in any information that is common to all threads in the process. * Must be called with the target process locked. */ static void fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp) { struct thread *td0; - struct tty *tp; - struct session *sp; struct ucred *cred; struct sigacts *ps; struct timeval boottime; PROC_LOCK_ASSERT(p, MA_OWNED); - bzero(kp, sizeof(*kp)); kp->ki_structsize = sizeof(*kp); kp->ki_paddr = p; @@ -1241,36 +1237,6 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp) FOREACH_THREAD_IN_PROC(p, td0) kp->ki_cow += td0->td_cow; - tp = NULL; - if (p->p_pgrp) { - kp->ki_pgid = p->p_pgrp->pg_id; - kp->ki_jobc = p->p_pgrp->pg_jobc; - sp = p->p_pgrp->pg_session; - - if (sp != NULL) { - kp->ki_sid = sp->s_sid; - SESS_LOCK(sp); - strlcpy(kp->ki_login, sp->s_login, - sizeof(kp->ki_login)); - if (sp->s_ttyvp) - kp->ki_kiflag |= KI_CTTY; - if (SESS_LEADER(p)) - kp->ki_kiflag |= KI_SLEADER; - /* XXX proctree_lock */ - tp = sp->s_ttyp; - SESS_UNLOCK(sp); - } - } - if ((p->p_flag & P_CONTROLT) && tp != NULL) { - kp->ki_tdev = tty_udev(tp); - kp->ki_tdev_freebsd11 = kp->ki_tdev; /* truncate */ - kp->ki_tpgid = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID; - if (tp->t_session) - kp->ki_tsid = tp->t_session->s_sid; - } else { - kp->ki_tdev = NODEV; - kp->ki_tdev_freebsd11 = kp->ki_tdev; /* truncate */ - } if (p->p_comm[0] != '\0') strlcpy(kp->ki_comm, p->p_comm, sizeof(kp->ki_comm)); if (p->p_sysent && p->p_sysent->sv_name != NULL && @@ -1287,6 +1253,53 @@ fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp) } } +/* + * Fill job-related process information. + */ +static void +fill_kinfo_proc_pgrp(struct proc *p, struct kinfo_proc *kp) +{ + struct tty *tp; + struct session *sp; + struct pgrp *pgrp; + + sx_assert(&proctree_lock, SA_LOCKED); + PROC_LOCK_ASSERT(p, MA_OWNED); + + pgrp = p->p_pgrp; + if (pgrp == NULL) + return; + + kp->ki_pgid = pgrp->pg_id; + kp->ki_jobc = pgrp->pg_jobc; + + sp = pgrp->pg_session; + tp = NULL; + + if (sp != NULL) { + kp->ki_sid = sp->s_sid; + SESS_LOCK(sp); + strlcpy(kp->ki_login, sp->s_login, sizeof(kp->ki_login)); + if (sp->s_ttyvp) + kp->ki_kiflag |= KI_CTTY; + if (SESS_LEADER(p)) + kp->ki_kiflag |= KI_SLEADER; + tp = sp->s_ttyp; + SESS_UNLOCK(sp); + } + + if ((p->p_flag & P_CONTROLT) && tp != NULL) { + kp->ki_tdev = tty_udev(tp); + kp->ki_tdev_freebsd11 = kp->ki_tdev; /* truncate */ + kp->ki_tpgid = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID; + if (tp->t_session) + kp->ki_tsid = tp->t_session->s_sid; + } else { + kp->ki_tdev = NODEV; + kp->ki_tdev_freebsd11 = kp->ki_tdev; /* truncate */ + } +} + /* * Fill in information that is thread specific. Must be called with * target process locked. If 'preferthread' is set, overwrite certain @@ -1409,6 +1422,9 @@ fill_kinfo_proc(struct proc *p, struct kinfo_proc *kp) MPASS(FIRST_THREAD_IN_PROC(p) != NULL); + bzero(kp, sizeof(*kp)); + + fill_kinfo_proc_pgrp(p,kp); fill_kinfo_proc_only(p, kp); fill_kinfo_thread(FIRST_THREAD_IN_PROC(p), kp, 0); fill_kinfo_aggregate(p, kp); From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:42:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CA6214EAAE2; Sun, 10 Jan 2021 02:42:05 +0000 (UTC) (envelope-from git@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 4DD1MF0b1Lz4pbX; Sun, 10 Jan 2021 02:42:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C341020D26; Sun, 10 Jan 2021 02:41:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2fvSM057664; Sun, 10 Jan 2021 02:41:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2fvtm057663; Sun, 10 Jan 2021 02:41:57 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:41:57 GMT Message-Id: <202101100241.10A2fvtm057663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 5844bd058aed - main - jobc: rework detection of orphaned groups. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5844bd058aed6f3d0c8cbbddd6aa95993ece0189 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:42:06 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5844bd058aed6f3d0c8cbbddd6aa95993ece0189 commit 5844bd058aed6f3d0c8cbbddd6aa95993ece0189 Author: Konstantin Belousov AuthorDate: 2020-12-29 00:41:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:41:20 +0000 jobc: rework detection of orphaned groups. Instead of trying to maintain pg_jobc counter on each process group update (and sometimes before), just calculate the counter when needed. Still, for the benefit of the signal delivery code, explicitly mark orphaned groups as such with the new process group flag. This way we prevent bugs in the corner cases where updates to the counter were missed due to complicated configuration of p_pptr/p_opptr/real_parent (debugger). Since we need to iterate over all children of the process on exit, this change mostly affects the process group entry and leave, where we need to iterate all process group members to detect orpaned status. (For MFC, keep pg_jobc around but unused). Reported by: jhb Reviewed by: jilles Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27871 --- lib/libkvm/kvm_proc.c | 2 +- sys/kern/kern_proc.c | 209 ++++++++++++++------------------------------------ sys/kern/kern_sig.c | 6 +- sys/kern/tty.c | 8 +- sys/sys/proc.h | 4 +- 5 files changed, 68 insertions(+), 161 deletions(-) diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c index 71cfd5f1629b..63f7c2a8a824 100644 --- a/lib/libkvm/kvm_proc.c +++ b/lib/libkvm/kvm_proc.c @@ -273,7 +273,7 @@ kvm_proclist(kvm_t *kd, int what, int arg, struct proc *p, return (-1); } kp->ki_pgid = pgrp.pg_id; - kp->ki_jobc = pgrp.pg_jobc; + kp->ki_jobc = -1; /* Or calculate? Arguably not. */ if (KREAD(kd, (u_long)pgrp.pg_session, &sess)) { _kvm_err(kd, kd->program, "can't read session at %p", pgrp.pg_session); diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 552a17d32abc..269705205fbc 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -102,14 +102,12 @@ MALLOC_DEFINE(M_SESSION, "session", "session header"); static MALLOC_DEFINE(M_PROC, "proc", "Proc structures"); MALLOC_DEFINE(M_SUBPROC, "subproc", "Proc sub-structures"); -static void fixjobc_enterpgrp(struct proc *p, struct pgrp *pgrp); static void doenterpgrp(struct proc *, struct pgrp *); static void orphanpg(struct pgrp *pg); static void fill_kinfo_aggregate(struct proc *p, struct kinfo_proc *kp); static void fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp); static void fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp, int preferthread); -static void pgadjustjobc(struct pgrp *pgrp, bool entering); static void pgdelete(struct pgrp *); static int pgrp_init(void *mem, int size, int flags); static int proc_ctor(void *mem, int size, void *arg, int flags); @@ -612,13 +610,13 @@ enterpgrp(struct proc *p, pid_t pgid, struct pgrp *pgrp, struct session *sess) pgrp->pg_id = pgid; proc_id_set(PROC_ID_GROUP, p->p_pid); LIST_INIT(&pgrp->pg_members); + pgrp->pg_flags = 0; /* * As we have an exclusive lock of proctree_lock, * this should not deadlock. */ LIST_INSERT_HEAD(PGRPHASH(pgid), pgrp, pg_hash); - pgrp->pg_jobc = 0; SLIST_INIT(&pgrp->pg_sigiolst); PGRP_UNLOCK(pgrp); @@ -658,6 +656,7 @@ static bool isjobproc(struct proc *q, struct pgrp *pgrp) { sx_assert(&proctree_lock, SX_LOCKED); + return (q->p_pgrp != pgrp && q->p_pgrp->pg_session == pgrp->pg_session); } @@ -667,7 +666,7 @@ jobc_reaper(struct proc *p) { struct proc *pp; - sx_assert(&proctree_lock, SX_LOCKED); + sx_assert(&proctree_lock, SA_LOCKED); for (pp = p;;) { pp = pp->p_reaper; @@ -678,43 +677,40 @@ jobc_reaper(struct proc *p) } static struct proc * -jobc_parent(struct proc *p) +jobc_parent(struct proc *p, struct proc *p_exiting) { struct proc *pp; - sx_assert(&proctree_lock, SX_LOCKED); + sx_assert(&proctree_lock, SA_LOCKED); pp = proc_realparent(p); - if (pp->p_pptr == NULL || + if (pp->p_pptr == NULL || pp == p_exiting || (pp->p_treeflag & P_TREE_GRPEXITED) == 0) return (pp); return (jobc_reaper(pp)); } -#ifdef INVARIANTS -static void -check_pgrp_jobc(struct pgrp *pgrp) +static int +pgrp_calc_jobc(struct pgrp *pgrp) { struct proc *q; int cnt; - sx_assert(&proctree_lock, SX_LOCKED); - PGRP_LOCK_ASSERT(pgrp, MA_NOTOWNED); +#ifdef INVARIANTS + if (!mtx_owned(&pgrp->pg_mtx)) + sx_assert(&proctree_lock, SA_LOCKED); +#endif cnt = 0; - PGRP_LOCK(pgrp); LIST_FOREACH(q, &pgrp->pg_members, p_pglist) { if ((q->p_treeflag & P_TREE_GRPEXITED) != 0 || q->p_pptr == NULL) continue; - if (isjobproc(jobc_parent(q), pgrp)) + if (isjobproc(jobc_parent(q, NULL), pgrp)) cnt++; } - KASSERT(pgrp->pg_jobc == cnt, ("pgrp %d %p pg_jobc %d cnt %d", - pgrp->pg_id, pgrp, pgrp->pg_jobc, cnt)); - PGRP_UNLOCK(pgrp); + return (cnt); } -#endif /* * Move p to a process group @@ -723,6 +719,7 @@ static void doenterpgrp(struct proc *p, struct pgrp *pgrp) { struct pgrp *savepgrp; + struct proc *pp; sx_assert(&proctree_lock, SX_XLOCKED); PROC_LOCK_ASSERT(p, MA_NOTOWNED); @@ -731,24 +728,19 @@ doenterpgrp(struct proc *p, struct pgrp *pgrp) SESS_LOCK_ASSERT(p->p_session, MA_NOTOWNED); savepgrp = p->p_pgrp; - -#ifdef INVARIANTS - check_pgrp_jobc(pgrp); - check_pgrp_jobc(savepgrp); -#endif - - /* - * Adjust eligibility of affected pgrps to participate in job control. - */ - fixjobc_enterpgrp(p, pgrp); + pp = jobc_parent(p, NULL); PGRP_LOCK(pgrp); PGRP_LOCK(savepgrp); + if (isjobproc(pp, savepgrp) && pgrp_calc_jobc(savepgrp) == 1) + orphanpg(savepgrp); PROC_LOCK(p); LIST_REMOVE(p, p_pglist); p->p_pgrp = pgrp; PROC_UNLOCK(p); LIST_INSERT_HEAD(&pgrp->pg_members, p, p_pglist); + if (isjobproc(pp, pgrp)) + pgrp->pg_flags &= ~PGRP_ORPHANED; PGRP_UNLOCK(savepgrp); PGRP_UNLOCK(pgrp); if (LIST_EMPTY(&savepgrp->pg_members)) @@ -813,102 +805,6 @@ pgdelete(struct pgrp *pgrp) sess_release(savesess); } -static void -pgadjustjobc(struct pgrp *pgrp, bool entering) -{ - - PGRP_LOCK(pgrp); - if (entering) { - MPASS(pgrp->pg_jobc >= 0); - pgrp->pg_jobc++; - } else { - MPASS(pgrp->pg_jobc > 0); - --pgrp->pg_jobc; - if (pgrp->pg_jobc == 0) - orphanpg(pgrp); - } - PGRP_UNLOCK(pgrp); -} - -static void -fixjobc_enterpgrp_q(struct pgrp *pgrp, struct proc *p, struct proc *q, bool adj) -{ - struct pgrp *childpgrp; - bool future_jobc; - - sx_assert(&proctree_lock, SX_LOCKED); - - if ((q->p_treeflag & P_TREE_GRPEXITED) != 0) - return; - childpgrp = q->p_pgrp; - future_jobc = childpgrp != pgrp && - childpgrp->pg_session == pgrp->pg_session; - - if ((adj && !isjobproc(p, childpgrp) && future_jobc) || - (!adj && isjobproc(p, childpgrp) && !future_jobc)) - pgadjustjobc(childpgrp, adj); -} - -/* - * Adjust pgrp jobc counters when specified process changes process group. - * We count the number of processes in each process group that "qualify" - * the group for terminal job control (those with a parent in a different - * process group of the same session). If that count reaches zero, the - * process group becomes orphaned. Check both the specified process' - * process group and that of its children. - * We increment eligibility counts before decrementing, otherwise we - * could reach 0 spuriously during the decrement. - */ -static void -fixjobc_enterpgrp(struct proc *p, struct pgrp *pgrp) -{ - struct proc *q; - - sx_assert(&proctree_lock, SX_LOCKED); - PROC_LOCK_ASSERT(p, MA_NOTOWNED); - PGRP_LOCK_ASSERT(pgrp, MA_NOTOWNED); - SESS_LOCK_ASSERT(pgrp->pg_session, MA_NOTOWNED); - - if (p->p_pgrp == pgrp) - return; - - if (isjobproc(jobc_parent(p), pgrp)) - pgadjustjobc(pgrp, true); - LIST_FOREACH(q, &p->p_children, p_sibling) { - if ((q->p_treeflag & P_TREE_ORPHANED) != 0) - continue; - fixjobc_enterpgrp_q(pgrp, p, q, true); - } - LIST_FOREACH(q, &p->p_orphans, p_orphan) - fixjobc_enterpgrp_q(pgrp, p, q, true); - - if (isjobproc(jobc_parent(p), p->p_pgrp)) - pgadjustjobc(p->p_pgrp, false); - LIST_FOREACH(q, &p->p_children, p_sibling) { - if ((q->p_treeflag & P_TREE_ORPHANED) != 0) - continue; - fixjobc_enterpgrp_q(pgrp, p, q, false); - } - LIST_FOREACH(q, &p->p_orphans, p_orphan) - fixjobc_enterpgrp_q(pgrp, p, q, false); -} - -static void -fixjobc_kill_q(struct proc *p, struct proc *q, bool adj) -{ - struct pgrp *childpgrp; - - sx_assert(&proctree_lock, SX_LOCKED); - - if ((q->p_treeflag & P_TREE_GRPEXITED) != 0) - return; - childpgrp = q->p_pgrp; - - if ((adj && isjobproc(jobc_reaper(q), childpgrp) && - !isjobproc(p, childpgrp)) || (!adj && !isjobproc(jobc_reaper(q), - childpgrp) && isjobproc(p, childpgrp))) - pgadjustjobc(childpgrp, adj); -} static void fixjobc_kill(struct proc *p) @@ -921,9 +817,6 @@ fixjobc_kill(struct proc *p) pgrp = p->p_pgrp; PGRP_LOCK_ASSERT(pgrp, MA_NOTOWNED); SESS_LOCK_ASSERT(pgrp->pg_session, MA_NOTOWNED); -#ifdef INVARIANTS - check_pgrp_jobc(pgrp); -#endif /* * p no longer affects process group orphanage for children. @@ -934,35 +827,46 @@ fixjobc_kill(struct proc *p) p->p_treeflag |= P_TREE_GRPEXITED; /* - * Check p's parent to see whether p qualifies its own process - * group; if so, adjust count for p's process group. + * Check if exiting p orphans its own group. */ - if (isjobproc(jobc_parent(p), pgrp)) - pgadjustjobc(pgrp, false); + pgrp = p->p_pgrp; + if (isjobproc(jobc_parent(p, NULL), pgrp)) { + PGRP_LOCK(pgrp); + if (pgrp_calc_jobc(pgrp) == 0) + orphanpg(pgrp); + PGRP_UNLOCK(pgrp); + } /* * Check this process' children to see whether they qualify - * their process groups after reparenting to reaper. If so, - * adjust counts for children's process groups. + * their process groups after reparenting to reaper. */ LIST_FOREACH(q, &p->p_children, p_sibling) { - if ((q->p_treeflag & P_TREE_ORPHANED) != 0) - continue; - fixjobc_kill_q(p, q, true); + pgrp = q->p_pgrp; + PGRP_LOCK(pgrp); + if (pgrp_calc_jobc(pgrp) == 0) { + /* + * We want to handle exactly the children that + * has p as realparent. Then, when calculating + * jobc_parent for children, we should ignore + * P_TREE_GRPEXITED flag already set on p. + */ + if (jobc_parent(q, p) == p && isjobproc(p, pgrp)) + orphanpg(pgrp); + } else + pgrp->pg_flags &= ~PGRP_ORPHANED; + PGRP_UNLOCK(pgrp); } - LIST_FOREACH(q, &p->p_orphans, p_orphan) - fixjobc_kill_q(p, q, true); - LIST_FOREACH(q, &p->p_children, p_sibling) { - if ((q->p_treeflag & P_TREE_ORPHANED) != 0) - continue; - fixjobc_kill_q(p, q, false); + LIST_FOREACH(q, &p->p_orphans, p_orphan) { + pgrp = q->p_pgrp; + PGRP_LOCK(pgrp); + if (pgrp_calc_jobc(pgrp) == 0) { + if (isjobproc(p, pgrp)) + orphanpg(pgrp); + } else + pgrp->pg_flags &= ~PGRP_ORPHANED; + PGRP_UNLOCK(pgrp); } - LIST_FOREACH(q, &p->p_orphans, p_orphan) - fixjobc_kill_q(p, q, false); - -#ifdef INVARIANTS - check_pgrp_jobc(pgrp); -#endif } void @@ -1026,8 +930,8 @@ killjobc(void) } /* - * A process group has become orphaned; - * if there are any stopped processes in the group, + * A process group has become orphaned, mark it as such for signal + * delivery code. If there are any stopped processes in the group, * hang-up all process in that group. */ static void @@ -1037,6 +941,8 @@ orphanpg(struct pgrp *pg) PGRP_LOCK_ASSERT(pg, MA_OWNED); + pg->pg_flags |= PGRP_ORPHANED; + LIST_FOREACH(p, &pg->pg_members, p_pglist) { PROC_LOCK(p); if (P_SHOULDSTOP(p) == P_STOPPED_SIG) { @@ -1271,7 +1177,7 @@ fill_kinfo_proc_pgrp(struct proc *p, struct kinfo_proc *kp) return; kp->ki_pgid = pgrp->pg_id; - kp->ki_jobc = pgrp->pg_jobc; + kp->ki_jobc = pgrp_calc_jobc(pgrp); sp = pgrp->pg_session; tp = NULL; @@ -1419,7 +1325,6 @@ fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp, int preferthread) void fill_kinfo_proc(struct proc *p, struct kinfo_proc *kp) { - MPASS(FIRST_THREAD_IN_PROC(p) != NULL); bzero(kp, sizeof(*kp)); diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index c5899f19ee08..004aabdcb84e 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2228,7 +2228,7 @@ tdsendsignal(struct proc *p, struct thread *td, int sig, ksiginfo_t *ksi) * and don't clear any pending SIGCONT. */ if ((prop & SIGPROP_TTYSTOP) != 0 && - p->p_pgrp->pg_jobc == 0 && + (p->p_pgrp->pg_flags & PGRP_ORPHANED) != 0 && action == SIG_DFL) { if (ksi && (ksi->ksi_flags & KSI_INS)) ksiginfo_tryfree(ksi); @@ -2986,8 +2986,8 @@ issignal(struct thread *td) if (prop & SIGPROP_STOP) { mtx_unlock(&ps->ps_mtx); if ((p->p_flag & (P_TRACED | P_WEXIT | - P_SINGLE_EXIT)) != 0 || - (p->p_pgrp->pg_jobc == 0 && + P_SINGLE_EXIT)) != 0 || ((p->p_pgrp-> + pg_flags & PGRP_ORPHANED) != 0 && (prop & SIGPROP_TTYSTOP) != 0)) { mtx_lock(&ps->ps_mtx); break; /* == ignore */ diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 1f86507a6025..4b1f7ca52abe 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -471,7 +471,8 @@ tty_wait_background(struct tty *tp, struct thread *td, int sig) return (sig == SIGTTOU ? 0 : EIO); } - if ((p->p_flag & P_PPWAIT) != 0 || pg->pg_jobc == 0) { + if ((p->p_flag & P_PPWAIT) != 0 || + (pg->pg_flags & PGRP_ORPHANED) != 0) { /* Don't allow the action to happen. */ PROC_UNLOCK(p); PGRP_UNLOCK(pg); @@ -2395,9 +2396,8 @@ DB_SHOW_COMMAND(tty, db_show_tty) _db_show_hooks("\t", tp->t_hook); /* Process info. */ - db_printf("\tpgrp: %p gid %d jobc %d\n", tp->t_pgrp, - tp->t_pgrp ? tp->t_pgrp->pg_id : 0, - tp->t_pgrp ? tp->t_pgrp->pg_jobc : 0); + db_printf("\tpgrp: %p gid %d\n", tp->t_pgrp, + tp->t_pgrp ? tp->t_pgrp->pg_id : 0); db_printf("\tsession: %p", tp->t_session); if (tp->t_session != NULL) db_printf(" count %u leader %p tty %p sid %d login %s", diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 2a7f0740a0c3..99257878c2e0 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -111,10 +111,12 @@ struct pgrp { struct session *pg_session; /* (c) Pointer to session. */ struct sigiolst pg_sigiolst; /* (m) List of sigio sources. */ pid_t pg_id; /* (c) Process group id. */ - int pg_jobc; /* (m) Job control process count. */ struct mtx pg_mtx; /* Mutex to protect members */ + int pg_flags; /* (m) PGRP_ flags */ }; +#define PGRP_ORPHANED 0x00000001 /* Group is orphaned */ + /* * pargs, used to hold a copy of the command line, if it had a sane length. */ From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:43:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 91DE44EADAE; Sun, 10 Jan 2021 02:43:10 +0000 (UTC) (envelope-from git@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 4DD1NZ1lQnz4qGN; Sun, 10 Jan 2021 02:43:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D5BD20672; Sun, 10 Jan 2021 02:43:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2hA0Y058024; Sun, 10 Jan 2021 02:43:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2hAbK058023; Sun, 10 Jan 2021 02:43:10 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:43:10 GMT Message-Id: <202101100243.10A2hAbK058023@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: aa9450e44b5f - main - x86 identcpu.c: fix formatting of the comment. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa9450e44b5f017bb132ab5a00df68c9d7aa1d94 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:43:10 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=aa9450e44b5f017bb132ab5a00df68c9d7aa1d94 commit aa9450e44b5f017bb132ab5a00df68c9d7aa1d94 Author: Konstantin Belousov AuthorDate: 2021-01-06 14:52:27 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:42:33 +0000 x86 identcpu.c: fix formatting of the comment. Reviewed by: gallatin, markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27986 --- sys/x86/x86/identcpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c index 938c24d1951f..849f532dbf8b 100644 --- a/sys/x86/x86/identcpu.c +++ b/sys/x86/x86/identcpu.c @@ -223,7 +223,7 @@ static struct { } cpu_vendors[] = { { INTEL_VENDOR_ID, CPU_VENDOR_INTEL }, /* GenuineIntel */ { AMD_VENDOR_ID, CPU_VENDOR_AMD }, /* AuthenticAMD */ - { HYGON_VENDOR_ID, CPU_VENDOR_HYGON }, /* HygonGenuine*/ + { HYGON_VENDOR_ID, CPU_VENDOR_HYGON }, /* HygonGenuine */ { CENTAUR_VENDOR_ID, CPU_VENDOR_CENTAUR }, /* CentaurHauls */ #ifdef __i386__ { NSC_VENDOR_ID, CPU_VENDOR_NSC }, /* Geode by NSC */ From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:43:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 747174EAFB8; Sun, 10 Jan 2021 02:43:11 +0000 (UTC) (envelope-from git@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 4DD1Nb2fMgz4q9Q; Sun, 10 Jan 2021 02:43:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BBA620F8E; Sun, 10 Jan 2021 02:43:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2hBWI058047; Sun, 10 Jan 2021 02:43:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2hBvP058046; Sun, 10 Jan 2021 02:43:11 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:43:11 GMT Message-Id: <202101100243.10A2hBvP058046@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 826fc3cc3d59 - main - tsc: use u_int for return type for prototype, same as in definitions. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 826fc3cc3d59c1d0af4caf3a08888e168bfe22b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:43:11 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=826fc3cc3d59c1d0af4caf3a08888e168bfe22b2 commit 826fc3cc3d59c1d0af4caf3a08888e168bfe22b2 Author: Konstantin Belousov AuthorDate: 2021-01-05 20:44:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:42:34 +0000 tsc: use u_int for return type for prototype, same as in definitions. Reviewed by: gallatin, markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27986 --- sys/x86/x86/tsc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index 6b5242fb5d4f..8b6a420ae1e4 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -91,12 +91,12 @@ static void tsc_freq_changed(void *arg, const struct cf_level *level, int status); static void tsc_freq_changing(void *arg, const struct cf_level *level, int *status); -static unsigned tsc_get_timecount(struct timecounter *tc); -static inline unsigned tsc_get_timecount_low(struct timecounter *tc); -static unsigned tsc_get_timecount_lfence(struct timecounter *tc); -static unsigned tsc_get_timecount_low_lfence(struct timecounter *tc); -static unsigned tsc_get_timecount_mfence(struct timecounter *tc); -static unsigned tsc_get_timecount_low_mfence(struct timecounter *tc); +static u_int tsc_get_timecount(struct timecounter *tc); +static inline u_int tsc_get_timecount_low(struct timecounter *tc); +static u_int tsc_get_timecount_lfence(struct timecounter *tc); +static u_int tsc_get_timecount_low_lfence(struct timecounter *tc); +static u_int tsc_get_timecount_mfence(struct timecounter *tc); +static u_int tsc_get_timecount_low_mfence(struct timecounter *tc); static void tsc_levels_changed(void *arg, int unit); static uint32_t x86_tsc_vdso_timehands(struct vdso_timehands *vdso_th, struct timecounter *tc); From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:43:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4463E4EABE6; Sun, 10 Jan 2021 02:43:13 +0000 (UTC) (envelope-from git@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 4DD1Nc4QMLz4q9V; Sun, 10 Jan 2021 02:43:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F2FF20E12; Sun, 10 Jan 2021 02:43:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2hCKY058065; Sun, 10 Jan 2021 02:43:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2hCOY058064; Sun, 10 Jan 2021 02:43:12 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:43:12 GMT Message-Id: <202101100243.10A2hCOY058064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 45974de8fb23 - main - x86: Add rdtscp32() into cpufunc.h. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45974de8fb23710873417f1d2ca513761da6cacc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:43:13 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=45974de8fb23710873417f1d2ca513761da6cacc commit 45974de8fb23710873417f1d2ca513761da6cacc Author: Konstantin Belousov AuthorDate: 2021-01-09 20:39:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:42:34 +0000 x86: Add rdtscp32() into cpufunc.h. Suggested by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27986 --- sys/amd64/include/cpufunc.h | 9 +++++++++ sys/i386/include/cpufunc.h | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h index 94e9c15b5117..2bf2339c7d6e 100644 --- a/sys/amd64/include/cpufunc.h +++ b/sys/amd64/include/cpufunc.h @@ -412,6 +412,15 @@ rdtsc32(void) return (rv); } +static __inline uint32_t +rdtscp32(void) +{ + uint32_t rv; + + __asm __volatile("rdtscp" : "=a" (rv) : : "ecx", "edx"); + return (rv); +} + static __inline void wbinvd(void) { diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h index 3feeef02499c..9646590a6a40 100644 --- a/sys/i386/include/cpufunc.h +++ b/sys/i386/include/cpufunc.h @@ -412,6 +412,15 @@ rdtsc32(void) return (rv); } +static __inline uint32_t +rdtscp32(void) +{ + uint32_t rv; + + __asm __volatile("rdtscp" : "=a" (rv) : : "ecx", "edx"); + return (rv); +} + static __inline void wbinvd(void) { From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:43:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1F94F4EB037; Sun, 10 Jan 2021 02:43:15 +0000 (UTC) (envelope-from git@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 4DD1Nf0Hhkz4qGd; Sun, 10 Jan 2021 02:43:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FCE120BE2; Sun, 10 Jan 2021 02:43:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2hDoW058087; Sun, 10 Jan 2021 02:43:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2hDBv058086; Sun, 10 Jan 2021 02:43:13 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:43:13 GMT Message-Id: <202101100243.10A2hDBv058086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9e680e4005b7 - main - tsc: add RDTSCP or faster variants of get_timecount() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e680e4005b77e3028d28377ee3722a5260f4422 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:43:15 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9e680e4005b77e3028d28377ee3722a5260f4422 commit 9e680e4005b77e3028d28377ee3722a5260f4422 Author: Konstantin Belousov AuthorDate: 2021-01-05 21:00:14 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:42:34 +0000 tsc: add RDTSCP or faster variants of get_timecount() Use it in preference of Xfenced RDTSC if RDTSCP is supported. It is recommended by both Intel and AMD. But, on AMD Zens and newer use LFENCE, as recommended by AMD [*]. In particular, this means that now AMD CPUs use more appropriate fence instead of too harsh MFENCe. Add comment explaining the intent of the selection logic. Reported by: gallatin [*] Reviewed by: gallatin, markj Tested by: gallatin, pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27986 --- sys/x86/x86/tsc.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index 8b6a420ae1e4..ad8108c8a7ea 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -97,6 +97,8 @@ static u_int tsc_get_timecount_lfence(struct timecounter *tc); static u_int tsc_get_timecount_low_lfence(struct timecounter *tc); static u_int tsc_get_timecount_mfence(struct timecounter *tc); static u_int tsc_get_timecount_low_mfence(struct timecounter *tc); +static u_int tscp_get_timecount(struct timecounter *tc); +static u_int tscp_get_timecount_low(struct timecounter *tc); static void tsc_levels_changed(void *arg, int unit); static uint32_t x86_tsc_vdso_timehands(struct vdso_timehands *vdso_th, struct timecounter *tc); @@ -628,7 +630,25 @@ init_TSC_tc(void) init: for (shift = 0; shift <= 31 && (tsc_freq >> shift) > max_freq; shift++) ; - if ((cpu_feature & CPUID_SSE2) != 0 && mp_ncpus > 1) { + + /* + * Timecounter implementation selection, top to bottom: + * - For AMD Zens and newer, use LFENCE;RDTSC. + * - If RDTSCP is available, use RDTSCP. + * - If fence instructions are provided (SSE2), use LFENCE;RDTSC + * on Intel, and MFENCE;RDTSC on AMD. + * - For really old CPUs, just use RDTSC. + */ + if ((cpu_vendor_id == CPU_VENDOR_AMD || + cpu_vendor_id == CPU_VENDOR_HYGON) && + CPUID_TO_FAMILY(cpu_id) >= 0x17) { + tsc_timecounter.tc_get_timecount = shift > 0 ? + tsc_get_timecount_low_lfence : + tsc_get_timecount_lfence; + } else if ((amd_feature & AMDID_RDTSCP) != 0) { + tsc_timecounter.tc_get_timecount = shift > 0 ? + tscp_get_timecount_low : tscp_get_timecount; + } else if ((cpu_feature & CPUID_SSE2) != 0 && mp_ncpus > 1) { if (cpu_vendor_id == CPU_VENDOR_AMD || cpu_vendor_id == CPU_VENDOR_HYGON) { tsc_timecounter.tc_get_timecount = shift > 0 ? @@ -783,6 +803,13 @@ tsc_get_timecount(struct timecounter *tc __unused) return (rdtsc32()); } +static u_int +tscp_get_timecount(struct timecounter *tc __unused) +{ + + return (rdtscp32()); +} + static inline u_int tsc_get_timecount_low(struct timecounter *tc) { @@ -793,6 +820,16 @@ tsc_get_timecount_low(struct timecounter *tc) return (rv); } +static u_int +tscp_get_timecount_low(struct timecounter *tc) +{ + uint32_t rv; + + __asm __volatile("rdtscp; movl %1, %%ecx; shrd %%cl, %%edx, %0" + : "=a" (rv) : "m" (tc->tc_priv) : "ecx", "edx"); + return (rv); +} + static u_int tsc_get_timecount_lfence(struct timecounter *tc __unused) { From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:43:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CD3CE4EAEE8; Sun, 10 Jan 2021 02:43:17 +0000 (UTC) (envelope-from git@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 4DD1Ng3Z11z4qTP; Sun, 10 Jan 2021 02:43:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5D6E20BE3; Sun, 10 Jan 2021 02:43:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2hEXm058109; Sun, 10 Jan 2021 02:43:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2hEum058108; Sun, 10 Jan 2021 02:43:14 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:43:14 GMT Message-Id: <202101100243.10A2hEum058108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: de898cb96042 - main - x86 vdso gettc: reorganize ifunctions. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de898cb96042a026ef703d81aea6cdf1ffce8f32 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:43:17 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=de898cb96042a026ef703d81aea6cdf1ffce8f32 commit de898cb96042a026ef703d81aea6cdf1ffce8f32 Author: Konstantin Belousov AuthorDate: 2021-01-05 21:14:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:42:34 +0000 x86 vdso gettc: reorganize ifunctions. Instead of providing ifuncs for each kind of fence, define ifuncs that combine fence and invocation of RDTSC. This refactoring makes introduction of RDTSCP use possible. Reviewed by: gallatin, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27986 --- lib/libc/x86/sys/__vdso_gettc.c | 68 ++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c index 7a958ca256da..b08b11e9c714 100644 --- a/lib/libc/x86/sys/__vdso_gettc.c +++ b/lib/libc/x86/sys/__vdso_gettc.c @@ -53,57 +53,83 @@ __FBSDID("$FreeBSD$"); #include #include "libc_private.h" -static void -rdtsc_mb_lfence(void) +static inline u_int +rdtsc_low(const struct vdso_timehands *th) { + u_int rv; - lfence(); + __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" + : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); + return (rv); } -static void -rdtsc_mb_mfence(void) +static u_int +rdtsc_low_mb_lfence(const struct vdso_timehands *th) { + lfence(); + return (rdtsc_low(th)); +} +static u_int +rdtsc_low_mb_mfence(const struct vdso_timehands *th) +{ mfence(); + return (rdtsc_low(th)); } -static void -rdtsc_mb_none(void) +static u_int +rdtsc_low_mb_none(const struct vdso_timehands *th) { + return (rdtsc_low(th)); } -DEFINE_UIFUNC(static, void, rdtsc_mb, (void)) +DEFINE_UIFUNC(static, u_int, __vdso_gettc_rdtsc_low, + (const struct vdso_timehands *th)) { u_int p[4]; /* Not a typo, string matches our do_cpuid() registers use. */ static const char intel_id[] = "GenuntelineI"; if ((cpu_feature & CPUID_SSE2) == 0) - return (rdtsc_mb_none); + return (rdtsc_low_mb_none); do_cpuid(0, p); return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ? - rdtsc_mb_lfence : rdtsc_mb_mfence); + rdtsc_low_mb_lfence : rdtsc_low_mb_mfence); } static u_int -__vdso_gettc_rdtsc_low(const struct vdso_timehands *th) +rdtsc32_mb_lfence(void) { - u_int rv; - - rdtsc_mb(); - __asm __volatile("rdtsc; shrd %%cl, %%edx, %0" - : "=a" (rv) : "c" (th->th_x86_shift) : "edx"); - return (rv); + lfence(); + return (rdtsc32()); } static u_int -__vdso_rdtsc32(void) +rdtsc32_mb_mfence(void) { + mfence(); + return (rdtsc32()); +} - rdtsc_mb(); +static u_int +rdtsc32_mb_none(void) +{ return (rdtsc32()); } +DEFINE_UIFUNC(static, u_int, __vdso_gettc_rdtsc32, (void)) +{ + u_int p[4]; + /* Not a typo, string matches our do_cpuid() registers use. */ + static const char intel_id[] = "GenuntelineI"; + + if ((cpu_feature & CPUID_SSE2) == 0) + return (rdtsc32_mb_none); + do_cpuid(0, p); + return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ? + rdtsc32_mb_lfence : rdtsc32_mb_mfence); +} + #define HPET_DEV_MAP_MAX 10 static volatile char *hpet_dev_map[HPET_DEV_MAP_MAX]; @@ -199,7 +225,7 @@ __vdso_hyperv_tsc(struct hyperv_reftsc *tsc_ref, u_int *tc) scale = tsc_ref->tsc_scale; ofs = tsc_ref->tsc_ofs; - rdtsc_mb(); + mfence(); /* XXXKIB */ tsc = rdtsc(); /* ret = ((tsc * scale) >> 64) + ofs */ @@ -231,7 +257,7 @@ __vdso_gettc(const struct vdso_timehands *th, u_int *tc) switch (th->th_algo) { case VDSO_TH_ALGO_X86_TSC: *tc = th->th_x86_shift > 0 ? __vdso_gettc_rdtsc_low(th) : - __vdso_rdtsc32(); + __vdso_gettc_rdtsc32(); return (0); case VDSO_TH_ALGO_X86_HPET: idx = th->th_x86_hpet_idx; From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:43:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5EDBF4EAF45; Sun, 10 Jan 2021 02:43:18 +0000 (UTC) (envelope-from git@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 4DD1Nh5n2tz4qWS; Sun, 10 Jan 2021 02:43:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E907720673; Sun, 10 Jan 2021 02:43:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2hF0S058127; Sun, 10 Jan 2021 02:43:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2hFWG058126; Sun, 10 Jan 2021 02:43:15 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:43:15 GMT Message-Id: <202101100243.10A2hFWG058126@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 5bf4bafd13a4 - main - x86 vdso gettc: eliminate duplicated code in ifunc selectors. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5bf4bafd13a4044b7c3d2e8246684a597c6f2134 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:43:18 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5bf4bafd13a4044b7c3d2e8246684a597c6f2134 commit 5bf4bafd13a4044b7c3d2e8246684a597c6f2134 Author: Konstantin Belousov AuthorDate: 2021-01-06 15:00:48 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:42:34 +0000 x86 vdso gettc: eliminate duplicated code in ifunc selectors. Create array of rdtsc selectors and provide helper that calculate the index into the selectors array. Reviewed by: gallatin, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27986 --- lib/libc/x86/sys/__vdso_gettc.c | 87 ++++++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 22 deletions(-) diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c index b08b11e9c714..4e0fc9f7e841 100644 --- a/lib/libc/x86/sys/__vdso_gettc.c +++ b/lib/libc/x86/sys/__vdso_gettc.c @@ -83,20 +83,6 @@ rdtsc_low_mb_none(const struct vdso_timehands *th) return (rdtsc_low(th)); } -DEFINE_UIFUNC(static, u_int, __vdso_gettc_rdtsc_low, - (const struct vdso_timehands *th)) -{ - u_int p[4]; - /* Not a typo, string matches our do_cpuid() registers use. */ - static const char intel_id[] = "GenuntelineI"; - - if ((cpu_feature & CPUID_SSE2) == 0) - return (rdtsc_low_mb_none); - do_cpuid(0, p); - return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ? - rdtsc_low_mb_lfence : rdtsc_low_mb_mfence); -} - static u_int rdtsc32_mb_lfence(void) { @@ -117,17 +103,74 @@ rdtsc32_mb_none(void) return (rdtsc32()); } -DEFINE_UIFUNC(static, u_int, __vdso_gettc_rdtsc32, (void)) +struct tsc_selector_tag { + u_int (*ts_rdtsc32)(void); + u_int (*ts_rdtsc_low)(const struct vdso_timehands *); +}; + +static const struct tsc_selector_tag tsc_selector[] = { + [0] = { /* Intel or AMD Zen+, LFENCE */ + .ts_rdtsc32 = rdtsc32_mb_lfence, + .ts_rdtsc_low = rdtsc_low_mb_lfence, + }, + [1] = { /* AMD, MFENCE */ + .ts_rdtsc32 = rdtsc32_mb_mfence, + .ts_rdtsc_low = rdtsc_low_mb_mfence, + }, + [2] = { /* No SSE2 */ + .ts_rdtsc32 = rdtsc32_mb_none, + .ts_rdtsc_low = rdtsc_low_mb_none, + }, +}; + +static int +tsc_selector_idx(u_int cpu_feature) { - u_int p[4]; - /* Not a typo, string matches our do_cpuid() registers use. */ - static const char intel_id[] = "GenuntelineI"; + u_int amd_feature, cpu_exthigh, cpu_id, p[4], v[3]; + static const char amd_id[] = "AuthenticAMD"; + static const char hygon_id[] = "HygonGenuine"; + bool amd_cpu; + + if (cpu_feature == 0) + return (2); /* should not happen due to RDTSC */ - if ((cpu_feature & CPUID_SSE2) == 0) - return (rdtsc32_mb_none); do_cpuid(0, p); - return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ? - rdtsc32_mb_lfence : rdtsc32_mb_mfence); + v[0] = p[1]; + v[1] = p[3]; + v[2] = p[2]; + amd_cpu = memcmp(v, amd_id, sizeof(amd_id) - 1) == 0 || + memcmp(v, hygon_id, sizeof(hygon_id) - 1) == 0; + + do_cpuid(1, p); + cpu_id = p[0]; + + if (cpu_feature != 0) { + do_cpuid(0x80000000, p); + cpu_exthigh = p[0]; + } else { + cpu_exthigh = 0; + } + if (cpu_exthigh >= 0x80000001) { + do_cpuid(0x80000001, p); + amd_feature = p[3]; + } else { + amd_feature = 0; + } + + if ((cpu_feature & CPUID_SSE2) == 0) + return (2); + return (amd_cpu ? 1 : 0); +} + +DEFINE_UIFUNC(static, u_int, __vdso_gettc_rdtsc_low, + (const struct vdso_timehands *th)) +{ + return (tsc_selector[tsc_selector_idx(cpu_feature)].ts_rdtsc_low); +} + +DEFINE_UIFUNC(static, u_int, __vdso_gettc_rdtsc32, (void)) +{ + return (tsc_selector[tsc_selector_idx(cpu_feature)].ts_rdtsc32); } #define HPET_DEV_MAP_MAX 10 From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:43:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CCF794EADD5; Sun, 10 Jan 2021 02:43:19 +0000 (UTC) (envelope-from git@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 4DD1Nk6tbMz4qYv; Sun, 10 Jan 2021 02:43:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0ECBA20E13; Sun, 10 Jan 2021 02:43:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2hGBm058149; Sun, 10 Jan 2021 02:43:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2hGk9058148; Sun, 10 Jan 2021 02:43:16 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:43:16 GMT Message-Id: <202101100243.10A2hGk9058148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: cd240c9cf100 - main - x86 vdso gettc: Add RDTSCP support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd240c9cf100bec3def38ceb4a320611b1d02693 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:43:22 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=cd240c9cf100bec3def38ceb4a320611b1d02693 commit cd240c9cf100bec3def38ceb4a320611b1d02693 Author: Konstantin Belousov AuthorDate: 2021-01-06 15:05:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:42:34 +0000 x86 vdso gettc: Add RDTSCP support Detect and use RDTSCP if available, instead of fence+RDTSC. For AMD Zens+, use LFENCE+RDTSC instead of RDTSCP (or MFENCE;RDTSC previously). Reviewed by: gallatin, markj Tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27986 --- lib/libc/x86/sys/__vdso_gettc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c index 4e0fc9f7e841..7f224f8758cb 100644 --- a/lib/libc/x86/sys/__vdso_gettc.c +++ b/lib/libc/x86/sys/__vdso_gettc.c @@ -63,6 +63,16 @@ rdtsc_low(const struct vdso_timehands *th) return (rv); } +static inline u_int +rdtscp_low(const struct vdso_timehands *th) +{ + u_int rv; + + __asm __volatile("rdtscp; movl %%edi,%%ecx; shrd %%cl, %%edx, %0" + : "=a" (rv) : "D" (th->th_x86_shift) : "ecx", "edx"); + return (rv); +} + static u_int rdtsc_low_mb_lfence(const struct vdso_timehands *th) { @@ -103,6 +113,12 @@ rdtsc32_mb_none(void) return (rdtsc32()); } +static u_int +rdtscp32_(void) +{ + return (rdtscp32()); +} + struct tsc_selector_tag { u_int (*ts_rdtsc32)(void); u_int (*ts_rdtsc_low)(const struct vdso_timehands *); @@ -121,6 +137,10 @@ static const struct tsc_selector_tag tsc_selector[] = { .ts_rdtsc32 = rdtsc32_mb_none, .ts_rdtsc_low = rdtsc_low_mb_none, }, + [3] = { /* RDTSCP */ + .ts_rdtsc32 = rdtscp32_, + .ts_rdtsc_low = rdtscp_low, + }, }; static int @@ -144,6 +164,9 @@ tsc_selector_idx(u_int cpu_feature) do_cpuid(1, p); cpu_id = p[0]; + if (amd_cpu && CPUID_TO_FAMILY(cpu_id) >= 0x17) + return (0); + if (cpu_feature != 0) { do_cpuid(0x80000000, p); cpu_exthigh = p[0]; @@ -157,6 +180,8 @@ tsc_selector_idx(u_int cpu_feature) amd_feature = 0; } + if ((amd_feature & AMDID_RDTSCP) != 0) + return (3); if ((cpu_feature & CPUID_SSE2) == 0) return (2); return (amd_cpu ? 1 : 0); From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:49:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5E07D4EB633; Sun, 10 Jan 2021 02:49:09 +0000 (UTC) (envelope-from git@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 4DD1WT28qfz4rhZ; Sun, 10 Jan 2021 02:49:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CBAF20E14; Sun, 10 Jan 2021 02:49:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2n9O6059188; Sun, 10 Jan 2021 02:49:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2n9Vw059187; Sun, 10 Jan 2021 02:49:09 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:49:09 GMT Message-Id: <202101100249.10A2n9Vw059187@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 42bebbda9ed1 - main - tmpfs: make M_TMPFSMNT static to tmpfs_vfsops.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 42bebbda9ed13d12d0454b676aa81f34b39e496f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:49:09 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=42bebbda9ed13d12d0454b676aa81f34b39e496f commit 42bebbda9ed13d12d0454b676aa81f34b39e496f Author: Konstantin Belousov AuthorDate: 2021-01-05 18:52:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:44:55 +0000 tmpfs: make M_TMPFSMNT static to tmpfs_vfsops.c This malloc type is only used in this file. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/fs/tmpfs/tmpfs.h | 1 - sys/fs/tmpfs/tmpfs_vfsops.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index beded9cd5455..811df5b2936f 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -42,7 +42,6 @@ #include #ifdef _SYS_MALLOC_H_ -MALLOC_DECLARE(M_TMPFSMNT); MALLOC_DECLARE(M_TMPFSNAME); #endif diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index c090cd5aa658..125c5bb64120 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -80,7 +80,7 @@ __FBSDID("$FreeBSD$"); */ #define TMPFS_DEFAULT_ROOT_MODE (S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) -MALLOC_DEFINE(M_TMPFSMNT, "tmpfs mount", "tmpfs mount structures"); +static MALLOC_DEFINE(M_TMPFSMNT, "tmpfs mount", "tmpfs mount structures"); MALLOC_DEFINE(M_TMPFSNAME, "tmpfs name", "tmpfs file names"); static int tmpfs_mount(struct mount *); From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:50:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4694E4EB724; Sun, 10 Jan 2021 02:50:01 +0000 (UTC) (envelope-from git@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 4DD1XT1Xwyz4rr5; Sun, 10 Jan 2021 02:50:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2801320BE5; Sun, 10 Jan 2021 02:50:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2o1tQ060358; Sun, 10 Jan 2021 02:50:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2o1jh060355; Sun, 10 Jan 2021 02:50:01 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:50:01 GMT Message-Id: <202101100250.10A2o1jh060355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9f200bc47b5d - main - tmpfs_free_tmp(): explicitly assert that tmp is locked MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9f200bc47b5d8445d91d51f6dfd6af0f1fbbe354 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:50:01 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9f200bc47b5d8445d91d51f6dfd6af0f1fbbe354 commit 9f200bc47b5d8445d91d51f6dfd6af0f1fbbe354 Author: Konstantin Belousov AuthorDate: 2021-01-05 18:53:45 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:48:29 +0000 tmpfs_free_tmp(): explicitly assert that tmp is locked Despite TMPFS_UNLOCK() is done in both paths later, unlocking not locked mutex provides different failure mode. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/fs/tmpfs/tmpfs_vfsops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 125c5bb64120..ba7c654d4f0a 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -544,8 +544,9 @@ tmpfs_unmount(struct mount *mp, int mntflags) void tmpfs_free_tmp(struct tmpfs_mount *tmp) { - + TMPFS_MP_ASSERT_LOCKED(tmp); MPASS(tmp->tm_refcount > 0); + tmp->tm_refcount--; if (tmp->tm_refcount > 0) { TMPFS_UNLOCK(tmp); From owner-dev-commits-src-all@freebsd.org Sun Jan 10 02:50:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 62B7A4EB646; Sun, 10 Jan 2021 02:50:02 +0000 (UTC) (envelope-from git@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 4DD1XV2LzNz4rjj; Sun, 10 Jan 2021 02:50:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 442E920F40; Sun, 10 Jan 2021 02:50:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A2o25K060560; Sun, 10 Jan 2021 02:50:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A2o2t2060557; Sun, 10 Jan 2021 02:50:02 GMT (envelope-from git) Date: Sun, 10 Jan 2021 02:50:02 GMT Message-Id: <202101100250.10A2o2t2060557@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ac2576b9f7bc - main - tmpfs open: assert that there is no double-init of f_data. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac2576b9f7bc88b6f213141178102024705b03d3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 02:50:02 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ac2576b9f7bc88b6f213141178102024705b03d3 commit ac2576b9f7bc88b6f213141178102024705b03d3 Author: Konstantin Belousov AuthorDate: 2021-01-07 16:34:02 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 02:48:36 +0000 tmpfs open: assert that there is no double-init of f_data. Sponsored by: The FreeBSD Foundation --- sys/fs/tmpfs/tmpfs_vnops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 3c80c33ea047..90711b4849c5 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -311,6 +311,7 @@ tmpfs_open(struct vop_open_args *v) } fp = v->a_fp; + MPASS(fp == NULL || fp->f_data == NULL); if (error == 0 && fp != NULL && vp->v_type == VREG) { tmpfs_ref_node(node); finit_vnode(fp, mode, node, &tmpfs_fnops); From owner-dev-commits-src-all@freebsd.org Sun Jan 10 05:05:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 98C0A4EE0CB; Sun, 10 Jan 2021 05:05:36 +0000 (UTC) (envelope-from git@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 4DD4Xw3jW8z3F8s; Sun, 10 Jan 2021 05:05:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71E0522926; Sun, 10 Jan 2021 05:05:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A55aMO041023; Sun, 10 Jan 2021 05:05:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A55ahS041022; Sun, 10 Jan 2021 05:05:36 GMT (envelope-from git) Date: Sun, 10 Jan 2021 05:05:36 GMT Message-Id: <202101100505.10A55ahS041022@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: 2a4b22514635 - main - jail: Simplify handling of prison_deref() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2a4b225146353351c6af4a1904dca6ee9a433341 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 05:05:36 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=2a4b225146353351c6af4a1904dca6ee9a433341 commit 2a4b225146353351c6af4a1904dca6ee9a433341 Author: Jamie Gritton AuthorDate: 2021-01-10 05:05:06 +0000 Commit: Jamie Gritton CommitDate: 2021-01-10 05:05:06 +0000 jail: Simplify handling of prison_deref() Track the the current lock/reference state in a single variable, rather than deducing the proper prison_deref() flags from a combination of equations and hard-coded values. --- sys/kern/kern_jail.c | 324 +++++++++++++++++++++++++-------------------------- 1 file changed, 161 insertions(+), 163 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 55006939a5ff..ff540875c90e 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -151,11 +151,11 @@ static void prison_racct_detach(struct prison *pr); #endif /* Flags for prison_deref */ -#define PD_DEREF 0x01 -#define PD_DEUREF 0x02 -#define PD_LOCKED 0x04 -#define PD_LIST_SLOCKED 0x08 -#define PD_LIST_XLOCKED 0x10 +#define PD_DEREF 0x01 /* Decrement pr_ref */ +#define PD_DEUREF 0x02 /* Decrement pr_uref */ +#define PD_LOCKED 0x04 /* pr_mtx is held */ +#define PD_LIST_SLOCKED 0x08 /* allprison_lock is held shared */ +#define PD_LIST_XLOCKED 0x10 /* allprison_lock is held exclusive */ /* * Parameter names corresponding to PR_* flag values. Size values are for kvm @@ -526,7 +526,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #endif unsigned long hid; size_t namelen, onamelen, pnamelen; - int born, created, cuflags, descend, enforce, slocked; + int born, created, cuflags, descend, drflags, enforce; int error, errmsg_len, errmsg_pos; int gotchildmax, gotenforce, gothid, gotrsnum, gotslevel; int jid, jsys, len, level; @@ -994,11 +994,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) jid = 0; } sx_xlock(&allprison_lock); + drflags = PD_LIST_XLOCKED; if (jid != 0) { if (jid < 0) { error = EINVAL; vfs_opterror(opts, "negative jid"); - goto done_unlock_list; + goto done_deref; } /* * See if a requested jid already exists. Keep track of @@ -1009,6 +1010,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) mtx_lock(&inspr->pr_mtx); if (inspr->pr_ref > 0) { pr = inspr; + drflags |= PD_LOCKED; inspr = NULL; } else mtx_unlock(&inspr->pr_mtx); @@ -1025,11 +1027,10 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * Even creators that cannot see the jail will * get EEXIST. */ - mtx_unlock(&pr->pr_mtx); error = EEXIST; vfs_opterror(opts, "jail %d already exists", jid); - goto done_unlock_list; + goto done_deref; } if (!prison_ischild(mypr, pr)) { /* @@ -1037,15 +1038,15 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * jail. This is true even for CREATE | UPDATE, * which normally cannot give this error. */ - mtx_unlock(&pr->pr_mtx); - pr = NULL; + error = ENOENT; + vfs_opterror(opts, "jail %d not found", jid); + goto done_deref; } else if (pr->pr_uref == 0) { if (!(flags & JAIL_DYING)) { - mtx_unlock(&pr->pr_mtx); error = ENOENT; vfs_opterror(opts, "jail %d is dying", jid); - goto done_unlock_list; + goto done_deref; } else if ((flags & JAIL_ATTACH) || (pr_flags & PR_PERSIST)) { /* @@ -1060,13 +1061,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) name = prison_name(mypr, pr); } } - } - if (pr == NULL) { + } else { /* Update: jid must exist. */ if (cuflags == JAIL_UPDATE) { error = ENOENT; vfs_opterror(opts, "jail %d not found", jid); - goto done_unlock_list; + goto done_deref; } } } @@ -1091,11 +1091,10 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) if (pr != NULL) { if (strncmp(name, ppr->pr_name, namelc - name) || ppr->pr_name[namelc - name] != '\0') { - mtx_unlock(&pr->pr_mtx); error = EINVAL; vfs_opterror(opts, "cannot change jail's parent"); - goto done_unlock_list; + goto done_deref; } } else { *namelc = '\0'; @@ -1104,7 +1103,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) error = ENOENT; vfs_opterror(opts, "jail \"%s\" not found", name); - goto done_unlock_list; + goto done_deref; } mtx_unlock(&ppr->pr_mtx); *namelc = '.'; @@ -1129,6 +1128,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) */ if (tpr->pr_uref > 0) { pr = tpr; + drflags |= + PD_LOCKED; break; } deadpr = tpr; @@ -1141,12 +1142,10 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * active sibling jail. */ error = EEXIST; - if (pr != NULL) - mtx_unlock(&pr->pr_mtx); vfs_opterror(opts, "jail \"%s\" already exists", name); - goto done_unlock_list; + goto done_deref; } } } @@ -1159,11 +1158,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) goto name_again; } pr = deadpr; + drflags |= PD_LOCKED; } else if (cuflags == JAIL_UPDATE) { error = ENOENT; vfs_opterror(opts, "jail \"%s\" is dying", name); - goto done_unlock_list; + goto done_deref; } } /* Update: name must exist if no jid. */ @@ -1171,7 +1171,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) error = ENOENT; vfs_opterror(opts, "jail \"%s\" not found", name); - goto done_unlock_list; + goto done_deref; } } } @@ -1179,39 +1179,43 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) else if (cuflags == JAIL_UPDATE && pr == NULL) { error = ENOENT; vfs_opterror(opts, "update specified no jail"); - goto done_unlock_list; + goto done_deref; } /* If there's no prison to update, create a new one and link it in. */ - if (pr == NULL) { + created = pr == NULL; + if (created) { for (tpr = mypr; tpr != NULL; tpr = tpr->pr_parent) if (tpr->pr_childcount >= tpr->pr_childmax) { error = EPERM; vfs_opterror(opts, "prison limit exceeded"); - goto done_unlock_list; + goto done_deref; } - created = 1; mtx_lock(&ppr->pr_mtx); if (ppr->pr_ref == 0) { mtx_unlock(&ppr->pr_mtx); error = ENOENT; vfs_opterror(opts, "jail \"%s\" not found", prison_name(mypr, ppr)); - goto done_unlock_list; + goto done_deref; } ppr->pr_ref++; ppr->pr_uref++; mtx_unlock(&ppr->pr_mtx); - pr = malloc(sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO); if (jid == 0 && (jid = get_next_prid(&inspr)) == 0) { error = EAGAIN; vfs_opterror(opts, "no available jail IDs"); - free(pr, M_PRISON); - prison_deref(ppr, - PD_DEREF | PD_DEUREF | PD_LIST_XLOCKED); - goto done_releroot; + pr = ppr; + drflags |= PD_DEREF | PD_DEUREF; + goto done_deref; } + + pr = malloc(sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO); + LIST_INIT(&pr->pr_children); + mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF | MTX_DUPOK); + TASK_INIT(&pr->pr_task, 0, prison_complete, pr); + pr->pr_id = jid; if (inspr != NULL) TAILQ_INSERT_BEFORE(inspr, pr, pr_list); @@ -1286,10 +1290,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) strlcpy(pr->pr_osrelease, osrelstr, sizeof(pr->pr_osrelease)); - LIST_INIT(&pr->pr_children); - mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF | MTX_DUPOK); - TASK_INIT(&pr->pr_task, 0, prison_complete, pr); - #ifdef VIMAGE /* Allocate a new vnet if specified. */ pr->pr_vnet = (pr_flags & PR_VNET) @@ -1300,31 +1300,30 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * Unlike other initial settings, this may return an erorr. */ error = cpuset_create_root(ppr, &pr->pr_cpuset); - if (error) { - prison_deref(pr, PD_LIST_XLOCKED); - goto done_releroot; - } + if (error) + goto done_deref; mtx_lock(&pr->pr_mtx); + drflags |= PD_LOCKED; /* * New prisons do not yet have a reference, because we do not * want others to see the incomplete prison once the * allprison_lock is downgraded. */ } else { - created = 0; /* * Grab a reference for existing prisons, to ensure they * continue to exist for the duration of the call. */ pr->pr_ref++; + drflags |= PD_DEREF; #if defined(VIMAGE) && (defined(INET) || defined(INET6)) if ((pr->pr_flags & PR_VNET) && (ch_flags & (PR_IP4_USER | PR_IP6_USER))) { error = EINVAL; vfs_opterror(opts, "vnet jails cannot have IP address restrictions"); - goto done_deref_locked; + goto done_deref; } #endif #ifdef INET @@ -1332,7 +1331,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) error = EINVAL; vfs_opterror(opts, "ip4 cannot be changed after creation"); - goto done_deref_locked; + goto done_deref; } #endif #ifdef INET6 @@ -1340,7 +1339,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) error = EINVAL; vfs_opterror(opts, "ip6 cannot be changed after creation"); - goto done_deref_locked; + goto done_deref; } #endif } @@ -1349,19 +1348,19 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) if (gotslevel) { if (slevel < ppr->pr_securelevel) { error = EPERM; - goto done_deref_locked; + goto done_deref; } } if (gotchildmax) { if (childmax >= ppr->pr_childmax) { error = EPERM; - goto done_deref_locked; + goto done_deref; } } if (gotenforce) { if (enforce < ppr->pr_enforce_statfs) { error = EPERM; - goto done_deref_locked; + goto done_deref; } } if (gotrsnum) { @@ -1370,7 +1369,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) */ if (rsnum < 0 || rsnum > 65535) { error = EINVAL; - goto done_deref_locked; + goto done_deref; } /* * Nested jails always inherit parent's devfs ruleset @@ -1378,7 +1377,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) if (jailed(td->td_ucred)) { if (rsnum > 0 && rsnum != ppr->pr_devfs_rsnum) { error = EPERM; - goto done_deref_locked; + goto done_deref; } else rsnum = ppr->pr_devfs_rsnum; } @@ -1397,7 +1396,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) break; if (ij == ppr->pr_ip4s) { error = EPERM; - goto done_deref_locked; + goto done_deref; } if (ip4s > 1) { for (ii = ij = 1; ii < ip4s; ii++) { @@ -1413,7 +1412,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } if (ij == ppr->pr_ip4s) { error = EPERM; - goto done_deref_locked; + goto done_deref; } } } @@ -1451,7 +1450,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) error = EADDRINUSE; vfs_opterror(opts, "IPv4 addresses clash"); - goto done_deref_locked; + goto done_deref; } } } @@ -1470,7 +1469,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) break; if (ij == ppr->pr_ip6s) { error = EPERM; - goto done_deref_locked; + goto done_deref; } if (ip6s > 1) { for (ii = ij = 1; ii < ip6s; ii++) { @@ -1486,7 +1485,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } if (ij == ppr->pr_ip6s) { error = EPERM; - goto done_deref_locked; + goto done_deref; } } } @@ -1519,7 +1518,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) error = EADDRINUSE; vfs_opterror(opts, "IPv6 addresses clash"); - goto done_deref_locked; + goto done_deref; } } } @@ -1538,7 +1537,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) error = EINVAL; vfs_opterror(opts, "name cannot be numeric (unless it is the jid)"); - goto done_deref_locked; + goto done_deref; } /* * Make sure the name isn't too long for the prison or its @@ -1549,20 +1548,20 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) namelen = strlen(namelc); if (pnamelen + namelen + 1 > sizeof(pr->pr_name)) { error = ENAMETOOLONG; - goto done_deref_locked; + goto done_deref; } FOREACH_PRISON_DESCENDANT(pr, tpr, descend) { if (strlen(tpr->pr_name) + (namelen - onamelen) >= sizeof(pr->pr_name)) { error = ENAMETOOLONG; - goto done_deref_locked; + goto done_deref; } } } pr_allow_diff = pr_allow & ~ppr->pr_allow; if (pr_allow_diff & ~PR_ALLOW_DIFFERENCES) { error = EPERM; - goto done_deref_locked; + goto done_deref; } /* @@ -1571,21 +1570,19 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * as allprison_lock remains xlocked. */ mtx_unlock(&pr->pr_mtx); + drflags &= ~PD_LOCKED; error = osd_jail_call(pr, PR_METHOD_CHECK, opts); - if (error != 0) { - prison_deref(pr, created - ? PD_LIST_XLOCKED - : PD_DEREF | PD_LIST_XLOCKED); - goto done_releroot; - } + if (error != 0) + goto done_deref; mtx_lock(&pr->pr_mtx); + drflags |= PD_LOCKED; /* At this point, all valid parameters should have been noted. */ TAILQ_FOREACH(opt, opts, link) { if (!opt->seen && strcmp(opt->name, "errmsg")) { error = EINVAL; vfs_opterror(opts, "unknown parameter: %s", opt->name); - goto done_deref_locked; + goto done_deref; } } @@ -1679,6 +1676,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) /* Try to keep a real-rooted full pathname. */ strlcpy(pr->pr_path, path, sizeof(pr->pr_path)); pr->pr_root = root; + root = NULL; } if (PR_HOST & ch_flags & ~pr_flags) { if (pr->pr_flags & PR_HOST) { @@ -1749,6 +1747,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } pr->pr_flags = (pr->pr_flags & ~ch_flags) | pr_flags; mtx_unlock(&pr->pr_mtx); + drflags &= ~PD_LOCKED; #ifdef RACCT if (racct_enable && created) @@ -1807,45 +1806,41 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) /* Let the modules do their work. */ sx_downgrade(&allprison_lock); + drflags = (drflags & ~PD_LIST_XLOCKED) | PD_LIST_SLOCKED; if (born) { error = osd_jail_call(pr, PR_METHOD_CREATE, opts); if (error) { (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); - prison_deref(pr, created - ? PD_LIST_SLOCKED - : PD_DEREF | PD_LIST_SLOCKED); - goto done_errmsg; + goto done_deref; } } error = osd_jail_call(pr, PR_METHOD_SET, opts); if (error) { if (born) (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); - prison_deref(pr, created - ? PD_LIST_SLOCKED - : PD_DEREF | PD_LIST_SLOCKED); - goto done_errmsg; + goto done_deref; } /* Attach this process to the prison if requested. */ - slocked = PD_LIST_SLOCKED; if (flags & JAIL_ATTACH) { mtx_lock(&pr->pr_mtx); error = do_jail_attach(td, pr); - slocked = 0; + drflags &= ~PD_LIST_SLOCKED; if (error) { + if (created) { + /* do_jail_attach has removed the prison. */ + pr = NULL; + } vfs_opterror(opts, "attach failed"); - if (!created) - prison_deref(pr, PD_DEREF); - goto done_errmsg; + goto done_deref; } } #ifdef RACCT if (racct_enable && !created) { - if (slocked) { + if (drflags & PD_LIST_SLOCKED) { sx_sunlock(&allprison_lock); - slocked = 0; + drflags &= ~PD_LIST_SLOCKED; } prison_racct_modify(pr); } @@ -1853,39 +1848,36 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) td->td_retval[0] = pr->pr_id; - /* - * Now that it is all there, drop the temporary reference from existing - * prisons. Or add a reference to newly created persistent prisons - * (which was not done earlier so that the prison would not be publicly - * visible). - */ - if (!created) - prison_deref(pr, PD_DEREF | slocked); - else { + if (created) { + /* + * Add a reference to newly created persistent prisons + * (which was not done earlier so that the prison would + * not be publicly visible). + */ if (pr_flags & PR_PERSIST) { mtx_lock(&pr->pr_mtx); + drflags |= PD_LOCKED; pr->pr_ref++; pr->pr_uref++; - mtx_unlock(&pr->pr_mtx); + } else { + /* Non-persistent jails need no further changes. */ + pr = NULL; } - if (slocked) - sx_sunlock(&allprison_lock); } - goto done_free; - - done_deref_locked: - prison_deref(pr, created - ? PD_LOCKED | PD_LIST_XLOCKED - : PD_DEREF | PD_LOCKED | PD_LIST_XLOCKED); - goto done_releroot; - done_unlock_list: - sx_xunlock(&allprison_lock); - done_releroot: + done_deref: + /* Release any temporary prison holds and/or locks. */ + if (pr != NULL) + prison_deref(pr, drflags); + else if (drflags & PD_LIST_SLOCKED) + sx_sunlock(&allprison_lock); + else if (drflags & PD_LIST_XLOCKED) + sx_xunlock(&allprison_lock); if (root != NULL) vrele(root); done_errmsg: if (error) { + /* Write the error message back to userspace. */ if (vfs_getopt(opts, "errmsg", (void **)&errmsg, &errmsg_len) == 0 && errmsg_len > 0) { errmsg_pos = 2 * vfs_getopt_pos(opts, "errmsg") + 1; @@ -2013,7 +2005,7 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) struct vfsopt *opt; struct vfsoptlist *opts; char *errmsg, *name; - int error, errmsg_len, errmsg_pos, i, jid, len, locked, pos; + int drflags, error, errmsg_len, errmsg_pos, i, jid, len, pos; unsigned f; if (flags & ~JAIL_GET_MASK) @@ -2025,11 +2017,13 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) return (error); errmsg_pos = vfs_getopt_pos(opts, "errmsg"); mypr = td->td_ucred->cr_prison; + pr = NULL; /* * Find the prison specified by one of: lastjid, jid, name. */ sx_slock(&allprison_lock); + drflags = PD_LIST_SLOCKED; error = vfs_copyopt(opts, "lastjid", &jid, sizeof(jid)); if (error == 0) { TAILQ_FOREACH(pr, &allprison, pr_list) { @@ -2041,117 +2035,119 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) mtx_unlock(&pr->pr_mtx); } } - if (pr != NULL) + if (pr != NULL) { + drflags |= PD_LOCKED; goto found_prison; + } error = ENOENT; vfs_opterror(opts, "no jail after %d", jid); - goto done_unlock_list; + goto done; } else if (error != ENOENT) - goto done_unlock_list; + goto done; error = vfs_copyopt(opts, "jid", &jid, sizeof(jid)); if (error == 0) { if (jid != 0) { pr = prison_find_child(mypr, jid); if (pr != NULL) { + drflags |= PD_LOCKED; if (pr->pr_uref == 0 && !(flags & JAIL_DYING)) { - mtx_unlock(&pr->pr_mtx); error = ENOENT; vfs_opterror(opts, "jail %d is dying", jid); - goto done_unlock_list; + goto done; } goto found_prison; } error = ENOENT; vfs_opterror(opts, "jail %d not found", jid); - goto done_unlock_list; + goto done; } } else if (error != ENOENT) - goto done_unlock_list; + goto done; error = vfs_getopt(opts, "name", (void **)&name, &len); if (error == 0) { if (len == 0 || name[len - 1] != '\0') { error = EINVAL; - goto done_unlock_list; + goto done; } pr = prison_find_name(mypr, name); if (pr != NULL) { + drflags |= PD_LOCKED; if (pr->pr_uref == 0 && !(flags & JAIL_DYING)) { - mtx_unlock(&pr->pr_mtx); error = ENOENT; vfs_opterror(opts, "jail \"%s\" is dying", name); - goto done_unlock_list; + goto done; } goto found_prison; } error = ENOENT; vfs_opterror(opts, "jail \"%s\" not found", name); - goto done_unlock_list; + goto done; } else if (error != ENOENT) - goto done_unlock_list; + goto done; vfs_opterror(opts, "no jail specified"); error = ENOENT; - goto done_unlock_list; + goto done; found_prison: /* Get the parameters of the prison. */ pr->pr_ref++; - locked = PD_LOCKED; + drflags |= PD_DEREF; td->td_retval[0] = pr->pr_id; error = vfs_setopt(opts, "jid", &pr->pr_id, sizeof(pr->pr_id)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; i = (pr->pr_parent == mypr) ? 0 : pr->pr_parent->pr_id; error = vfs_setopt(opts, "parent", &i, sizeof(i)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; error = vfs_setopts(opts, "name", prison_name(mypr, pr)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; error = vfs_setopt(opts, "cpuset.id", &pr->pr_cpuset->cs_id, sizeof(pr->pr_cpuset->cs_id)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; error = vfs_setopts(opts, "path", prison_path(mypr, pr)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; #ifdef INET error = vfs_setopt_part(opts, "ip4.addr", pr->pr_ip4, pr->pr_ip4s * sizeof(*pr->pr_ip4)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; #endif #ifdef INET6 error = vfs_setopt_part(opts, "ip6.addr", pr->pr_ip6, pr->pr_ip6s * sizeof(*pr->pr_ip6)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; #endif error = vfs_setopt(opts, "securelevel", &pr->pr_securelevel, sizeof(pr->pr_securelevel)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; error = vfs_setopt(opts, "children.cur", &pr->pr_childcount, sizeof(pr->pr_childcount)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; error = vfs_setopt(opts, "children.max", &pr->pr_childmax, sizeof(pr->pr_childmax)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; error = vfs_setopts(opts, "host.hostname", pr->pr_hostname); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; error = vfs_setopts(opts, "host.domainname", pr->pr_domainname); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; error = vfs_setopts(opts, "host.hostuuid", pr->pr_hostuuid); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; #ifdef COMPAT_FREEBSD32 if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) { uint32_t hid32 = pr->pr_hostid; @@ -2162,26 +2158,26 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) error = vfs_setopt(opts, "host.hostid", &pr->pr_hostid, sizeof(pr->pr_hostid)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; error = vfs_setopt(opts, "enforce_statfs", &pr->pr_enforce_statfs, sizeof(pr->pr_enforce_statfs)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; error = vfs_setopt(opts, "devfs_ruleset", &pr->pr_devfs_rsnum, sizeof(pr->pr_devfs_rsnum)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; for (bf = pr_flag_bool; bf < pr_flag_bool + nitems(pr_flag_bool); bf++) { i = (pr->pr_flags & bf->flag) ? 1 : 0; error = vfs_setopt(opts, bf->name, &i, sizeof(i)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; i = !i; error = vfs_setopt(opts, bf->noname, &i, sizeof(i)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; } for (jsf = pr_flag_jailsys; jsf < pr_flag_jailsys + nitems(pr_flag_jailsys); @@ -2192,7 +2188,7 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) : JAIL_SYS_INHERIT; error = vfs_setopt(opts, jsf->name, &i, sizeof(i)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; } for (bf = pr_flag_allow; bf < pr_flag_allow + nitems(pr_flag_allow) && @@ -2201,42 +2197,44 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) i = (pr->pr_allow & bf->flag) ? 1 : 0; error = vfs_setopt(opts, bf->name, &i, sizeof(i)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; i = !i; error = vfs_setopt(opts, bf->noname, &i, sizeof(i)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; } i = (pr->pr_uref == 0); error = vfs_setopt(opts, "dying", &i, sizeof(i)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; i = !i; error = vfs_setopt(opts, "nodying", &i, sizeof(i)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; error = vfs_setopt(opts, "osreldate", &pr->pr_osreldate, sizeof(pr->pr_osreldate)); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; error = vfs_setopts(opts, "osrelease", pr->pr_osrelease); if (error != 0 && error != ENOENT) - goto done_deref; + goto done; /* Get the module parameters. */ mtx_unlock(&pr->pr_mtx); - locked = 0; + drflags &= ~PD_LOCKED; error = osd_jail_call(pr, PR_METHOD_GET, opts); if (error) - goto done_deref; - prison_deref(pr, PD_DEREF | PD_LIST_SLOCKED); + goto done; + prison_deref(pr, drflags); + pr = NULL; + drflags = 0; /* By now, all parameters should have been noted. */ TAILQ_FOREACH(opt, opts, link) { if (!opt->seen && strcmp(opt->name, "errmsg")) { error = EINVAL; vfs_opterror(opts, "unknown parameter: %s", opt->name); - goto done_errmsg; + goto done; } } @@ -2261,16 +2259,15 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) } } } - goto done_errmsg; - done_deref: - prison_deref(pr, locked | PD_DEREF | PD_LIST_SLOCKED); - goto done_errmsg; - - done_unlock_list: - sx_sunlock(&allprison_lock); - done_errmsg: + done: + /* Release any temporary prison holds and/or locks. */ + if (pr != NULL) + prison_deref(pr, drflags); + else if (drflags & PD_LIST_SLOCKED) + sx_sunlock(&allprison_lock); if (error && errmsg_pos >= 0) { + /* Write the error message back to userspace. */ vfs_getopt(opts, "errmsg", (void **)&errmsg, &errmsg_len); errmsg_pos = 2 * errmsg_pos + 1; if (errmsg_len > 0) { @@ -2347,13 +2344,14 @@ static void prison_remove_one(struct prison *pr) { struct proc *p; - int deuref; + int drflags; + + drflags = PD_DEREF | PD_LOCKED | PD_LIST_XLOCKED; /* If the prison was persistent, it is not anymore. */ - deuref = 0; if (pr->pr_flags & PR_PERSIST) { pr->pr_ref--; - deuref = PD_DEUREF; + drflags |= PD_DEUREF; pr->pr_flags &= ~PR_PERSIST; } @@ -2364,13 +2362,13 @@ prison_remove_one(struct prison *pr) KASSERT(pr->pr_ref > 0, ("prison_remove_one removing a dead prison (jid=%d)", pr->pr_id)); if (pr->pr_ref == 1) { - prison_deref(pr, - deuref | PD_DEREF | PD_LOCKED | PD_LIST_XLOCKED); + prison_deref(pr, drflags); return; } mtx_unlock(&pr->pr_mtx); sx_xunlock(&allprison_lock); + drflags &= ~(PD_LOCKED | PD_LIST_XLOCKED); /* * Kill all processes unfortunate enough to be attached to this prison. */ @@ -2384,7 +2382,7 @@ prison_remove_one(struct prison *pr) } sx_sunlock(&allproc_lock); /* Remove the temporary reference added by jail_remove. */ - prison_deref(pr, deuref | PD_DEREF); + prison_deref(pr, drflags); } /* From owner-dev-commits-src-all@freebsd.org Sun Jan 10 05:59:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2FE884EF109; Sun, 10 Jan 2021 05:59:01 +0000 (UTC) (envelope-from git@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 4DD5kY0kqQz3HGp; Sun, 10 Jan 2021 05:59:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C057231C3; Sun, 10 Jan 2021 05:59:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A5x0Vi006472; Sun, 10 Jan 2021 05:59:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A5x0mK006470; Sun, 10 Jan 2021 05:59:00 GMT (envelope-from git) Date: Sun, 10 Jan 2021 05:59:00 GMT Message-Id: <202101100559.10A5x0mK006470@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 63882ce21586 - stable/12 - kern: efirt: enter runtime environment to deref efi_cfgtbl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 63882ce21586f6904ae4faf9dbbf73b560378773 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 05:59:01 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=63882ce21586f6904ae4faf9dbbf73b560378773 commit 63882ce21586f6904ae4faf9dbbf73b560378773 Author: Kyle Evans AuthorDate: 2020-12-27 17:28:32 +0000 Commit: Kyle Evans CommitDate: 2021-01-10 05:58:43 +0000 kern: efirt: enter runtime environment to deref efi_cfgtbl This fixes an insta-panic when EFIIOC_GET_TABLE is used. (cherry picked from commit 0861c7d3e048556841fa5085173660dceadc5646) --- sys/dev/efidev/efirt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/efidev/efirt.c b/sys/dev/efidev/efirt.c index ccbae5701e18..9eaaba9801fd 100644 --- a/sys/dev/efidev/efirt.c +++ b/sys/dev/efidev/efirt.c @@ -285,18 +285,25 @@ efi_get_table(struct uuid *uuid, void **ptr) { struct efi_cfgtbl *ct; u_long count; + int error; if (efi_cfgtbl == NULL || efi_systbl == NULL) return (ENXIO); + error = efi_enter(); + if (error != 0) + return (error); count = efi_systbl->st_entries; ct = efi_cfgtbl; while (count--) { if (!bcmp(&ct->ct_uuid, uuid, sizeof(*uuid))) { *ptr = (void *)efi_phys_to_kva(ct->ct_data); + efi_leave(); return (0); } ct++; } + + efi_leave(); return (ENOENT); } From owner-dev-commits-src-all@freebsd.org Sun Jan 10 05:59:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 75C764EEEBA; Sun, 10 Jan 2021 05:59:02 +0000 (UTC) (envelope-from git@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 4DD5kZ2C9fz3HX0; Sun, 10 Jan 2021 05:59:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 363552359A; Sun, 10 Jan 2021 05:59:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A5x245006492; Sun, 10 Jan 2021 05:59:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A5x2HC006491; Sun, 10 Jan 2021 05:59:02 GMT (envelope-from git) Date: Sun, 10 Jan 2021 05:59:02 GMT Message-Id: <202101100559.10A5x2HC006491@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 4c63cc766f30 - stable/12 - kern: efirt: correct configuration table entry size MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4c63cc766f30781dadf1e164e7137de95108ff25 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 05:59:02 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4c63cc766f30781dadf1e164e7137de95108ff25 commit 4c63cc766f30781dadf1e164e7137de95108ff25 Author: Kyle Evans AuthorDate: 2020-12-27 17:26:45 +0000 Commit: Kyle Evans CommitDate: 2021-01-10 05:58:55 +0000 kern: efirt: correct configuration table entry size Each entry actually stores a native pointer, not a uint64_t quantity. While we're here, go ahead and export the pointer as-is rather than converting it to KVA. This may be more useful as consumers can map /dev/mem and observe the entry. For reference, see: sys/contrib/edk2/Include/Uefi/UefiSpec.h (cherry picked from commit ee938b20335d26ca652deac4a1a063e90cafa303) --- sys/dev/efidev/efirt.c | 2 +- sys/sys/efi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/efidev/efirt.c b/sys/dev/efidev/efirt.c index 9eaaba9801fd..f9c01242d1a0 100644 --- a/sys/dev/efidev/efirt.c +++ b/sys/dev/efidev/efirt.c @@ -296,7 +296,7 @@ efi_get_table(struct uuid *uuid, void **ptr) ct = efi_cfgtbl; while (count--) { if (!bcmp(&ct->ct_uuid, uuid, sizeof(*uuid))) { - *ptr = (void *)efi_phys_to_kva(ct->ct_data); + *ptr = ct->ct_data; efi_leave(); return (0); } diff --git a/sys/sys/efi.h b/sys/sys/efi.h index 622df48e7f32..9460030bb5c2 100644 --- a/sys/sys/efi.h +++ b/sys/sys/efi.h @@ -51,7 +51,7 @@ typedef unsigned long efi_status; struct efi_cfgtbl { struct uuid ct_uuid; - uint64_t ct_data; + void *ct_data; }; struct efi_md { From owner-dev-commits-src-all@freebsd.org Sun Jan 10 05:59:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 955E54EF1A8; Sun, 10 Jan 2021 05:59:41 +0000 (UTC) (envelope-from git@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 4DD5lK3gNhz3HjQ; Sun, 10 Jan 2021 05:59:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 717352342A; Sun, 10 Jan 2021 05:59:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A5xfZF006692; Sun, 10 Jan 2021 05:59:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A5xfr7006691; Sun, 10 Jan 2021 05:59:41 GMT (envelope-from git) Date: Sun, 10 Jan 2021 05:59:41 GMT Message-Id: <202101100559.10A5xfr7006691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: e6d98805103c - stable/12 - syscons: scrnmaps: appease -Wmissing-variable-declarations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e6d98805103c51dc384ad0708e66642ce4a6746f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 05:59:41 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e6d98805103c51dc384ad0708e66642ce4a6746f commit e6d98805103c51dc384ad0708e66642ce4a6746f Author: Kyle Evans AuthorDate: 2021-01-01 17:53:47 +0000 Commit: Kyle Evans CommitDate: 2021-01-10 05:59:31 +0000 syscons: scrnmaps: appease -Wmissing-variable-declarations scrmap is only used in the one compilation unit in all cases, make it static rather than extern'ing it. There's little benefit, but it's easy to do. It's unclear how this hasn't failed many builds before now, since it should have cropped up sometime around deeper hierarchies getting a default WARNS. (cherry picked from commit fb6bc290fb342864f5362ab9cef7dd214df05cf3) --- share/syscons/scrnmaps/armscii8-2haik8 | 2 +- share/syscons/scrnmaps/iso-8859-1_to_cp437 | 2 +- share/syscons/scrnmaps/iso-8859-4_for_vga9 | 2 +- share/syscons/scrnmaps/iso-8859-7_to_cp437 | 2 +- share/syscons/scrnmaps/koi8-r2cp866 | 2 +- share/syscons/scrnmaps/koi8-u2cp866u | 2 +- share/syscons/scrnmaps/us-ascii_to_cp437 | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/share/syscons/scrnmaps/armscii8-2haik8 b/share/syscons/scrnmaps/armscii8-2haik8 index f6bc35d74701..0546204b9164 100644 --- a/share/syscons/scrnmaps/armscii8-2haik8 +++ b/share/syscons/scrnmaps/armscii8-2haik8 @@ -27,7 +27,7 @@ * $FreeBSD$ */ -scrmap_t scrmap = { +static scrmap_t scrmap = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/share/syscons/scrnmaps/iso-8859-1_to_cp437 b/share/syscons/scrnmaps/iso-8859-1_to_cp437 index c18e62f04667..80522c4315e2 100644 --- a/share/syscons/scrnmaps/iso-8859-1_to_cp437 +++ b/share/syscons/scrnmaps/iso-8859-1_to_cp437 @@ -25,7 +25,7 @@ * $FreeBSD$ */ -scrmap_t scrmap = { +static scrmap_t scrmap = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/share/syscons/scrnmaps/iso-8859-4_for_vga9 b/share/syscons/scrnmaps/iso-8859-4_for_vga9 index e096bdcd771e..5afbe36ee397 100644 --- a/share/syscons/scrnmaps/iso-8859-4_for_vga9 +++ b/share/syscons/scrnmaps/iso-8859-4_for_vga9 @@ -31,7 +31,7 @@ * only at 0xC0-0xDF area. */ -scrmap_t scrmap = { +static scrmap_t scrmap = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, diff --git a/share/syscons/scrnmaps/iso-8859-7_to_cp437 b/share/syscons/scrnmaps/iso-8859-7_to_cp437 index 12c467a360f2..7c1b49dba2da 100644 --- a/share/syscons/scrnmaps/iso-8859-7_to_cp437 +++ b/share/syscons/scrnmaps/iso-8859-7_to_cp437 @@ -2,7 +2,7 @@ * $FreeBSD$ */ -scrmap_t scrmap = { +static scrmap_t scrmap = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/share/syscons/scrnmaps/koi8-r2cp866 b/share/syscons/scrnmaps/koi8-r2cp866 index 15f2847fa9b3..d8d86f28e3e8 100644 --- a/share/syscons/scrnmaps/koi8-r2cp866 +++ b/share/syscons/scrnmaps/koi8-r2cp866 @@ -26,7 +26,7 @@ * $FreeBSD$ */ -scrmap_t scrmap = { +static scrmap_t scrmap = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/share/syscons/scrnmaps/koi8-u2cp866u b/share/syscons/scrnmaps/koi8-u2cp866u index 7fd86ad51bb7..a4e583da44a8 100644 --- a/share/syscons/scrnmaps/koi8-u2cp866u +++ b/share/syscons/scrnmaps/koi8-u2cp866u @@ -28,7 +28,7 @@ * $FreeBSD$ */ -scrmap_t scrmap = { +static scrmap_t scrmap = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/share/syscons/scrnmaps/us-ascii_to_cp437 b/share/syscons/scrnmaps/us-ascii_to_cp437 index e1155aa137c4..5e7d631237b3 100644 --- a/share/syscons/scrnmaps/us-ascii_to_cp437 +++ b/share/syscons/scrnmaps/us-ascii_to_cp437 @@ -2,7 +2,7 @@ * $FreeBSD$ */ -scrmap_t scrmap = { +static scrmap_t scrmap = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, From owner-dev-commits-src-all@freebsd.org Sun Jan 10 06:26:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 58D1F4EF772; Sun, 10 Jan 2021 06:26:31 +0000 (UTC) (envelope-from git@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 4DD6LH22mJz3KJf; Sun, 10 Jan 2021 06:26:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38A3C2347A; Sun, 10 Jan 2021 06:26:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A6QV5m045257; Sun, 10 Jan 2021 06:26:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A6QV2J045256; Sun, 10 Jan 2021 06:26:31 GMT (envelope-from git) Date: Sun, 10 Jan 2021 06:26:31 GMT Message-Id: <202101100626.10A6QV2J045256@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 81b3a0a34145 - main - libc: implement rtld_get_stack_prot() for real MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 81b3a0a34145ee6c855f50c8035728f76d63c3f0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 06:26:31 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=81b3a0a34145ee6c855f50c8035728f76d63c3f0 commit 81b3a0a34145ee6c855f50c8035728f76d63c3f0 Author: Konstantin Belousov AuthorDate: 2021-01-10 03:05:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 06:25:43 +0000 libc: implement rtld_get_stack_prot() for real which makes stack prot correct for non-main threads created by binaries with statically linked libthr. Cache result, but do not engage into the full double-checked locking, since calculation of the return value is idempotent. PR: 252549 Reported and reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28075 --- lib/libc/gen/dlfcn.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/libc/gen/dlfcn.c b/lib/libc/gen/dlfcn.c index f7f162753b4b..395a6d9402e8 100644 --- a/lib/libc/gen/dlfcn.c +++ b/lib/libc/gen/dlfcn.c @@ -34,7 +34,9 @@ __FBSDID("$FreeBSD$"); /* * Linkage to services provided by the dynamic linker. */ +#include #include +#include #include #include #include @@ -256,8 +258,30 @@ _rtld_addr_phdr(const void *addr __unused, int _rtld_get_stack_prot(void) { +#ifndef IN_LIBDL + unsigned i; + int r; + static int ret; + + r = atomic_load_int(&ret); + if (r != 0) + return (r); - return (PROT_EXEC | PROT_READ | PROT_WRITE); + _once(&dl_phdr_info_once, dl_init_phdr_info); + r = PROT_EXEC | PROT_READ | PROT_WRITE; + for (i = 0; i < phdr_info.dlpi_phnum; i++) { + if (phdr_info.dlpi_phdr[i].p_type != PT_GNU_STACK) + continue; + r = PROT_READ | PROT_WRITE; + if ((phdr_info.dlpi_phdr[i].p_flags & PF_X) != 0) + r |= PROT_EXEC; + break; + } + atomic_store_int(&ret, r); + return (r); +#else + return (0); +#endif } #pragma weak _rtld_is_dlopened From owner-dev-commits-src-all@freebsd.org Sun Jan 10 06:39:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DEE2C4EFAC4; Sun, 10 Jan 2021 06:39:59 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (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 4DD6dp6cggz3Km3; Sun, 10 Jan 2021 06:39:58 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-qt1-f182.google.com with SMTP id u21so9342132qtw.11; Sat, 09 Jan 2021 22:39:58 -0800 (PST) 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=VhdA5Ynsvg9KnlQAwqVKb9FhwTMIfKdzLI06MCqXRRA=; b=ehwvdoXmK7ex3BeIsJYbZsmtJnjqCuEq282CNfIHxyDnX4IUiUZnwQU2/ivZlCkFXi oI8qorUY7klSkNjjLDPNjSYSomzv27TSihLnJvEvcrF/Ma1kQLErUUfBY4bhyG4P9GLv /vx/dT/uxNgt4FgmXsm1vK3WrKofv/jgGghI/cAZ4ndTVaTHQQZY+8E+ULdio/8raLMv tPJrCGPXJ6rfOftk4TIWyaaI/fJ/mB/YXRrSvMPiIwdL0NKl254nPl6/0V+BL6ObhKdP mRiKk+lZqVcNT1Epgsx7xUJuz1DCUxx1mvIBqG6QyCLNOOXU6coj+GLff9Y197+w8PrE piKg== X-Gm-Message-State: AOAM5332iSS51QSS8Lt4YN7Dp8TRVk97NvuYX510VWNTIC3vOQqeIIU1 rJK5C2EM/4/olpaAL7AzHAI8GiVGPaM= X-Google-Smtp-Source: ABdhPJwUFpLsPVp4WFynWGxKUv9I3bE22a1eCfnkR4OWM+VArHclLj33PrKgyq7LlQSgin8BBg0ifw== X-Received: by 2002:a05:622a:193:: with SMTP id s19mr8269554qtw.366.1610260796932; Sat, 09 Jan 2021 22:39:56 -0800 (PST) Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com. [209.85.219.41]) by smtp.gmail.com with ESMTPSA id v4sm6509859qth.16.2021.01.09.22.39.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 09 Jan 2021 22:39:56 -0800 (PST) Received: by mail-qv1-f41.google.com with SMTP id p5so6205035qvs.7; Sat, 09 Jan 2021 22:39:56 -0800 (PST) X-Received: by 2002:a05:6214:1887:: with SMTP id cx7mr10973922qvb.39.1610260795895; Sat, 09 Jan 2021 22:39:55 -0800 (PST) MIME-Version: 1.0 References: <202101072320.107NKosW063030@gitrepo.freebsd.org> In-Reply-To: <202101072320.107NKosW063030@gitrepo.freebsd.org> From: Ryan Libby Date: Sat, 9 Jan 2021 22:39:44 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: afd590d9e566 - main - hid: Import hidmap and bunch of drivers based on it To: Vladimir Kondratyev Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DD6dp6cggz3Km3 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of rlibby@gmail.com designates 209.85.160.182 as permitted sender) smtp.mailfrom=rlibby@gmail.com X-Spamd-Result: default: False [-1.31 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RWL_MAILSPIKE_GOOD(0.00)[209.85.160.182:from]; RCVD_COUNT_THREE(0.00)[4]; FORGED_SENDER(0.30)[rlibby@freebsd.org,rlibby@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.160.182:from]; R_DKIM_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[rlibby@freebsd.org,rlibby@gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEFALL_USER(0.00)[rlibby]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_SPAM_SHORT(0.69)[0.689]; SPAMHAUS_ZRD(0.00)[209.85.160.182:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[209.85.160.182:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 06:39:59 -0000 On Thu, Jan 7, 2021 at 3:21 PM Vladimir Kondratyev wrote: > > The branch main has been updated by wulf: > > URL: https://cgit.FreeBSD.org/src/commit/?id=afd590d9e56686e179cbbf626ec567aeaaa49199 > > commit afd590d9e56686e179cbbf626ec567aeaaa49199 > Author: Vladimir Kondratyev > AuthorDate: 2020-10-14 22:02:15 +0000 > Commit: Vladimir Kondratyev > CommitDate: 2021-01-07 23:18:44 +0000 > > hid: Import hidmap and bunch of drivers based on it > > hidmap is a kernel module that maps HID input usages to evdev events. > > Following dependent drivers is included in the commit: > > hms - HID mouse driver. > hcons - Consumer page AKA Multimedia keys driver. > hsctrl - System Controls page (Power/Sleep keys) driver. > ps4dshock - Sony DualShock 4 gamepad driver. > > Reviewed by: hselasky > Differential revision: https://reviews.freebsd.org/D27993 > --- > share/man/man4/Makefile | 4 + > share/man/man4/hcons.4 | 98 +++ > share/man/man4/hms.4 | 115 +++ > share/man/man4/hsctrl.4 | 98 +++ > share/man/man4/ps4dshock.4 | 109 +++ > sys/conf/files | 5 + > sys/dev/hid/hcons.c | 295 ++++++++ > sys/dev/hid/hidmap.c | 832 +++++++++++++++++++++ > sys/dev/hid/hidmap.h | 262 +++++++ > sys/dev/hid/hms.c | 267 +++++++ > sys/dev/hid/hsctrl.c | 110 +++ > sys/dev/hid/ps4dshock.c | 1406 ++++++++++++++++++++++++++++++++++++ > sys/modules/hid/Makefile | 7 +- > sys/modules/hid/hcons/Makefile | 9 + > sys/modules/hid/hidmap/Makefile | 9 + > sys/modules/hid/hms/Makefile | 9 + > sys/modules/hid/hsctrl/Makefile | 9 + > sys/modules/hid/ps4dshock/Makefile | 9 + > 18 files changed, 3652 insertions(+), 1 deletion(-) > > diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile > index 02d1bca75a3f..60c1b5f19a9b 100644 > --- a/share/man/man4/Makefile > +++ b/share/man/man4/Makefile > @@ -180,11 +180,13 @@ MAN= aac.4 \ > gre.4 \ > h_ertt.4 \ > hconf.4 \ > + hcons.4 \ > hidbus.4 \ > hidquirk.4 \ > hidraw.4 \ > hifn.4 \ > hkbd.4 \ > + hms.4 \ > hmt.4 \ > hpet.4 \ > ${_hpt27xx.4} \ > @@ -192,6 +194,7 @@ MAN= aac.4 \ > ${_hptmv.4} \ > ${_hptnr.4} \ > ${_hptrr.4} \ > + hsctrl.4 \ > ${_hv_kvp.4} \ > ${_hv_netvsc.4} \ > ${_hv_storvsc.4} \ > @@ -432,6 +435,7 @@ MAN= aac.4 \ > ppi.4 \ > procdesc.4 \ > proto.4 \ > + ps4dshock.4 \ > psm.4 \ > pst.4 \ > pt.4 \ > diff --git a/share/man/man4/hcons.4 b/share/man/man4/hcons.4 > new file mode 100644 > index 000000000000..a8fe22983453 > --- /dev/null > +++ b/share/man/man4/hcons.4 > @@ -0,0 +1,98 @@ > +.\" Copyright (c) 2020 Vladimir Kondratyev > +.\" > +.\" 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 September 14, 2020 > +.Dt HCONS 4 > +.Os > +.Sh NAME > +.Nm hcons > +.Nd HID consumer page controls driver > +.Sh SYNOPSIS > +To compile this driver into the kernel, > +place the following lines in your > +kernel configuration file: > +.Bd -ragged -offset indent > +.Cd "device hcons" > +.Cd "device hid" > +.Cd "device hidbus" > +.Cd "device hidmap" > +.Cd "device evdev" > +.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 > +hgame_load="YES" > +.Ed > +.Sh DESCRIPTION > +The > +.Nm > +driver provides support for HID consumer page controls most often used as > +"Multimedia keys" found on many keyboards. > +.Pp > +The > +.Pa /dev/input/event* > +device presents the consumer page controls as a > +.Ar evdev > +type device. > +.Sh SYSCTL VARIABLES > +The following variable is available as both > +.Xr sysctl 8 > +variable and > +.Xr loader 8 > +tunable: > +.Bl -tag -width indent > +.It Va dev.hcons.X.debug > +Debug output level, where 0 is debugging disabled and larger values increase > +debug message verbosity. > +Default is 0. > +.El > +.Pp > +It default value is set with > +.Xr loader 8 > +tunable: > +.Bl -tag -width indent > +.It Va hw.hid.hcons.debug > +.El > +.Sh FILES > +.Bl -tag -width /dev/input/event* -compact > +.It Pa /dev/input/event* > +input event device node. > +.El > +.Sh SEE ALSO > +.Xr iichid 4 , > +.Xr usbhid 4 > +.Sh HISTORY > +The > +.Nm > +driver first appeared in > +.Fx 13.0. > +.Sh AUTHORS > +.An -nosplit > +The > +.Nm > +driver was written by > +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . > diff --git a/share/man/man4/hms.4 b/share/man/man4/hms.4 > new file mode 100644 > index 000000000000..eb413e943976 > --- /dev/null > +++ b/share/man/man4/hms.4 > @@ -0,0 +1,115 @@ > +.\" Copyright (c) > +.\" 1999 Nick Hibma . All rights reserved. > +.\" 2020 Vladimir Kondratyev . > +.\" > +.\" 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 September 12, 2020 > +.Dt HMS 4 > +.Os > +.Sh NAME > +.Nm hms > +.Nd HID mouse driver > +.Sh SYNOPSIS > +To compile this driver into the kernel, > +place the following lines in your > +kernel configuration file: > +.Bd -ragged -offset indent > +.Cd "device hms" > +.Cd "device hidbus" > +.Cd "device hid" > +.Cd "device evdev" > +.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 > +hms_load="YES" > +.Ed > +.Sh DESCRIPTION > +The > +.Nm > +driver provides support for HID mice that attach to the HID transport > +backend. > +See > +.Xr iichid 4 > +or > +.Xr usbhid 4 . > +Supported are > +mice with any number of buttons, mice with a wheel and absolute mice. > +.Pp > +The > +.Pa /dev/input/eventX > +device presents the mouse as a > +.Ar evdev > +type device. > +.Sh SYSCTL VARIABLES > +The following variable is available as both > +.Xr sysctl 8 > +variable and > +.Xr loader 8 > +tunable: > +.Bl -tag -width indent > +.It Va dev.hms.X.debug > +Debug output level, where 0 is debugging disabled and larger values increase > +debug message verbosity. > +Default is 0. > +.El > +.Pp > +It default value is derived from > +.Xr loader 8 > +tunable: > +.Bl -tag -width indent > +.It Va hw.hid.hms.debug > +.El > +.Sh FILES > +.Bl -tag -width /dev/input/eventX -compact > +.It Pa /dev/input/eventX > +input event device node. > +.El > +.Sh SEE ALSO > +.Xr iichid 4 , > +.Xr usbhid 4 , > +.Xr xorg.conf 5 Pq Pa ports/x11/xorg > +.\.Xr moused 8 > +.Sh BUGS > +.Nm > +cannot act like > +.Xr sysmouse 4 > +.Sh AUTHORS > +.An -nosplit > +The > +.Nm > +driver was written by > +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . > +.Pp > +This manual page was originally written by > +.An Nick Hibma Aq Mt n_hibma@FreeBSD.org > +for > +.Xr umt 4 > +driver and was adopted for > +.Nm > +by > +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . > diff --git a/share/man/man4/hsctrl.4 b/share/man/man4/hsctrl.4 > new file mode 100644 > index 000000000000..ba7976c3c03d > --- /dev/null > +++ b/share/man/man4/hsctrl.4 > @@ -0,0 +1,98 @@ > +.\" Copyright (c) 2020 Vladimir Kondratyev > +.\" > +.\" 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 September 14, 2020 > +.Dt HSCTRL 4 > +.Os > +.Sh NAME > +.Nm hsctrl > +.Nd HID system controls driver > +.Sh SYNOPSIS > +To compile this driver into the kernel, > +place the following lines in your > +kernel configuration file: > +.Bd -ragged -offset indent > +.Cd "device hsctrl" > +.Cd "device hid" > +.Cd "device hidbus" > +.Cd "device hidmap" > +.Cd "device evdev" > +.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 > +hgame_load="YES" > +.Ed > +.Sh DESCRIPTION > +The > +.Nm > +driver provides support for HID system controls most often used as > +"Power off/Sleep keys" found on many keyboards. > +.Pp > +The > +.Pa /dev/input/event* > +device presents the consumer page controls as a > +.Ar evdev > +type device. > +.Sh SYSCTL VARIABLES > +The following variable is available as both > +.Xr sysctl 8 > +variable and > +.Xr loader 8 > +tunable: > +.Bl -tag -width indent > +.It Va dev.hsctrl.X.debug > +Debug output level, where 0 is debugging disabled and larger values increase > +debug message verbosity. > +Default is 0. > +.El > +.Pp > +It default value is set with > +.Xr loader 8 > +tunable: > +.Bl -tag -width indent > +.It Va hw.hid.hsctrl.debug > +.El > +.Sh FILES > +.Bl -tag -width /dev/input/event* -compact > +.It Pa /dev/input/event* > +input event device node. > +.El > +.Sh SEE ALSO > +.Xr iichid 4 , > +.Xr usbhid 4 > +.Sh HISTORY > +The > +.Nm > +driver first appeared in > +.Fx 13.0. > +.Sh AUTHORS > +.An -nosplit > +The > +.Nm > +driver was written by > +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . > diff --git a/share/man/man4/ps4dshock.4 b/share/man/man4/ps4dshock.4 > new file mode 100644 > index 000000000000..e2295533989f > --- /dev/null > +++ b/share/man/man4/ps4dshock.4 > @@ -0,0 +1,109 @@ > +.\" Copyright (c) 2020 Vladimir Kondratyev > +.\" > +.\" 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 September 19, 2020 > +.Dt PS4DSHOCK 4 > +.Os > +.Sh NAME > +.Nm ps4dshock > +.Nd Sony PlayStation 4 Dualshock 4 gamepad driver > +.Sh SYNOPSIS > +To compile this driver into the kernel, > +place the following lines in your > +kernel configuration file: > +.Bd -ragged -offset indent > +.Cd "device ps4dshock" > +.Cd "device hid" > +.Cd "device hidbus" > +.Cd "device hidmap" > +.Cd "device evdev" > +.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 > +ps4dshock_load="YES" > +.Ed > +.Sh DESCRIPTION > +The > +.Nm > +driver provides support for Sony PlayStation 4 Dualshock 4 gamepad driver. > +.Pp > +The > +.Pa /dev/input/event* > +device presents the game controller as a > +.Ar evdev > +type device. > +.Sh SYSCTL VARIABLES > +Next parameters are available as > +.Xr sysctl 8 > +variables. > +Debug parameter is available as > +.Xr loader 8 > +tunable as well. > +.Bl -tag -width indent > +.It Va dev.p4dshock.*.led_state > +LED state: 0 - off, 1 - on, 2 - blinking. > +.It Va dev.p4dshock.*.led_color_r > +LED color. > +Red component. > +.It Va dev.p4dshock.*.led_color_g > +LED color. > +Green component. > +.It Va dev.p4dshock.*.led_color_b > +LED color. > +Blue component. > +.It Va dev.p4dshock.*.led_delay_on > +LED blink. > +On delay, msecs. > +.It Va dev.p4dshock.*.led_delay_off > +LED blink. > +Off delay, msecs. > +.It Va hw.hid.ps4dshock.debug > +Debug output level, where 0 is debugging disabled and larger values increase > +debug message verbosity. > +Default is 0. > +.El > +.Sh FILES > +.Bl -tag -width /dev/input/event* -compact > +.It Pa /dev/input/event* > +input event device node. > +.El > +.Sh BUGS > +The > +.Nm > +does not support force-feedback events. > +.Sh HISTORY > +The > +.Nm > +driver first appeared in > +.Fx 13.0. > +.Sh AUTHORS > +.An -nosplit > +The > +.Nm > +driver was written by > +.An Vladimir Kondratyev Aq Mt wulf@FreeBSD.org . > diff --git a/sys/conf/files b/sys/conf/files > index cea809deb039..31a06150a329 100644 > --- a/sys/conf/files > +++ b/sys/conf/files > @@ -1816,13 +1816,18 @@ dev/gpio/gpiobus_if.m optional gpio > dev/gpio/gpiopps.c optional gpiopps fdt > dev/gpio/ofw_gpiobus.c optional fdt gpio > dev/hid/hconf.c optional hconf > +dev/hid/hcons.c optional hcons > dev/hid/hid.c optional hid > dev/hid/hid_if.m optional hid > dev/hid/hidbus.c optional hidbus > +dev/hid/hidmap.c optional hidmap > dev/hid/hidquirk.c optional hid > dev/hid/hidraw.c optional hidraw > dev/hid/hkbd.c optional hkbd > +dev/hid/hms.c optional hms > dev/hid/hmt.c optional hmt hconf > +dev/hid/hsctrl.c optional hsctrl > +dev/hid/ps4dshock.c optional ps4dshock > dev/hifn/hifn7751.c optional hifn > dev/hptiop/hptiop.c optional hptiop scbus > dev/hwpmc/hwpmc_logging.c optional hwpmc > diff --git a/sys/dev/hid/hcons.c b/sys/dev/hid/hcons.c > new file mode 100644 > index 000000000000..559e84d468f3 > --- /dev/null > +++ b/sys/dev/hid/hcons.c > @@ -0,0 +1,295 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2020 Vladimir Kondratyev > + * > + * 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 > +__FBSDID("$FreeBSD$"); > + > +/* > + * Consumer Controls usage page driver > + * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#include > +#include > +#include > + > +static hidmap_cb_t hcons_rel_volume_cb; > + > +#define HCONS_MAP_KEY(usage, code) \ > + { HIDMAP_KEY(HUP_CONSUMER, usage, code) } > +#define HCONS_MAP_ABS(usage, code) \ > + { HIDMAP_ABS(HUP_CONSUMER, usage, code) } > +#define HCONS_MAP_REL(usage, code) \ > + { HIDMAP_REL(HUP_CONSUMER, usage, code) } > +#define HCONS_MAP_REL_CB(usage, callback) \ > + { HIDMAP_REL_CB(HUP_CONSUMER, usage, &callback) } > + > +static const struct hidmap_item hcons_map[] = { > + HCONS_MAP_KEY(0x030, KEY_POWER), > + HCONS_MAP_KEY(0x031, KEY_RESTART), > + HCONS_MAP_KEY(0x032, KEY_SLEEP), > + HCONS_MAP_KEY(0x034, KEY_SLEEP), > + HCONS_MAP_KEY(0x035, KEY_KBDILLUMTOGGLE), > + HCONS_MAP_KEY(0x036, BTN_MISC), > + HCONS_MAP_KEY(0x040, KEY_MENU), /* Menu */ > + HCONS_MAP_KEY(0x041, KEY_SELECT), /* Menu Pick */ > + HCONS_MAP_KEY(0x042, KEY_UP), /* Menu Up */ > + HCONS_MAP_KEY(0x043, KEY_DOWN), /* Menu Down */ > + HCONS_MAP_KEY(0x044, KEY_LEFT), /* Menu Left */ > + HCONS_MAP_KEY(0x045, KEY_RIGHT), /* Menu Right */ > + HCONS_MAP_KEY(0x046, KEY_ESC), /* Menu Escape */ > + HCONS_MAP_KEY(0x047, KEY_KPPLUS), /* Menu Value Increase */ > + HCONS_MAP_KEY(0x048, KEY_KPMINUS), /* Menu Value Decrease */ > + HCONS_MAP_KEY(0x060, KEY_INFO), /* Data On Screen */ > + HCONS_MAP_KEY(0x061, KEY_SUBTITLE), /* Closed Caption */ > + HCONS_MAP_KEY(0x063, KEY_VCR), /* VCR/TV */ > + HCONS_MAP_KEY(0x065, KEY_CAMERA), /* Snapshot */ > + HCONS_MAP_KEY(0x069, KEY_RED), > + HCONS_MAP_KEY(0x06a, KEY_GREEN), > + HCONS_MAP_KEY(0x06b, KEY_BLUE), > + HCONS_MAP_KEY(0x06c, KEY_YELLOW), > + HCONS_MAP_KEY(0x06d, KEY_ASPECT_RATIO), > + HCONS_MAP_KEY(0x06f, KEY_BRIGHTNESSUP), > + HCONS_MAP_KEY(0x070, KEY_BRIGHTNESSDOWN), > + HCONS_MAP_KEY(0x072, KEY_BRIGHTNESS_TOGGLE), > + HCONS_MAP_KEY(0x073, KEY_BRIGHTNESS_MIN), > + HCONS_MAP_KEY(0x074, KEY_BRIGHTNESS_MAX), > + HCONS_MAP_KEY(0x075, KEY_BRIGHTNESS_AUTO), > + HCONS_MAP_KEY(0x079, KEY_KBDILLUMUP), > + HCONS_MAP_KEY(0x07a, KEY_KBDILLUMDOWN), > + HCONS_MAP_KEY(0x07c, KEY_KBDILLUMTOGGLE), > + HCONS_MAP_KEY(0x082, KEY_VIDEO_NEXT), > + HCONS_MAP_KEY(0x083, KEY_LAST), > + HCONS_MAP_KEY(0x084, KEY_ENTER), > + HCONS_MAP_KEY(0x088, KEY_PC), > + HCONS_MAP_KEY(0x089, KEY_TV), > + HCONS_MAP_KEY(0x08a, KEY_WWW), > + HCONS_MAP_KEY(0x08b, KEY_DVD), > + HCONS_MAP_KEY(0x08c, KEY_PHONE), > + HCONS_MAP_KEY(0x08d, KEY_PROGRAM), > + HCONS_MAP_KEY(0x08e, KEY_VIDEOPHONE), > + HCONS_MAP_KEY(0x08f, KEY_GAMES), > + HCONS_MAP_KEY(0x090, KEY_MEMO), > + HCONS_MAP_KEY(0x091, KEY_CD), > + HCONS_MAP_KEY(0x092, KEY_VCR), > + HCONS_MAP_KEY(0x093, KEY_TUNER), > + HCONS_MAP_KEY(0x094, KEY_EXIT), > + HCONS_MAP_KEY(0x095, KEY_HELP), > + HCONS_MAP_KEY(0x096, KEY_TAPE), > + HCONS_MAP_KEY(0x097, KEY_TV2), > + HCONS_MAP_KEY(0x098, KEY_SAT), > + HCONS_MAP_KEY(0x09a, KEY_PVR), > + HCONS_MAP_KEY(0x09c, KEY_CHANNELUP), > + HCONS_MAP_KEY(0x09d, KEY_CHANNELDOWN), > + HCONS_MAP_KEY(0x0a0, KEY_VCR2), > + HCONS_MAP_KEY(0x0b0, KEY_PLAY), > + HCONS_MAP_KEY(0x0b1, KEY_PAUSE), > + HCONS_MAP_KEY(0x0b2, KEY_RECORD), > + HCONS_MAP_KEY(0x0b3, KEY_FASTFORWARD), > + HCONS_MAP_KEY(0x0b4, KEY_REWIND), > + HCONS_MAP_KEY(0x0b5, KEY_NEXTSONG), > + HCONS_MAP_KEY(0x0b6, KEY_PREVIOUSSONG), > + HCONS_MAP_KEY(0x0b7, KEY_STOPCD), > + HCONS_MAP_KEY(0x0b8, KEY_EJECTCD), > + HCONS_MAP_KEY(0x0bc, KEY_MEDIA_REPEAT), > + HCONS_MAP_KEY(0x0b9, KEY_SHUFFLE), > + HCONS_MAP_KEY(0x0bf, KEY_SLOW), > + HCONS_MAP_KEY(0x0cd, KEY_PLAYPAUSE), > + HCONS_MAP_KEY(0x0cf, KEY_VOICECOMMAND), > + HCONS_MAP_ABS(0x0e0, ABS_VOLUME), > + HCONS_MAP_REL_CB(0x0e0, hcons_rel_volume_cb), > + HCONS_MAP_KEY(0x0e2, KEY_MUTE), > + HCONS_MAP_KEY(0x0e5, KEY_BASSBOOST), > + HCONS_MAP_KEY(0x0e9, KEY_VOLUMEUP), > + HCONS_MAP_KEY(0x0ea, KEY_VOLUMEDOWN), > + HCONS_MAP_KEY(0x0f5, KEY_SLOW), > + HCONS_MAP_KEY(0x181, KEY_BUTTONCONFIG), > + HCONS_MAP_KEY(0x182, KEY_BOOKMARKS), > + HCONS_MAP_KEY(0x183, KEY_CONFIG), > + HCONS_MAP_KEY(0x184, KEY_WORDPROCESSOR), > + HCONS_MAP_KEY(0x185, KEY_EDITOR), > + HCONS_MAP_KEY(0x186, KEY_SPREADSHEET), > + HCONS_MAP_KEY(0x187, KEY_GRAPHICSEDITOR), > + HCONS_MAP_KEY(0x188, KEY_PRESENTATION), > + HCONS_MAP_KEY(0x189, KEY_DATABASE), > + HCONS_MAP_KEY(0x18a, KEY_MAIL), > + HCONS_MAP_KEY(0x18b, KEY_NEWS), > + HCONS_MAP_KEY(0x18c, KEY_VOICEMAIL), > + HCONS_MAP_KEY(0x18d, KEY_ADDRESSBOOK), > + HCONS_MAP_KEY(0x18e, KEY_CALENDAR), > + HCONS_MAP_KEY(0x18f, KEY_TASKMANAGER), > + HCONS_MAP_KEY(0x190, KEY_JOURNAL), > + HCONS_MAP_KEY(0x191, KEY_FINANCE), > + HCONS_MAP_KEY(0x192, KEY_CALC), > + HCONS_MAP_KEY(0x193, KEY_PLAYER), > + HCONS_MAP_KEY(0x194, KEY_FILE), > + HCONS_MAP_KEY(0x196, KEY_WWW), > + HCONS_MAP_KEY(0x199, KEY_CHAT), > + HCONS_MAP_KEY(0x19c, KEY_LOGOFF), > + HCONS_MAP_KEY(0x19e, KEY_COFFEE), > + HCONS_MAP_KEY(0x19f, KEY_CONTROLPANEL), > + HCONS_MAP_KEY(0x1a2, KEY_APPSELECT), > + HCONS_MAP_KEY(0x1a3, KEY_NEXT), > + HCONS_MAP_KEY(0x1a4, KEY_PREVIOUS), > + HCONS_MAP_KEY(0x1a6, KEY_HELP), > + HCONS_MAP_KEY(0x1a7, KEY_DOCUMENTS), > + HCONS_MAP_KEY(0x1ab, KEY_SPELLCHECK), > + HCONS_MAP_KEY(0x1ae, KEY_KEYBOARD), > + HCONS_MAP_KEY(0x1b1, KEY_SCREENSAVER), > + HCONS_MAP_KEY(0x1b4, KEY_FILE), > + HCONS_MAP_KEY(0x1b6, KEY_IMAGES), > + HCONS_MAP_KEY(0x1b7, KEY_AUDIO), > + HCONS_MAP_KEY(0x1b8, KEY_VIDEO), > + HCONS_MAP_KEY(0x1bc, KEY_MESSENGER), > + HCONS_MAP_KEY(0x1bd, KEY_INFO), > + HCONS_MAP_KEY(0x1cb, KEY_ASSISTANT), > + HCONS_MAP_KEY(0x201, KEY_NEW), > + HCONS_MAP_KEY(0x202, KEY_OPEN), > + HCONS_MAP_KEY(0x203, KEY_CLOSE), > + HCONS_MAP_KEY(0x204, KEY_EXIT), > + HCONS_MAP_KEY(0x207, KEY_SAVE), > + HCONS_MAP_KEY(0x208, KEY_PRINT), > + HCONS_MAP_KEY(0x209, KEY_PROPS), > + HCONS_MAP_KEY(0x21a, KEY_UNDO), > + HCONS_MAP_KEY(0x21b, KEY_COPY), > + HCONS_MAP_KEY(0x21c, KEY_CUT), > + HCONS_MAP_KEY(0x21d, KEY_PASTE), > + HCONS_MAP_KEY(0x21f, KEY_FIND), > + HCONS_MAP_KEY(0x221, KEY_SEARCH), > + HCONS_MAP_KEY(0x222, KEY_GOTO), > + HCONS_MAP_KEY(0x223, KEY_HOMEPAGE), > + HCONS_MAP_KEY(0x224, KEY_BACK), > + HCONS_MAP_KEY(0x225, KEY_FORWARD), > + HCONS_MAP_KEY(0x226, KEY_STOP), > + HCONS_MAP_KEY(0x227, KEY_REFRESH), > + HCONS_MAP_KEY(0x22a, KEY_BOOKMARKS), > + HCONS_MAP_KEY(0x22d, KEY_ZOOMIN), > + HCONS_MAP_KEY(0x22e, KEY_ZOOMOUT), > + HCONS_MAP_KEY(0x22f, KEY_ZOOMRESET), > + HCONS_MAP_KEY(0x232, KEY_FULL_SCREEN), > + HCONS_MAP_KEY(0x233, KEY_SCROLLUP), > + HCONS_MAP_KEY(0x234, KEY_SCROLLDOWN), > + HCONS_MAP_REL(0x238, REL_HWHEEL), /* AC Pan */ > + HCONS_MAP_KEY(0x23d, KEY_EDIT), > + HCONS_MAP_KEY(0x25f, KEY_CANCEL), > + HCONS_MAP_KEY(0x269, KEY_INSERT), > + HCONS_MAP_KEY(0x26a, KEY_DELETE), > + HCONS_MAP_KEY(0x279, KEY_REDO), > + HCONS_MAP_KEY(0x289, KEY_REPLY), > + HCONS_MAP_KEY(0x28b, KEY_FORWARDMAIL), > + HCONS_MAP_KEY(0x28c, KEY_SEND), > + HCONS_MAP_KEY(0x29d, KEY_KBD_LAYOUT_NEXT), > + HCONS_MAP_KEY(0x2c7, KEY_KBDINPUTASSIST_PREV), > + HCONS_MAP_KEY(0x2c8, KEY_KBDINPUTASSIST_NEXT), > + HCONS_MAP_KEY(0x2c9, KEY_KBDINPUTASSIST_PREVGROUP), > + HCONS_MAP_KEY(0x2ca, KEY_KBDINPUTASSIST_NEXTGROUP), > + HCONS_MAP_KEY(0x2cb, KEY_KBDINPUTASSIST_ACCEPT), > + HCONS_MAP_KEY(0x2cc, KEY_KBDINPUTASSIST_CANCEL), > + HCONS_MAP_KEY(0x29f, KEY_SCALE), > +}; > + > +static const struct hid_device_id hcons_devs[] = { > + { HID_TLC(HUP_CONSUMER, HUC_CONTROL) }, > +}; > + > +/* > + * Emulate relative Consumer volume usage with pressing > + * VOLUMEUP and VOLUMEDOWN keys appropriate number of times > + */ > +static int > +hcons_rel_volume_cb(HIDMAP_CB_ARGS) > +{ > + struct evdev_dev *evdev = HIDMAP_CB_GET_EVDEV(); > + int32_t code; > + int nrepeats; > + > + switch (HIDMAP_CB_GET_STATE()) { > + case HIDMAP_CB_IS_ATTACHING: > + evdev_support_event(evdev, EV_KEY); > + evdev_support_key(evdev, KEY_VOLUMEUP); > + evdev_support_key(evdev, KEY_VOLUMEDOWN); > + break; > + case HIDMAP_CB_IS_RUNNING: > + /* Nothing to report. */ > + if (ctx.data == 0) > + return (ENOMSG); > + code = ctx.data > 0 ? KEY_VOLUMEUP : KEY_VOLUMEDOWN; > + for (nrepeats = abs(ctx.data); nrepeats > 0; nrepeats--) { > + evdev_push_key(evdev, code, 1); > + evdev_push_key(evdev, code, 0); > + } > + } This broke the gcc build in about a half dozen places due to -Wswitch, e.g. here. If you like, I can prepare an inelegant patch adding either default cases or all the ignored cases to all of them. > + > + return (0); > +} > + > +static int > +hcons_probe(device_t dev) > +{ > + return (HIDMAP_PROBE(device_get_softc(dev), dev, > + hcons_devs, hcons_map, "Consumer Control")); > +} > + > +static int > +hcons_attach(device_t dev) > +{ > + return (hidmap_attach(device_get_softc(dev))); > +} > + > +static int > +hcons_detach(device_t dev) > +{ > + return (hidmap_detach(device_get_softc(dev))); > +} > + > +static devclass_t hcons_devclass; > +static device_method_t hcons_methods[] = { > + DEVMETHOD(device_probe, hcons_probe), > + DEVMETHOD(device_attach, hcons_attach), > + DEVMETHOD(device_detach, hcons_detach), > + > + DEVMETHOD_END > +}; > + > +DEFINE_CLASS_0(hcons, hcons_driver, hcons_methods, sizeof(struct hidmap)); > +DRIVER_MODULE(hcons, hidbus, hcons_driver, hcons_devclass, NULL, 0); > +MODULE_DEPEND(hcons, hid, 1, 1, 1); > +MODULE_DEPEND(hcons, hidbus, 1, 1, 1); > +MODULE_DEPEND(hcons, hidmap, 1, 1, 1); > +MODULE_DEPEND(hcons, evdev, 1, 1, 1); > +MODULE_VERSION(hcons, 1); > +HID_PNP_INFO(hcons_devs); > diff --git a/sys/dev/hid/hidmap.c b/sys/dev/hid/hidmap.c > new file mode 100644 > index 000000000000..163d63c20232 > --- /dev/null > +++ b/sys/dev/hid/hidmap.c > @@ -0,0 +1,832 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2020 Vladimir Kondratyev > + * > + * 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 > +__FBSDID("$FreeBSD$"); > + > +/* > + * Abstract 1 to 1 HID input usage to evdev event mapper driver. > + */ > + > +#include "opt_hid.h" > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#include > +#include > +#include > + > +#ifdef HID_DEBUG > +#define DPRINTFN(hm, n, fmt, ...) do { \ > + if ((hm)->debug_var != NULL && *(hm)->debug_var >= (n)) { \ > + device_printf((hm)->dev, "%s: " fmt, \ > + __FUNCTION__ ,##__VA_ARGS__); \ > + } \ > +} while (0) > +#define DPRINTF(hm, ...) DPRINTFN(hm, 1, __VA_ARGS__) > +#else > +#define DPRINTF(...) do { } while (0) > +#define DPRINTFN(...) do { } while (0) > +#endif > + > +static evdev_open_t hidmap_ev_open; > +static evdev_close_t hidmap_ev_close; > + > +#define HIDMAP_WANT_MERGE_KEYS(hm) ((hm)->key_rel != NULL) > + > +#define HIDMAP_FOREACH_ITEM(hm, mi, uoff) \ > + for (u_int _map = 0, _item = 0, _uoff_priv = -1; \ > + ((mi) = hidmap_get_next_map_item( \ > + (hm), &_map, &_item, &_uoff_priv, &(uoff))) != NULL;) > + > +static inline bool > +hidmap_get_next_map_index(const struct hidmap_item *map, int nmap_items, > + uint32_t *index, uint16_t *usage_offset) > +{ > + > + ++*usage_offset; > + if ((*index != 0 || *usage_offset != 0) && > + *usage_offset >= map[*index].nusages) { > + ++*index; > + *usage_offset = 0; > + } > + > + return (*index < nmap_items); > +} > + > +static inline const struct hidmap_item * > +hidmap_get_next_map_item(struct hidmap *hm, u_int *map, u_int *item, > + u_int *uoff_priv, uint16_t *uoff) > +{ > + > + *uoff = *uoff_priv; > + while (!hidmap_get_next_map_index( > + hm->map[*map], hm->nmap_items[*map], item, uoff)) { > + ++*map; > + *item = 0; > + *uoff = -1; > + if (*map >= hm->nmaps) > + return (NULL); > + } > + *uoff_priv = *uoff; > + > + return (hm->map[*map] + *item); > +} > + > +void > +_hidmap_set_debug_var(struct hidmap *hm, int *debug_var) > +{ > +#ifdef HID_DEBUG > + hm->debug_var = debug_var; > +#endif > +} > + > +static int > +hidmap_ev_close(struct evdev_dev *evdev) > +{ > + return (hidbus_intr_stop(evdev_get_softc(evdev))); > +} > + > +static int > +hidmap_ev_open(struct evdev_dev *evdev) > +{ > + return (hidbus_intr_start(evdev_get_softc(evdev))); > +} > + > +void > +hidmap_support_key(struct hidmap *hm, uint16_t key) > +{ > + if (hm->key_press == NULL) { > + hm->key_press = malloc(howmany(KEY_CNT, 8), M_DEVBUF, > + M_ZERO | M_WAITOK); > *** 2864 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Jan 10 09:11:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4DA554BCF69; Sun, 10 Jan 2021 09:11:09 +0000 (UTC) (envelope-from git@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 4DDB0F1mvTz3tkN; Sun, 10 Jan 2021 09:11:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FD4025A67; Sun, 10 Jan 2021 09:11:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A9B92J061577; Sun, 10 Jan 2021 09:11:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A9B9Ji061576; Sun, 10 Jan 2021 09:11:09 GMT (envelope-from git) Date: Sun, 10 Jan 2021 09:11:09 GMT Message-Id: <202101100911.10A9B9Ji061576@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: af352cf1397f - stable/12 - netmap: bridge: fix NS_MOREFRAG support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: af352cf1397fd3ada7d565c4a52c71b71ea2b3b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 09:11:09 -0000 The branch stable/12 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=af352cf1397fd3ada7d565c4a52c71b71ea2b3b3 commit af352cf1397fd3ada7d565c4a52c71b71ea2b3b3 Author: Vincenzo Maffione AuthorDate: 2021-01-07 07:00:43 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-10 09:10:29 +0000 netmap: bridge: fix NS_MOREFRAG support Support for NS_MOREFRAG is broken, as NS_MOREFRAG is copied from the TX slot to the RX slot rather than the other way around. Also, the NS_MOREFRAG must be copied also in case of packet copy (no zerocopy). Reported by: rajesh1.kumar_amd.com Differential Revision: https://reviews.freebsd.org/D27980 (cherry picked from commit 163f4f15733f82584a967538cf2340bf1b6a245f) --- tools/tools/netmap/bridge.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/tools/netmap/bridge.c b/tools/tools/netmap/bridge.c index af8c2847130a..77d235bf6e08 100644 --- a/tools/tools/netmap/bridge.c +++ b/tools/tools/netmap/bridge.c @@ -86,13 +86,12 @@ rings_move(struct netmap_ring *rxring, struct netmap_ring *txring, struct netmap_slot *rs = &rxring->slot[j]; struct netmap_slot *ts = &txring->slot[k]; - /* swap packets */ if (ts->buf_idx < 2 || rs->buf_idx < 2) { RD(2, "wrong index rxr[%d] = %d -> txr[%d] = %d", j, rs->buf_idx, k, ts->buf_idx); sleep(2); } - /* copy the packet length. */ + /* Copy the packet length. */ if (rs->len > rxring->nr_buf_size) { RD(2, "%s: invalid len %u, rxr[%d] -> txr[%d]", msg, rs->len, j, k); @@ -109,13 +108,16 @@ rings_move(struct netmap_ring *rxring, struct netmap_ring *txring, /* report the buffer change. */ ts->flags |= NS_BUF_CHANGED; rs->flags |= NS_BUF_CHANGED; - /* copy the NS_MOREFRAG */ - rs->flags = (rs->flags & ~NS_MOREFRAG) | (ts->flags & NS_MOREFRAG); } else { char *rxbuf = NETMAP_BUF(rxring, rs->buf_idx); char *txbuf = NETMAP_BUF(txring, ts->buf_idx); nm_pkt_copy(rxbuf, txbuf, ts->len); } + /* + * Copy the NS_MOREFRAG from rs to ts, leaving any + * other flags unchanged. + */ + ts->flags = (ts->flags & ~NS_MOREFRAG) | (rs->flags & NS_MOREFRAG); j = nm_ring_next(rxring, j); k = nm_ring_next(txring, k); } @@ -190,7 +192,7 @@ usage(void) int main(int argc, char **argv) { - char msg_a2b[128], msg_b2a[128]; + char msg_a2b[256], msg_b2a[256]; struct pollfd pollfd[2]; u_int burst = 1024, wait_link = 4; struct nmport_d *pa = NULL, *pb = NULL; From owner-dev-commits-src-all@freebsd.org Sun Jan 10 09:27:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8EBBB4BDAB0; Sun, 10 Jan 2021 09:27:08 +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 4DDBLh3019z3vdW; Sun, 10 Jan 2021 09:27:08 +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 A94B72600DD; Sun, 10 Jan 2021 10:27:05 +0100 (CET) Subject: Re: git: afd590d9e566 - main - hid: Import hidmap and bunch of drivers based on it To: Ryan Libby , Vladimir Kondratyev Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202101072320.107NKosW063030@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Sun, 10 Jan 2021 10:26:55 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.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: 4DDBLh3019z3vdW X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 09:27:08 -0000 On 1/10/21 7:39 AM, Ryan Libby wrote: > This broke the gcc build in about a half dozen places due to -Wswitch, > e.g. here. If you like, I can prepare an inelegant patch adding > either default cases or all the ignored cases to all of them. wulf: I believe adding "default:" cases to all switch statements added in the patch series is the right thing to do. --HPS From owner-dev-commits-src-all@freebsd.org Sun Jan 10 11:12:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CFC1C4C835C; Sun, 10 Jan 2021 11:12:48 +0000 (UTC) (envelope-from tijl@coosemans.org) Received: from mailrelay110.isp.belgacom.be (mailrelay110.isp.belgacom.be [195.238.20.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign RSA OV SSL CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DDDhb3Hzsz4Tky; Sun, 10 Jan 2021 11:12:47 +0000 (UTC) (envelope-from tijl@coosemans.org) IronPort-SDR: kJLz3GeVuwWP4EvYNrESlM44LTw4+k+mM+qUaIcOBCXCyXjr+BlK3rVT0AOn3lda50HvpmJSfM ypS7YyOm+k58BnUg28zVWuQd5CrPT/vfrUYTJENOCyi7150qZmeuJkrKW0apCUzzcu8KivSC76 T8kkblWbJkj3VVofwbFenS+qNBeyy6SmmmHSZUbP/ynPFd3BkFL8SfqlC7zaP4DKO7A0gBBHpq aXbVZlLbTAzQu5P7Ff33cUcy8NCyaRem9kzABzobUUmZ0Qmsqaj3ZaB+EqUJJTH96NoEghjNpA VsY= X-Belgacom-Dynamic: yes IronPort-PHdr: =?us-ascii?q?9a23=3ARmi2Yxd64K0gPhVIlaYh0qGxlGMj4u6mDksu8p?= =?us-ascii?q?Mizoh2WeGdxc27YhGN2/xhgRfzUJnB7Loc0qyK6v+mAzBRqszd+Fk5M7V0Hy?= =?us-ascii?q?cfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aFR?= =?us-ascii?q?rwLxd6KfroEYDOkcu3y/qy+5rOaAlUmTaxe7x/IAi0oAnLqMUbjo9vJqkvxh?= =?us-ascii?q?bGv3BFZ/lYyWR0KFyJgh3y/N2w/Jlt8yRRv/Iu6ctNWrjkcqo7ULJVEi0oP3?= =?us-ascii?q?g668P3uxbDSxCP5mYHXWUNjhVIGQnF4wrkUZr3ryD3q/By2CiePc3xULA0RT?= =?us-ascii?q?Gv5LplRRP0lCsKMSMy/XrJgcJskq1UvBOhpwR+w4HKZoGVKOF+db7Zcd8DWG?= =?us-ascii?q?ZNQtpdWylHD4ihbYUAEvABMP5WoYf9uVUAsBiwCguiBOzg1jBGiWT73bE43u?= =?us-ascii?q?k7DQ3KwBAsE8wIvX/JrNv1LqASUeWtwafWyDfDa+5d1Cn66IjPaRAuv/SMUq?= =?us-ascii?q?h2ccrK1EIiEB/FjlSSqYzhJD6ayuMNs2+A7+V+UOKgkWgnqxprrjio3McshZ?= =?us-ascii?q?DEi4QIwV/L6St32pw6JcGkSEFle96kFoNduzyGOodoQs4uXWFmtig0xLAJpJ?= =?us-ascii?q?K2fzYGxYgnyhPfdfCLboyF7xP+WeuPITp0mXxrdK+iixi970St1vPxW9e03V?= =?us-ascii?q?tMsyFLnN7MtnUX2BzS7MiKUvV9/l2/1jmRzA/T8fxLLVozlarBJJ4t2rkwlo?= =?us-ascii?q?IPsUTYBCP2nUb2gamLfUsn4uil8+fqbqj8qpOCOIJ4lBvyPrksl8ChG+g1PQ?= =?us-ascii?q?4DVHWB9+umzr3s50j5Ta1Pjv0xj6bWrojXJd8epq6lGw9V1Zsj6wqnAzemzt?= =?us-ascii?q?sYmX4HIUpGeB2di4jpOlTOL+7iDfe4mVisjDZrx/LCPrH7HprNKX/DkKz/cr?= =?us-ascii?q?Z48UFczhEzwcpY55JOBbENOPPzWknvu9zEFhI0MBG4z/z5BNhyyI8SQ3+DD6?= =?us-ascii?q?2HPK/IvlKE/ucvLPONZI8Rtjb9Mf8l5/v2gH8lmF8df62p0IALZ3C/GfRmOF?= =?us-ascii?q?uWYX/2jdcHCmcGpA0+TPbliFGaSz5ce26yX74g5jE8EI+pEJnMRp60jLOd2y?= =?us-ascii?q?e7G5hWZmFaClCXCHvobJ+EVOsVZCKXOMBhkzoEWKOvS487yx6hqhT1y6F6Ie?= =?us-ascii?q?bO/S0Yr53j3sBv5+LPjREy6SB0D8OF3m6QUW50gHoESCMx3KB6pEx9y0uD0b?= =?us-ascii?q?Nhj/xDD9xc++pFXR0+NZ7Y1OF6BcryVRzfcdiSU1apX8+qATYrTtI+29UOeV?= =?us-ascii?q?pyG82+jhDf2CqnG6QVl6aXC5At7q3c2H3xJ8N8y3bayKkukUMmQtBUOG2onK?= =?us-ascii?q?5w6RbcCJXSk0qEjaqqcr4c3CHV/meZ0WWOpF1YUBJ3UajdR38ffErWosj55k?= =?us-ascii?q?zYVb+hFK8nMgxHycOZJKtKcMPmgktdS/f4JdvSeWWxm32/BUXA+rTZRY7nay?= =?us-ascii?q?0n3S7dAVIIiAcVtSKPLwk1Bi67r3nZChRAD1/iSXjAt+5kpyXoYFUzylS2iE?= =?us-ascii?q?kp/L2y4RMQjPqHA6cP37AAkCwmrC55GV+7xJTREdXW9FkpR7lVfd5ouAQP7m?= =?us-ascii?q?nerQEoe8X4d60=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2C2AQCQ4Ppf/wSs8lFiGgEBAQEBAQE?= =?us-ascii?q?BAQEDAQEBARIBAQEBAgIBAQEBQAeBSAIBgx5XAWCNQ4YhghYDOIg8giiRIAs?= =?us-ascii?q?BAQEBAQEBAQEwCAQBAYRKAoFxJjkFDQIDAQEBAwIFAQEGAQEBAQEBBQQBhhg?= =?us-ascii?q?5DEMBAQEBAgEGBIFkKQGDEgEFJxM/EAsOCi5XBhODJ4MKC60FgQEzhD8BgRi?= =?us-ascii?q?DZYEHgTgBjTBBPoFCgRGDGT6CRhcEF4c+BIJEeD4Be1ItFwGcQ5wqgwGJK5I?= =?us-ascii?q?lMYMpgTCIf5UILYVxmQqSCoY3gXlNMAiDJAlHGQ2WMXWFRUADMAIBAQcsAgY?= =?us-ascii?q?KAQEDCYMyToMOhjsBAQ?= X-IPAS-Result: =?us-ascii?q?A2C2AQCQ4Ppf/wSs8lFiGgEBAQEBAQEBAQEDAQEBARIBA?= =?us-ascii?q?QEBAgIBAQEBQAeBSAIBgx5XAWCNQ4YhghYDOIg8giiRIAsBAQEBAQEBAQEwC?= =?us-ascii?q?AQBAYRKAoFxJjkFDQIDAQEBAwIFAQEGAQEBAQEBBQQBhhg5DEMBAQEBAgEGB?= =?us-ascii?q?IFkKQGDEgEFJxM/EAsOCi5XBhODJ4MKC60FgQEzhD8BgRiDZYEHgTgBjTBBP?= =?us-ascii?q?oFCgRGDGT6CRhcEF4c+BIJEeD4Be1ItFwGcQ5wqgwGJK5IlMYMpgTCIf5UIL?= =?us-ascii?q?YVxmQqSCoY3gXlNMAiDJAlHGQ2WMXWFRUADMAIBAQcsAgYKAQEDCYMyToMOh?= =?us-ascii?q?jsBAQ?= Received: from 4.172-242-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.242.172.4]) by relay.skynet.be with ESMTP; 10 Jan 2021 12:12:44 +0100 Received: from localhost (localhost [127.0.0.1]) by kalimero.tijl.coosemans.org (8.16.1/8.16.1) with ESMTP id 10ABCgJX001851; Sun, 10 Jan 2021 12:12:43 +0100 (CET) (envelope-from tijl@coosemans.org) Date: Sun, 10 Jan 2021 12:12:42 +0100 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Alex Richardson Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 7fa2f2a62f04 - main - Rename NO_WERROR -> MK_WERROR=no Message-ID: <20210110121242.1d9809ff@coosemans.org> In-Reply-To: <202101071105.107B5tUX011254@gitrepo.freebsd.org> References: <202101071105.107B5tUX011254@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DDDhb3Hzsz4Tky X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of tijl@coosemans.org has no SPF policy when checking 195.238.20.137) smtp.mailfrom=tijl@coosemans.org X-Spamd-Result: default: False [-2.20 / 15.00]; MID_RHS_MATCH_FROM(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[195.238.20.137:from]; FREEFALL_USER(0.00)[tijl]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[coosemans.org]; ARC_NA(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[195.238.20.137:from]; SPAMHAUS_ZRD(0.00)[195.238.20.137:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; AUTH_NA(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.999]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:5432, ipnet:195.238.0.0/19, country:BE]; RCVD_TLS_LAST(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all]; RCVD_IN_DNSWL_LOW(-0.10)[195.238.20.137:from] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 11:12:48 -0000 On Thu, 7 Jan 2021 11:05:55 GMT Alex Richardson wrote: > The branch main has been updated by arichardson: > > URL: https://cgit.FreeBSD.org/src/commit/?id=7fa2f2a62f04f095e1e27ad55aa22a8f59b1df8f > > commit 7fa2f2a62f04f095e1e27ad55aa22a8f59b1df8f > Author: Alex Richardson > AuthorDate: 2021-01-06 17:55:06 +0000 > Commit: Alex Richardson > CommitDate: 2021-01-07 09:31:03 +0000 > > Rename NO_WERROR -> MK_WERROR=no > > As suggested in D27598. This also supports MK_WERROR.clang=no and > MK_WERROR.gcc=no to support the existing NO_WERROR. uses. > > Reviewed By: brooks > Differential Revision: https://reviews.freebsd.org/D27601 > --- > diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk > index d0e7f1cb00ba..88c73cc6bfe4 100644 > --- a/share/mk/bsd.opts.mk > +++ b/share/mk/bsd.opts.mk > @@ -65,7 +65,8 @@ __DEFAULT_YES_OPTIONS = \ > SSP \ > TESTS \ > TOOLCHAIN \ > - WARNS > + WARNS \ > + WERROR > > __DEFAULT_NO_OPTIONS = \ > BIND_NOW \ > @@ -103,7 +104,8 @@ __DEFAULT_DEPENDENT_OPTIONS = \ > INSTALLLIB \ > MAN \ > PROFILE \ > - WARNS > + WARNS \ > + WERROR > .if defined(NO_${var}) > .error "NO_${var} is defined, but deprecated. Please use MK_${var}=no instead." > MK_${var}:=no NO_WERROR is also used by some ports [1] (which have to build against multiple version of FreeBSD) and this turns it into an error. Can you remove this change or turn it into a warning maybe? Changes to share/mk should always go through a ports exp-run IMHO. [1] http://beefy17.nyi.freebsd.org/data/main-i386-default/p560826_se83fdf8bb3/logs/linux_libusb-13.0r358841_4.log From owner-dev-commits-src-all@freebsd.org Sun Jan 10 11:44:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2212A4C8E62; Sun, 10 Jan 2021 11:44:14 +0000 (UTC) (envelope-from git@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 4DDFNs75Cmz4WMB; Sun, 10 Jan 2021 11:44:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E617227BF6; Sun, 10 Jan 2021 11:44:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10ABiD2w058556; Sun, 10 Jan 2021 11:44:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10ABiDru058555; Sun, 10 Jan 2021 11:44:13 GMT (envelope-from git) Date: Sun, 10 Jan 2021 11:44:13 GMT Message-Id: <202101101144.10ABiDru058555@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: dcdad299479e - main - fileargs: add support for realpath MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dcdad299479e2d224448cd8a09a33afc1328aa13 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 11:44:14 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=dcdad299479e2d224448cd8a09a33afc1328aa13 commit dcdad299479e2d224448cd8a09a33afc1328aa13 Author: Mariusz Zaborski AuthorDate: 2021-01-10 11:44:06 +0000 Commit: Mariusz Zaborski CommitDate: 2021-01-10 11:44:06 +0000 fileargs: add support for realpath --- lib/libcasper/services/cap_fileargs/Makefile | 1 + lib/libcasper/services/cap_fileargs/cap_fileargs.3 | 13 +- lib/libcasper/services/cap_fileargs/cap_fileargs.c | 62 ++++++++- lib/libcasper/services/cap_fileargs/cap_fileargs.h | 6 + .../services/cap_fileargs/tests/fileargs_test.c | 145 +++++++++++++++++++++ 5 files changed, 224 insertions(+), 3 deletions(-) diff --git a/lib/libcasper/services/cap_fileargs/Makefile b/lib/libcasper/services/cap_fileargs/Makefile index 04787c01db35..22230f82d9f4 100644 --- a/lib/libcasper/services/cap_fileargs/Makefile +++ b/lib/libcasper/services/cap_fileargs/Makefile @@ -35,5 +35,6 @@ MLINKS+=cap_fileargs.3 fileargs_init.3 MLINKS+=cap_fileargs.3 fileargs_initnv.3 MLINKS+=cap_fileargs.3 fileargs_lstat.3 MLINKS+=cap_fileargs.3 fileargs_open.3 +MLINKS+=cap_fileargs.3 fileargs_realpath.3 .include diff --git a/lib/libcasper/services/cap_fileargs/cap_fileargs.3 b/lib/libcasper/services/cap_fileargs/cap_fileargs.3 index b59d30b2d595..acf51e4ed62b 100644 --- a/lib/libcasper/services/cap_fileargs/cap_fileargs.3 +++ b/lib/libcasper/services/cap_fileargs/cap_fileargs.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 5, 2020 +.Dd January 10, 2021 .Dt CAP_FILEARGS 3 .Os .Sh NAME @@ -59,6 +59,8 @@ .Fn fileargs_open "fileargs_t *fa" "const char *name" .Ft "FILE *" .Fn fileargs_fopen "fileargs_t *fa" "const char *name" "const char *mode" +.Ft "char *" +.Fn fileargs_realpath "fileargs_t *fa" "const char *pathname" "char *reserved_path" .Sh DESCRIPTION The library is used to simplify Capsicumizing a tools that are using file system. Idea behind the library is that we are passing a remaining @@ -115,6 +117,9 @@ and .It FA_LSTAT Allow .Fn fileargs_lstat . +.It FA_REALPATH +Allow +.Fn fileargs_realpath . .El .Pp The function @@ -161,6 +166,11 @@ and expect that all arguments are fetched from the .Va fileargs_t structure. +.Pp +The function +.Fn fileargs_realpath +is equivalent to +.Xr realpath 3 . .Sh LIMITS This section describe which values and types should be used to pass arguments to the .Fa system.fileargs @@ -261,6 +271,7 @@ fileargs_free(fa); .Xr err 3 , .Xr fopen 3 , .Xr getopt 3 , +.Xr realpath 3 , .Xr capsicum 4 , .Xr nv 9 .Sh HISTORY diff --git a/lib/libcasper/services/cap_fileargs/cap_fileargs.c b/lib/libcasper/services/cap_fileargs/cap_fileargs.c index a777647b1720..ecab23004fcf 100644 --- a/lib/libcasper/services/cap_fileargs/cap_fileargs.c +++ b/lib/libcasper/services/cap_fileargs/cap_fileargs.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2018 Mariusz Zaborski + * Copyright (c) 2018-2021 Mariusz Zaborski * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -412,6 +412,41 @@ fileargs_lstat(fileargs_t *fa, const char *name, struct stat *sb) return (0); } +char * +fileargs_realpath(fileargs_t *fa, const char *pathname, char *reserved_path) +{ + nvlist_t *nvl; + char *ret; + + assert(fa != NULL); + assert(fa->fa_magic == FILEARGS_MAGIC); + + if (pathname == NULL) { + errno = EINVAL; + return (NULL); + } + + if (fa->fa_chann == NULL) { + errno = ENOTCAPABLE; + return (NULL); + } + + nvl = fileargs_fetch(fa, pathname, "realpath"); + if (nvl == NULL) + return (NULL); + + if (reserved_path != NULL) { + ret = reserved_path; + strcpy(reserved_path, + nvlist_get_string(nvl, "realpath")); + } else { + ret = nvlist_take_string(nvl, "realpath"); + } + nvlist_destroy(nvl); + + return (ret); +} + void fileargs_free(fileargs_t *fa) { @@ -631,6 +666,28 @@ fileargs_command_lstat(const nvlist_t *limits, nvlist_t *nvlin, return (0); } +static int +fileargs_command_realpath(const nvlist_t *limits, nvlist_t *nvlin, + nvlist_t *nvlout) +{ + const char *pathname; + char *resolvedpath; + + if (limits == NULL) + return (ENOTCAPABLE); + + if (!fileargs_allowed(limits, nvlin, FA_REALPATH)) + return (ENOTCAPABLE); + + pathname = nvlist_get_string(nvlin, "name"); + resolvedpath = realpath(pathname, NULL); + if (resolvedpath == NULL) + return (errno); + + nvlist_move_string(nvlout, "realpath", resolvedpath); + return (0); +} + static int fileargs_command_open(const nvlist_t *limits, nvlist_t *nvlin, nvlist_t *nvlout) @@ -668,9 +725,10 @@ fileargs_command(const char *cmd, const nvlist_t *limits, if (strcmp(cmd, "open") == 0) return (fileargs_command_open(limits, nvlin, nvlout)); - if (strcmp(cmd, "lstat") == 0) return (fileargs_command_lstat(limits, nvlin, nvlout)); + if (strcmp(cmd, "realpath") == 0) + return (fileargs_command_realpath(limits, nvlin, nvlout)); return (EINVAL); } diff --git a/lib/libcasper/services/cap_fileargs/cap_fileargs.h b/lib/libcasper/services/cap_fileargs/cap_fileargs.h index 03ff5c29d6c0..6e8523cb9423 100644 --- a/lib/libcasper/services/cap_fileargs/cap_fileargs.h +++ b/lib/libcasper/services/cap_fileargs/cap_fileargs.h @@ -39,6 +39,7 @@ #define FA_OPEN 1 #define FA_LSTAT 2 +#define FA_REALPATH 4 #ifdef WITH_CASPER struct fileargs; @@ -55,6 +56,8 @@ fileargs_t *fileargs_initnv(nvlist_t *limits); fileargs_t *fileargs_cinitnv(cap_channel_t *cas, nvlist_t *limits); int fileargs_lstat(fileargs_t *fa, const char *name, struct stat *sb); int fileargs_open(fileargs_t *fa, const char *name); +char *fileargs_realpath(fileargs_t *fa, const char *pathname, + char *reserved_path); void fileargs_free(fileargs_t *fa); FILE *fileargs_fopen(fileargs_t *fa, const char *name, const char *mode); @@ -117,6 +120,9 @@ fileargs_cinitnv(cap_channel_t *cas __unused, nvlist_t *limits) lstat(name, sb) #define fileargs_open(fa, name) \ open(name, fa->fa_flags, fa->fa_mode) +#define fileargs_realpath(fa, pathname, reserved_path) \ + realpath(pathname, reserved_path) + static inline FILE *fileargs_fopen(fileargs_t *fa, const char *name, const char *mode) { diff --git a/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c b/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c index ad889bb2986f..9a7f9dfcb9aa 100644 --- a/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c +++ b/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c @@ -141,6 +141,57 @@ test_file_lstat(fileargs_t *fa, const char *file) return (0); } +static int +test_file_realpath_static(fileargs_t *fa, const char *file) +{ + char fapath[PATH_MAX], origpath[PATH_MAX]; + + if (fileargs_realpath(fa, file, fapath) == NULL) + return (errno); + + ATF_REQUIRE(realpath(file, origpath) != NULL); + + if (strcmp(fapath, origpath) != 0) + return (EINVAL); + + return (0); +} + +static int +test_file_realpath_alloc(fileargs_t *fa, const char *file) +{ + char *fapath, *origpath; + int serrno; + + fapath = fileargs_realpath(fa, file, NULL); + if (fapath == NULL) + return (errno); + + origpath = realpath(file, NULL); + ATF_REQUIRE(origpath != NULL); + + serrno = 0; + if (strcmp(fapath, origpath) != 0) + serrno = EINVAL; + + free(fapath); + free(origpath); + + return (serrno); +} + +static int +test_file_realpath(fileargs_t *fa, const char *file) +{ + int serrno; + + serrno = test_file_realpath_static(fa, file); + if (serrno != 0) + return serrno; + + return (test_file_realpath_alloc(fa, file)); +} + static int test_file_mode(int fd, int mode) { @@ -254,6 +305,8 @@ ATF_TC_BODY(fileargs__open_read, tc) ATF_REQUIRE(test_file_open(fa, TEST_FILE, NULL) == ENOTCAPABLE); ATF_REQUIRE(test_file_cap(fd, &norights) == false); ATF_REQUIRE(test_file_write(fd) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, TEST_FILE) == ENOTCAPABLE); /* CLOSE */ ATF_REQUIRE(close(fd) == 0); @@ -297,6 +350,8 @@ ATF_TC_BODY(fileargs__open_write, tc) ATF_REQUIRE(test_file_open(fa, TEST_FILE, NULL) == ENOTCAPABLE); ATF_REQUIRE(test_file_cap(fd, &norights) == false); ATF_REQUIRE(test_file_read(fd) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, TEST_FILE) == ENOTCAPABLE); /* CLOSE */ ATF_REQUIRE(close(fd) == 0); @@ -337,6 +392,8 @@ ATF_TC_BODY(fileargs__open_create, tc) ATF_REQUIRE(test_file_lstat(fa, files[i]) == ENOTCAPABLE); ATF_REQUIRE(test_file_open(fa, TEST_FILE, NULL) == ENOTCAPABLE); ATF_REQUIRE(test_file_cap(fd, &norights) == false); + ATF_REQUIRE(test_file_realpath(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, TEST_FILE) == ENOTCAPABLE); /* CLOSE */ ATF_REQUIRE(close(fd) == 0); @@ -417,6 +474,8 @@ ATF_TC_BODY(fileargs__fopen_read, tc) ENOTCAPABLE); ATF_REQUIRE(test_file_cap(fd, &norights) == false); ATF_REQUIRE(test_file_fwrite(pfile) == EBADF); + ATF_REQUIRE(test_file_realpath(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, TEST_FILE) == ENOTCAPABLE); /* CLOSE */ ATF_REQUIRE(fclose(pfile) == 0); @@ -463,6 +522,8 @@ ATF_TC_BODY(fileargs__fopen_write, tc) ENOTCAPABLE); ATF_REQUIRE(test_file_cap(fd, &norights) == false); ATF_REQUIRE(test_file_fread(pfile) == EBADF); + ATF_REQUIRE(test_file_realpath(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, TEST_FILE) == ENOTCAPABLE); /* CLOSE */ ATF_REQUIRE(fclose(pfile) == 0); @@ -504,6 +565,8 @@ ATF_TC_BODY(fileargs__fopen_create, tc) ATF_REQUIRE(test_file_lstat(fa, files[i]) == ENOTCAPABLE); ATF_REQUIRE(test_file_fopen(fa, TEST_FILE, "w+", NULL) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, TEST_FILE) == ENOTCAPABLE); /* CLOSE */ ATF_REQUIRE(fclose(pfile) == 0); @@ -535,6 +598,8 @@ ATF_TC_BODY(fileargs__lstat, tc) ATF_REQUIRE(test_file_open(fa, files[i], &fd) == ENOTCAPABLE); ATF_REQUIRE(test_file_lstat(fa, TEST_FILE) == ENOTCAPABLE); ATF_REQUIRE(test_file_open(fa, TEST_FILE, &fd) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, TEST_FILE) == ENOTCAPABLE); } } ATF_TC_CLEANUP(fileargs__lstat, tc) @@ -542,6 +607,36 @@ ATF_TC_CLEANUP(fileargs__lstat, tc) clear_files(); } +ATF_TC_WITH_CLEANUP(fileargs__realpath); +ATF_TC_HEAD(fileargs__realpath, tc) {} +ATF_TC_BODY(fileargs__realpath, tc) +{ + fileargs_t *fa; + size_t i; + int fd; + + prepare_files(MAX_FILES, true); + + fa = fileargs_init(MAX_FILES, files, 0, 0, NULL, FA_REALPATH); + ATF_REQUIRE(fa != NULL); + + for (i = 0; i < MAX_FILES; i++) { + /* ALLOWED */ + ATF_REQUIRE(test_file_realpath(fa, files[i]) == 0); + + /* DISALLOWED */ + ATF_REQUIRE(test_file_open(fa, files[i], &fd) == ENOTCAPABLE); + ATF_REQUIRE(test_file_lstat(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_lstat(fa, TEST_FILE) == ENOTCAPABLE); + ATF_REQUIRE(test_file_open(fa, TEST_FILE, &fd) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, TEST_FILE) == ENOTCAPABLE); + } +} +ATF_TC_CLEANUP(fileargs__realpath, tc) +{ + clear_files(); +} + ATF_TC_WITH_CLEANUP(fileargs__open_lstat); ATF_TC_HEAD(fileargs__open_lstat, tc) {} ATF_TC_BODY(fileargs__open_lstat, tc) @@ -576,6 +671,8 @@ ATF_TC_BODY(fileargs__open_lstat, tc) ATF_REQUIRE(test_file_open(fa, TEST_FILE, NULL) == ENOTCAPABLE); ATF_REQUIRE(test_file_cap(fd, &norights) == false); ATF_REQUIRE(test_file_write(fd) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, files[i]) == ENOTCAPABLE); + ATF_REQUIRE(test_file_realpath(fa, TEST_FILE) == ENOTCAPABLE); /* CLOSE */ ATF_REQUIRE(close(fd) == 0); @@ -586,6 +683,51 @@ ATF_TC_CLEANUP(fileargs__open_lstat, tc) clear_files(); } +ATF_TC_WITH_CLEANUP(fileargs__open_realpath); +ATF_TC_HEAD(fileargs__open_realpath, tc) {} +ATF_TC_BODY(fileargs__open_realpath, tc) +{ + cap_rights_t rights, norights; + fileargs_t *fa; + size_t i; + int fd; + + prepare_files(MAX_FILES, true); + + cap_rights_init(&rights, CAP_READ | CAP_FCNTL); + cap_rights_init(&norights, CAP_WRITE); + fa = fileargs_init(MAX_FILES, files, O_RDONLY, 0, &rights, + FA_OPEN | FA_REALPATH); + ATF_REQUIRE(fa != NULL); + + for (i = 0; i < MAX_FILES; i++) { + /* ALLOWED */ + /* We open file twice to check if we can. */ + ATF_REQUIRE(test_file_realpath(fa, files[i]) == 0); + ATF_REQUIRE(test_file_open(fa, files[i], &fd) == 0); + ATF_REQUIRE(close(fd) == 0); + + ATF_REQUIRE(test_file_open(fa, files[i], &fd) == 0); + ATF_REQUIRE(test_file_realpath(fa, files[i]) == 0); + ATF_REQUIRE(test_file_mode(fd, O_RDONLY) == 0); + ATF_REQUIRE(test_file_cap(fd, &rights) == true); + ATF_REQUIRE(test_file_read(fd) == 0); + + /* DISALLOWED */ + ATF_REQUIRE(test_file_open(fa, TEST_FILE, NULL) == ENOTCAPABLE); + ATF_REQUIRE(test_file_cap(fd, &norights) == false); + ATF_REQUIRE(test_file_write(fd) == ENOTCAPABLE); + ATF_REQUIRE(test_file_lstat(fa, files[i]) == ENOTCAPABLE); + + /* CLOSE */ + ATF_REQUIRE(close(fd) == 0); + } +} +ATF_TC_CLEANUP(fileargs__open_realpath, tc) +{ + clear_files(); +} + ATF_TP_ADD_TCS(tp) { @@ -600,7 +742,10 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, fileargs__lstat); + ATF_TP_ADD_TC(tp, fileargs__realpath); + ATF_TP_ADD_TC(tp, fileargs__open_lstat); + ATF_TP_ADD_TC(tp, fileargs__open_realpath); return (atf_no_error()); } From owner-dev-commits-src-all@freebsd.org Sun Jan 10 12:03:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3F0434C9B7D; Sun, 10 Jan 2021 12:03:24 +0000 (UTC) (envelope-from git@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 4DDFq01H5Mz4XY7; Sun, 10 Jan 2021 12:03:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EB1427ACE; Sun, 10 Jan 2021 12:03:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AC3OFu084233; Sun, 10 Jan 2021 12:03:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AC3OZQ084232; Sun, 10 Jan 2021 12:03:24 GMT (envelope-from git) Date: Sun, 10 Jan 2021 12:03:24 GMT Message-Id: <202101101203.10AC3OZQ084232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: fae87eeff2e3 - stable/12 - fortune(6): Add EXIT STATUS and HISTORY sections MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fae87eeff2e3bf787de089793ae47422b08584fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 12:03:24 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=fae87eeff2e3bf787de089793ae47422b08584fa commit fae87eeff2e3bf787de089793ae47422b08584fa Author: Gordon Bergling AuthorDate: 2021-01-03 22:50:18 +0000 Commit: Gordon Bergling CommitDate: 2021-01-10 12:02:25 +0000 fortune(6): Add EXIT STATUS and HISTORY sections Obtained from: OpenBSD Differential Revision: https://reviews.freebsd.org/D27941 (cherry picked from commit c949ba1d202c6e939e71f1cb555958b8de3dd048) --- usr.bin/fortune/fortune/fortune.6 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/usr.bin/fortune/fortune/fortune.6 b/usr.bin/fortune/fortune/fortune.6 index bc6e26e182a0..2660cf8bf20c 100644 --- a/usr.bin/fortune/fortune/fortune.6 +++ b/usr.bin/fortune/fortune/fortune.6 @@ -31,7 +31,7 @@ .\" @(#)fortune.6 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd November 7, 2007 +.Dd January 3, 2021 .Dt FORTUNE 6 .Os .Sh NAME @@ -183,8 +183,22 @@ contain the .Sy offensive fortunes) .El +.Sh EXIT STATUS +.Ex -std +In particular, if +.Fl l , +.Fl m , +or +.Fl s +is specified, failure to find a matching citation in the selected +files counts as an error. .Sh SEE ALSO .Xr arc4random_uniform 3 , .Xr regcomp 3 , .Xr regex 3 , .Xr strfile 8 +.Sh HISTORY +The +.Nm +utility first appeared +.At v7 . From owner-dev-commits-src-all@freebsd.org Sun Jan 10 12:05:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B3CA44CA29B; Sun, 10 Jan 2021 12:05:35 +0000 (UTC) (envelope-from git@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 4DDFsW4mkbz4XtJ; Sun, 10 Jan 2021 12:05:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96A9B27DD5; Sun, 10 Jan 2021 12:05:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AC5Zdt084659; Sun, 10 Jan 2021 12:05:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AC5ZrS084658; Sun, 10 Jan 2021 12:05:35 GMT (envelope-from git) Date: Sun, 10 Jan 2021 12:05:35 GMT Message-Id: <202101101205.10AC5ZrS084658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 3d65fd97e85a - main - netmap: iflib: enable/disable krings on any interface reinit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d65fd97e85ab807f3baa62aa979ae527914a3ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 12:05:35 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=3d65fd97e85ab807f3baa62aa979ae527914a3ea commit 3d65fd97e85ab807f3baa62aa979ae527914a3ea Author: Vincenzo Maffione AuthorDate: 2021-01-10 12:00:30 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-10 12:04:08 +0000 netmap: iflib: enable/disable krings on any interface reinit Since 1d238b07d5d4d9660ae0e0, krings are disabled before a reinit cycle triggered by iflib_netmap_register. However, this operation is actually necessary also for any interface reinit triggered by other causes (i.e., ifconfig commands). We achieve this goal by moving the krings enable/disable operation inside iflib_stop() and iflib_init_locked(). Once here, this change also removes some redundant operations from iflib_netmap_register(), that are already performed by iflib_stop(). PR: 252453 MFC after: 1 week --- sys/net/iflib.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index cf02b1574c10..3de80ecaeb0c 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -801,27 +801,18 @@ iflib_netmap_register(struct netmap_adapter *na, int onoff) int status; CTX_LOCK(ctx); - IFDI_INTR_DISABLE(ctx); - - /* Tell the stack that the interface is no longer active */ - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - if (!CTX_IS_VF(ctx)) IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip); - /* - * Stop any pending txsync/rxsync and prevent new ones - * form starting. Processes blocked in poll() will get - * POLLERR. - */ - netmap_disable_all_rings(ifp); - iflib_stop(ctx); /* * Enable (or disable) netmap flags, and intercept (or restore) * ifp->if_transmit. This is done once the device has been stopped - * to prevent race conditions. + * to prevent race conditions. Also, this must be done after + * calling netmap_disable_all_rings() and before calling + * netmap_enable_all_rings(), so that these two functions see the + * updated state of the NAF_NETMAP_ON bit. */ if (onoff) { nm_set_native_flags(na); @@ -835,8 +826,6 @@ iflib_netmap_register(struct netmap_adapter *na, int onoff) if (status) nm_clear_native_flags(na); CTX_UNLOCK(ctx); - /* Re-enable txsync/rxsync. */ - netmap_enable_all_rings(ifp); return (status); } @@ -2388,6 +2377,12 @@ iflib_init_locked(if_ctx_t ctx) if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); IFDI_INTR_DISABLE(ctx); + /* + * See iflib_stop(). Useful in case iflib_init_locked() is + * called without first calling iflib_stop(). + */ + netmap_disable_all_rings(ifp); + tx_ip_csum_flags = scctx->isc_tx_csum_flags & (CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_SCTP); tx_ip6_csum_flags = scctx->isc_tx_csum_flags & (CSUM_IP6_TCP | CSUM_IP6_UDP | CSUM_IP6_SCTP); /* Set hardware offload abilities */ @@ -2444,6 +2439,9 @@ done: for (i = 0; i < sctx->isc_ntxqsets; i++, txq++) callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, txq, txq->ift_timer.c_cpu); + + /* Re-enable txsync/rxsync. */ + netmap_enable_all_rings(ifp); } static int @@ -2489,6 +2487,13 @@ iflib_stop(if_ctx_t ctx) IFDI_STOP(ctx); DELAY(1000); + /* + * Stop any pending txsync/rxsync and prevent new ones + * form starting. Processes blocked in poll() will get + * POLLERR. + */ + netmap_disable_all_rings(ctx->ifc_ifp); + iflib_debug_reset(); /* Wait for current tx queue users to exit to disarm watchdog timer. */ for (i = 0; i < scctx->isc_ntxqsets; i++, txq++) { From owner-dev-commits-src-all@freebsd.org Sun Jan 10 12:16:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8AB864CA550; Sun, 10 Jan 2021 12:16:38 +0000 (UTC) (envelope-from git@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 4DDG6G3SnQz4YRF; Sun, 10 Jan 2021 12:16:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69A83156; Sun, 10 Jan 2021 12:16:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10ACGcqC098247; Sun, 10 Jan 2021 12:16:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10ACGcGr098246; Sun, 10 Jan 2021 12:16:38 GMT (envelope-from git) Date: Sun, 10 Jan 2021 12:16:38 GMT Message-Id: <202101101216.10ACGcGr098246@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Watson Subject: git: 4f2cbaf3cd59 - main - Track pipe(2) reads and writes as rusage message receives and sends, a feature misplaced during the transition from BSD 4.4's socket implementation to the optimised FreeBSD pipe implementation. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rwatson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f2cbaf3cd5900b06d3b5ad97db1962ec4fa0ffd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 12:16:38 -0000 The branch main has been updated by rwatson: URL: https://cgit.FreeBSD.org/src/commit/?id=4f2cbaf3cd5900b06d3b5ad97db1962ec4fa0ffd commit 4f2cbaf3cd5900b06d3b5ad97db1962ec4fa0ffd Author: Robert Watson AuthorDate: 2021-01-01 13:04:46 +0000 Commit: Robert Watson CommitDate: 2021-01-10 12:16:39 +0000 Track pipe(2) reads and writes as rusage message receives and sends, a feature misplaced during the transition from BSD 4.4's socket implementation to the optimised FreeBSD pipe implementation. MFC after: 1 week Reviewed by: arichardson, imp Differential Revision: https://reviews.freebsd.org/D27878 --- sys/kern/sys_pipe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 76ab7bab05f7..558337794950 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -857,6 +857,8 @@ unlocked_error: pipeselwakeup(rpipe); PIPE_UNLOCK(rpipe); + if (nread > 0) + td->td_ru.ru_msgrcv++; return (error); } @@ -1314,6 +1316,8 @@ pipe_write(struct file *fp, struct uio *uio, struct ucred *active_cred, pipeunlock(wpipe); PIPE_UNLOCK(rpipe); + if (uio->uio_resid != orig_resid) + td->td_ru.ru_msgsnd++; return (error); } From owner-dev-commits-src-all@freebsd.org Sun Jan 10 12:59:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 210ED4CB956; Sun, 10 Jan 2021 12:59:11 +0000 (UTC) (envelope-from dim@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 4DDH3M05dHz4c65; Sun, 10 Jan 2021 12:59:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "R3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id CF77A25864; Sun, 10 Jan 2021 12:59:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::1d5d:d377:dcb4:cd20] (unknown [IPv6:2001:470:7a58:0:1d5d:d377:dcb4:cd20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id AD9DE42214; Sun, 10 Jan 2021 13:59:08 +0100 (CET) From: Dimitry Andric Message-Id: <2B913109-27A8-4ABF-8F64-48CE78B76759@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_B662E377-B892-42B0-A9EE-915CA5C94CBD"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page Date: Sun, 10 Jan 2021 13:59:02 +0100 In-Reply-To: <202101082253.108MrrUL003251@slippy.cwsent.com> Cc: Chuck Tuffli , Jessica Clarke , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , "src-committers@freebsd.org" To: Cy Schubert References: <202101081729.108HTG7j066884@gitrepo.freebsd.org> <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> <202101081920.108JKUd2003299@slippy.cwsent.com> <202101081927.108JRKxR084004@slippy.cwsent.com> <202101082253.108MrrUL003251@slippy.cwsent.com> X-Mailer: Apple Mail (2.3445.104.17) X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 12:59:11 -0000 --Apple-Mail=_B662E377-B892-42B0-A9EE-915CA5C94CBD Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 8 Jan 2021, at 23:53, Cy Schubert wrote: >=20 > In message = om> > , Chuck Tuffli writes: >> --000000000000c9481f05b86a0c60 >> Content-Type: text/plain; charset=3D"UTF-8" >>=20 >> On Fri, Jan 8, 2021 at 11:27 AM Cy Schubert = >> wrote: >>=20 >>> In message <202101081920.108JKUd2003299@slippy.cwsent.com>, Cy = Schubert >>> writes: >>>> In message <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org>, = Jessica >>>> Clarke w >>>> rites: >>>=20 >> ... >>=20 >>>>> This broke powerpc and powerpc64: >>=20 >>=20 >> Sorry about that. I'll fix this in a bit. >>=20 >> --chuck >=20 > Looks like dim@ already did. >=20 > The time before last I fixed one of these it was pointed out to me > privately that when we use %jd that we should also cast to intmax_t or > uintmax_t, and that jhb@ told him. This was to future-proof, assuming = we'd > have 128-bit processors one day. That is certainly valid for e.g. time_t or other types with a varying width, or where you cannot predict the exact width. But for printing uint64_t and friends, where the width *is* exactly specified, I would rather just use the standards-defined PRIu64 and so on. Casting will obscure any type mismatches between the printf format strings and the actual arguments. -Dimitry --Apple-Mail=_B662E377-B892-42B0-A9EE-915CA5C94CBD Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCX/r6FgAKCRCwXqMKLiCW o+J+AKCeYyD2580Oi4rzzHPSGP87XkiNcACfRsz+iNOqMwrRN1jtksK75qLGIWA= =VpgJ -----END PGP SIGNATURE----- --Apple-Mail=_B662E377-B892-42B0-A9EE-915CA5C94CBD-- From owner-dev-commits-src-all@freebsd.org Sun Jan 10 13:24:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 68E844CC15E; Sun, 10 Jan 2021 13:24:28 +0000 (UTC) (envelope-from dim@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 4DDHcX2Trgz4cxy; Sun, 10 Jan 2021 13:24:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "R3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 2E8B926C52; Sun, 10 Jan 2021 13:24:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::1d5d:d377:dcb4:cd20] (unknown [IPv6:2001:470:7a58:0:1d5d:d377:dcb4:cd20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 3E923420F8; Sun, 10 Jan 2021 14:24:26 +0100 (CET) From: Dimitry Andric Message-Id: <32828B4F-9876-42F5-9110-21418960496D@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_D923C41E-DE7E-485F-92AC-6DE87C0F6B37"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support Date: Sun, 10 Jan 2021 14:24:15 +0100 In-Reply-To: Cc: Kyle Evans , Baptiste Daroussin , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org To: Gordon Bergling References: <202101051302.105D24lW041218@gitrepo.freebsd.org> <20210107135842.lji6ydbajmzxqiuq@ivaldir.net> X-Mailer: Apple Mail (2.3445.104.17) X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 13:24:28 -0000 --Apple-Mail=_D923C41E-DE7E-485F-92AC-6DE87C0F6B37 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 8 Jan 2021, at 16:43, Gordon Bergling wrote: >=20 > On Fri, Jan 08, 2021 at 09:21:01AM -0600, Kyle Evans wrote: >> On Thu, Jan 7, 2021 at 7:59 AM Baptiste Daroussin = wrote: >>> On Thu, Jan 07, 2021 at 07:53:47AM -0600, Kyle Evans wrote: >>>> On Tue, Jan 5, 2021 at 7:02 AM Baptiste Daroussin = wrote: ... > thanks for the additional bugfix. It would be good to provide = somewhere in > UPDATING some information about 'depend-cleanup.sh'. I use FreeBSD = since > about 20 years, and even as a committer I had never heard something = about > 'depend-cleanup.sh' before. IIRC emaste added this script recently. It used to be a bunch of commands directly in the top-level Makefiles, but this was getting a bit annoying to maintain. What's more, it was difficult to test the commands separately from the rather heavy "let's do a full buildworld" scenario. So now it is just a shell script, and you can run it by hand to test if any changes you're making to it work as expected, before committing. (Note that I consider all the "depend cleanup" stuff to be a fig leaf for a rather glaring deficiency in our build system. An ugly kludge. :) -Dimitry --Apple-Mail=_D923C41E-DE7E-485F-92AC-6DE87C0F6B37 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCX/r//wAKCRCwXqMKLiCW o+MeAJ9EphzWN+3xRg9A0L5lmNqqq4X8fgCdHRhwEQxea48JixhcJzf2IqWWNYs= =nlX3 -----END PGP SIGNATURE----- --Apple-Mail=_D923C41E-DE7E-485F-92AC-6DE87C0F6B37-- From owner-dev-commits-src-all@freebsd.org Sun Jan 10 13:59:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D98C14CD36C; Sun, 10 Jan 2021 13:59:43 +0000 (UTC) (envelope-from git@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 4DDJPC5mFnz4g8l; Sun, 10 Jan 2021 13:59:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B82CD159F; Sun, 10 Jan 2021 13:59:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10ADxh6Y027385; Sun, 10 Jan 2021 13:59:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10ADxhCg027384; Sun, 10 Jan 2021 13:59:43 GMT (envelope-from git) Date: Sun, 10 Jan 2021 13:59:43 GMT Message-Id: <202101101359.10ADxhCg027384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 4ba9ad0dc316 - main - iflib: add assert to prevent out-of-bounds array access MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ba9ad0dc316940f32065b05f24259f942c0692d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 13:59:43 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=4ba9ad0dc316940f32065b05f24259f942c0692d commit 4ba9ad0dc316940f32065b05f24259f942c0692d Author: Vincenzo Maffione AuthorDate: 2021-01-10 13:49:51 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-10 13:59:20 +0000 iflib: add assert to prevent out-of-bounds array access The iflib_queues_alloc() allocates isc_nrxqs iflib_dma_info structs for each rxqset, and links each struct to a different free list. As a result, it must be isc_nrxqs >= isc_nfl (plus the completion queue, if present). Add an assertion to make this constraint explicit. MFC after: 2 weeks --- sys/net/iflib.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 3de80ecaeb0c..e53c5031d3a7 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -5547,11 +5547,14 @@ iflib_queues_alloc(if_ctx_t ctx) uint8_t nrxqs = sctx->isc_nrxqs; uint8_t ntxqs = sctx->isc_ntxqs; int nfree_lists = sctx->isc_nfl ? sctx->isc_nfl : 1; + int fl_offset = (sctx->isc_flags & IFLIB_HAS_RXCQ ? 1 : 0); caddr_t *vaddrs; uint64_t *paddrs; KASSERT(ntxqs > 0, ("number of queues per qset must be at least 1")); KASSERT(nrxqs > 0, ("number of queues per qset must be at least 1")); + KASSERT(nrxqs >= fl_offset + nfree_lists, + ("there must be at least a rxq for each free list")); /* Allocate the TX ring struct memory */ if (!(ctx->ifc_txqs = @@ -5659,11 +5662,7 @@ iflib_queues_alloc(if_ctx_t ctx) } rxq->ifr_ctx = ctx; rxq->ifr_id = i; - if (sctx->isc_flags & IFLIB_HAS_RXCQ) { - rxq->ifr_fl_offset = 1; - } else { - rxq->ifr_fl_offset = 0; - } + rxq->ifr_fl_offset = fl_offset; rxq->ifr_nfl = nfree_lists; if (!(fl = (iflib_fl_t) malloc(sizeof(struct iflib_fl) * nfree_lists, M_IFLIB, M_NOWAIT | M_ZERO))) { From owner-dev-commits-src-all@freebsd.org Sun Jan 10 14:11:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6604A4CDB26; Sun, 10 Jan 2021 14:11:00 +0000 (UTC) (envelope-from git@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 4DDJfD2Nh7z4h0R; Sun, 10 Jan 2021 14:11:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A93A16D2; Sun, 10 Jan 2021 14:11:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AEB0qo051476; Sun, 10 Jan 2021 14:11:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AEB02x051475; Sun, 10 Jan 2021 14:11:00 GMT (envelope-from git) Date: Sun, 10 Jan 2021 14:11:00 GMT Message-Id: <202101101411.10AEB02x051475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: bb714db6d395 - main - netmap: vtnet: enable/disable krings on any interface reinit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bb714db6d39583a9fbf5d11849c5e2365e7c0d80 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 14:11:00 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=bb714db6d39583a9fbf5d11849c5e2365e7c0d80 commit bb714db6d39583a9fbf5d11849c5e2365e7c0d80 Author: Vincenzo Maffione AuthorDate: 2021-01-10 14:09:00 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-10 14:10:09 +0000 netmap: vtnet: enable/disable krings on any interface reinit See 3d65fd97e85ab807f3b for a detailed explanation. PR: 252453 MFC after: 1 week --- sys/dev/netmap/if_vtnet_netmap.h | 6 ------ sys/dev/netmap/netmap.c | 4 ++++ sys/dev/virtio/network/if_vtnet.c | 10 ++++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sys/dev/netmap/if_vtnet_netmap.h b/sys/dev/netmap/if_vtnet_netmap.h index a44cc13baae2..f787bf573a28 100644 --- a/sys/dev/netmap/if_vtnet_netmap.h +++ b/sys/dev/netmap/if_vtnet_netmap.h @@ -40,9 +40,6 @@ vtnet_netmap_reg(struct netmap_adapter *na, int state) struct ifnet *ifp = na->ifp; struct vtnet_softc *sc = ifp->if_softc; - /* Stop all txsync/rxsync and disable them. */ - netmap_disable_all_rings(ifp); - /* * Trigger a device reinit, asking vtnet_init_locked() to * also enter or exit netmap mode. @@ -53,9 +50,6 @@ vtnet_netmap_reg(struct netmap_adapter *na, int state) : VTNET_INIT_NETMAP_EXIT); VTNET_CORE_UNLOCK(sc); - /* Enable txsync/rxsync again. */ - netmap_enable_all_rings(ifp); - return (0); } diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index cf85671cae55..cabbd35aec20 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -619,6 +619,10 @@ netmap_set_all_rings(struct netmap_adapter *na, int stopped) if (!nm_netmap_on(na)) return; + if (netmap_verbose) { + nm_prinf("%s: %sable all rings", na->name, + (stopped ? "dis" : "en")); + } for_rx_tx(t) { for (i = 0; i < netmap_real_rings(na, t); i++) { netmap_set_ring(na, i, t, stopped); diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index cff9fa5831f2..2bfa72734f9e 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -2900,6 +2900,11 @@ vtnet_stop(struct vtnet_softc *sc) /* Only advisory. */ vtnet_disable_interrupts(sc); +#ifdef DEV_NETMAP + /* Stop any pending txsync/rxsync and disable them. */ + netmap_disable_all_rings(ifp); +#endif /* DEV_NETMAP */ + /* * Stop the host adapter. This resets it to the pre-initialized * state. It will not generate any interrupts until after it is @@ -3165,6 +3170,11 @@ vtnet_init_locked(struct vtnet_softc *sc, int init_mode) vtnet_update_link_status(sc); callout_reset(&sc->vtnet_tick_ch, hz, vtnet_tick, sc); +#ifdef DEV_NETMAP + /* Re-enable txsync/rxsync. */ + netmap_enable_all_rings(ifp); +#endif /* DEV_NETMAP */ + return; fail: From owner-dev-commits-src-all@freebsd.org Sun Jan 10 14:26:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A035A4CE3D7; Sun, 10 Jan 2021 14:26:07 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [204.107.128.30]) by mx1.freebsd.org (Postfix) with ESMTP id 4DDJzg43Pbz4hxv; Sun, 10 Jan 2021 14:26:07 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [198.74.231.63]) by cyrus.watson.org (Postfix) with ESMTPS id C6E7E5CCED; Sun, 10 Jan 2021 14:26:06 +0000 (UTC) Date: Sun, 10 Jan 2021 14:26:06 +0000 (GMT) From: Robert Watson To: Vincenzo Maffione cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Build breakage (was: Re: git: 4ba9ad0dc316 - main - iflib: add assert to prevent out-of-bounds array access) In-Reply-To: <202101101359.10ADxhCg027384@gitrepo.freebsd.org> Message-ID: <3bd51ab4-2ead-513e-2a8-bcaa562b22a9@fledge.watson.org> References: <202101101359.10ADxhCg027384@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 4DDJzg43Pbz4hxv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 14:26:07 -0000 With recent iflib/netmap commits, I'm getting the following on my cross-built GENERIC-MMCCAM-NODEBUG kernel, which is essentially the FreeBSD/arm64 GENERIC-MMCCAM as in the tree, but with GENERIC-NODEBUG as the base. This configuration built fine until this morning, but I've not had a chance to bisect to figure out which was the commit that triggered the breakage: >>> stage 3.1: building everything /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2384:2: error: implicit declaration of function 'netmap_disable_all_rings' is invalid in C99 [-Werror,-Wimplicit-function-declaration] netmap_disable_all_rings(ifp); ^ /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2444:2: error: implicit declaration of function 'netmap_enable_all_rings' is invalid in C99 [-Werror,-Wimplicit-function-declaration] netmap_enable_all_rings(ifp); ^ /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2444:2: note: did you mean 'netmap_disable_all_rings'? /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2384:2: note: 'netmap_disable_all_rings' declared here netmap_disable_all_rings(ifp); ^ /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2495:2: error: implicit declaration of function 'netmap_disable_all_rings' is invalid in C99 [-Werror,-Wimplicit-function-declaration] netmap_disable_all_rings(ctx->ifc_ifp); ^ 3 errors generated. --- iflib.o --- *** [iflib.o] Error code 1 make[2]: stopped in /usr/home/robert/cheri/build/freebsd-aarch64-build/usr/home/robert/cheri/freebsd/arm64.aarch64/sys/GENERIC-MMCCAM-NODEBUG --- all_subdir_bge --- --- modules-all --- *** [modules-all] Error code 2 make[2]: stopped in /usr/home/robert/cheri/build/freebsd-aarch64-build/usr/home/robert/cheri/freebsd/arm64.aarch64/sys/GENERIC-MMCCAM-NODEBUG 2 errors make[2]: stopped in /usr/home/robert/cheri/build/freebsd-aarch64-build/usr/home/robert/cheri/freebsd/arm64.aarch64/sys/GENERIC-MMCCAM-NODEBUG --- buildkernel --- --- buildkernel --- Fatal error: Command `nice make -DDB_FROM_SRC -DNO_CLEAN -DI_REALLY_MEAN_NO_CLEAN -DNO_ROOT -DBUILD_WITH_STRICT_TMPPATH TARGET_ARCH=aarch64 TARGET=arm64 DEBUG_FLAGS=-g 'LOCAL_XTOOL_DIRS=lib/libnetbsd usr.sbin/makefs usr.bin/mkimg' LD=/usr/bin/ld.lld XLD=/usr/bin/ld.lld 'HACK_EXTRA_FLAGS=-shared -fuse-ld=/usr/bin/ld.lld' TRAMP_LDFLAGS=-fuse-ld=/usr/bin/ld.lld KERNCONF=GENERIC-MMCCAM-NODEBUG -DWITHOUT_CLEAN -DWITH_TESTS -DWITHOUT_PROFILE -DWITHOUT_DEBUG_FILES -DWITHOUT_OFED -DWITHOUT_MAN -DWITH_GOOGLETEST -DWITHOUT_GCC -DWITHOUT_CLANG -DWITHOUT_LLD -DWITHOUT_LLDB -DWITHOUT_GCC_BOOTSTRAP -DWITHOUT_CLANG_BOOTSTRAP -DWITHOUT_LLD_BOOTSTRAP -DWITHOUT_LIB32 -DWITH_ELFTOOLCHAIN_BOOTSTRAP -DWITH_TOOLCHAIN -DWITHOUT_BINUTILS_BOOTSTRAP -s -de buildkernel -j6` failed with non-zero exit code 2 On Sun, 10 Jan 2021, Vincenzo Maffione wrote: > The branch main has been updated by vmaffione: > > URL: https://cgit.FreeBSD.org/src/commit/?id=4ba9ad0dc316940f32065b05f24259f942c0692d > > commit 4ba9ad0dc316940f32065b05f24259f942c0692d > Author: Vincenzo Maffione > AuthorDate: 2021-01-10 13:49:51 +0000 > Commit: Vincenzo Maffione > CommitDate: 2021-01-10 13:59:20 +0000 > > iflib: add assert to prevent out-of-bounds array access > > The iflib_queues_alloc() allocates isc_nrxqs iflib_dma_info structs > for each rxqset, and links each struct to a different free list. > As a result, it must be isc_nrxqs >= isc_nfl (plus the completion > queue, if present). > Add an assertion to make this constraint explicit. > > MFC after: 2 weeks > --- > sys/net/iflib.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/sys/net/iflib.c b/sys/net/iflib.c > index 3de80ecaeb0c..e53c5031d3a7 100644 > --- a/sys/net/iflib.c > +++ b/sys/net/iflib.c > @@ -5547,11 +5547,14 @@ iflib_queues_alloc(if_ctx_t ctx) > uint8_t nrxqs = sctx->isc_nrxqs; > uint8_t ntxqs = sctx->isc_ntxqs; > int nfree_lists = sctx->isc_nfl ? sctx->isc_nfl : 1; > + int fl_offset = (sctx->isc_flags & IFLIB_HAS_RXCQ ? 1 : 0); > caddr_t *vaddrs; > uint64_t *paddrs; > > KASSERT(ntxqs > 0, ("number of queues per qset must be at least 1")); > KASSERT(nrxqs > 0, ("number of queues per qset must be at least 1")); > + KASSERT(nrxqs >= fl_offset + nfree_lists, > + ("there must be at least a rxq for each free list")); > > /* Allocate the TX ring struct memory */ > if (!(ctx->ifc_txqs = > @@ -5659,11 +5662,7 @@ iflib_queues_alloc(if_ctx_t ctx) > } > rxq->ifr_ctx = ctx; > rxq->ifr_id = i; > - if (sctx->isc_flags & IFLIB_HAS_RXCQ) { > - rxq->ifr_fl_offset = 1; > - } else { > - rxq->ifr_fl_offset = 0; > - } > + rxq->ifr_fl_offset = fl_offset; > rxq->ifr_nfl = nfree_lists; > if (!(fl = > (iflib_fl_t) malloc(sizeof(struct iflib_fl) * nfree_lists, M_IFLIB, M_NOWAIT | M_ZERO))) { > From owner-dev-commits-src-all@freebsd.org Sun Jan 10 14:33:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 100414CE7C7; Sun, 10 Jan 2021 14:33:03 +0000 (UTC) (envelope-from vmaffione@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 4DDK7f6vlDz4jsZ; Sun, 10 Jan 2021 14:33:02 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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: vmaffione) by smtp.freebsd.org (Postfix) with ESMTPSA id D8E662778A; Sun, 10 Jan 2021 14:33:02 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: by mail-pj1-f50.google.com with SMTP id l23so8878871pjg.1; Sun, 10 Jan 2021 06:33:02 -0800 (PST) X-Gm-Message-State: AOAM531SfvMDm9hOnxOd6STailoiXNTShGJqVQVTWbyA5N+Dt2HQJL0k y4tQBdJGtfjcpFd6R3Ib8OUzmmWpRjssfAzVzTE= X-Google-Smtp-Source: ABdhPJxX8mgLyR8p1xt6hvIvM/iwVI126OymhdXBIJHdvHoR1C+16ZrSVzBT/+O/WAshE0VUgIIX8I/ir+hHAsAXMnE= X-Received: by 2002:a17:90a:5303:: with SMTP id x3mr13539225pjh.54.1610289181818; Sun, 10 Jan 2021 06:33:01 -0800 (PST) MIME-Version: 1.0 References: <202101101359.10ADxhCg027384@gitrepo.freebsd.org> <3bd51ab4-2ead-513e-2a8-bcaa562b22a9@fledge.watson.org> In-Reply-To: <3bd51ab4-2ead-513e-2a8-bcaa562b22a9@fledge.watson.org> From: Vincenzo Maffione Date: Sun, 10 Jan 2021 15:32:50 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Build breakage (was: Re: git: 4ba9ad0dc316 - main - iflib: add assert to prevent out-of-bounds array access) To: Robert Watson Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 14:33:03 -0000 Sorry, my bad. I'll fix it right away. Thanks, Vincenzo Il giorno dom 10 gen 2021 alle ore 15:26 Robert Watson ha scritto: > > With recent iflib/netmap commits, I'm getting the following on my > cross-built > GENERIC-MMCCAM-NODEBUG kernel, which is essentially the FreeBSD/arm64 > GENERIC-MMCCAM as in the tree, but with GENERIC-NODEBUG as the base. This > configuration built fine until this morning, but I've not had a chance to > bisect to figure out which was the commit that triggered the breakage: > > >>> stage 3.1: building everything > /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2384:2: error: implicit > declaration of function 'netmap_disable_all_rings' is invalid in C99 > [-Werror,-Wimplicit-function-declaration] > netmap_disable_all_rings(ifp); > ^ > /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2444:2: error: implicit > declaration of function 'netmap_enable_all_rings' is invalid in C99 > [-Werror,-Wimplicit-function-declaration] > netmap_enable_all_rings(ifp); > ^ > /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2444:2: note: did you mean > 'netmap_disable_all_rings'? > /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2384:2: note: > 'netmap_disable_all_rings' declared here > netmap_disable_all_rings(ifp); > ^ > /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2495:2: error: implicit > declaration of function 'netmap_disable_all_rings' is invalid in C99 > [-Werror,-Wimplicit-function-declaration] > netmap_disable_all_rings(ctx->ifc_ifp); > ^ > 3 errors generated. > --- iflib.o --- > *** [iflib.o] Error code 1 > make[2]: stopped in > > /usr/home/robert/cheri/build/freebsd-aarch64-build/usr/home/robert/cheri/freebsd/arm64.aarch64/sys/GENERIC-MMCCAM-NODEBUG > --- all_subdir_bge --- > --- modules-all --- > *** [modules-all] Error code 2 > make[2]: stopped in > > /usr/home/robert/cheri/build/freebsd-aarch64-build/usr/home/robert/cheri/freebsd/arm64.aarch64/sys/GENERIC-MMCCAM-NODEBUG > 2 errors > make[2]: stopped in > > /usr/home/robert/cheri/build/freebsd-aarch64-build/usr/home/robert/cheri/freebsd/arm64.aarch64/sys/GENERIC-MMCCAM-NODEBUG > --- buildkernel --- > --- buildkernel --- > Fatal error: Command `nice make -DDB_FROM_SRC -DNO_CLEAN > -DI_REALLY_MEAN_NO_CLEAN -DNO_ROOT -DBUILD_WITH_STRICT_TMPPATH > TARGET_ARCH=aarch64 TARGET=arm64 DEBUG_FLAGS=-g > 'LOCAL_XTOOL_DIRS=lib/libnetbsd usr.sbin/makefs usr.bin/mkimg' > LD=/usr/bin/ld.lld XLD=/usr/bin/ld.lld 'HACK_EXTRA_FLAGS=-shared > -fuse-ld=/usr/bin/ld.lld' TRAMP_LDFLAGS=-fuse-ld=/usr/bin/ld.lld > KERNCONF=GENERIC-MMCCAM-NODEBUG -DWITHOUT_CLEAN -DWITH_TESTS > -DWITHOUT_PROFILE > -DWITHOUT_DEBUG_FILES -DWITHOUT_OFED -DWITHOUT_MAN -DWITH_GOOGLETEST > -DWITHOUT_GCC -DWITHOUT_CLANG -DWITHOUT_LLD -DWITHOUT_LLDB > -DWITHOUT_GCC_BOOTSTRAP -DWITHOUT_CLANG_BOOTSTRAP -DWITHOUT_LLD_BOOTSTRAP > -DWITHOUT_LIB32 -DWITH_ELFTOOLCHAIN_BOOTSTRAP -DWITH_TOOLCHAIN > -DWITHOUT_BINUTILS_BOOTSTRAP -s -de buildkernel -j6` failed with non-zero > exit > code 2 > > > > > On Sun, 10 Jan 2021, Vincenzo Maffione wrote: > > > The branch main has been updated by vmaffione: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=4ba9ad0dc316940f32065b05f24259f942c0692d > > > > commit 4ba9ad0dc316940f32065b05f24259f942c0692d > > Author: Vincenzo Maffione > > AuthorDate: 2021-01-10 13:49:51 +0000 > > Commit: Vincenzo Maffione > > CommitDate: 2021-01-10 13:59:20 +0000 > > > > iflib: add assert to prevent out-of-bounds array access > > > > The iflib_queues_alloc() allocates isc_nrxqs iflib_dma_info structs > > for each rxqset, and links each struct to a different free list. > > As a result, it must be isc_nrxqs >= isc_nfl (plus the completion > > queue, if present). > > Add an assertion to make this constraint explicit. > > > > MFC after: 2 weeks > > --- > > sys/net/iflib.c | 9 ++++----- > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > diff --git a/sys/net/iflib.c b/sys/net/iflib.c > > index 3de80ecaeb0c..e53c5031d3a7 100644 > > --- a/sys/net/iflib.c > > +++ b/sys/net/iflib.c > > @@ -5547,11 +5547,14 @@ iflib_queues_alloc(if_ctx_t ctx) > > uint8_t nrxqs = sctx->isc_nrxqs; > > uint8_t ntxqs = sctx->isc_ntxqs; > > int nfree_lists = sctx->isc_nfl ? sctx->isc_nfl : 1; > > + int fl_offset = (sctx->isc_flags & IFLIB_HAS_RXCQ ? 1 : 0); > > caddr_t *vaddrs; > > uint64_t *paddrs; > > > > KASSERT(ntxqs > 0, ("number of queues per qset must be at least > 1")); > > KASSERT(nrxqs > 0, ("number of queues per qset must be at least > 1")); > > + KASSERT(nrxqs >= fl_offset + nfree_lists, > > + ("there must be at least a rxq for each free list")); > > > > /* Allocate the TX ring struct memory */ > > if (!(ctx->ifc_txqs = > > @@ -5659,11 +5662,7 @@ iflib_queues_alloc(if_ctx_t ctx) > > } > > rxq->ifr_ctx = ctx; > > rxq->ifr_id = i; > > - if (sctx->isc_flags & IFLIB_HAS_RXCQ) { > > - rxq->ifr_fl_offset = 1; > > - } else { > > - rxq->ifr_fl_offset = 0; > > - } > > + rxq->ifr_fl_offset = fl_offset; > > rxq->ifr_nfl = nfree_lists; > > if (!(fl = > > (iflib_fl_t) malloc(sizeof(struct iflib_fl) * > nfree_lists, M_IFLIB, M_NOWAIT | M_ZERO))) { > > > From owner-dev-commits-src-all@freebsd.org Sun Jan 10 14:33:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E64824CE7DB; Sun, 10 Jan 2021 14:33:51 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (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 4DDK8b3VQDz4jt8; Sun, 10 Jan 2021 14:33:51 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id ybmtk7qPftdldybmukgvpD; Sun, 10 Jan 2021 07:33:49 -0700 X-Authority-Analysis: v=2.4 cv=INe8tijG c=1 sm=1 tr=0 ts=5ffb104d a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=y212I2TeAYNnVHBa6CIA: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 92AF055D; Sun, 10 Jan 2021 06:33:46 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 10AEXkaX075355; Sun, 10 Jan 2021 06:33:46 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101101433.10AEXkaX075355@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: Vincenzo Maffione cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 3d65fd97e85a - main - netmap: iflib: enable/disable krings on any interface reinit In-reply-to: <202101101205.10AC5ZrS084658@gitrepo.freebsd.org> References: <202101101205.10AC5ZrS084658@gitrepo.freebsd.org> Comments: In-reply-to Vincenzo Maffione message dated "Sun, 10 Jan 2021 12:05:35 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 10 Jan 2021 06:33:46 -0800 X-CMAE-Envelope: MS4xfATCwhsFg+5IyMOrac4RcE0ApAmsh5rqHROK47uFR0ANjzd3KpJpO3M5TAqvgADh38GGPXS/Pyi2VCGrDn/WBaSn0ERwimQL3jEkt1YmXB18Uq4YuSDD IP2yezStm9ruyyw6kbLnwntuyd5YDuvj2wlpmZiwYHZujBfMaPO3N8ijxhs9JbNLA8wXfRbyozM17gQdvl6XC9d08VCzdj29aTxIaJOwEopbkMPTPzER3dH7 VYbhilSRD9TcAz4g+VzPmnNk5hnrxIDOrpHddLtUtWCYZkWC1QGOKiiq1839y+0bEt0jJI4i33rwt1eqBtGTBm4k6uC5QrFFpjzcHkWdkDE= X-Rspamd-Queue-Id: 4DDK8b3VQDz4jt8 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 14:33:52 -0000 In message <202101101205.10AC5ZrS084658@gitrepo.freebsd.org>, Vincenzo Maffione writes: > The branch main has been updated by vmaffione: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3d65fd97e85ab807f3baa62aa979ae52 > 7914a3ea > > commit 3d65fd97e85ab807f3baa62aa979ae527914a3ea > Author: Vincenzo Maffione > AuthorDate: 2021-01-10 12:00:30 +0000 > Commit: Vincenzo Maffione > CommitDate: 2021-01-10 12:04:08 +0000 > > netmap: iflib: enable/disable krings on any interface reinit > > Since 1d238b07d5d4d9660ae0e0, krings are disabled before > a reinit cycle triggered by iflib_netmap_register. > However, this operation is actually necessary also for > any interface reinit triggered by other causes (i.e., > ifconfig commands). > We achieve this goal by moving the krings enable/disable > operation inside iflib_stop() and iflib_init_locked(). > > Once here, this change also removes some redundant operations > from iflib_netmap_register(), that are already performed by > iflib_stop(). > > PR: 252453 > MFC after: 1 week > --- > sys/net/iflib.c | 35 ++++++++++++++++++++--------------- > 1 file changed, 20 insertions(+), 15 deletions(-) > > diff --git a/sys/net/iflib.c b/sys/net/iflib.c > index cf02b1574c10..3de80ecaeb0c 100644 > --- a/sys/net/iflib.c > +++ b/sys/net/iflib.c > @@ -801,27 +801,18 @@ iflib_netmap_register(struct netmap_adapter *na, int on > off) > int status; > > CTX_LOCK(ctx); > - IFDI_INTR_DISABLE(ctx); > - > - /* Tell the stack that the interface is no longer active */ > - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); > - > if (!CTX_IS_VF(ctx)) > IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip); > > - /* > - * Stop any pending txsync/rxsync and prevent new ones > - * form starting. Processes blocked in poll() will get > - * POLLERR. > - */ > - netmap_disable_all_rings(ifp); > - > iflib_stop(ctx); > > /* > * Enable (or disable) netmap flags, and intercept (or restore) > * ifp->if_transmit. This is done once the device has been stopped > - * to prevent race conditions. > + * to prevent race conditions. Also, this must be done after > + * calling netmap_disable_all_rings() and before calling > + * netmap_enable_all_rings(), so that these two functions see the > + * updated state of the NAF_NETMAP_ON bit. > */ > if (onoff) { > nm_set_native_flags(na); > @@ -835,8 +826,6 @@ iflib_netmap_register(struct netmap_adapter *na, int onof > f) > if (status) > nm_clear_native_flags(na); > CTX_UNLOCK(ctx); > - /* Re-enable txsync/rxsync. */ > - netmap_enable_all_rings(ifp); > return (status); > } > > @@ -2388,6 +2377,12 @@ iflib_init_locked(if_ctx_t ctx) > if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); > IFDI_INTR_DISABLE(ctx); > > + /* > + * See iflib_stop(). Useful in case iflib_init_locked() is > + * called without first calling iflib_stop(). > + */ > + netmap_disable_all_rings(ifp); > + > tx_ip_csum_flags = scctx->isc_tx_csum_flags & (CSUM_IP | CSUM_TCP | CSU > M_UDP | CSUM_SCTP); > tx_ip6_csum_flags = scctx->isc_tx_csum_flags & (CSUM_IP6_TCP | CSUM_IP6 > _UDP | CSUM_IP6_SCTP); > /* Set hardware offload abilities */ > @@ -2444,6 +2439,9 @@ done: > for (i = 0; i < sctx->isc_ntxqsets; i++, txq++) > callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_ti > mer, txq, > txq->ift_timer.c_cpu); > + > + /* Re-enable txsync/rxsync. */ > + netmap_enable_all_rings(ifp); > } > > static int > @@ -2489,6 +2487,13 @@ iflib_stop(if_ctx_t ctx) > IFDI_STOP(ctx); > DELAY(1000); > > + /* > + * Stop any pending txsync/rxsync and prevent new ones > + * form starting. Processes blocked in poll() will get > + * POLLERR. > + */ > + netmap_disable_all_rings(ctx->ifc_ifp); > + > iflib_debug_reset(); > /* Wait for current tx queue users to exit to disarm watchdog timer. */ > for (i = 0; i < scctx->isc_ntxqsets; i++, txq++) { > This commit makes a couple of assumptions 1. It's missing definition in a header for netmap_disable_all_rings() and netmap_enable_all_rings(). 2. It assumes that all kernels include device, that it is not loaded as a kld. The first assumption causes a build failure. The second assumption might require at the very least an UPDATING entry to warn people not to remove netmap from their kernels or rely on the module. And probably needs a __FreeBSD_version bump. -- 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-dev-commits-src-all@freebsd.org Sun Jan 10 14:45:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 76E214CF0F8; Sun, 10 Jan 2021 14:45:14 +0000 (UTC) (envelope-from git@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 4DDKPk30LFz4kJ0; Sun, 10 Jan 2021 14:45:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59C462108; Sun, 10 Jan 2021 14:45:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AEjEwg091869; Sun, 10 Jan 2021 14:45:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AEjEjx091868; Sun, 10 Jan 2021 14:45:14 GMT (envelope-from git) Date: Sun, 10 Jan 2021 14:45:14 GMT Message-Id: <202101101445.10AEjEjx091868@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 8aa8484cbf06 - main - iflib: fix build failure in case DEV_NETMAP is not defined MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8aa8484cbf06bb26ad87177fe4aebcaf1519f138 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 14:45:14 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=8aa8484cbf06bb26ad87177fe4aebcaf1519f138 commit 8aa8484cbf06bb26ad87177fe4aebcaf1519f138 Author: Vincenzo Maffione AuthorDate: 2021-01-10 14:42:49 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-10 14:43:58 +0000 iflib: fix build failure in case DEV_NETMAP is not defined This addresses the build failure introduced by 3d65fd97e85ab807f3baa62. MFC with: 3d65fd97e85ab807f3baa62 --- sys/net/iflib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index e53c5031d3a7..0a40a0825a95 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -1293,6 +1293,8 @@ iflib_netmap_timer(void *arg) #define iflib_netmap_txq_init(ctx, txq) (0) #define iflib_netmap_rxq_init(ctx, rxq) (0) #define iflib_netmap_detach(ifp) +#define netmap_enable_all_rings(ifp) +#define netmap_disable_all_rings(ifp) #define iflib_netmap_attach(ctx) (0) #define netmap_rx_irq(ifp, qid, budget) (0) From owner-dev-commits-src-all@freebsd.org Sun Jan 10 14:48:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 27A534CF247; Sun, 10 Jan 2021 14:48:45 +0000 (UTC) (envelope-from vmaffione@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 4DDKTn0bc1z4kvj; Sun, 10 Jan 2021 14:48:45 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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: vmaffione) by smtp.freebsd.org (Postfix) with ESMTPSA id E8A06271C3; Sun, 10 Jan 2021 14:48:44 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: by mail-pf1-f172.google.com with SMTP id c79so9409976pfc.2; Sun, 10 Jan 2021 06:48:44 -0800 (PST) X-Gm-Message-State: AOAM530lJmOQmH90nWFQpi3APeFasDAZdftsl7ci2f1Frp3m/l9+fkec I/xlW1XZuCiYtq7ECSegzyb8Yin/33NzD3PDO/A= X-Google-Smtp-Source: ABdhPJzuDhzKVN1GJe65uR1FyQXNqrmSYzBFtH1JniyFvtJSP9Nf/7jKbrduXC73ZLHMEgnmaEroW13n6RiQYgFdjOA= X-Received: by 2002:aa7:8387:0:b029:1ae:72c6:e011 with SMTP id u7-20020aa783870000b02901ae72c6e011mr10558768pfm.81.1610290123772; Sun, 10 Jan 2021 06:48:43 -0800 (PST) MIME-Version: 1.0 References: <202101101205.10AC5ZrS084658@gitrepo.freebsd.org> <202101101433.10AEXkaX075355@slippy.cwsent.com> In-Reply-To: <202101101433.10AEXkaX075355@slippy.cwsent.com> From: Vincenzo Maffione Date: Sun, 10 Jan 2021 15:48:32 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 3d65fd97e85a - main - netmap: iflib: enable/disable krings on any interface reinit To: Cy Schubert Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 14:48:45 -0000 Il giorno dom 10 gen 2021 alle ore 15:33 Cy Schubert < Cy.Schubert@cschubert.com> ha scritto: > In message <202101101205.10AC5ZrS084658@gitrepo.freebsd.org>, Vincenzo > Maffione > writes: > > The branch main has been updated by vmaffione: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3d65fd97e85ab807f3baa62aa979ae52 > > 7914a3ea > > > > commit 3d65fd97e85ab807f3baa62aa979ae527914a3ea > > Author: Vincenzo Maffione > > AuthorDate: 2021-01-10 12:00:30 +0000 > > Commit: Vincenzo Maffione > > CommitDate: 2021-01-10 12:04:08 +0000 > > > > netmap: iflib: enable/disable krings on any interface reinit > > > > Since 1d238b07d5d4d9660ae0e0, krings are disabled before > > a reinit cycle triggered by iflib_netmap_register. > > However, this operation is actually necessary also for > > any interface reinit triggered by other causes (i.e., > > ifconfig commands). > > We achieve this goal by moving the krings enable/disable > > operation inside iflib_stop() and iflib_init_locked(). > > > > Once here, this change also removes some redundant operations > > from iflib_netmap_register(), that are already performed by > > iflib_stop(). > > > > PR: 252453 > > MFC after: 1 week > > --- > > sys/net/iflib.c | 35 ++++++++++++++++++++--------------- > > 1 file changed, 20 insertions(+), 15 deletions(-) > > > > diff --git a/sys/net/iflib.c b/sys/net/iflib.c > > index cf02b1574c10..3de80ecaeb0c 100644 > > --- a/sys/net/iflib.c > > +++ b/sys/net/iflib.c > > @@ -801,27 +801,18 @@ iflib_netmap_register(struct netmap_adapter *na, > int on > > off) > > int status; > > > > CTX_LOCK(ctx); > > - IFDI_INTR_DISABLE(ctx); > > - > > - /* Tell the stack that the interface is no longer active */ > > - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); > > - > > if (!CTX_IS_VF(ctx)) > > IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip); > > > > - /* > > - * Stop any pending txsync/rxsync and prevent new ones > > - * form starting. Processes blocked in poll() will get > > - * POLLERR. > > - */ > > - netmap_disable_all_rings(ifp); > > - > > iflib_stop(ctx); > > > > /* > > * Enable (or disable) netmap flags, and intercept (or restore) > > * ifp->if_transmit. This is done once the device has been stopped > > - * to prevent race conditions. > > + * to prevent race conditions. Also, this must be done after > > + * calling netmap_disable_all_rings() and before calling > > + * netmap_enable_all_rings(), so that these two functions see the > > + * updated state of the NAF_NETMAP_ON bit. > > */ > > if (onoff) { > > nm_set_native_flags(na); > > @@ -835,8 +826,6 @@ iflib_netmap_register(struct netmap_adapter *na, int > onof > > f) > > if (status) > > nm_clear_native_flags(na); > > CTX_UNLOCK(ctx); > > - /* Re-enable txsync/rxsync. */ > > - netmap_enable_all_rings(ifp); > > return (status); > > } > > > > @@ -2388,6 +2377,12 @@ iflib_init_locked(if_ctx_t ctx) > > if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); > > IFDI_INTR_DISABLE(ctx); > > > > + /* > > + * See iflib_stop(). Useful in case iflib_init_locked() is > > + * called without first calling iflib_stop(). > > + */ > > + netmap_disable_all_rings(ifp); > > + > > tx_ip_csum_flags = scctx->isc_tx_csum_flags & (CSUM_IP | CSUM_TCP > | CSU > > M_UDP | CSUM_SCTP); > > tx_ip6_csum_flags = scctx->isc_tx_csum_flags & (CSUM_IP6_TCP | > CSUM_IP6 > > _UDP | CSUM_IP6_SCTP); > > /* Set hardware offload abilities */ > > @@ -2444,6 +2439,9 @@ done: > > for (i = 0; i < sctx->isc_ntxqsets; i++, txq++) > > callout_reset_on(&txq->ift_timer, iflib_timer_default, > iflib_ti > > mer, txq, > > txq->ift_timer.c_cpu); > > + > > + /* Re-enable txsync/rxsync. */ > > + netmap_enable_all_rings(ifp); > > } > > > > static int > > @@ -2489,6 +2487,13 @@ iflib_stop(if_ctx_t ctx) > > IFDI_STOP(ctx); > > DELAY(1000); > > > > + /* > > + * Stop any pending txsync/rxsync and prevent new ones > > + * form starting. Processes blocked in poll() will get > > + * POLLERR. > > + */ > > + netmap_disable_all_rings(ctx->ifc_ifp); > > + > > iflib_debug_reset(); > > /* Wait for current tx queue users to exit to disarm watchdog > timer. */ > > for (i = 0; i < scctx->isc_ntxqsets; i++, txq++) { > > > > Sorry, that was not intentional. > This commit makes a couple of assumptions > > 1. It's missing definition in a header for netmap_disable_all_rings() and > netmap_enable_all_rings(). > The header definitions are actually in sys/dev/netmap/netmap_kern.h > > 2. It assumes that all kernels include device, that it is not loaded as a > kld. > > The first assumption causes a build failure. > > The second assumption might require at the very least an UPDATING entry to > warn people not to remove netmap from their kernels or rely on the module. > And probably needs a __FreeBSD_version bump. > I pushed another commit to (hopefully) fix the issue. I don't think any of this is necessary, because iflib already supports the case where DEV_NETMAP is not defined. I simply forgot to add a placeholder. Thanks > -- > 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-dev-commits-src-all@freebsd.org Sun Jan 10 14:49:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 224A44CF1C3; Sun, 10 Jan 2021 14:49:09 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (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 4DDKVC72tVz4lHs; Sun, 10 Jan 2021 14:49:07 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id yc1gkajjIktFkyc1hk6JXf; Sun, 10 Jan 2021 07:49:06 -0700 X-Authority-Analysis: v=2.4 cv=NYRYa0P4 c=1 sm=1 tr=0 ts=5ffb13e2 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=VxmjJ2MpAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=hkcPmCClcqprY-XaVP8A:9 a=CjuIK1q_8ugA:10 a=1gNDDdWnnLUA:10 a=7gXAzLPJhVmCkEl4_tsf:22 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 A1969610; Sun, 10 Jan 2021 06:49:03 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 10AEn3Gt075605; Sun, 10 Jan 2021 06:49:03 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101101449.10AEn3Gt075605@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: Cy Schubert cc: Vincenzo Maffione , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 3d65fd97e85a - main - netmap: iflib: enable/disable krings on any interface reinit In-reply-to: <202101101433.10AEXkaX075355@slippy.cwsent.com> References: <202101101205.10AC5ZrS084658@gitrepo.freebsd.org> <202101101433.10AEXkaX075355@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Sun, 10 Jan 2021 06:33:46 -0800." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 10 Jan 2021 06:49:03 -0800 X-CMAE-Envelope: MS4xfDfLoW22xE61/kD4+bj+xqgQJs8uoTUvg1XaVjpA1npz8Wsp8nzsAgyGa6RzEqbgMROWnaB51J5ov3XD9gO833eo9htw2uVpsGmyHo+gTk1u6lNlerCt ZgVHinIEc7PNDS7B8QiqvHLqyuCmRMa0IsYAfSNh96ZOBgluSDfMMFvtaBRtyzEZ0tmavDedVgTyISiNyuCkGl7U86LqGEXhLirc/UddKnZq+4Tqj5t4xLal pyNu9SQ57aatKI49pqVdW6ZtJbXJMZkje7T0esRXmJdIymTXV/PpzsGRtVoKCx+KHsAi3lbDxKxguWEpZNIJCBmeq+R3IsO4C7szhHwts1Q= X-Rspamd-Queue-Id: 4DDKVC72tVz4lHs 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.137) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-1.70 / 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)[]; RWL_MAILSPIKE_GOOD(0.00)[64.59.136.137:from]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RECEIVED_SPAMHAUS_PBL(0.00)[70.67.229.168:received]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[64.59.136.137:from]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; AUTH_NA(1.00)[]; SPAMHAUS_ZRD(0.00)[64.59.136.137:from:127.0.2.255]; RCVD_IN_DNSWL_LOW(-0.10)[64.59.136.137:from]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_SPF_NA(0.00)[no SPF record]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 14:49:09 -0000 In message <202101101433.10AEXkaX075355@slippy.cwsent.com>, Cy Schubert writes: > In message <202101101205.10AC5ZrS084658@gitrepo.freebsd.org>, Vincenzo > Maffione > writes: > > The branch main has been updated by vmaffione: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3d65fd97e85ab807f3baa62aa979ae > 52 > > 7914a3ea > > > > commit 3d65fd97e85ab807f3baa62aa979ae527914a3ea > > Author: Vincenzo Maffione > > AuthorDate: 2021-01-10 12:00:30 +0000 > > Commit: Vincenzo Maffione > > CommitDate: 2021-01-10 12:04:08 +0000 > > > > netmap: iflib: enable/disable krings on any interface reinit > > > > Since 1d238b07d5d4d9660ae0e0, krings are disabled before > > a reinit cycle triggered by iflib_netmap_register. > > However, this operation is actually necessary also for > > any interface reinit triggered by other causes (i.e., > > ifconfig commands). > > We achieve this goal by moving the krings enable/disable > > operation inside iflib_stop() and iflib_init_locked(). > > > > Once here, this change also removes some redundant operations > > from iflib_netmap_register(), that are already performed by > > iflib_stop(). > > > > PR: 252453 > > MFC after: 1 week > > --- > > sys/net/iflib.c | 35 ++++++++++++++++++++--------------- > > 1 file changed, 20 insertions(+), 15 deletions(-) > > > > diff --git a/sys/net/iflib.c b/sys/net/iflib.c > > index cf02b1574c10..3de80ecaeb0c 100644 > > --- a/sys/net/iflib.c > > +++ b/sys/net/iflib.c > > @@ -801,27 +801,18 @@ iflib_netmap_register(struct netmap_adapter *na, int > on > > off) > > int status; > > > > CTX_LOCK(ctx); > > - IFDI_INTR_DISABLE(ctx); > > - > > - /* Tell the stack that the interface is no longer active */ > > - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); > > - > > if (!CTX_IS_VF(ctx)) > > IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip); > > > > - /* > > - * Stop any pending txsync/rxsync and prevent new ones > > - * form starting. Processes blocked in poll() will get > > - * POLLERR. > > - */ > > - netmap_disable_all_rings(ifp); > > - > > iflib_stop(ctx); > > > > /* > > * Enable (or disable) netmap flags, and intercept (or restore) > > * ifp->if_transmit. This is done once the device has been stopped > > - * to prevent race conditions. > > + * to prevent race conditions. Also, this must be done after > > + * calling netmap_disable_all_rings() and before calling > > + * netmap_enable_all_rings(), so that these two functions see the > > + * updated state of the NAF_NETMAP_ON bit. > > */ > > if (onoff) { > > nm_set_native_flags(na); > > @@ -835,8 +826,6 @@ iflib_netmap_register(struct netmap_adapter *na, int on > of > > f) > > if (status) > > nm_clear_native_flags(na); > > CTX_UNLOCK(ctx); > > - /* Re-enable txsync/rxsync. */ > > - netmap_enable_all_rings(ifp); > > return (status); > > } > > > > @@ -2388,6 +2377,12 @@ iflib_init_locked(if_ctx_t ctx) > > if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); > > IFDI_INTR_DISABLE(ctx); > > > > + /* > > + * See iflib_stop(). Useful in case iflib_init_locked() is > > + * called without first calling iflib_stop(). > > + */ > > + netmap_disable_all_rings(ifp); > > + > > tx_ip_csum_flags = scctx->isc_tx_csum_flags & (CSUM_IP | CSUM_TCP | CSU > > M_UDP | CSUM_SCTP); > > tx_ip6_csum_flags = scctx->isc_tx_csum_flags & (CSUM_IP6_TCP | CSUM_IP6 > > _UDP | CSUM_IP6_SCTP); > > /* Set hardware offload abilities */ > > @@ -2444,6 +2439,9 @@ done: > > for (i = 0; i < sctx->isc_ntxqsets; i++, txq++) > > callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_ti > > mer, txq, > > txq->ift_timer.c_cpu); > > + > > + /* Re-enable txsync/rxsync. */ > > + netmap_enable_all_rings(ifp); > > } > > > > static int > > @@ -2489,6 +2487,13 @@ iflib_stop(if_ctx_t ctx) > > IFDI_STOP(ctx); > > DELAY(1000); > > > > + /* > > + * Stop any pending txsync/rxsync and prevent new ones > > + * form starting. Processes blocked in poll() will get > > + * POLLERR. > > + */ > > + netmap_disable_all_rings(ctx->ifc_ifp); > > + > > iflib_debug_reset(); > > /* Wait for current tx queue users to exit to disarm watchdog timer. */ > > for (i = 0; i < scctx->isc_ntxqsets; i++, txq++) { > > > > This commit makes a couple of assumptions > > 1. It's missing definition in a header for netmap_disable_all_rings() and > netmap_enable_all_rings(). > > 2. It assumes that all kernels include device, that it is not loaded as a > kld. > > The first assumption causes a build failure. > > The second assumption might require at the very least an UPDATING entry to > warn people not to remove netmap from their kernels or rely on the module. > And probably needs a __FreeBSD_version bump. Nevermnd. I see what's going on. -- 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-dev-commits-src-all@freebsd.org Sun Jan 10 14:56:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4CBA24CF7C2; Sun, 10 Jan 2021 14:56:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [204.107.128.30]) by mx1.freebsd.org (Postfix) with ESMTP id 4DDKft1lWDz4lhd; Sun, 10 Jan 2021 14:56:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from [192.168.4.23] (host81-156-200-208.range81-156.btcentralplus.com [81.156.200.208]) by cyrus.watson.org (Postfix) with ESMTPSA id 1BE8891397; Sun, 10 Jan 2021 14:56:37 +0000 (UTC) From: "Robert N. M. Watson" Message-Id: <9AC50976-FF55-4DF6-8A58-D35BA636CA4C@FreeBSD.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: Build breakage (was: Re: git: 4ba9ad0dc316 - main - iflib: add assert to prevent out-of-bounds array access) Date: Sun, 10 Jan 2021 14:56:35 +0000 In-Reply-To: Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org To: Vincenzo Maffione References: <202101101359.10ADxhCg027384@gitrepo.freebsd.org> <3bd51ab4-2ead-513e-2a8-bcaa562b22a9@fledge.watson.org> X-Mailer: Apple Mail (2.3654.40.0.2.32) X-Rspamd-Queue-Id: 4DDKft1lWDz4lhd X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 14:56:38 -0000 Thanks for the rapid fix =E2=80=94 I can build fine again now. Robert > On 10 Jan 2021, at 14:32, Vincenzo Maffione = wrote: >=20 > Sorry, my bad. > I'll fix it right away. >=20 > Thanks, > Vincenzo >=20 > Il giorno dom 10 gen 2021 alle ore 15:26 Robert Watson = > ha scritto: >=20 > With recent iflib/netmap commits, I'm getting the following on my = cross-built=20 > GENERIC-MMCCAM-NODEBUG kernel, which is essentially the FreeBSD/arm64=20= > GENERIC-MMCCAM as in the tree, but with GENERIC-NODEBUG as the base. = This=20 > configuration built fine until this morning, but I've not had a chance = to=20 > bisect to figure out which was the commit that triggered the breakage: >=20 > >>> stage 3.1: building everything > /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2384:2: error: implicit=20= > declaration of function 'netmap_disable_all_rings' is invalid in C99=20= > [-Werror,-Wimplicit-function-declaration] > netmap_disable_all_rings(ifp); > ^ > /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2444:2: error: implicit=20= > declaration of function 'netmap_enable_all_rings' is invalid in C99=20 > [-Werror,-Wimplicit-function-declaration] > netmap_enable_all_rings(ifp); > ^ > /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2444:2: note: did you = mean=20 > 'netmap_disable_all_rings'? > /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2384:2: note:=20 > 'netmap_disable_all_rings' declared here > netmap_disable_all_rings(ifp); > ^ > /usr/home/robert/cheri/freebsd/sys/net/iflib.c:2495:2: error: implicit=20= > declaration of function 'netmap_disable_all_rings' is invalid in C99=20= > [-Werror,-Wimplicit-function-declaration] > netmap_disable_all_rings(ctx->ifc_ifp); > ^ > 3 errors generated. > --- iflib.o --- > *** [iflib.o] Error code 1 > make[2]: stopped in=20 > = /usr/home/robert/cheri/build/freebsd-aarch64-build/usr/home/robert/cheri/f= reebsd/arm64.aarch64/sys/GENERIC-MMCCAM-NODEBUG > --- all_subdir_bge --- > --- modules-all --- > *** [modules-all] Error code 2 > make[2]: stopped in=20 > = /usr/home/robert/cheri/build/freebsd-aarch64-build/usr/home/robert/cheri/f= reebsd/arm64.aarch64/sys/GENERIC-MMCCAM-NODEBUG > 2 errors > make[2]: stopped in=20 > = /usr/home/robert/cheri/build/freebsd-aarch64-build/usr/home/robert/cheri/f= reebsd/arm64.aarch64/sys/GENERIC-MMCCAM-NODEBUG > --- buildkernel --- > --- buildkernel --- > Fatal error: Command `nice make -DDB_FROM_SRC -DNO_CLEAN=20 > -DI_REALLY_MEAN_NO_CLEAN -DNO_ROOT -DBUILD_WITH_STRICT_TMPPATH=20 > TARGET_ARCH=3Daarch64 TARGET=3Darm64 DEBUG_FLAGS=3D-g=20 > 'LOCAL_XTOOL_DIRS=3Dlib/libnetbsd usr.sbin/makefs usr.bin/mkimg'=20 > LD=3D/usr/bin/ld.lld XLD=3D/usr/bin/ld.lld 'HACK_EXTRA_FLAGS=3D-shared=20= > -fuse-ld=3D/usr/bin/ld.lld' TRAMP_LDFLAGS=3D-fuse-ld=3D/usr/bin/ld.lld=20= > KERNCONF=3DGENERIC-MMCCAM-NODEBUG -DWITHOUT_CLEAN -DWITH_TESTS = -DWITHOUT_PROFILE=20 > -DWITHOUT_DEBUG_FILES -DWITHOUT_OFED -DWITHOUT_MAN -DWITH_GOOGLETEST=20= > -DWITHOUT_GCC -DWITHOUT_CLANG -DWITHOUT_LLD -DWITHOUT_LLDB=20 > -DWITHOUT_GCC_BOOTSTRAP -DWITHOUT_CLANG_BOOTSTRAP = -DWITHOUT_LLD_BOOTSTRAP=20 > -DWITHOUT_LIB32 -DWITH_ELFTOOLCHAIN_BOOTSTRAP -DWITH_TOOLCHAIN=20 > -DWITHOUT_BINUTILS_BOOTSTRAP -s -de buildkernel -j6` failed with = non-zero exit=20 > code 2 >=20 >=20 >=20 >=20 > On Sun, 10 Jan 2021, Vincenzo Maffione wrote: >=20 > > The branch main has been updated by vmaffione: > > > > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D4ba9ad0dc316940f32065b05f24259f9= 42c0692d = > > > > commit 4ba9ad0dc316940f32065b05f24259f942c0692d > > Author: Vincenzo Maffione > > AuthorDate: 2021-01-10 13:49:51 +0000 > > Commit: Vincenzo Maffione > > CommitDate: 2021-01-10 13:59:20 +0000 > > > > iflib: add assert to prevent out-of-bounds array access > > > > The iflib_queues_alloc() allocates isc_nrxqs iflib_dma_info = structs > > for each rxqset, and links each struct to a different free list. > > As a result, it must be isc_nrxqs >=3D isc_nfl (plus the = completion > > queue, if present). > > Add an assertion to make this constraint explicit. > > > > MFC after: 2 weeks > > --- > > sys/net/iflib.c | 9 ++++----- > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > diff --git a/sys/net/iflib.c b/sys/net/iflib.c > > index 3de80ecaeb0c..e53c5031d3a7 100644 > > --- a/sys/net/iflib.c > > +++ b/sys/net/iflib.c > > @@ -5547,11 +5547,14 @@ iflib_queues_alloc(if_ctx_t ctx) > > uint8_t nrxqs =3D sctx->isc_nrxqs; > > uint8_t ntxqs =3D sctx->isc_ntxqs; > > int nfree_lists =3D sctx->isc_nfl ? sctx->isc_nfl : 1; > > + int fl_offset =3D (sctx->isc_flags & IFLIB_HAS_RXCQ ? 1 : 0); > > caddr_t *vaddrs; > > uint64_t *paddrs; > > > > KASSERT(ntxqs > 0, ("number of queues per qset must be at = least 1")); > > KASSERT(nrxqs > 0, ("number of queues per qset must be at = least 1")); > > + KASSERT(nrxqs >=3D fl_offset + nfree_lists, > > + ("there must be at least a rxq for each free list")); > > > > /* Allocate the TX ring struct memory */ > > if (!(ctx->ifc_txqs =3D > > @@ -5659,11 +5662,7 @@ iflib_queues_alloc(if_ctx_t ctx) > > } > > rxq->ifr_ctx =3D ctx; > > rxq->ifr_id =3D i; > > - if (sctx->isc_flags & IFLIB_HAS_RXCQ) { > > - rxq->ifr_fl_offset =3D 1; > > - } else { > > - rxq->ifr_fl_offset =3D 0; > > - } > > + rxq->ifr_fl_offset =3D fl_offset; > > rxq->ifr_nfl =3D nfree_lists; > > if (!(fl =3D > > (iflib_fl_t) malloc(sizeof(struct iflib_fl) = * nfree_lists, M_IFLIB, M_NOWAIT | M_ZERO))) { > > From owner-dev-commits-src-all@freebsd.org Sun Jan 10 15:12:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 978194CF867; Sun, 10 Jan 2021 15:12:22 +0000 (UTC) (envelope-from git@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 4DDL123xVxz4mkb; Sun, 10 Jan 2021 15:12:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A4CC25AB; Sun, 10 Jan 2021 15:12:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AFCMeK029377; Sun, 10 Jan 2021 15:12:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AFCMvU029376; Sun, 10 Jan 2021 15:12:22 GMT (envelope-from git) Date: Sun, 10 Jan 2021 15:12:22 GMT Message-Id: <202101101512.10AFCMvU029376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 54bbcca4f979 - main - re: netmap: enable/disable krings on interface reinit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 54bbcca4f9790e012e0a0f1512d9c879a48d5293 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 15:12:22 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=54bbcca4f9790e012e0a0f1512d9c879a48d5293 commit 54bbcca4f9790e012e0a0f1512d9c879a48d5293 Author: Vincenzo Maffione AuthorDate: 2021-01-10 15:09:05 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-10 15:09:05 +0000 re: netmap: enable/disable krings on interface reinit This prevents krings from being used during an interface reset, and notifies the active applications. See also 1d238b07d5d4d9660ae0. MFC after: 1 week --- sys/dev/re/if_re.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index 7d2940a67b35..cf327932cd74 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -3360,6 +3360,10 @@ re_init_locked(struct rl_softc *sc) sc->rl_watchdog_timer = 0; callout_reset(&sc->rl_stat_callout, hz, re_tick, sc); + +#ifdef DEV_NETMAP + netmap_enable_all_rings(ifp); +#endif /* DEV_NETMAP */ } /* @@ -3608,6 +3612,10 @@ re_stop(struct rl_softc *sc) callout_stop(&sc->rl_stat_callout); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); +#ifdef DEV_NETMAP + netmap_disable_all_rings(ifp); +#endif /* DEV_NETMAP */ + /* * Disable accepting frames to put RX MAC into idle state. * Otherwise it's possible to get frames while stop command From owner-dev-commits-src-all@freebsd.org Sun Jan 10 19:20:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8C2B24D6204; Sun, 10 Jan 2021 19:20:05 +0000 (UTC) (envelope-from git@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 4DDRVs3c3fz3JFL; Sun, 10 Jan 2021 19:20:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EEDF5864; Sun, 10 Jan 2021 19:20:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AJK5sL043754; Sun, 10 Jan 2021 19:20:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AJK5Qm043751; Sun, 10 Jan 2021 19:20:05 GMT (envelope-from git) Date: Sun, 10 Jan 2021 19:20:05 GMT Message-Id: <202101101920.10AJK5Qm043751@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 8ffcde255432 - main - hid: fix extraneous SYSCTL_ADD_INT() options revealed by LINT build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ffcde2554324cdc7b5f23fc09f11820c14ff3ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 19:20:05 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=8ffcde2554324cdc7b5f23fc09f11820c14ff3ac commit 8ffcde2554324cdc7b5f23fc09f11820c14ff3ac Author: Vladimir Kondratyev AuthorDate: 2021-01-09 12:06:01 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-10 19:17:20 +0000 hid: fix extraneous SYSCTL_ADD_INT() options revealed by LINT build Reviewed by: hselasky (as part of D28060) --- sys/dev/hid/hidmap.c | 2 +- sys/dev/iicbus/iichid.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/hid/hidmap.c b/sys/dev/hid/hidmap.c index 163d63c20232..46e789fa7cec 100644 --- a/sys/dev/hid/hidmap.c +++ b/sys/dev/hid/hidmap.c @@ -752,7 +752,7 @@ hidmap_attach(struct hidmap* hm) TUNABLE_INT_FETCH(tunable, &hm->debug_level); SYSCTL_ADD_INT(device_get_sysctl_ctx(hm->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(hm->dev)), - OID_AUTO, "debug", CTLTYPE_INT | CTLFLAG_RWTUN, + OID_AUTO, "debug", CTLFLAG_RWTUN, &hm->debug_level, 0, "Verbosity level"); } #endif diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c index c4bc2d3cee1f..fe949f113984 100644 --- a/sys/dev/iicbus/iichid.c +++ b/sys/dev/iicbus/iichid.c @@ -1116,12 +1116,12 @@ iichid_attach(device_t dev) "idle sampling rate in num/second"); SYSCTL_ADD_INT(device_get_sysctl_ctx(sc->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), - OID_AUTO, "sampling_rate_fast", CTLTYPE_INT | CTLFLAG_RWTUN, + OID_AUTO, "sampling_rate_fast", CTLFLAG_RWTUN, &sc->sampling_rate_fast, 0, "active sampling rate in num/second"); SYSCTL_ADD_INT(device_get_sysctl_ctx(sc->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), - OID_AUTO, "sampling_hysteresis", CTLTYPE_INT | CTLFLAG_RWTUN, + OID_AUTO, "sampling_hysteresis", CTLFLAG_RWTUN, &sc->sampling_hysteresis, 0, "number of missing samples before enabling of slow mode"); hid_add_dynamic_quirk(&sc->hw, HQ_IICHID_SAMPLING); From owner-dev-commits-src-all@freebsd.org Sun Jan 10 19:20:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9F75E4D5DE9; Sun, 10 Jan 2021 19:20:06 +0000 (UTC) (envelope-from git@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 4DDRVt4B14z3JHR; Sun, 10 Jan 2021 19:20:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8299D5365; Sun, 10 Jan 2021 19:20:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AJK6Pm043960; Sun, 10 Jan 2021 19:20:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AJK6rv043957; Sun, 10 Jan 2021 19:20:06 GMT (envelope-from git) Date: Sun, 10 Jan 2021 19:20:06 GMT Message-Id: <202101101920.10AJK6rv043957@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 0f0379fa5581 - main - hid: Add recently imported drivers to NOTES MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f0379fa5581c6b89d22bd041f7443581bac616c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 19:20:06 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=0f0379fa5581c6b89d22bd041f7443581bac616c commit 0f0379fa5581c6b89d22bd041f7443581bac616c Author: Vladimir Kondratyev AuthorDate: 2021-01-09 12:07:19 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-10 19:17:20 +0000 hid: Add recently imported drivers to NOTES Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D28060 --- sys/amd64/conf/NOTES | 8 +++++++- sys/arm64/conf/NOTES | 7 +++++++ sys/conf/NOTES | 25 +++++++++++++++++++++++-- sys/i386/conf/NOTES | 8 +++++++- 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index 8504bfa68c36..1b949fc24c8e 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -607,7 +607,13 @@ options NKPT=31 # EFI Runtime Services support options EFIRT - +# +# HID-over-I2C support +# +device iichid # HID-over-I2C support +options IICHID_DEBUG # Enable HID-over-I2C debug messages +options IICHID_SAMPLING # Workaround missing GPIO INTR support + ##################################################################### # ABI Emulation diff --git a/sys/arm64/conf/NOTES b/sys/arm64/conf/NOTES index c966ab436221..97ea00d181bd 100644 --- a/sys/arm64/conf/NOTES +++ b/sys/arm64/conf/NOTES @@ -239,3 +239,10 @@ options COMPAT_FREEBSD32 # Compatible with FreeBSD/arm # ZFS support options ZFS + +# +# HID-over-I2C support +# +device iichid # HID-over-I2C support +options IICHID_DEBUG # Enable HID-over-I2C debug messages +options IICHID_SAMPLING # Workaround missing GPIO INTR support diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 5033cc63524f..b377f845e793 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2413,8 +2413,23 @@ options NSFBUFS=1024 options DEBUG_LOCKS ##################################################################### -# Generic HID support -device hid +# HID support +device hid # Generic HID support +options HID_DEBUG # enable debug msgs +device hidbus # HID bus +device hidmap # HID to evdev mapping +device hidraw # Raw access driver +options HIDRAW_MAKE_UHID_ALIAS # install /dev/uhid alias +device hconf # Multitouch configuration TLC +device hcons # Consumer controls +device hgame # Generic game controllers +device hkbd # HID keyboard +device hms # HID mouse +device hmt # HID multitouch (MS-compatible) +device hpen # Generic pen driver +device hsctrl # System controls +device ps4dshock # Sony PS4 DualShock 4 gamepad driver +device xb360gp # XBox 360 gamepad driver ##################################################################### # USB support @@ -2460,6 +2475,9 @@ device wsp device uep # Diamond Rio 500 MP3 player device urio +# HID-over-USB driver +device usbhid + # # USB serial support device ucom @@ -2576,6 +2594,9 @@ options UVSCOM_DEFAULT_OPKTSIZE=8 # default output packet size options UVSCOM_INTR_INTERVAL=100 # interrupt pipe interval # in milliseconds +# options for usbhid: +options USBHID_ENABLED # Prefer usbhid to other USBHID drivers + ##################################################################### # FireWire support diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index f39f8ab6b302..47626787cab9 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -860,7 +860,13 @@ options PMAP_SHPGPERPROC=201 # options NKPT=31 - +# +# HID-over-I2C support +# +device iichid # HID-over-I2C support +options IICHID_DEBUG # Enable HID-over-I2C debug messages +options IICHID_SAMPLING # Workaround missing GPIO INTR support + ##################################################################### # ABI Emulation From owner-dev-commits-src-all@freebsd.org Sun Jan 10 19:29:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C65474D6669; Sun, 10 Jan 2021 19:29:15 +0000 (UTC) (envelope-from git@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 4DDRjR4yLPz3K8B; Sun, 10 Jan 2021 19:29:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CF295C0D; Sun, 10 Jan 2021 19:29:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AJTFqh055417; Sun, 10 Jan 2021 19:29:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AJTFDL055416; Sun, 10 Jan 2021 19:29:15 GMT (envelope-from git) Date: Sun, 10 Jan 2021 19:29:15 GMT Message-Id: <202101101929.10AJTFDL055416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 5a181b8bce99 - main - Prefer the use of vm_page_domain() to vm_phys_domain(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a181b8bce9958be9e3c2b3840f5a56b712c108e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 19:29:15 -0000 The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=5a181b8bce9958be9e3c2b3840f5a56b712c108e commit 5a181b8bce9958be9e3c2b3840f5a56b712c108e Author: Alan Cox AuthorDate: 2021-01-10 08:51:33 +0000 Commit: Alan Cox CommitDate: 2021-01-10 19:25:33 +0000 Prefer the use of vm_page_domain() to vm_phys_domain(). When we already have the vm page in hand, use vm_page_domain() instead of vm_phys_domain(). The former has a trivial constant-time implementation whereas the latter iterates over the mem_affinity array. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D28005 --- sys/amd64/amd64/pmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 5267203d7473..2ec303d687a7 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -5259,7 +5259,7 @@ retry: pc->pc_map[0] = PC_FREE0 & ~1ul; /* preallocated bit 0 */ pc->pc_map[1] = PC_FREE1; pc->pc_map[2] = PC_FREE2; - pvc = &pv_chunks[vm_phys_domain(m->phys_addr)]; + pvc = &pv_chunks[vm_page_domain(m)]; mtx_lock(&pvc->pvc_lock); TAILQ_INSERT_TAIL(&pvc->pvc_list, pc, pc_lru); mtx_unlock(&pvc->pvc_lock); @@ -5360,7 +5360,7 @@ retry: pc->pc_map[1] = PC_FREE1; pc->pc_map[2] = PC_FREE2; TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); - TAILQ_INSERT_TAIL(&new_tail[pc_to_domain(pc)], pc, pc_lru); + TAILQ_INSERT_TAIL(&new_tail[vm_page_domain(m)], pc, pc_lru); PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV)); /* From owner-dev-commits-src-all@freebsd.org Sun Jan 10 20:41:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F0C1F4D89FF; Sun, 10 Jan 2021 20:41:30 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) (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 4DDTJp6GC6z3PYF; Sun, 10 Jan 2021 20:41:30 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-qv1-f44.google.com with SMTP id az16so6673780qvb.5; Sun, 10 Jan 2021 12:41:30 -0800 (PST) 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=njguncw9pTEiyOi5M2jwpq5KsBxOunXV2983ce4WIOU=; b=nDb2R1lONjQfofNq9mhQWIUg/37jUvIJ/pIH9TMTJWFBhJkJeMeX7Rkkz3noguVN+D 5cftFFZX1BUq3mFbXF2q5aFBCqgUjrYQjjgxRFDleY5NwGlk0Tb2gNZMd84jOy0HCcsk psaxonaUF5voAiiHe0g22fSuEk7kLSanAg77a3HbgfeOp+ThsibduHnIhge01dBXpTId nFgnW8O3cYgTIHo55/prMzTkiAA6dcaXUpTAl9PNWW5IfEbVsCRwMH2baHlEEHG6yQZh 6ctN2Tp6d6ku8tt8FfHSexlii1cjk11eHNIS2R4YR/m4hOixofvis6ZkOf4ikMVaK3lL 2PXA== X-Gm-Message-State: AOAM53327f1OwNrJttSGIar6Bx/yW41fHyjEqgWRWZeIU6G7AwvHQ6z+ 1UyuBrkUblClM2V5ItRaCDmyFy/UxMRMWg== X-Google-Smtp-Source: ABdhPJzdzYwnmc242O9Xi0OOQXsNcZ4wsKFtF9LTz9xxk4P3BSdLNag17A8PsE/2QTxYgP/tr715Vg== X-Received: by 2002:a0c:b9a8:: with SMTP id v40mr13169724qvf.36.1610311289738; Sun, 10 Jan 2021 12:41:29 -0800 (PST) Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com. [209.85.222.171]) by smtp.gmail.com with ESMTPSA id k42sm5430069qtk.17.2021.01.10.12.41.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Jan 2021 12:41:29 -0800 (PST) Received: by mail-qk1-f171.google.com with SMTP id d14so13068053qkc.13; Sun, 10 Jan 2021 12:41:29 -0800 (PST) X-Received: by 2002:a05:620a:4047:: with SMTP id i7mr13365036qko.3.1610311288912; Sun, 10 Jan 2021 12:41:28 -0800 (PST) MIME-Version: 1.0 References: <202101081729.108HTG7j066884@gitrepo.freebsd.org> <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> <202101081920.108JKUd2003299@slippy.cwsent.com> <202101081927.108JRKxR084004@slippy.cwsent.com> <202101082253.108MrrUL003251@slippy.cwsent.com> <2B913109-27A8-4ABF-8F64-48CE78B76759@FreeBSD.org> In-Reply-To: <2B913109-27A8-4ABF-8F64-48CE78B76759@FreeBSD.org> From: Ryan Libby Date: Sun, 10 Jan 2021 12:41:18 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page To: Dimitry Andric Cc: Cy Schubert , Chuck Tuffli , Jessica Clarke , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DDTJp6GC6z3PYF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 20:41:31 -0000 On Sun, Jan 10, 2021 at 4:59 AM Dimitry Andric wrote: > > On 8 Jan 2021, at 23:53, Cy Schubert wrote: > > > > In message > om> > > , Chuck Tuffli writes: > >> --000000000000c9481f05b86a0c60 > >> Content-Type: text/plain; charset="UTF-8" > >> > >> On Fri, Jan 8, 2021 at 11:27 AM Cy Schubert > >> wrote: > >> > >>> In message <202101081920.108JKUd2003299@slippy.cwsent.com>, Cy Schubert > >>> writes: > >>>> In message <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org>, Jessica > >>>> Clarke w > >>>> rites: > >>> > >> ... > >> > >>>>> This broke powerpc and powerpc64: > >> > >> > >> Sorry about that. I'll fix this in a bit. > >> > >> --chuck > > > > Looks like dim@ already did. > > > > The time before last I fixed one of these it was pointed out to me > > privately that when we use %jd that we should also cast to intmax_t or > > uintmax_t, and that jhb@ told him. This was to future-proof, assuming we'd > > have 128-bit processors one day. > > That is certainly valid for e.g. time_t or other types with a varying > width, or where you cannot predict the exact width. > > But for printing uint64_t and friends, where the width *is* exactly > specified, I would rather just use the standards-defined PRIu64 and so > on. Casting will obscure any type mismatches between the printf format > strings and the actual arguments. > > -Dimitry > This is technically right, but it's just so ugly and so much harder to read, especially with multiple format arguments. IMHO, casting to max width is acceptable. From owner-dev-commits-src-all@freebsd.org Sun Jan 10 20:53:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BA6CA4D908E; Sun, 10 Jan 2021 20:53:16 +0000 (UTC) (envelope-from git@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 4DDTZN4gV4z3QKJ; Sun, 10 Jan 2021 20:53:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9341E6C59; Sun, 10 Jan 2021 20:53:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AKrGNF070361; Sun, 10 Jan 2021 20:53:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AKrGqv070360; Sun, 10 Jan 2021 20:53:16 GMT (envelope-from git) Date: Sun, 10 Jan 2021 20:53:16 GMT Message-Id: <202101102053.10AKrGqv070360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: facdd1cd2045 - main - cgem: add 64-bit support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: facdd1cd20451d7817c72a25e9253b934ca65eb6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 20:53:16 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=facdd1cd20451d7817c72a25e9253b934ca65eb6 commit facdd1cd20451d7817c72a25e9253b934ca65eb6 Author: Thomas Skibo AuthorDate: 2021-01-10 20:18:41 +0000 Commit: Mitchell Horne CommitDate: 2021-01-10 20:51:52 +0000 cgem: add 64-bit support Add 64-bit address support to Cadence CGEM Ethernet driver for use in other SoCs such as the Zynq UltraScale+ and SiFive HighFive Unleashed. Reviewed by: philip, 0mp (manpages) Differential Revision: https://reviews.freebsd.org/D24304 --- share/man/man4/Makefile | 7 + share/man/man4/{man4.arm => }/cgem.4 | 14 +- share/man/man4/man4.arm/Makefile | 4 +- sys/arm/conf/GENERIC | 2 +- sys/arm/conf/ZEDBOARD | 2 +- sys/arm64/conf/GENERIC | 1 + sys/dev/cadence/if_cgem.c | 341 ++++++++++++++++++++++++----------- sys/dev/cadence/if_cgem_hw.h | 64 ++++++- sys/dts/arm/zynq-7000.dtsi | 12 +- sys/riscv/conf/GENERIC | 2 +- 10 files changed, 323 insertions(+), 126 deletions(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index c72caf0199c9..b8e63315cb95 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -106,6 +106,7 @@ MAN= aac.4 \ cdceem.4 \ cfi.4 \ cfumass.4 \ + ${_cgem.4} \ ch.4 \ chromebook_platform.4 \ ${_chvgpio.4} \ @@ -903,6 +904,12 @@ _virtio_scsi.4= virtio_scsi.4 _vtnet.4= vtnet.4 .endif +.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "aarch64" || \ + ${MACHINE_CPUARCH} == "riscv" +_cgem.4= cgem.4 +MLINKS+=cgem.4 if_cgem.4 +.endif + .if empty(MAN_ARCH) __arches= ${MACHINE} ${MACHINE_ARCH} ${MACHINE_CPUARCH} .elif ${MAN_ARCH} == "all" diff --git a/share/man/man4/man4.arm/cgem.4 b/share/man/man4/cgem.4 similarity index 96% rename from share/man/man4/man4.arm/cgem.4 rename to share/man/man4/cgem.4 index 6de1d7961788..f9f525dc4554 100644 --- a/share/man/man4/man4.arm/cgem.4 +++ b/share/man/man4/cgem.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 26, 2014 +.Dd January 10, 2021 .Dt CGEM 4 .Os .Sh NAME @@ -44,7 +44,8 @@ The .Nm driver provides support for the Cadence GEM (Gigabit Ethernet MAC). The Cadence GEM is used in some SoC (System on a Chip) devices such as -the Xilinx Zynq-7000 and the Atmel SAMA5D3. +the Xilinx Zynq-7000, the Xilinx Zynq UltraScale+, and the SiFive +HiFive Unleashed. .Pp The .Nm @@ -284,7 +285,7 @@ There are variables that count packets discarded by the hardware (see below). .Pp -The GEM used in the Zynq-7000 has a bug such that the receiver can +The GEM used in the Zynq-7000 has a bug such that the receiver can potentially freeze up under a high load. The issue is described in sec. 16.7 "Known Issues" of the Zynq-7000 SoC Technical Reference Manual (Xilinx @@ -292,7 +293,10 @@ UG585 v1.7). The .Nm driver implements the work-around suggested in the manual. -If the bug does not exist in other versions of this device, the -work-around can be disabled by setting the dev.cgem.%d.rxhangwar +It is believed that the bug does not exist in the Zynq UltraScale+ and +SiFive SoCs so the work-around is disabled in those instances and enabled +in all others. +The work-around can be disabled by setting the +.Va dev.cgem.%d.rxhangwar .Xr sysctl 8 variable to 0. diff --git a/share/man/man4/man4.arm/Makefile b/share/man/man4/man4.arm/Makefile index 21d53f43a7c8..0b3eec427934 100644 --- a/share/man/man4/man4.arm/Makefile +++ b/share/man/man4/man4.arm/Makefile @@ -8,7 +8,6 @@ MAN= \ aw_spi.4 \ aw_syscon.4 \ bcm283x_pwm.4 \ - cgem.4 \ devcfg.4 \ imx6_ahci.4 \ imx6_snvs.4 \ @@ -16,8 +15,7 @@ MAN= \ mge.4 \ ti_adc.4 -MLINKS= cgem.4 if_cgem.4 -MLINKS+= imx_wdog.4 imxwdt.4 +MLINKS= imx_wdog.4 imxwdt.4 MLINKS+= mge.4 if_mge.4 MANSUBDIR=/arm diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC index 0f0522eb9802..3cfe16ccfe54 100644 --- a/sys/arm/conf/GENERIC +++ b/sys/arm/conf/GENERIC @@ -228,8 +228,8 @@ device e6000sw device miibus device awg # 10/100/1000 integrated EMAC controller +device cgem # Cadence GEM Gigabit Ethernet device device cpsw # TI Common Platform Ethernet Switch (CPSW) -device cgem # Zynq-7000 gig ethernet device device dwc # 10/100/1000 integrated GMAC controller device emac # 10/100 integrated EMAC controller device ffec # Freescale Fast Ethernet Controller diff --git a/sys/arm/conf/ZEDBOARD b/sys/arm/conf/ZEDBOARD index 613e0c73a16d..24490a5129e5 100644 --- a/sys/arm/conf/ZEDBOARD +++ b/sys/arm/conf/ZEDBOARD @@ -49,7 +49,7 @@ device mpcore_timer device loop device ether -device cgem # Zynq-7000 gig ethernet device +device cgem # Cadence GEM Gigabit Ethernet device device mii device e1000phy device rgephy # Zybo uses Realtek RTL8211E diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index 268089dba1fc..463271d1db26 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -278,6 +278,7 @@ device miibus # MII bus support device al_eth # Annapurna Alpine Ethernet NIC device awg # Allwinner EMAC Gigabit Ethernet device axa # AMD Opteron A1100 integrated NIC +device cgem # Cadence GEM Gigabit Ethernet device device dwc_rk # Rockchip Designware device dwc_socfpga # Altera SOCFPGA Ethernet MAC device ffec # iMX FFEC diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c index 3c5277452469..77337e977dcc 100644 --- a/sys/dev/cadence/if_cgem.c +++ b/sys/dev/cadence/if_cgem.c @@ -77,6 +77,14 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef EXT_RESOURCES +#include +#endif + +#if INTPTR_MAX == INT64_MAX +#define CGEM64 +#endif + #include #include "miibus_if.h" @@ -86,9 +94,6 @@ __FBSDID("$FreeBSD$"); #define CGEM_NUM_RX_DESCS 512 /* size of receive descriptor ring */ #define CGEM_NUM_TX_DESCS 512 /* size of transmit descriptor ring */ -#define MAX_DESC_RING_SIZE (MAX(CGEM_NUM_RX_DESCS*sizeof(struct cgem_rx_desc),\ - CGEM_NUM_TX_DESCS*sizeof(struct cgem_tx_desc))) - /* Default for sysctl rxbufs. Must be < CGEM_NUM_RX_DESCS of course. */ #define DEFAULT_NUM_RX_BUFS 256 /* number of receive bufs to queue. */ @@ -97,11 +102,18 @@ __FBSDID("$FreeBSD$"); #define CGEM_CKSUM_ASSIST (CSUM_IP | CSUM_TCP | CSUM_UDP | \ CSUM_TCP_IPV6 | CSUM_UDP_IPV6) +#define HWTYPE_GENERIC_GEM 1 +#define HWTYPE_ZYNQ 2 +#define HWTYPE_ZYNQMP 3 +#define HWTYPE_SIFIVE_FU540 4 + static struct ofw_compat_data compat_data[] = { - { "cadence,gem", 1 }, - { "cdns,macb", 1 }, - { "sifive,fu540-c000-gem", 1 }, - { NULL, 0 }, + { "cdns,zynq-gem", HWTYPE_ZYNQ }, + { "cdns,zynqmp-gem", HWTYPE_ZYNQMP }, + { "sifive,fu540-c000-gem", HWTYPE_SIFIVE_FU540 }, + { "cdns,gem", HWTYPE_GENERIC_GEM }, + { "cadence,gem", HWTYPE_GENERIC_GEM }, + { NULL, 0 } }; struct cgem_softc { @@ -116,8 +128,13 @@ struct cgem_softc { void *intrhand; struct callout tick_ch; uint32_t net_ctl_shadow; + uint32_t net_cfg_shadow; +#ifdef EXT_RESOURCES + clk_t ref_clk; +#else int ref_clk_num; - u_char eaddr[6]; +#endif + int neednullqs; bus_dma_tag_t desc_dma_tag; bus_dma_tag_t mbuf_dma_tag; @@ -146,12 +163,15 @@ struct cgem_softc { int txring_hd_ptr; /* where to put next xmits */ int txring_tl_ptr; /* next xmit mbuf to free */ int txring_queued; /* num xmits segs queued */ - bus_dmamap_t txring_dma_map; u_int txfull; /* tx ring full events */ u_int txdefrags; /* tx calls to m_defrag() */ u_int txdefragfails; /* tx m_defrag() failures */ u_int txdmamapfails; /* tx dmamap failures */ + /* null descriptor rings */ + void *null_qs; + bus_addr_t null_qs_physaddr; + /* hardware provided statistics */ struct cgem_hw_stats { uint64_t tx_bytes; @@ -274,9 +294,9 @@ cgem_get_mac(struct cgem_softc *sc, u_char eaddr[]) /* * cgem_mac_hash(): map 48-bit address to a 6-bit hash. The 6-bit hash - * corresponds to a bit in a 64-bit hash register. Setting that bit in the hash - * register enables reception of all frames with a destination address that - * hashes to that 6-bit value. + * corresponds to a bit in a 64-bit hash register. Setting that bit in the + * hash register enables reception of all frames with a destination address + * that hashes to that 6-bit value. * * The hash function is described in sec. 16.2.3 in the Zynq-7000 Tech * Reference Manual. Bits 0-5 in the hash are the exclusive-or of @@ -321,18 +341,15 @@ cgem_rx_filter(struct cgem_softc *sc) { if_t ifp = sc->ifp; uint32_t hashes[2] = { 0, 0 }; - uint32_t net_cfg; - - net_cfg = RD4(sc, CGEM_NET_CFG); - net_cfg &= ~(CGEM_NET_CFG_MULTI_HASH_EN | + sc->net_cfg_shadow &= ~(CGEM_NET_CFG_MULTI_HASH_EN | CGEM_NET_CFG_NO_BCAST | CGEM_NET_CFG_COPY_ALL); if ((if_getflags(ifp) & IFF_PROMISC) != 0) - net_cfg |= CGEM_NET_CFG_COPY_ALL; + sc->net_cfg_shadow |= CGEM_NET_CFG_COPY_ALL; else { if ((if_getflags(ifp) & IFF_BROADCAST) == 0) - net_cfg |= CGEM_NET_CFG_NO_BCAST; + sc->net_cfg_shadow |= CGEM_NET_CFG_NO_BCAST; if ((if_getflags(ifp) & IFF_ALLMULTI) != 0) { hashes[0] = 0xffffffff; hashes[1] = 0xffffffff; @@ -340,12 +357,12 @@ cgem_rx_filter(struct cgem_softc *sc) if_foreach_llmaddr(ifp, cgem_hash_maddr, hashes); if (hashes[0] != 0 || hashes[1] != 0) - net_cfg |= CGEM_NET_CFG_MULTI_HASH_EN; + sc->net_cfg_shadow |= CGEM_NET_CFG_MULTI_HASH_EN; } WR4(sc, CGEM_HASH_TOP, hashes[0]); WR4(sc, CGEM_HASH_BOT, hashes[1]); - WR4(sc, CGEM_NET_CFG, net_cfg); + WR4(sc, CGEM_NET_CFG, sc->net_cfg_shadow); } /* For bus_dmamap_load() callback. */ @@ -358,40 +375,92 @@ cgem_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error) *(bus_addr_t *)arg = segs[0].ds_addr; } +/* Set up null queues for priority queues we actually can't disable. */ +static void +cgem_null_qs(struct cgem_softc *sc) +{ + struct cgem_rx_desc *rx_desc; + struct cgem_tx_desc *tx_desc; + uint32_t queue_mask; + int n; + + /* Read design config register 6 to determine number of queues. */ + queue_mask = (RD4(sc, CGEM_DESIGN_CFG6) & + CGEM_DESIGN_CFG6_DMA_PRIO_Q_MASK) >> 1; + if (queue_mask == 0) + return; + + /* Create empty RX queue and empty TX buf queues. */ + memset(sc->null_qs, 0, sizeof(struct cgem_rx_desc) + + sizeof(struct cgem_tx_desc)); + rx_desc = sc->null_qs; + rx_desc->addr = CGEM_RXDESC_OWN | CGEM_RXDESC_WRAP; + tx_desc = (struct cgem_tx_desc *)(rx_desc + 1); + tx_desc->ctl = CGEM_TXDESC_USED | CGEM_TXDESC_WRAP; + + /* Point all valid ring base pointers to the null queues. */ + for (n = 1; (queue_mask & 1) != 0; n++, queue_mask >>= 1) { + WR4(sc, CGEM_RX_QN_BAR(n), sc->null_qs_physaddr); + WR4(sc, CGEM_TX_QN_BAR(n), sc->null_qs_physaddr + + sizeof(struct cgem_rx_desc)); + } +} + /* Create DMA'able descriptor rings. */ static int cgem_setup_descs(struct cgem_softc *sc) { int i, err; + int desc_rings_size = CGEM_NUM_RX_DESCS * sizeof(struct cgem_rx_desc) + + CGEM_NUM_TX_DESCS * sizeof(struct cgem_tx_desc); + + if (sc->neednullqs) + desc_rings_size += sizeof(struct cgem_rx_desc) + + sizeof(struct cgem_tx_desc); sc->txring = NULL; sc->rxring = NULL; /* Allocate non-cached DMA space for RX and TX descriptors. */ - err = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - MAX_DESC_RING_SIZE, 1, MAX_DESC_RING_SIZE, 0, + err = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, +#ifdef CGEM64 + 1ULL << 32, /* Do not cross a 4G boundary. */ +#else + 0, +#endif + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + desc_rings_size, 1, desc_rings_size, 0, busdma_lock_mutex, &sc->sc_mtx, &sc->desc_dma_tag); if (err) return (err); /* Set up a bus_dma_tag for mbufs. */ err = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - MCLBYTES, TX_MAX_DMA_SEGS, MCLBYTES, 0, - busdma_lock_mutex, &sc->sc_mtx, &sc->mbuf_dma_tag); + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, + TX_MAX_DMA_SEGS, MCLBYTES, 0, busdma_lock_mutex, &sc->sc_mtx, + &sc->mbuf_dma_tag); if (err) return (err); - /* Allocate DMA memory in non-cacheable space. */ + /* + * Allocate DMA memory in non-cacheable space. We allocate transmit, + * receive and null descriptor queues all at once because the + * hardware only provides one register for the upper 32 bits of + * rx and tx descriptor queues hardware addresses. + */ err = bus_dmamem_alloc(sc->desc_dma_tag, (void **)&sc->rxring, - BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &sc->rxring_dma_map); +#ifdef __arm__ + BUS_DMA_NOWAIT | BUS_DMA_COHERENT | BUS_DMA_ZERO, +#else + BUS_DMA_NOWAIT | BUS_DMA_NOCACHE | BUS_DMA_ZERO, +#endif + &sc->rxring_dma_map); if (err) return (err); /* Load descriptor DMA memory. */ err = bus_dmamap_load(sc->desc_dma_tag, sc->rxring_dma_map, - (void *)sc->rxring, CGEM_NUM_RX_DESCS*sizeof(struct cgem_rx_desc), + (void *)sc->rxring, desc_rings_size, cgem_getaddr, &sc->rxring_physaddr, BUS_DMA_NOWAIT); if (err) return (err); @@ -409,18 +478,9 @@ cgem_setup_descs(struct cgem_softc *sc) sc->rxring_tl_ptr = 0; sc->rxring_queued = 0; - /* Allocate DMA memory for TX descriptors in non-cacheable space. */ - err = bus_dmamem_alloc(sc->desc_dma_tag, (void **)&sc->txring, - BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &sc->txring_dma_map); - if (err) - return (err); - - /* Load TX descriptor DMA memory. */ - err = bus_dmamap_load(sc->desc_dma_tag, sc->txring_dma_map, - (void *)sc->txring, CGEM_NUM_TX_DESCS*sizeof(struct cgem_tx_desc), - cgem_getaddr, &sc->txring_physaddr, BUS_DMA_NOWAIT); - if (err) - return (err); + sc->txring = (struct cgem_tx_desc *)(sc->rxring + CGEM_NUM_RX_DESCS); + sc->txring_physaddr = sc->rxring_physaddr + CGEM_NUM_RX_DESCS * + sizeof(struct cgem_rx_desc); /* Initialize TX descriptor ring. */ for (i = 0; i < CGEM_NUM_TX_DESCS; i++) { @@ -435,6 +495,14 @@ cgem_setup_descs(struct cgem_softc *sc) sc->txring_tl_ptr = 0; sc->txring_queued = 0; + if (sc->neednullqs) { + sc->null_qs = (void *)(sc->txring + CGEM_NUM_TX_DESCS); + sc->null_qs_physaddr = sc->txring_physaddr + + CGEM_NUM_TX_DESCS * sizeof(struct cgem_tx_desc); + + cgem_null_qs(sc); + } + return (0); } @@ -484,6 +552,9 @@ cgem_fill_rqueue(struct cgem_softc *sc) /* Write rx descriptor and increment head pointer. */ sc->rxring[sc->rxring_hd_ptr].ctl = 0; +#ifdef CGEM64 + sc->rxring[sc->rxring_hd_ptr].addrhi = segs[0].ds_addr >> 32; +#endif if (sc->rxring_hd_ptr == CGEM_NUM_RX_DESCS - 1) { sc->rxring[sc->rxring_hd_ptr].addr = segs[0].ds_addr | CGEM_RXDESC_WRAP; @@ -509,7 +580,7 @@ cgem_recv(struct cgem_softc *sc) m_hd = NULL; m_tl = &m_hd; while (sc->rxring_queued > 0 && - (sc->rxring[sc->rxring_tl_ptr].addr & CGEM_RXDESC_OWN) != 0) { + (sc->rxring[sc->rxring_tl_ptr].addr & CGEM_RXDESC_OWN) != 0) { ctl = sc->rxring[sc->rxring_tl_ptr].ctl; /* Grab filled mbuf. */ @@ -629,9 +700,16 @@ cgem_clean_tx(struct cgem_softc *sc) /* Check the status. */ if ((ctl & CGEM_TXDESC_AHB_ERR) != 0) { /* Serious bus error. log to console. */ +#ifdef CGEM64 + device_printf(sc->dev, + "cgem_clean_tx: AHB error, addr=0x%x%08x\n", + sc->txring[sc->txring_tl_ptr].addrhi, + sc->txring[sc->txring_tl_ptr].addr); +#else device_printf(sc->dev, "cgem_clean_tx: AHB error, addr=0x%x\n", sc->txring[sc->txring_tl_ptr].addr); +#endif } else if ((ctl & (CGEM_TXDESC_RETRY_ERR | CGEM_TXDESC_LATE_COLL)) != 0) { if_inc_counter(sc->ifp, IFCOUNTER_OERRORS, 1); @@ -640,8 +718,8 @@ cgem_clean_tx(struct cgem_softc *sc) /* * If the packet spanned more than one tx descriptor, skip - * descriptors until we find the end so that only start-of-frame - * descriptors are processed. + * descriptors until we find the end so that only + * start-of-frame descriptors are processed. */ while ((ctl & CGEM_TXDESC_LAST_BUF) == 0) { if ((ctl & CGEM_TXDESC_WRAP) != 0) @@ -759,7 +837,10 @@ cgem_start_locked(if_t ifp) /* Descriptor address. */ sc->txring[sc->txring_hd_ptr + i].addr = segs[i].ds_addr; - +#ifdef CGEM64 + sc->txring[sc->txring_hd_ptr + i].addrhi = + segs[i].ds_addr >> 32; +#endif /* Descriptor control word. */ ctl = segs[i].ds_len; if (i == nsegs - 1) { @@ -961,8 +1042,21 @@ cgem_reset(struct cgem_softc *sc) CGEM_ASSERT_LOCKED(sc); + /* Determine data bus width from design configuration register. */ + switch (RD4(sc, CGEM_DESIGN_CFG1) & + CGEM_DESIGN_CFG1_DMA_BUS_WIDTH_MASK) { + case CGEM_DESIGN_CFG1_DMA_BUS_WIDTH_64: + sc->net_cfg_shadow = CGEM_NET_CFG_DBUS_WIDTH_64; + break; + case CGEM_DESIGN_CFG1_DMA_BUS_WIDTH_128: + sc->net_cfg_shadow = CGEM_NET_CFG_DBUS_WIDTH_128; + break; + default: + sc->net_cfg_shadow = CGEM_NET_CFG_DBUS_WIDTH_32; + } + WR4(sc, CGEM_NET_CTRL, 0); - WR4(sc, CGEM_NET_CFG, 0); + WR4(sc, CGEM_NET_CFG, sc->net_cfg_shadow); WR4(sc, CGEM_NET_CTRL, CGEM_NET_CTRL_CLR_STAT_REGS); WR4(sc, CGEM_TX_STAT, CGEM_TX_STAT_ALL); WR4(sc, CGEM_RX_STAT, CGEM_RX_STAT_ALL); @@ -973,8 +1067,8 @@ cgem_reset(struct cgem_softc *sc) WR4(sc, CGEM_RX_QBAR, 0); /* Get management port running even if interface is down. */ - WR4(sc, CGEM_NET_CFG, CGEM_NET_CFG_DBUS_WIDTH_32 | - CGEM_NET_CFG_MDC_CLK_DIV_64); + sc->net_cfg_shadow |= CGEM_NET_CFG_MDC_CLK_DIV_48; + WR4(sc, CGEM_NET_CFG, sc->net_cfg_shadow); sc->net_ctl_shadow = CGEM_NET_CTRL_MGMT_PORT_EN; WR4(sc, CGEM_NET_CTRL, sc->net_ctl_shadow); @@ -985,33 +1079,33 @@ static void cgem_config(struct cgem_softc *sc) { if_t ifp = sc->ifp; - uint32_t net_cfg; uint32_t dma_cfg; u_char *eaddr = if_getlladdr(ifp); CGEM_ASSERT_LOCKED(sc); /* Program Net Config Register. */ - net_cfg = CGEM_NET_CFG_DBUS_WIDTH_32 | - CGEM_NET_CFG_MDC_CLK_DIV_64 | - CGEM_NET_CFG_FCS_REMOVE | + sc->net_cfg_shadow &= (CGEM_NET_CFG_MDC_CLK_DIV_MASK | + CGEM_NET_CFG_DBUS_WIDTH_MASK); + sc->net_cfg_shadow |= (CGEM_NET_CFG_FCS_REMOVE | CGEM_NET_CFG_RX_BUF_OFFSET(ETHER_ALIGN) | - CGEM_NET_CFG_GIGE_EN | - CGEM_NET_CFG_1536RXEN | - CGEM_NET_CFG_FULL_DUPLEX | - CGEM_NET_CFG_SPEED100; + CGEM_NET_CFG_GIGE_EN | CGEM_NET_CFG_1536RXEN | + CGEM_NET_CFG_FULL_DUPLEX | CGEM_NET_CFG_SPEED100); /* Enable receive checksum offloading? */ if ((if_getcapenable(ifp) & IFCAP_RXCSUM) != 0) - net_cfg |= CGEM_NET_CFG_RX_CHKSUM_OFFLD_EN; + sc->net_cfg_shadow |= CGEM_NET_CFG_RX_CHKSUM_OFFLD_EN; - WR4(sc, CGEM_NET_CFG, net_cfg); + WR4(sc, CGEM_NET_CFG, sc->net_cfg_shadow); /* Program DMA Config Register. */ dma_cfg = CGEM_DMA_CFG_RX_BUF_SIZE(MCLBYTES) | CGEM_DMA_CFG_RX_PKTBUF_MEMSZ_SEL_8K | CGEM_DMA_CFG_TX_PKTBUF_MEMSZ_SEL | CGEM_DMA_CFG_AHB_FIXED_BURST_LEN_16 | +#ifdef CGEM64 + CGEM_DMA_CFG_ADDR_BUS_64 | +#endif CGEM_DMA_CFG_DISC_WHEN_NO_AHB; /* Enable transmit checksum offloading? */ @@ -1021,8 +1115,12 @@ cgem_config(struct cgem_softc *sc) WR4(sc, CGEM_DMA_CFG, dma_cfg); /* Write the rx and tx descriptor ring addresses to the QBAR regs. */ - WR4(sc, CGEM_RX_QBAR, (uint32_t) sc->rxring_physaddr); - WR4(sc, CGEM_TX_QBAR, (uint32_t) sc->txring_physaddr); + WR4(sc, CGEM_RX_QBAR, (uint32_t)sc->rxring_physaddr); + WR4(sc, CGEM_TX_QBAR, (uint32_t)sc->txring_physaddr); +#ifdef CGEM64 + WR4(sc, CGEM_RX_QBAR_HI, (uint32_t)(sc->rxring_physaddr >> 32)); + WR4(sc, CGEM_TX_QBAR_HI, (uint32_t)(sc->txring_physaddr >> 32)); +#endif /* Enable rx and tx. */ sc->net_ctl_shadow |= (CGEM_NET_CTRL_TX_EN | CGEM_NET_CTRL_RX_EN); @@ -1055,8 +1153,10 @@ cgem_init_locked(struct cgem_softc *sc) if_setdrvflagbits(sc->ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE); - mii = device_get_softc(sc->miibus); - mii_mediachg(mii); + if (sc->miibus != NULL) { + mii = device_get_softc(sc->miibus); + mii_mediachg(mii); + } callout_reset(&sc->tick_ch, hz, cgem_tick, sc); } @@ -1085,9 +1185,9 @@ cgem_stop(struct cgem_softc *sc) cgem_reset(sc); /* Clear out transmit queue. */ + memset(sc->txring, 0, CGEM_NUM_TX_DESCS * sizeof(struct cgem_tx_desc)); for (i = 0; i < CGEM_NUM_TX_DESCS; i++) { sc->txring[i].ctl = CGEM_TXDESC_USED; - sc->txring[i].addr = 0; if (sc->txring_m[i]) { /* Unload and destroy dmamap. */ bus_dmamap_unload(sc->mbuf_dma_tag, @@ -1106,9 +1206,9 @@ cgem_stop(struct cgem_softc *sc) sc->txring_queued = 0; /* Clear out receive queue. */ + memset(sc->rxring, 0, CGEM_NUM_RX_DESCS * sizeof(struct cgem_rx_desc)); for (i = 0; i < CGEM_NUM_RX_DESCS; i++) { sc->rxring[i].addr = CGEM_RXDESC_OWN; - sc->rxring[i].ctl = 0; if (sc->rxring_m[i]) { /* Unload and destroy dmamap. */ bus_dmamap_unload(sc->mbuf_dma_tag, @@ -1171,6 +1271,8 @@ cgem_ioctl(if_t ifp, u_long cmd, caddr_t data) case SIOCSIFMEDIA: case SIOCGIFMEDIA: + if (sc->miibus == NULL) + return (ENXIO); mii = device_get_softc(sc->miibus); error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd); break; @@ -1205,16 +1307,16 @@ cgem_ioctl(if_t ifp, u_long cmd, caddr_t data) /* Turn on RX checksumming. */ if_setcapenablebit(ifp, IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6, 0); - WR4(sc, CGEM_NET_CFG, - RD4(sc, CGEM_NET_CFG) | - CGEM_NET_CFG_RX_CHKSUM_OFFLD_EN); + sc->net_cfg_shadow |= + CGEM_NET_CFG_RX_CHKSUM_OFFLD_EN; + WR4(sc, CGEM_NET_CFG, sc->net_cfg_shadow); } else { /* Turn off RX checksumming. */ if_setcapenablebit(ifp, 0, IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6); - WR4(sc, CGEM_NET_CFG, - RD4(sc, CGEM_NET_CFG) & - ~CGEM_NET_CFG_RX_CHKSUM_OFFLD_EN); + sc->net_cfg_shadow &= + ~CGEM_NET_CFG_RX_CHKSUM_OFFLD_EN; + WR4(sc, CGEM_NET_CFG, sc->net_cfg_shadow); } } if ((if_getcapenable(ifp) & (IFCAP_RXCSUM | IFCAP_TXCSUM)) == @@ -1235,15 +1337,6 @@ cgem_ioctl(if_t ifp, u_long cmd, caddr_t data) /* MII bus support routines. */ -static void -cgem_child_detached(device_t dev, device_t child) -{ - struct cgem_softc *sc = device_get_softc(dev); - - if (child == sc->miibus) - sc->miibus = NULL; -} - static int cgem_ifmedia_upd(if_t ifp) { @@ -1380,24 +1473,22 @@ __weak_reference(cgem_default_set_ref_clk, cgem_set_ref_clk); static void cgem_mediachange(struct cgem_softc *sc, struct mii_data *mii) { - uint32_t net_cfg; int ref_clk_freq; CGEM_ASSERT_LOCKED(sc); /* Update hardware to reflect media. */ - net_cfg = RD4(sc, CGEM_NET_CFG); - net_cfg &= ~(CGEM_NET_CFG_SPEED100 | CGEM_NET_CFG_GIGE_EN | + sc->net_cfg_shadow &= ~(CGEM_NET_CFG_SPEED100 | CGEM_NET_CFG_GIGE_EN | CGEM_NET_CFG_FULL_DUPLEX); switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_1000_T: - net_cfg |= (CGEM_NET_CFG_SPEED100 | + sc->net_cfg_shadow |= (CGEM_NET_CFG_SPEED100 | CGEM_NET_CFG_GIGE_EN); ref_clk_freq = 125000000; break; case IFM_100_TX: - net_cfg |= CGEM_NET_CFG_SPEED100; + sc->net_cfg_shadow |= CGEM_NET_CFG_SPEED100; ref_clk_freq = 25000000; break; default: @@ -1405,15 +1496,25 @@ cgem_mediachange(struct cgem_softc *sc, struct mii_data *mii) } if ((mii->mii_media_active & IFM_FDX) != 0) - net_cfg |= CGEM_NET_CFG_FULL_DUPLEX; + sc->net_cfg_shadow |= CGEM_NET_CFG_FULL_DUPLEX; - WR4(sc, CGEM_NET_CFG, net_cfg); + WR4(sc, CGEM_NET_CFG, sc->net_cfg_shadow); +#ifdef EXT_RESOURCES + if (sc->ref_clk != NULL) { + CGEM_UNLOCK(sc); + if (clk_set_freq(sc->ref_clk, ref_clk_freq, 0)) + device_printf(sc->dev, "could not set ref clk to %d\n", + ref_clk_freq); + CGEM_LOCK(sc); + } +#else /* Set the reference clock if necessary. */ if (cgem_set_ref_clk(sc->ref_clk_num, ref_clk_freq)) device_printf(sc->dev, "cgem_mediachange: could not set ref clk%d to %d.\n", sc->ref_clk_num, ref_clk_freq); +#endif sc->mii_media_active = mii->mii_media_active; } @@ -1640,19 +1741,46 @@ cgem_attach(device_t dev) { struct cgem_softc *sc = device_get_softc(dev); if_t ifp = NULL; - phandle_t node; - pcell_t cell; int rid, err; u_char eaddr[ETHER_ADDR_LEN]; + int hwtype; +#ifndef EXT_RESOURCES + phandle_t node; + pcell_t cell; +#endif sc->dev = dev; CGEM_LOCK_INIT(sc); + /* Key off of compatible string and set hardware-specific options. */ + hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if (hwtype == HWTYPE_ZYNQMP) + sc->neednullqs = 1; + if (hwtype == HWTYPE_ZYNQ) + sc->rxhangwar = 1; + +#ifdef EXT_RESOURCES + if (hwtype == HWTYPE_ZYNQ || hwtype == HWTYPE_ZYNQMP) { + if (clk_get_by_ofw_name(dev, 0, "tx_clk", &sc->ref_clk) != 0) + device_printf(dev, + "could not retrieve reference clock.\n"); + else if (clk_enable(sc->ref_clk) != 0) + device_printf(dev, "could not enable clock.\n"); + } + else if (hwtype == HWTYPE_SIFIVE_FU540) { + if (clk_get_by_ofw_name(dev, 0, "pclk", &sc->ref_clk) != 0) + device_printf(dev, + "could not retrieve reference clock.\n"); + else if (clk_enable(sc->ref_clk) != 0) + device_printf(dev, "could not enable clock.\n"); + } +#else /* Get reference clock number and base divider from fdt. */ node = ofw_bus_get_node(dev); sc->ref_clk_num = 0; if (OF_getprop(node, "ref-clock-num", &cell, sizeof(cell)) > 0) sc->ref_clk_num = fdt32_to_cpu(cell); +#endif /* Get memory resource. */ rid = 0; @@ -1665,7 +1793,8 @@ cgem_attach(device_t dev) /* Get IRQ resource. */ rid = 0; - sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); if (sc->irq_res == NULL) { device_printf(dev, "could not allocate interrupt resource.\n"); cgem_detach(dev); @@ -1697,7 +1826,6 @@ cgem_attach(device_t dev) sc->if_old_flags = if_getflags(ifp); sc->rxbufs = DEFAULT_NUM_RX_BUFS; - sc->rxhangwar = 1; /* Reset hardware. */ CGEM_LOCK(sc); @@ -1708,11 +1836,8 @@ cgem_attach(device_t dev) err = mii_attach(dev, &sc->miibus, ifp, cgem_ifmedia_upd, cgem_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); - if (err) { - device_printf(dev, "attaching PHYs failed\n"); - cgem_detach(dev); - return (err); - } + if (err) + device_printf(dev, "warning: attaching PHYs failed\n"); /* Set up TX and RX descriptor area. */ err = cgem_setup_descs(sc); @@ -1787,26 +1912,21 @@ cgem_detach(device_t dev) bus_dmamap_unload(sc->desc_dma_tag, sc->rxring_dma_map); sc->rxring_physaddr = 0; + sc->txring_physaddr = 0; + sc->null_qs_physaddr = 0; } bus_dmamem_free(sc->desc_dma_tag, sc->rxring, sc->rxring_dma_map); sc->rxring = NULL; + sc->txring = NULL; + sc->null_qs = NULL; + for (i = 0; i < CGEM_NUM_RX_DESCS; i++) if (sc->rxring_m_dmamap[i] != NULL) { bus_dmamap_destroy(sc->mbuf_dma_tag, sc->rxring_m_dmamap[i]); sc->rxring_m_dmamap[i] = NULL; } - } - if (sc->txring != NULL) { - if (sc->txring_physaddr != 0) { - bus_dmamap_unload(sc->desc_dma_tag, - sc->txring_dma_map); - sc->txring_physaddr = 0; - } - bus_dmamem_free(sc->desc_dma_tag, sc->txring, - sc->txring_dma_map); - sc->txring = NULL; for (i = 0; i < CGEM_NUM_TX_DESCS; i++) if (sc->txring_m_dmamap[i] != NULL) { bus_dmamap_destroy(sc->mbuf_dma_tag, @@ -1823,6 +1943,13 @@ cgem_detach(device_t dev) sc->mbuf_dma_tag = NULL; } +#ifdef EXT_RESOURCES + if (sc->ref_clk != NULL) { + clk_release(sc->ref_clk); + sc->ref_clk = NULL; + } +#endif + bus_generic_detach(dev); CGEM_LOCK_DESTROY(sc); @@ -1836,9 +1963,6 @@ static device_method_t cgem_methods[] = { DEVMETHOD(device_attach, cgem_attach), DEVMETHOD(device_detach, cgem_detach), - /* Bus interface */ - DEVMETHOD(bus_child_detached, cgem_child_detached), - /* MII interface */ DEVMETHOD(miibus_readreg, cgem_miibus_readreg), DEVMETHOD(miibus_writereg, cgem_miibus_writereg), @@ -1858,3 +1982,4 @@ DRIVER_MODULE(cgem, simplebus, cgem_driver, cgem_devclass, NULL, NULL); DRIVER_MODULE(miibus, cgem, miibus_driver, miibus_devclass, NULL, NULL); MODULE_DEPEND(cgem, miibus, 1, 1, 1); MODULE_DEPEND(cgem, ether, 1, 1, 1); +SIMPLEBUS_PNP_INFO(compat_data); diff --git a/sys/dev/cadence/if_cgem_hw.h b/sys/dev/cadence/if_cgem_hw.h index fced73327d91..784b131a885e 100644 --- a/sys/dev/cadence/if_cgem_hw.h +++ b/sys/dev/cadence/if_cgem_hw.h @@ -35,6 +35,10 @@ * Reference: Zynq-7000 All Programmable SoC Technical Reference Manual. * (v1.4) November 16, 2012. Xilinx doc UG585. GEM is covered in Ch. 16 * and register definitions are in appendix B.18. + * + * Additional Reference: Zynq UltraScale+ Device Register Reference + * (UG1087 v1.7 Feb 8,2019): + * https://www.xilinx.com/html_docs/registers/ug1087/ug1087-zynq-ultrascale-registers.html */ #ifndef _IF_CGEM_HW_H_ @@ -113,6 +117,7 @@ #define CGEM_USER_IO 0x00C /* User I/O */ #define CGEM_DMA_CFG 0x010 /* DMA Config */ +#define CGEM_DMA_CFG_ADDR_BUS_64 (1 << 30) #define CGEM_DMA_CFG_DISC_WHEN_NO_AHB (1 << 24) #define CGEM_DMA_CFG_RX_BUF_SIZE_SHIFT 16 #define CGEM_DMA_CFG_RX_BUF_SIZE_MASK (0xff << 16) @@ -290,6 +295,29 @@ #define CGEM_PTP_PEER_RX_S 0x1F8 /* PTP Peer Event rcv'd s */ #define CGEM_PTP_PEER_RX_NS 0x1FC /* PTP Peer Event rcv'd ns */ +#define CGEM_DESIGN_CFG1 0x280 /* Design Configuration 1 */ +#define CGEM_DESIGN_CFG1_AXI_CACHE_WIDTH_MASK (0xfU << 28) +#define CGEM_DESIGN_CFG1_DMA_BUS_WIDTH_MASK (7 << 25) +#define CGEM_DESIGN_CFG1_DMA_BUS_WIDTH_32 (1 << 25) +#define CGEM_DESIGN_CFG1_DMA_BUS_WIDTH_64 (2 << 25) +#define CGEM_DESIGN_CFG1_DMA_BUS_WIDTH_128 (4 << 25) +#define CGEM_DESIGN_CFG1_IRQ_READ_CLR (1 << 23) +#define CGEM_DESIGN_CFG1_NO_SNAPSHOT (1 << 22) +#define CGEM_DESIGN_CFG1_NO_STATS (1 << 21) +#define CGEM_DESIGN_CFG1_NO_SCAN_PINS (1 << 20) +#define CGEM_DESIGN_CFG1_USER_IN_WIDTH_MASK (0x1f << 15) +#define CGEM_DESIGN_CFG1_USER_OUT_WIDTH_MASK (0x1f << 10) +#define CGEM_DESIGN_CFG1_USER_IO (1 << 9) +#define CGEM_DESIGN_CFG1_APB_REV2 (1 << 8) +#define CGEM_DESIGN_CFG1_APB_REV1 (1 << 7) +#define CGEM_DESIGN_CFG1_EXT_FIFO_INTERFACE (1 << 6) +#define CGEM_DESIGN_CFG1_NO_INT_LOOPBACK (1 << 5) +#define CGEM_DESIGN_CFG1_INT_LOOPBACK (1 << 4) +#define CGEM_DESIGN_CFG1_TDC_50 (1 << 3) +#define CGEM_DESIGN_CFG1_RDC_50 (1 << 2) +#define CGEM_DESIGN_CFG1_SERDES (1 << 1) +#define CGEM_DESIGN_CFG1_NO_PCS (1 << 0) + #define CGEM_DESIGN_CFG2 0x284 /* Design Configuration 2 */ #define CGEM_DESIGN_CFG2_TX_PBUF_ADDR_SHIFT 26 #define CGEM_DESIGN_CFG2_TX_PBUF_ADDR_MASK (0xf << 26) @@ -330,7 +358,25 @@ #define CGEM_DESIGN_CFG5_TX_FIFO_CNT_WIDTH_MASK (0xf << 4) #define CGEM_DESIGN_CFG5_RX_FIFO_CNT_WIDTH_MASK 0xf -/* Transmit Descriptors */ +#define CGEM_DESIGN_CFG6 0x294 /* Design Configuration 6 */ +#define CGEM_DESIGN_CFG6_ADDR_64B (1 << 23) /* 64-bit addr cap */ +#define CGEM_DESIGN_CFG6_DMA_PRIO_Q_MASK 0xfffe +#define CGEM_DESIGN_CFG6_DMA_PRIO_Q(n) (1 << (n)) + +#define CGEM_TX_QN_BAR(n) (0x440 + ((n) - 1) * 4) +#define CGEM_RX_QN_BAR(n) (0x480 + ((n) - 1) * 4) + +#define CGEM_TX_QBAR_HI 0x4C8 +#define CGEM_RX_QBAR_HI 0x4D4 + +/* + * Transmit Descriptors: two or four 32-bit words: + * word0: address + * word1: length and control + * word2: address upper 32-bits (64-bit mode) + * word3: unused (64-bit mode) + */ + struct cgem_tx_desc { uint32_t addr; uint32_t ctl; @@ -350,8 +396,20 @@ struct cgem_tx_desc { #define CGEM_TXDESC_NO_CRC_APPENDED (1 << 16) #define CGEM_TXDESC_LAST_BUF (1 << 15) /* last in frame */ #define CGEM_TXDESC_LENGTH_MASK 0x3fff +#ifdef CGEM64 + uint32_t addrhi; + uint32_t unused; +#endif }; +/* + * Receive Descriptors: two or four 32-bit words: + * word0: address | WRAP and OWN flags + * word1: length and control + * word2: address upper 32 bits (64-bit mode) + * word3: unused + */ + struct cgem_rx_desc { uint32_t addr; #define CGEM_RXDESC_WRAP (1 << 1) /* goes in addr! */ @@ -379,6 +437,10 @@ struct cgem_rx_desc { #define CGEM_RXDESC_SOF (1 << 14) /* start of frame */ #define CGEM_RXDESC_BAD_FCS (1 << 13) #define CGEM_RXDESC_LENGTH_MASK 0x1fff +#ifdef CGEM64 + uint32_t addrhi; + uint32_t unused; +#endif }; #endif /* _IF_CGEM_HW_H_ */ diff --git a/sys/dts/arm/zynq-7000.dtsi b/sys/dts/arm/zynq-7000.dtsi index a48c7bb732a1..a2a585a39446 100644 --- a/sys/dts/arm/zynq-7000.dtsi +++ b/sys/dts/arm/zynq-7000.dtsi @@ -176,20 +176,20 @@ *** 40 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Jan 10 20:57:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 345074D926B; Sun, 10 Jan 2021 20:57:51 +0000 (UTC) (envelope-from git@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 4DDTgg11KBz3QPS; Sun, 10 Jan 2021 20:57:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15B246B51; Sun, 10 Jan 2021 20:57:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AKvpph071150; Sun, 10 Jan 2021 20:57:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AKvpCD071149; Sun, 10 Jan 2021 20:57:51 GMT (envelope-from git) Date: Sun, 10 Jan 2021 20:57:51 GMT Message-Id: <202101102057.10AKvpCD071149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: ef757da441b1 - main - rc.conf(5): describe devmatch rc variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ef757da441b199da680bfbd24afaa9d3c16e5b55 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 20:57:51 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=ef757da441b199da680bfbd24afaa9d3c16e5b55 commit ef757da441b199da680bfbd24afaa9d3c16e5b55 Author: Mitchell Horne AuthorDate: 2021-01-10 20:53:59 +0000 Commit: Mitchell Horne CommitDate: 2021-01-10 20:56:40 +0000 rc.conf(5): describe devmatch rc variables Reviewed by: imp, gbe (manpages) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28048 --- share/man/man5/rc.conf.5 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index b824426a91d2..473406660b8b 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Sep 21, 2020 +.Dd January 10, 2021 .Dt RC.CONF 5 .Os .Sh NAME @@ -251,6 +251,16 @@ Configuration file for .Xr ddb 8 . Default .Pa /etc/ddb.conf . +.It Va devmatch_enable +.Pq Vt bool +If set to +.Dq Li NO , +disable auto-loading of kernel modules with +.Xr devmatch 8 . +.It Va devmatch_blacklist +.Pq Vt str +A whitespace-separated list of kernel modules to be ignored by +.Xr devmatch 8 . .It Va kld_list .Pq Vt str A whitespace-separated list of kernel modules to load right after From owner-dev-commits-src-all@freebsd.org Sun Jan 10 21:17:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8DA864DA850 for ; Sun, 10 Jan 2021 21:17:52 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 4DDV6m3PVgz3k07 for ; Sun, 10 Jan 2021 21:17:52 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f41.google.com with SMTP id q75so13292466wme.2 for ; Sun, 10 Jan 2021 13:17:52 -0800 (PST) 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=69Wp4A2yerWOslX/H5Gc28GtPXLPLfQw4aG3Wm2Oko0=; b=BNWbAfC15NkV/VRziEPBJaT6dRUP2ZDRg6FomMQCMtsQoYJM5b0/PxZv021X8gPX5S giHBqL7uUswU7C6JtJtfilLrImxEOfbclmDQLarsp67oMZQNp3AXHMlItMRpwPGzuy5m zegzQjUMP9sOgaka2V1RANERpj2eyl87fmhBqWq1TGpGlMXELMFDRGZK7JnumyOXNxqz 66qzRp616desOa0qVo35WYvGkbIM3yhRyWvEdVUSYOb2qx55sV+JBnkTtFylFEVyeEyf gk5NEd1ymOkn5EBtvGbCu3cdWLhFCmPzAaWi5e9IfSmretiSdK5HPwQ7/JP23Xd0Ub9I WwKw== X-Gm-Message-State: AOAM531TkIRBrCN+va3rmeunnidXd5vYwjbFPFVYJG9ttKSVCjcbj2rj K8x1mfnFCViSNiMZLxguNjL+3w== X-Google-Smtp-Source: ABdhPJwhhFVAb66x89riPlQj9Od39hQ3Zc625LNzjcdhW8IM01u4r5g6D78eXi02TKAjqjfKwvrZcg== X-Received: by 2002:a1c:7218:: with SMTP id n24mr12049461wmc.186.1610313470918; Sun, 10 Jan 2021 13:17:50 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id l8sm23595050wrb.73.2021.01.10.13.17.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jan 2021 13:17:50 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: facdd1cd2045 - main - cgem: add 64-bit support From: Jessica Clarke In-Reply-To: <202101102053.10AKrGqv070360@gitrepo.freebsd.org> Date: Sun, 10 Jan 2021 21:17:48 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: 7bit Message-Id: References: <202101102053.10AKrGqv070360@gitrepo.freebsd.org> To: Mitchell Horne X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DDV6m3PVgz3k07 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 21:17:52 -0000 On 10 Jan 2021, at 20:53, Mitchell Horne wrote: > diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c > index 3c5277452469..77337e977dcc 100644 > --- a/sys/dev/cadence/if_cgem.c > +++ b/sys/dev/cadence/if_cgem.c > @@ -77,6 +77,14 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#ifdef EXT_RESOURCES > +#include > +#endif > + > +#if INTPTR_MAX == INT64_MAX > +#define CGEM64 > +#endif This isn't going to work with CHERI. Perhaps a BUS_SPACE_MAXADDR check, or SIZE_MAX? The former is probably preferable for PAE systems. Jess From owner-dev-commits-src-all@freebsd.org Sun Jan 10 21:31:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 30A224DA8DF; Sun, 10 Jan 2021 21:31:20 +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 4DDVQH69wXz3kcg; Sun, 10 Jan 2021 21:31:19 +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 10ALV615058424 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 10 Jan 2021 23:31:10 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 10ALV615058424 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 10ALV6v2058423; Sun, 10 Jan 2021 23:31:06 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 10 Jan 2021 23:31:06 +0200 From: Konstantin Belousov To: Jessica Clarke Cc: Mitchell Horne , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: facdd1cd2045 - main - cgem: add 64-bit support Message-ID: References: <202101102053.10AKrGqv070360@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: 4DDVQH69wXz3kcg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 21:31:20 -0000 On Sun, Jan 10, 2021 at 09:17:48PM +0000, Jessica Clarke wrote: > On 10 Jan 2021, at 20:53, Mitchell Horne wrote: > > diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c > > index 3c5277452469..77337e977dcc 100644 > > --- a/sys/dev/cadence/if_cgem.c > > +++ b/sys/dev/cadence/if_cgem.c > > @@ -77,6 +77,14 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > > > +#ifdef EXT_RESOURCES > > +#include > > +#endif > > + > > +#if INTPTR_MAX == INT64_MAX > > +#define CGEM64 > > +#endif > > This isn't going to work with CHERI. Perhaps a BUS_SPACE_MAXADDR check, > or SIZE_MAX? The former is probably preferable for PAE systems. Wouldn't it be spelled as __LP64__ ? From owner-dev-commits-src-all@freebsd.org Sun Jan 10 21:33:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 419804DA8FA for ; Sun, 10 Jan 2021 21:33:18 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 4DDVSZ1JL4z3l25 for ; Sun, 10 Jan 2021 21:33:18 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f42.google.com with SMTP id e25so13331357wme.0 for ; Sun, 10 Jan 2021 13:33:17 -0800 (PST) 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=sSsNU83EpOWo5xjXp1Oi9sAuotfmAsXha9zO9zY1W2I=; b=BDMLrGzoaMqsEX04RrAKJPo3veu48VYKLuZdk+OlZsmfK5A0xjQFF5a9rRfx1qYUC1 LNeUa2Z+cOhsW/yD33o6HAUDmVIt3x1a388bsv0kya1onLcaYmlOmuy6DjDljo/76ddw EVmWS1SoTZZXsBGvnM4fKi9+Z/hpn0q5v4qUATLruaBhsd/ImH78J9VuVI070MjjMS+j CksGNXKs2X0lhFQflHdpIfoAI/PHLoq/TRZ6m0ySig7xgK98UGm4tKbvkIiYgg85R+Qh PhmiL32KcwfxloFNGjjRhiXd/1a/ndgAFIg2FDeVP+SX13gJwoXsZNEiL08FK6OFcIDy nZkw== X-Gm-Message-State: AOAM531PLwBZA/8XsnWVKQLvSAOxI65cW+9qBnJc/sOgBoKgWLICr3fQ tf09gk+lz9WcMD65wA4RuDRs+w== X-Google-Smtp-Source: ABdhPJyOG8UA3hDi5RLyDqgCHwOTUlOaILfsLcYsvrq5I6nSV7p8cYrQg3cY6CGIVHyrK001DhLS+g== X-Received: by 2002:a1c:b608:: with SMTP id g8mr12192391wmf.110.1610314397089; Sun, 10 Jan 2021 13:33:17 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id r7sm19385790wmh.2.2021.01.10.13.33.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jan 2021 13:33:16 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: facdd1cd2045 - main - cgem: add 64-bit support From: Jessica Clarke In-Reply-To: Date: Sun, 10 Jan 2021 21:33:16 +0000 Cc: Mitchell Horne , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: 7bit Message-Id: <51C7F0DA-0EA2-45EF-A817-53984205C648@freebsd.org> References: <202101102053.10AKrGqv070360@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DDVSZ1JL4z3l25 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 21:33:18 -0000 On 10 Jan 2021, at 21:31, Konstantin Belousov wrote: > On Sun, Jan 10, 2021 at 09:17:48PM +0000, Jessica Clarke wrote: >> On 10 Jan 2021, at 20:53, Mitchell Horne wrote: >>> diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c >>> index 3c5277452469..77337e977dcc 100644 >>> --- a/sys/dev/cadence/if_cgem.c >>> +++ b/sys/dev/cadence/if_cgem.c >>> @@ -77,6 +77,14 @@ __FBSDID("$FreeBSD$"); >>> #include >>> #include >>> >>> +#ifdef EXT_RESOURCES >>> +#include >>> +#endif >>> + >>> +#if INTPTR_MAX == INT64_MAX >>> +#define CGEM64 >>> +#endif >> >> This isn't going to work with CHERI. Perhaps a BUS_SPACE_MAXADDR check, >> or SIZE_MAX? The former is probably preferable for PAE systems. > > Wouldn't it be spelled as __LP64__ ? It shouldn't be, because the P stands for pointer(s), which we make 128-bit, though in practice for compatibility we have a hack to define it anyway (but the compiler *won't*, it's in bsd.cpu.mk or similar). Only the integer addresses are 128-bit. Jess From owner-dev-commits-src-all@freebsd.org Sun Jan 10 21:40:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6E5ED4DAF9D for ; Sun, 10 Jan 2021 21:40:24 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.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 4DDVcl50gTz3lGK for ; Sun, 10 Jan 2021 21:40:23 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f54.google.com with SMTP id d13so14408303wrc.13 for ; Sun, 10 Jan 2021 13:40:23 -0800 (PST) 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=v/cMVJWH+dgSCOwwPk6krsGZQHtiRhslKsmTX8YNp1I=; b=dooM5rbBvuG6og3qrvsW35PNbzr8jKRAPxbM8FqDlfBYjjF0Xb7OIdEjGHqgOIOpNp aWXODZ51QARDOWR1R2f2wVKgAFPXMyMUfW2nWlgSNJMR132s57LmSyeZfgjv5Ln9RiRb d50pWssYxb9Yg8t/cUBplQSFyt87LUH6rUjed6SfIPG32zkghHqkgDh2H82U619+IZdo YxiKQAT4t7jqLY29FXxVwrO8GrXfMHdW5dp4T/mV098QYYFqw9lJpBvUJRhCnMUpAq1G 5VYBCBzB6MpyU2qBMrYymIF/iUyHI/eKA4rZF5/pNh6K5e92THILSi/vx6Gcn43XL6rr +Saw== X-Gm-Message-State: AOAM533S2VPwnGl3OLnG00yEUNLLzKPJjZQaKMd/GnPUkxJSFeN9dopN zAXwJ6Y61V3bDMaQcDBrmP592mCQWhq7Bonb X-Google-Smtp-Source: ABdhPJyHnXyVMJA0IMsHHMbZJKxDKNB9YWK2iOUbflJQtOtZHzrC/1hNP1tgGfTnpM5DeQeBtg78pA== X-Received: by 2002:a5d:51cc:: with SMTP id n12mr13224385wrv.375.1610314822228; Sun, 10 Jan 2021 13:40:22 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id o83sm19796249wme.21.2021.01.10.13.40.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jan 2021 13:40:21 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: facdd1cd2045 - main - cgem: add 64-bit support From: Jessica Clarke In-Reply-To: <51C7F0DA-0EA2-45EF-A817-53984205C648@freebsd.org> Date: Sun, 10 Jan 2021 21:40:21 +0000 Cc: Mitchell Horne , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: 7bit Message-Id: <6FE70CCD-B854-4D41-B050-B7CBD516067F@freebsd.org> References: <202101102053.10AKrGqv070360@gitrepo.freebsd.org> <51C7F0DA-0EA2-45EF-A817-53984205C648@freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DDVcl50gTz3lGK 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.221.54 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.42 / 15.00]; TO_DN_EQ_ADDR_SOME(0.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]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.92)[-0.918]; FREEMAIL_TO(0.00)[gmail.com]; 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)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.221.54:from]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.221.54:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.54:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.54:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 21:40:24 -0000 On 10 Jan 2021, at 21:33, Jessica Clarke wrote: > On 10 Jan 2021, at 21:31, Konstantin Belousov wrote: >> On Sun, Jan 10, 2021 at 09:17:48PM +0000, Jessica Clarke wrote: >>> On 10 Jan 2021, at 20:53, Mitchell Horne wrote: >>>> diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c >>>> index 3c5277452469..77337e977dcc 100644 >>>> --- a/sys/dev/cadence/if_cgem.c >>>> +++ b/sys/dev/cadence/if_cgem.c >>>> @@ -77,6 +77,14 @@ __FBSDID("$FreeBSD$"); >>>> #include >>>> #include >>>> >>>> +#ifdef EXT_RESOURCES >>>> +#include >>>> +#endif >>>> + >>>> +#if INTPTR_MAX == INT64_MAX >>>> +#define CGEM64 >>>> +#endif >>> >>> This isn't going to work with CHERI. Perhaps a BUS_SPACE_MAXADDR check, >>> or SIZE_MAX? The former is probably preferable for PAE systems. >> >> Wouldn't it be spelled as __LP64__ ? > > It shouldn't be, because the P stands for pointer(s), which we make > 128-bit, though in practice for compatibility we have a hack to define > it anyway (but the compiler *won't*, it's in bsd.cpu.mk or similar). > Only the integer addresses are 128-bit. As for the original comment about the diff, I stand corrected; it's using MAX not SIZE, so will work on CHERI. Jess From owner-dev-commits-src-all@freebsd.org Sun Jan 10 21:41:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5BCF14DAD63; Sun, 10 Jan 2021 21:41:41 +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 4DDVfD71jLz3lN6; Sun, 10 Jan 2021 21:41:40 +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 10ALfXOs060850 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 10 Jan 2021 23:41:37 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 10ALfXOs060850 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 10ALfXUB060849; Sun, 10 Jan 2021 23:41:33 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 10 Jan 2021 23:41:33 +0200 From: Konstantin Belousov To: Jessica Clarke Cc: Mitchell Horne , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: facdd1cd2045 - main - cgem: add 64-bit support Message-ID: References: <202101102053.10AKrGqv070360@gitrepo.freebsd.org> <51C7F0DA-0EA2-45EF-A817-53984205C648@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51C7F0DA-0EA2-45EF-A817-53984205C648@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: 4DDVfD71jLz3lN6 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 21:41:41 -0000 On Sun, Jan 10, 2021 at 09:33:16PM +0000, Jessica Clarke wrote: > On 10 Jan 2021, at 21:31, Konstantin Belousov wrote: > > On Sun, Jan 10, 2021 at 09:17:48PM +0000, Jessica Clarke wrote: > >> On 10 Jan 2021, at 20:53, Mitchell Horne wrote: > >>> diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c > >>> index 3c5277452469..77337e977dcc 100644 > >>> --- a/sys/dev/cadence/if_cgem.c > >>> +++ b/sys/dev/cadence/if_cgem.c > >>> @@ -77,6 +77,14 @@ __FBSDID("$FreeBSD$"); > >>> #include > >>> #include > >>> > >>> +#ifdef EXT_RESOURCES > >>> +#include > >>> +#endif > >>> + > >>> +#if INTPTR_MAX == INT64_MAX > >>> +#define CGEM64 > >>> +#endif > >> > >> This isn't going to work with CHERI. Perhaps a BUS_SPACE_MAXADDR check, > >> or SIZE_MAX? The former is probably preferable for PAE systems. > > > > Wouldn't it be spelled as __LP64__ ? > > It shouldn't be, because the P stands for pointer(s), which we make > 128-bit, though in practice for compatibility we have a hack to define > it anyway (but the compiler *won't*, it's in bsd.cpu.mk or similar). > Only the integer addresses are 128-bit. I have no idea about CHERI, I mean how this statement should be handled for FreeBSD. From owner-dev-commits-src-all@freebsd.org Sun Jan 10 21:44:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D6B2F4DADE5 for ; Sun, 10 Jan 2021 21:44:24 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.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 4DDVjN554pz3ljS for ; Sun, 10 Jan 2021 21:44:24 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f53.google.com with SMTP id a6so12286009wmc.2 for ; Sun, 10 Jan 2021 13:44:24 -0800 (PST) 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=waDWz+nugdqZxDXUc2gkCkpki2vSAfv5HWfdiSOE8AQ=; b=iP5GDIBMsHeQ7/LOez0J9Z3vXW45Cu7L+w6OQhA0l+GTchE94JV9yGgx6uSgd3dPSX PP2xi1alG++x34tApm4KPUeCoT4CnPthWSPcuObWBJxgUCcWoX84Xjo2f82K4XalHgMr GYabovJivXWWnbU584ktMqfhZnxr/N4zfGEqMqkxU7pTJKcBJ4dqqJROVYY42u5E/Nee vWNIAydj7HjS1+hbSZm1cm/PErQ5ozuftdPGDIdq8riwF8UILJku1eRf974Q+GacM90U 9OlPB5gYqjqM5osaw7lwlrvdJL51Y4y8RgbHNXvuWL6b0Or9zqlzpjBZP3T1cUZRFtIP tcAg== X-Gm-Message-State: AOAM530yFBG1mD55/PwGo1D+PUW92dFnXN1KiiemJobJFqPl/7SoMRZy Axg3CvvLHz9EBa9r1n73w8lPDA== X-Google-Smtp-Source: ABdhPJz3J5bUoZyY7fUMYiC6gu5Ec2Jv64F59tiyxrS6vBEWBv6xvsKQ20EsHV77tsZ6DdR3VelkQg== X-Received: by 2002:a7b:c04c:: with SMTP id u12mr12425641wmc.185.1610315063295; Sun, 10 Jan 2021 13:44:23 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id z13sm26542623wmz.3.2021.01.10.13.44.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jan 2021 13:44:22 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: facdd1cd2045 - main - cgem: add 64-bit support From: Jessica Clarke In-Reply-To: Date: Sun, 10 Jan 2021 21:44:22 +0000 Cc: Mitchell Horne , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: 7bit Message-Id: <8EE9AF5A-E74C-470E-B3E5-A347E3367777@freebsd.org> References: <202101102053.10AKrGqv070360@gitrepo.freebsd.org> <51C7F0DA-0EA2-45EF-A817-53984205C648@freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DDVjN554pz3ljS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 21:44:24 -0000 On 10 Jan 2021, at 21:41, Konstantin Belousov wrote: > On Sun, Jan 10, 2021 at 09:33:16PM +0000, Jessica Clarke wrote: >> On 10 Jan 2021, at 21:31, Konstantin Belousov wrote: >>> On Sun, Jan 10, 2021 at 09:17:48PM +0000, Jessica Clarke wrote: >>>> On 10 Jan 2021, at 20:53, Mitchell Horne wrote: >>>>> diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c >>>>> index 3c5277452469..77337e977dcc 100644 >>>>> --- a/sys/dev/cadence/if_cgem.c >>>>> +++ b/sys/dev/cadence/if_cgem.c >>>>> @@ -77,6 +77,14 @@ __FBSDID("$FreeBSD$"); >>>>> #include >>>>> #include >>>>> >>>>> +#ifdef EXT_RESOURCES >>>>> +#include >>>>> +#endif >>>>> + >>>>> +#if INTPTR_MAX == INT64_MAX >>>>> +#define CGEM64 >>>>> +#endif >>>> >>>> This isn't going to work with CHERI. Perhaps a BUS_SPACE_MAXADDR check, >>>> or SIZE_MAX? The former is probably preferable for PAE systems. >>> >>> Wouldn't it be spelled as __LP64__ ? >> >> It shouldn't be, because the P stands for pointer(s), which we make >> 128-bit, though in practice for compatibility we have a hack to define >> it anyway (but the compiler *won't*, it's in bsd.cpu.mk or similar). >> Only the integer addresses are 128-bit. > > I have no idea about CHERI, I mean how this statement should be handled > for FreeBSD. Well, ideally in a way that works for FreeBSD and CHERI. This one happens to do that, though it doesn't feel very idiomatic, and a comparison against SIZE_MAX or BUS_SPACE_MAXADDR would seem more accurate (depending on the behaviour you want for PAE systems). FreeBSD *can* use __LP64__ but it causes pain for us downstream so we prefer people to be more specific in what they mean (i.e., do you care about the size of the address space or the size of the representation of pointers). Jess From owner-dev-commits-src-all@freebsd.org Sun Jan 10 21:53:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 97F354DB072; Sun, 10 Jan 2021 21:53:33 +0000 (UTC) (envelope-from git@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 4DDVvx3td7z3mP4; Sun, 10 Jan 2021 21:53:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76AFB777A; Sun, 10 Jan 2021 21:53:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10ALrXI9048181; Sun, 10 Jan 2021 21:53:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10ALrXf5048180; Sun, 10 Jan 2021 21:53:33 GMT (envelope-from git) Date: Sun, 10 Jan 2021 21:53:33 GMT Message-Id: <202101102153.10ALrXf5048180@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 148a227bf80e - main - nfsd: add KASSERTs to nfsm_trimtrailing() for M_EXTPG mbufs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 148a227bf80e9716ee26a8a6747961b5a639918b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 21:53:33 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=148a227bf80e9716ee26a8a6747961b5a639918b commit 148a227bf80e9716ee26a8a6747961b5a639918b Author: Rick Macklem AuthorDate: 2021-01-10 21:50:15 +0000 Commit: Rick Macklem CommitDate: 2021-01-10 21:50:15 +0000 nfsd: add KASSERTs to nfsm_trimtrailing() for M_EXTPG mbufs Add KASSERTS to nfsm_trimtrailing() to confirm the sanity of the arguments for the M_EXTPG case. Suggested by: kib Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D28053 --- sys/fs/nfsserver/nfs_nfsdport.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 727a83005fa0..8336a0b8fab2 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -6581,6 +6581,12 @@ nfsm_trimtrailing(struct nfsrv_descript *nd, struct mbuf *mb, char *bpos, mb->m_next = NULL; } if ((mb->m_flags & M_EXTPG) != 0) { + KASSERT(bextpg >= 0 && bextpg < mb->m_epg_npgs, + ("nfsm_trimtrailing: bextpg out of range")); + KASSERT(bpos == (char *)(void *) + PHYS_TO_DMAP(mb->m_epg_pa[bextpg]) + PAGE_SIZE - bextpgsiz, + ("nfsm_trimtrailing: bextpgsiz bad!")); + /* First, get rid of any pages after this position. */ for (i = mb->m_epg_npgs - 1; i > bextpg; i--) { pg = PHYS_TO_VM_PAGE(mb->m_epg_pa[i]); From owner-dev-commits-src-all@freebsd.org Sun Jan 10 21:56:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B2D1C4DB6C8; Sun, 10 Jan 2021 21:56:38 +0000 (UTC) (envelope-from mhorne@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 4DDVzV4gD1z3mYW; Sun, 10 Jan 2021 21:56:38 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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: mhorne) by smtp.freebsd.org (Postfix) with ESMTPSA id 8E04A2A2D5; Sun, 10 Jan 2021 21:56:38 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: by mail-yb1-f177.google.com with SMTP id y128so15078038ybf.10; Sun, 10 Jan 2021 13:56:38 -0800 (PST) X-Gm-Message-State: AOAM531kP0W2tOqqs/XLMV7axBEsWs/O0oKpO7iaq2nOIroGx1O8ovf5 ahXfiy4bZPftjJiOmrF4NU3nZFoHPDxFzwjkIGY= X-Google-Smtp-Source: ABdhPJxll85PYCTMRE8xJPh7cpDD23WI+lKyTsUyplrynzFFBva5WpebYaNuhLHERTeoeCbIbpnaUAJFNRdgj1Bd/5c= X-Received: by 2002:a25:76c3:: with SMTP id r186mr22073507ybc.226.1610315798030; Sun, 10 Jan 2021 13:56:38 -0800 (PST) MIME-Version: 1.0 References: <202101102053.10AKrGqv070360@gitrepo.freebsd.org> <51C7F0DA-0EA2-45EF-A817-53984205C648@freebsd.org> <8EE9AF5A-E74C-470E-B3E5-A347E3367777@freebsd.org> In-Reply-To: <8EE9AF5A-E74C-470E-B3E5-A347E3367777@freebsd.org> From: Mitchell Horne Date: Sun, 10 Jan 2021 17:56:26 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: facdd1cd2045 - main - cgem: add 64-bit support To: Jessica Clarke Cc: Konstantin Belousov , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 21:56:38 -0000 On Sun, Jan 10, 2021 at 5:44 PM Jessica Clarke wrote: > > On 10 Jan 2021, at 21:41, Konstantin Belousov wrote: > > On Sun, Jan 10, 2021 at 09:33:16PM +0000, Jessica Clarke wrote: > >> On 10 Jan 2021, at 21:31, Konstantin Belousov wrote: > >>> On Sun, Jan 10, 2021 at 09:17:48PM +0000, Jessica Clarke wrote: > >>>> On 10 Jan 2021, at 20:53, Mitchell Horne wrote: > >>>>> diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c > >>>>> index 3c5277452469..77337e977dcc 100644 > >>>>> --- a/sys/dev/cadence/if_cgem.c > >>>>> +++ b/sys/dev/cadence/if_cgem.c > >>>>> @@ -77,6 +77,14 @@ __FBSDID("$FreeBSD$"); > >>>>> #include > >>>>> #include > >>>>> > >>>>> +#ifdef EXT_RESOURCES > >>>>> +#include > >>>>> +#endif > >>>>> + > >>>>> +#if INTPTR_MAX == INT64_MAX > >>>>> +#define CGEM64 > >>>>> +#endif > >>>> > >>>> This isn't going to work with CHERI. Perhaps a BUS_SPACE_MAXADDR check, > >>>> or SIZE_MAX? The former is probably preferable for PAE systems. > >>> > >>> Wouldn't it be spelled as __LP64__ ? > >> > >> It shouldn't be, because the P stands for pointer(s), which we make > >> 128-bit, though in practice for compatibility we have a hack to define > >> it anyway (but the compiler *won't*, it's in bsd.cpu.mk or similar). > >> Only the integer addresses are 128-bit. > > > > I have no idea about CHERI, I mean how this statement should be handled > > for FreeBSD. > > Well, ideally in a way that works for FreeBSD and CHERI. This one > happens to do that, though it doesn't feel very idiomatic, and a > comparison against SIZE_MAX or BUS_SPACE_MAXADDR would seem more > accurate (depending on the behaviour you want for PAE systems). FreeBSD > *can* use __LP64__ but it causes pain for us downstream so we prefer > people to be more specific in what they mean (i.e., do you care about > the size of the address space or the size of the representation of > pointers). > > Jess > Indeed, the committed version is not very idiomatic. In this case I would think that a comparison like `#if BUS_SPACE_MAXADDR > BUS_SPACE_MAXADDR_32BIT` describes the intent, but I don't see anything like that in the tree already. I do see several occurrences of `#ifdef __LP64__` under sys/dev/. From owner-dev-commits-src-all@freebsd.org Sun Jan 10 22:08:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7CA504DB96C; Sun, 10 Jan 2021 22:08:52 +0000 (UTC) (envelope-from git@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 4DDWFc35x5z3n99; Sun, 10 Jan 2021 22:08:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D1E87E81; Sun, 10 Jan 2021 22:08:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AM8q9u061866; Sun, 10 Jan 2021 22:08:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AM8qOx061865; Sun, 10 Jan 2021 22:08:52 GMT (envelope-from git) Date: Sun, 10 Jan 2021 22:08:52 GMT Message-Id: <202101102208.10AM8qOx061865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a013e285dfd6 - main - x86 tsc: mark %eax as earlyclobber in tscp_get_timecount_low(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a013e285dfd6b89b1908ca13febb0fdb0a7f3b1f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 22:08:52 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a013e285dfd6b89b1908ca13febb0fdb0a7f3b1f commit a013e285dfd6b89b1908ca13febb0fdb0a7f3b1f Author: Konstantin Belousov AuthorDate: 2021-01-10 22:05:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-10 22:05:49 +0000 x86 tsc: mark %eax as earlyclobber in tscp_get_timecount_low(). i386 codegen insists on preloading tc_priv into register on i386, and this register cannot be %eax because RDTSCP instruction clobbers it before it is used. Reported and tested by: dim MFC after: 6 days Sponsored by: The FreeBSD Foundation --- sys/x86/x86/tsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index ad8108c8a7ea..85924df98312 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -826,7 +826,7 @@ tscp_get_timecount_low(struct timecounter *tc) uint32_t rv; __asm __volatile("rdtscp; movl %1, %%ecx; shrd %%cl, %%edx, %0" - : "=a" (rv) : "m" (tc->tc_priv) : "ecx", "edx"); + : "=&a" (rv) : "m" (tc->tc_priv) : "ecx", "edx"); return (rv); } From owner-dev-commits-src-all@freebsd.org Sun Jan 10 22:29:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 123D04DC1B8; Sun, 10 Jan 2021 22:29:51 +0000 (UTC) (envelope-from git@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 4DDWjp6Cvrz3p8G; Sun, 10 Jan 2021 22:29:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C86807FC6; Sun, 10 Jan 2021 22:29:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AMTomY087575; Sun, 10 Jan 2021 22:29:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AMToeD087574; Sun, 10 Jan 2021 22:29:50 GMT (envelope-from git) Date: Sun, 10 Jan 2021 22:29:50 GMT Message-Id: <202101102229.10AMToeD087574@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 89632acb50f1 - main - loader: term_image_display() should test screen_buffer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 89632acb50f1a0bcc6ce82b9921f779cafaa9468 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 22:29:51 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=89632acb50f1a0bcc6ce82b9921f779cafaa9468 commit 89632acb50f1a0bcc6ce82b9921f779cafaa9468 Author: Toomas Soome AuthorDate: 2021-01-10 19:56:34 +0000 Commit: Toomas Soome CommitDate: 2021-01-10 19:59:52 +0000 loader: term_image_display() should test screen_buffer Make sure screen_buffer is not NULL. --- stand/efi/libefi/efi_console.c | 3 +++ stand/i386/libi386/vidconsole.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c index 22adcd3a00e2..6782cf5696a8 100644 --- a/stand/efi/libefi/efi_console.c +++ b/stand/efi/libefi/efi_console.c @@ -147,6 +147,9 @@ term_image_display(teken_gfx_t *state, const teken_rect_t *r) teken_pos_t p; int idx; + if (screen_buffer == NULL) + return; + for (p.tp_row = r->tr_begin.tp_row; p.tp_row < r->tr_end.tp_row; p.tp_row++) { for (p.tp_col = r->tr_begin.tp_col; diff --git a/stand/i386/libi386/vidconsole.c b/stand/i386/libi386/vidconsole.c index 47150b3dd09f..b42a476ef85e 100644 --- a/stand/i386/libi386/vidconsole.c +++ b/stand/i386/libi386/vidconsole.c @@ -109,6 +109,9 @@ term_image_display(teken_gfx_t *state, const teken_rect_t *r) teken_pos_t p; int idx; + if (screen_buffer == NULL) + return; + for (p.tp_row = r->tr_begin.tp_row; p.tp_row < r->tr_end.tp_row; p.tp_row++) { for (p.tp_col = r->tr_begin.tp_col; From owner-dev-commits-src-all@freebsd.org Sun Jan 10 22:56:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A5DF64DC855; Sun, 10 Jan 2021 22:56:41 +0000 (UTC) (envelope-from git@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 4DDXJn4GX2z3qHW; Sun, 10 Jan 2021 22:56:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 818B810A8C; Sun, 10 Jan 2021 22:56:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AMufu9026081; Sun, 10 Jan 2021 22:56:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AMufSY026080; Sun, 10 Jan 2021 22:56:41 GMT (envelope-from git) Date: Sun, 10 Jan 2021 22:56:41 GMT Message-Id: <202101102256.10AMufSY026080@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 55f0ad5fdee1 - main - netmap: restore hwofs and support it in iflib MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 55f0ad5fdee1a779d6889481ba591a819081b9ca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 22:56:41 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=55f0ad5fdee1a779d6889481ba591a819081b9ca commit 55f0ad5fdee1a779d6889481ba591a819081b9ca Author: Vincenzo Maffione AuthorDate: 2021-01-10 22:49:37 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-10 22:51:15 +0000 netmap: restore hwofs and support it in iflib Restore the hwofs functionality temporarily disabled by 7ba6ecf216fb15e8b147db2 to prevent issues with iflib. This patch brings the necessary changes to iflib to enable howfs to allow interface restarts without disrupting netmap applications actively using its rings. After this change, it becomes possible for multiple non-cooperating netmap applications to use non-overlapping subsets of the available netmap rings without clashing with each other. PR: 252453 MFC after: 1 week --- sys/dev/netmap/netmap.c | 47 ++++++++++++++++++++++++++++++++++------------- sys/net/iflib.c | 40 +++++++++++++++++++++++++++------------- 2 files changed, 61 insertions(+), 26 deletions(-) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index cabbd35aec20..62d00f0bffc7 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -640,7 +640,7 @@ void netmap_disable_all_rings(struct ifnet *ifp) { if (NM_NA_VALID(ifp)) { - netmap_set_all_rings(NA(ifp), NM_KR_STOPPED); + netmap_set_all_rings(NA(ifp), NM_KR_LOCKED); } } @@ -4072,12 +4072,13 @@ done: /* * Reset function to be called by the driver routines when reinitializing * a hardware ring. The driver is in charge of locking to protect the kring - * while this operation is being performed. - * This is normally done by calling netmap_disable_all_rings() before - * triggering a reset. + * while this operation is being performed. This is normally achieved by + * calling netmap_disable_all_rings() before triggering a reset. * If the kring is not in netmap mode, return NULL to inform the caller * that this is the case. - * If the kring is in netmap mode, reset the kring indices to 0. + * If the kring is in netmap mode, set hwofs so that the netmap indices + * seen by userspace (head/cut/tail) do not change, although the internal + * NIC indices have been reset to 0. * In any case, adjust kring->nr_mode. */ struct netmap_slot * @@ -4085,6 +4086,7 @@ netmap_reset(struct netmap_adapter *na, enum txrx tx, u_int n, u_int new_cur) { struct netmap_kring *kring; + u_int new_hwtail, new_hwofs; if (!nm_native_on(na)) { nm_prdis("interface not in native netmap mode"); @@ -4094,26 +4096,45 @@ netmap_reset(struct netmap_adapter *na, enum txrx tx, u_int n, if (tx == NR_TX) { if (n >= na->num_tx_rings) return NULL; - kring = na->tx_rings[n]; - + /* + * Set hwofs to rhead, so that slots[rhead] is mapped to + * the NIC internal slot 0, and thus the netmap buffer + * at rhead is the next to be transmitted. Transmissions + * that were pending before the reset are considered as + * sent, so that we can have hwcur = rhead. All the slots + * are now owned by the user, so we can also reinit hwtail. + */ + new_hwofs = kring->rhead; + new_hwtail = nm_prev(kring->rhead, kring->nkr_num_slots - 1); } else { if (n >= na->num_rx_rings) return NULL; kring = na->rx_rings[n]; + /* + * Set hwofs to hwtail, so that slots[hwtail] is mapped to + * the NIC internal slot 0, and thus the netmap buffer + * at hwtail is the next to be given to the NIC. + * Unread slots (the ones in [rhead,hwtail[) are owned by + * the user, and thus the caller cannot give them + * to the NIC right now. + */ + new_hwofs = kring->nr_hwtail; + new_hwtail = kring->nr_hwtail; } if (kring->nr_pending_mode == NKR_NETMAP_OFF) { kring->nr_mode = NKR_NETMAP_OFF; return NULL; } if (netmap_verbose) { - nm_prinf("%s, was: hc %u h %u c %u ht %u", kring->name, - kring->nr_hwcur, kring->ring->head, - kring->ring->cur, kring->nr_hwtail); + nm_prinf("%s, hc %u->%u, ht %u->%u, ho %u->%u", kring->name, + kring->nr_hwcur, kring->rhead, + kring->nr_hwtail, new_hwtail, + kring->nkr_hwofs, new_hwofs); } - /* For the moment being, nkr_hwofs is not used. */ - kring->rhead = kring->rcur = kring->nr_hwcur = kring->nkr_hwofs = 0; - kring->nr_hwtail = (tx == NR_TX) ? (kring->nkr_num_slots - 1) : 0; + kring->nr_hwcur = kring->rhead; + kring->nr_hwtail = new_hwtail; + kring->nkr_hwofs = new_hwofs; /* * Wakeup on the individual and global selwait diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 0a40a0825a95..4b4952122d1e 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -834,13 +834,13 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init) { struct netmap_adapter *na = kring->na; u_int const lim = kring->nkr_num_slots - 1; - u_int nm_i = kring->nr_hwcur; struct netmap_ring *ring = kring->ring; bus_dmamap_t *map; struct if_rxd_update iru; if_ctx_t ctx = rxq->ifr_ctx; iflib_fl_t fl = &rxq->ifr_fl[0]; u_int nic_i_first, nic_i; + u_int nm_i; int i, n; #if IFLIB_DEBUG_COUNTERS int rf_count = 0; @@ -849,31 +849,42 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init) /* * This function is used both at initialization and in rxsync. * At initialization we need to prepare (with isc_rxd_refill()) - * all the (N) netmap buffers in the ring, in such a way to keep - * fl->ifl_pidx and kring->nr_hwcur in sync (except for - * kring->nkr_hwofs); at rxsync time, both indexes point to the - * next buffer to be refilled. + * all the netmap buffers currently owned by the kernel, in + * such a way to keep fl->ifl_pidx and kring->nr_hwcur in sync + * (except for kring->nkr_hwofs). These may be less than + * kring->nkr_num_slots if netmap_reset() was called while + * an application using the kring that still owned some + * buffers. + * At rxsync time, both indexes point to the next buffer to be + * refilled. * In any case we publish (with isc_rxd_flush()) up to * (fl->ifl_pidx - 1) % N (included), to avoid the NIC tail/prod * pointer to overrun the head/cons pointer, although this is * not necessary for some NICs (e.g. vmx). */ - if (__predict_false(init)) - n = kring->nkr_num_slots; - else { - n = kring->rhead - nm_i; + if (__predict_false(init)) { + n = kring->nkr_num_slots - nm_kr_rxspace(kring); + } else { + n = kring->rhead - kring->nr_hwcur; if (n == 0) return (0); /* Nothing to do. */ if (n < 0) n += kring->nkr_num_slots; } - /* Start to refill from nr_hwcur, publishing n buffers. */ iru_init(&iru, rxq, 0 /* flid */); map = fl->ifl_sds.ifsd_map; nic_i = fl->ifl_pidx; - MPASS(!init || nic_i == 0); /* on init/reset, nic_i must be 0 */ - MPASS(nic_i == netmap_idx_k2n(kring, nm_i)); + nm_i = netmap_idx_n2k(kring, nic_i); + if (__predict_false(init)) { + /* + * On init/reset, nic_i must be 0, and we must + * start to refill from hwtail (see netmap_reset()). + */ + MPASS(nic_i == 0); + MPASS(nm_i == kring->nr_hwtail); + } else + MPASS(nm_i == kring->nr_hwcur); DBG_COUNTER_INC(fl_refills); while (n > 0) { #if IFLIB_DEBUG_COUNTERS @@ -913,7 +924,10 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init) ctx->isc_rxd_refill(ctx->ifc_softc, &iru); } fl->ifl_pidx = nic_i; - MPASS(!init || nic_i == 0); /* on init/reset nic_i wraps around to 0 */ + /* + * At the end of the loop we must have refilled everything + * we could possibly refill. + */ MPASS(nm_i == kring->rhead); kring->nr_hwcur = nm_i; From owner-dev-commits-src-all@freebsd.org Sun Jan 10 23:00:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 963004DCD84; Sun, 10 Jan 2021 23:00:02 +0000 (UTC) (envelope-from git@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 4DDXNf3v7gz3qfN; Sun, 10 Jan 2021 23:00:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 789C4105ED; Sun, 10 Jan 2021 23:00:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10AN02Nl027816; Sun, 10 Jan 2021 23:00:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10AN027R027814; Sun, 10 Jan 2021 23:00:02 GMT (envelope-from git) Date: Sun, 10 Jan 2021 23:00:02 GMT Message-Id: <202101102300.10AN027R027814@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d00431a7bd0c - main - libdtrace: Format USDT symbols correctly based on symbol binding MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d00431a7bd0c4b4607943baed588e58ad5ae6150 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 23:00:02 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d00431a7bd0c4b4607943baed588e58ad5ae6150 commit d00431a7bd0c4b4607943baed588e58ad5ae6150 Author: Mark Johnston AuthorDate: 2021-01-10 22:46:32 +0000 Commit: Mark Johnston CommitDate: 2021-01-10 22:58:38 +0000 libdtrace: Format USDT symbols correctly based on symbol binding Before we did not handle weak symbols correctly, sometimes resulting in link errors from dtrace -G when processing object files where functions with weak aliases contain USDT probes. Reported by: rlibby Tested by: rlibby MFC after: 1 week Sponsored by: The FreeBSD Foundation --- cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c index 8f32890057f0..0b3dac0224f9 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c @@ -1344,18 +1344,24 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp) /* * Aliases of weak symbols don't get a uniquifier. */ - if (GELF_ST_BIND(fsym.st_info) == STB_WEAK) + if (GELF_ST_BIND(fsym.st_info) == STB_WEAK) { len = snprintf(NULL, 0, dt_weaksymfmt, dt_symprefix, s) + 1; - else + } else { len = snprintf(NULL, 0, dt_symfmt, dt_symprefix, objkey, s) + 1; + } if ((p = dt_alloc(dtp, len)) == NULL) { dt_strtab_destroy(strtab); goto err; } - (void) snprintf(p, len, dt_symfmt, dt_symprefix, - objkey, s); + if (GELF_ST_BIND(fsym.st_info) == STB_WEAK) { + (void) snprintf(p, len, dt_weaksymfmt, + dt_symprefix, s); + } else { + (void) snprintf(p, len, dt_symfmt, dt_symprefix, + objkey, s); + } if (dt_strtab_index(strtab, p) == -1) { /*