From owner-svn-src-head@freebsd.org Sun Oct 20 00:43:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E8E515B11E; Sun, 20 Oct 2019 00:43:20 +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 46wgx36BL3z3KkH; Sun, 20 Oct 2019 00:43:19 +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 x9K0h6B7030773; Sat, 19 Oct 2019 17:43:06 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x9K0h5YZ030772; Sat, 19 Oct 2019 17:43:05 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201910200043.x9K0h5YZ030772@gndrsh.dnsmgr.net> Subject: Re: svn commit: r353365 - head/usr.bin/procstat In-Reply-To: To: Jeremie Le Hen Date: Sat, 19 Oct 2019 17:43:05 -0700 (PDT) CC: rgrimes@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-head@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: 46wgx36BL3z3KkH X-Spamd-Bar: ----- X-Spamd-Result: default: False [-5.93 / 15.00]; NEURAL_HAM_MEDIUM(-0.93)[-0.933,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 00:43:20 -0000 > On Thu, Oct 10, 2019 at 11:27 PM Rodney W. Grimes > wrote: > > > > > Author: jlh > > > Date: Wed Oct 9 20:05:14 2019 > > > New Revision: 353365 > > > URL: https://svnweb.freebsd.org/changeset/base/353365 > > > > > > Log: > > > Add a missing macro for the previous commit (IS_INADDR_ANY()). > > > > Can we write it the same was as it is 100+ other places? > > 1022}# find . -type f | xargs grep "== INADDR_ANY" | wc > > 131 781 9607 > > Done in r353768. Thanks! Thank you. > > > Modified: > > > head/usr.bin/procstat/procstat_files.c > > > > > > Modified: head/usr.bin/procstat/procstat_files.c > > > ============================================================================== > > > --- head/usr.bin/procstat/procstat_files.c Wed Oct 9 20:01:23 2019 (r353364) > > > +++ head/usr.bin/procstat/procstat_files.c Wed Oct 9 20:05:14 2019 (r353365) > > > @@ -94,6 +94,7 @@ addr_to_string(struct sockaddr_storage *ss, char *buff > > > struct sockaddr_in6 *sin6; > > > struct sockaddr_in *sin; > > > struct sockaddr_un *sun; > > > +#define IS_INADDR_ANY(x) ((x).s_addr == INADDR_ANY) > > > > > > switch (ss->ss_family) { > > > case AF_LOCAL: > > > > > > > -- > > Rod Grimes rgrimes@freebsd.org > > > > -- > Jeremie Le Hen > jlh@FreeBSD.org > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Oct 20 10:48:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A3DC15B43C; Sun, 20 Oct 2019 10:48:29 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46wxMK1Srpz4cBB; Sun, 20 Oct 2019 10:48:29 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16C73A97B; Sun, 20 Oct 2019 10:48:29 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KAmTI2036279; Sun, 20 Oct 2019 10:48:29 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KAmR1O036272; Sun, 20 Oct 2019 10:48:27 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201910201048.x9KAmR1O036272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 20 Oct 2019 10:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353773 - in head/sys: arm/mv arm64/conf conf X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: arm/mv arm64/conf conf X-SVN-Commit-Revision: 353773 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 10:48:29 -0000 Author: mmel Date: Sun Oct 20 10:48:27 2019 New Revision: 353773 URL: https://svnweb.freebsd.org/changeset/base/353773 Log: Update Armada 8k drivers to cover newly imported DT and latest changes in simple multifunction driver. - follow interrupt changes in DT. Split old ICU driver to function oriented parts and add drivers for newly defined parts (system error interrupts). - Many drivers are children of simple multifunction driver. But after r349596 simple MF driver doesn't longer exports memory resources, and all children must use syscon interface to access their registers. Adapt affected drivers to this fact. MFC after: 3 weeks Added: head/sys/arm/mv/mv_ap806_sei.c (contents, props changed) head/sys/arm/mv/mv_cp110_icu_bus.c (contents, props changed) Modified: head/sys/arm/mv/mv_ap806_clock.c head/sys/arm/mv/mv_ap806_gicp.c head/sys/arm/mv/mv_cp110_clock.c head/sys/arm/mv/mv_cp110_icu.c head/sys/arm/mv/mv_thermal.c head/sys/arm/mv/mvebu_pinctrl.c head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm/mv/mv_ap806_clock.c ============================================================================== --- head/sys/arm/mv/mv_ap806_clock.c Sun Oct 20 01:09:14 2019 (r353772) +++ head/sys/arm/mv/mv_ap806_clock.c Sun Oct 20 10:48:27 2019 (r353773) @@ -44,13 +44,15 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include +#include #include #include -#include +#include "syscon_if.h" + static struct clk_fixed_def ap806_clk_cluster_0 = { .clkdef.id = 0, .clkdef.name = "ap806-cpu-cluster-0", @@ -92,23 +94,19 @@ static struct clk_fixed_def ap806_clk_sdio = { }; struct mv_ap806_clock_softc { - struct simplebus_softc simplebus_sc; device_t dev; - struct resource *res; + struct syscon *syscon; }; -static struct resource_spec mv_ap806_clock_res_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE | RF_SHAREABLE }, - { -1, 0 } -}; + static struct ofw_compat_data compat_data[] = { - {"marvell,ap806-clock", 1}, - {NULL, 0} + {"marvell,ap806-clock", 1}, + {NULL, 0} }; -#define RD4(sc, reg) bus_read_4((sc)->res, (reg)) -#define WR4(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) +#define RD4(sc, reg) SYSCON_READ_4((sc)->syscon, (reg)) +#define WR4(sc, reg, val) SYSCON_WRITE_4((sc)->syscon, (reg), (val)) static int mv_ap806_clock_probe(device_t dev) @@ -135,8 +133,9 @@ mv_ap806_clock_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - if (bus_alloc_resources(dev, mv_ap806_clock_res_spec, &sc->res) != 0) { - device_printf(dev, "cannot allocate resources for device\n"); + if (SYSCON_GET_HANDLE(sc->dev, &sc->syscon) != 0 || + sc->syscon == NULL) { + device_printf(dev, "cannot get syscon for device\n"); return (ENXIO); } @@ -160,7 +159,8 @@ mv_ap806_clock_attach(device_t dev) clock_freq = 1333000000; break; default: - device_printf(dev, "Cannot guess clock freq with reg %x\n", reg & 0x1f); + device_printf(dev, "Cannot guess clock freq with reg %x\n", + reg & 0x1f); return (ENXIO); break; }; Modified: head/sys/arm/mv/mv_ap806_gicp.c ============================================================================== --- head/sys/arm/mv/mv_ap806_gicp.c Sun Oct 20 01:09:14 2019 (r353772) +++ head/sys/arm/mv/mv_ap806_gicp.c Sun Oct 20 10:48:27 2019 (r353773) @@ -60,6 +60,7 @@ struct mv_ap806_gicp_softc { ssize_t spi_ranges_cnt; uint32_t *spi_ranges; + struct intr_map_data_fdt *parent_map_data; }; static struct ofw_compat_data compat_data[] = { @@ -96,11 +97,13 @@ mv_ap806_gicp_attach(device_t dev) /* Look for our parent */ if ((intr_parent = ofw_bus_find_iparent(node)) == 0) { - device_printf(dev, "Cannot find our parent interrupt controller\n"); + device_printf(dev, + "Cannot find our parent interrupt controller\n"); return (ENXIO); } if ((sc->parent = OF_device_from_xref(intr_parent)) == NULL) { - device_printf(dev, "cannot find parent interrupt controller device\n"); + device_printf(dev, + "cannot find parent interrupt controller device\n"); return (ENXIO); } @@ -112,7 +115,10 @@ mv_ap806_gicp_attach(device_t dev) device_printf(dev, "Cannot register GICP\n"); return (ENXIO); } - + /* Allocate GIC compatible mapping entry (3 cells) */ + sc->parent_map_data = (struct intr_map_data_fdt *)intr_alloc_map_data( + INTR_MAP_DATA_FDT, sizeof(struct intr_map_data_fdt) + + + 3 * sizeof(phandle_t), M_WAITOK | M_ZERO); OF_device_register_xref(xref, dev); return (0); @@ -125,6 +131,45 @@ mv_ap806_gicp_detach(device_t dev) return (EBUSY); } +static struct intr_map_data * +mv_ap806_gicp_convert_map_data(struct mv_ap806_gicp_softc *sc, + struct intr_map_data *data) +{ + struct intr_map_data_fdt *daf; + uint32_t i, irq_num, irq_type; + + daf = (struct intr_map_data_fdt *)data; + if (daf->ncells != 2) + return (NULL); + + irq_num = daf->cells[0]; + irq_type = daf->cells[1]; + if (irq_num >= MV_AP806_GICP_MAX_NIRQS) + return (NULL); + + /* Construct GIC compatible mapping. */ + sc->parent_map_data->ncells = 3; + sc->parent_map_data->cells[0] = 0; /* SPI */ + sc->parent_map_data->cells[2] = irq_type; + + /* Map the interrupt number to SPI number */ + for (i = 0; i < sc->spi_ranges_cnt / 2; i += 2) { + if (irq_num < sc->spi_ranges[i + 1]) { + irq_num += sc->spi_ranges[i]; + break; + } + + irq_num -= sc->spi_ranges[i]; + } + + sc->parent_map_data->cells[1] = irq_num - 32; + + return ((struct intr_map_data *)sc->parent_map_data); +} + + + + static int mv_ap806_gicp_activate_intr(device_t dev, struct intr_irqsrc *isrc, struct resource *res, struct intr_map_data *data) @@ -132,6 +177,9 @@ mv_ap806_gicp_activate_intr(device_t dev, struct intr_ struct mv_ap806_gicp_softc *sc; sc = device_get_softc(dev); + data = mv_ap806_gicp_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_ACTIVATE_INTR(sc->parent, isrc, res, data)); } @@ -161,36 +209,20 @@ mv_ap806_gicp_map_intr(device_t dev, struct intr_map_d struct intr_irqsrc **isrcp) { struct mv_ap806_gicp_softc *sc; - struct intr_map_data_fdt *daf; - uint32_t group, irq_num, irq_type; - int i; + int ret; sc = device_get_softc(dev); if (data->type != INTR_MAP_DATA_FDT) return (ENOTSUP); - daf = (struct intr_map_data_fdt *)data; - if (daf->ncells != 3 || daf->cells[0] >= MV_AP806_GICP_MAX_NIRQS) + data = mv_ap806_gicp_convert_map_data(sc, data); + if (data == NULL) return (EINVAL); - group = daf->cells[0]; - irq_num = daf->cells[1]; - irq_type = daf->cells[2]; - - /* Map the interrupt number to spi number */ - for (i = 0; i < sc->spi_ranges_cnt / 2; i += 2) { - if (irq_num < sc->spi_ranges[i + 1]) { - irq_num += sc->spi_ranges[i]; - break; - } - - irq_num -= sc->spi_ranges[i]; - } - - daf->cells[1] = irq_num - 32; - - return (PIC_MAP_INTR(sc->parent, data, isrcp)); + ret = PIC_MAP_INTR(sc->parent, data, isrcp); + (*isrcp)->isrc_dev = sc->dev; + return(ret); } static int @@ -201,6 +233,10 @@ mv_ap806_gicp_deactivate_intr(device_t dev, struct int sc = device_get_softc(dev); + data = mv_ap806_gicp_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); + return (PIC_DEACTIVATE_INTR(sc->parent, isrc, res, data)); } @@ -211,6 +247,9 @@ mv_ap806_gicp_setup_intr(device_t dev, struct intr_irq struct mv_ap806_gicp_softc *sc; sc = device_get_softc(dev); + data = mv_ap806_gicp_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_SETUP_INTR(sc->parent, isrc, res, data)); } @@ -222,6 +261,9 @@ mv_ap806_gicp_teardown_intr(device_t dev, struct intr_ struct mv_ap806_gicp_softc *sc; sc = device_get_softc(dev); + data = mv_ap806_gicp_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_TEARDOWN_INTR(sc->parent, isrc, res, data)); } Added: head/sys/arm/mv/mv_ap806_sei.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/mv_ap806_sei.c Sun Oct 20 10:48:27 2019 (r353773) @@ -0,0 +1,419 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * 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 +#include + +#include "pic_if.h" + +#define MV_AP806_SEI_LOCK(_sc) mtx_lock(&(_sc)->mtx) +#define MV_AP806_SEI_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx) +#define MV_AP806_SEI_LOCK_INIT(_sc) mtx_init(&_sc->mtx, \ + device_get_nameunit(_sc->dev), "mv_ap806_sei", MTX_DEF) +#define MV_AP806_SEI_LOCK_DESTROY(_sc) mtx_destroy(&_sc->mtx); +#define MV_AP806_SEI_ASSERT_LOCKED(_sc) mtx_assert(&_sc->mtx, MA_OWNED); +#define MV_AP806_SEI_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->mtx, MA_NOTOWNED); + +#define MV_AP806_SEI_MAX_NIRQS 64 +#define GICP_SECR0 0x00 +#define GICP_SECR1 0x04 +#define GICP_SECR(i) (0x00 + (((i)/32) * 0x4)) +#define GICP_SECR_BIT(i) ((i) % 32) +#define GICP_SEMR0 0x20 +#define GICP_SEMR1 0x24 +#define GICP_SEMR(i) (0x20 + (((i)/32) * 0x4)) +#define GICP_SEMR_BIT(i) ((i) % 32) + + + +struct mv_ap806_sei_irqsrc { + struct intr_irqsrc isrc; + u_int irq; +}; + +struct mv_ap806_sei_softc { + device_t dev; + struct resource *mem_res; + struct resource *irq_res; + void *irq_ih; + struct mtx mtx; + + struct mv_ap806_sei_irqsrc *isrcs; +}; + +static struct ofw_compat_data compat_data[] = { + {"marvell,ap806-sei", 1}, + {NULL, 0} +}; + +#define RD4(sc, reg) bus_read_4((sc)->mem_res, (reg)) +#define WR4(sc, reg, val) bus_write_4((sc)->mem_res, (reg), (val)) + +static inline void +mv_ap806_sei_isrc_mask(struct mv_ap806_sei_softc *sc, + struct mv_ap806_sei_irqsrc *sisrc, uint32_t val) +{ + uint32_t tmp; + int bit; + + bit = GICP_SEMR_BIT(sisrc->irq); + MV_AP806_SEI_LOCK(sc); + tmp = RD4(sc, GICP_SEMR(sisrc->irq)); + if (val != 0) + tmp |= 1 << bit; + else + tmp &= ~(1 << bit); + WR4(sc, GICP_SEMR(sisrc->irq), tmp); + MV_AP806_SEI_UNLOCK(sc); +} + +static inline void +mv_ap806_sei_isrc_eoi(struct mv_ap806_sei_softc *sc, + struct mv_ap806_sei_irqsrc *sisrc) +{ + + WR4(sc, GICP_SECR(sisrc->irq), GICP_SECR_BIT(sisrc->irq)); +} + +static void +mv_ap806_sei_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + mv_ap806_sei_isrc_mask(sc, sisrc, 0); +} + +static void +mv_ap806_sei_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + mv_ap806_sei_isrc_mask(sc, sisrc, 1); +} + +static int +mv_ap806_sei_map(device_t dev, struct intr_map_data *data, u_int *irqp) +{ + struct mv_ap806_sei_softc *sc; + struct intr_map_data_fdt *daf; + u_int irq; + + sc = device_get_softc(dev); + + if (data->type != INTR_MAP_DATA_FDT) + return (ENOTSUP); + + daf = (struct intr_map_data_fdt *)data; + if (daf->ncells != 1 || daf->cells[0] >= MV_AP806_SEI_MAX_NIRQS) + return (EINVAL); + irq = daf->cells[0]; + if (irqp != NULL) + *irqp = irq; + + return(0); +} + +static int +mv_ap806_sei_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ + struct mv_ap806_sei_softc *sc; + u_int irq; + int rv; + + sc = device_get_softc(dev); + rv = mv_ap806_sei_map(dev, data, &irq); + if (rv == 0) + *isrcp = &sc->isrcs[irq].isrc; + + return (rv); +} + + + +static int +mv_ap806_sei_setup_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + u_int irq; + int rv; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + if (data == NULL) + return (ENOTSUP); + rv = mv_ap806_sei_map(dev, data, &irq); + if (rv != 0) + return (rv); + if (irq != sisrc->irq) + return (EINVAL); + mv_ap806_sei_isrc_mask(sc, sisrc, 0); + return (0); +} + +static int +mv_ap806_sei_teardown_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + + mv_ap806_sei_isrc_mask(sc, sisrc, 1); + return (0); +} + +static void +mv_ap806_sei_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + + mv_ap806_sei_isrc_mask(sc, sisrc, 1); + mv_ap806_sei_isrc_eoi(sc, sisrc); +} + +static void +mv_ap806_sei_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + + mv_ap806_sei_isrc_mask(sc, sisrc, 1); +} + +static void +mv_ap806_sei_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + + mv_ap806_sei_isrc_mask(sc, sisrc, 1); + mv_ap806_sei_isrc_eoi(sc, sisrc); +} + +/* ---------------------------------------------------------------------------- + * + * B u s i n t e r f a c e + */ +static int +mv_ap806_sei_intr(void *arg) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sirq; + struct trapframe *tf; + uint64_t cause; + u_int irq; + + sc = (struct mv_ap806_sei_softc *)arg; + tf = curthread->td_intr_frame; + while (1) { + cause = RD4(sc, GICP_SECR1); + cause <<= 32; + cause |= RD4(sc, GICP_SECR0); + + irq = ffsll(cause); + if (irq == 0) break; + irq--; + sirq = &sc->isrcs[irq]; + if (intr_isrc_dispatch(&sirq->isrc, tf) != 0) { + mv_ap806_sei_isrc_mask(sc, sirq, 0); + mv_ap806_sei_isrc_eoi(sc, sirq); + device_printf(sc->dev, + "Stray irq %u disabled\n", irq); + } + } + + return (FILTER_HANDLED); +} + + +static int +mv_ap806_sei_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Marvell SEI"); + return (BUS_PROBE_DEFAULT); +} + +static int +mv_ap806_sei_attach(device_t dev) +{ + struct mv_ap806_sei_softc *sc; + phandle_t xref, node; + uint32_t irq; + const char *name; + int rv, rid; + + sc = device_get_softc(dev); + sc->dev = dev; + node = ofw_bus_get_node(dev); + MV_AP806_SEI_LOCK_INIT(sc); + + /* Allocate resources. */ + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "Cannot allocate memory resources\n"); + rv = ENXIO; + goto fail; + } + + rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); + if (sc->irq_res == NULL) { + device_printf(dev, "Cannot allocate IRQ resources\n"); + rv = ENXIO; + goto fail; + } + + /* Mask all interrupts) */ + WR4(sc, GICP_SEMR0, 0xFFFFFFFF); + WR4(sc, GICP_SEMR1, 0xFFFFFFFF); + + /* Create all interrupt sources */ + sc->isrcs = malloc(sizeof(*sc->isrcs) * MV_AP806_SEI_MAX_NIRQS, + M_DEVBUF, M_WAITOK | M_ZERO); + name = device_get_nameunit(sc->dev); + for (irq = 0; irq < MV_AP806_SEI_MAX_NIRQS; irq++) { + sc->isrcs[irq].irq = irq; + rv = intr_isrc_register(&sc->isrcs[irq].isrc, + sc->dev, 0, "%s,%u", name, irq); + if (rv != 0) + goto fail; /* XXX deregister ISRCs */ + } + xref = OF_xref_from_node(node);; + if (intr_pic_register(dev, xref) == NULL) { + device_printf(dev, "Cannot register SEI\n"); + rv = ENXIO; + goto fail; + } + if (bus_setup_intr(dev, sc->irq_res,INTR_TYPE_MISC | INTR_MPSAFE, + mv_ap806_sei_intr, NULL, sc, &sc->irq_ih)) { + device_printf(dev, + "Unable to register interrupt handler\n"); + rv = ENXIO; + goto fail; + } + + OF_device_register_xref(xref, dev); + return (0); + +fail: + if (sc->irq_ih != NULL) + bus_teardown_intr(dev, sc->irq_res, sc->irq_ih); + if (sc->irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); + if (sc->mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); + MV_AP806_SEI_LOCK_DESTROY(sc); + return (ENXIO); +} + +static int +mv_ap806_sei_detach(device_t dev) +{ + + return (EBUSY); +} + + +static device_method_t mv_ap806_sei_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mv_ap806_sei_probe), + DEVMETHOD(device_attach, mv_ap806_sei_attach), + DEVMETHOD(device_detach, mv_ap806_sei_detach), + + /* Interrupt controller interface */ + DEVMETHOD(pic_disable_intr, mv_ap806_sei_disable_intr), + DEVMETHOD(pic_enable_intr, mv_ap806_sei_enable_intr), + DEVMETHOD(pic_map_intr, mv_ap806_sei_map_intr), + DEVMETHOD(pic_setup_intr, mv_ap806_sei_setup_intr), + DEVMETHOD(pic_teardown_intr, mv_ap806_sei_teardown_intr), + DEVMETHOD(pic_post_filter, mv_ap806_sei_post_filter), + DEVMETHOD(pic_post_ithread, mv_ap806_sei_post_ithread), + DEVMETHOD(pic_pre_ithread, mv_ap806_sei_pre_ithread), + + DEVMETHOD_END +}; + +static devclass_t mv_ap806_sei_devclass; + +static driver_t mv_ap806_sei_driver = { + "mv_ap806_sei", + mv_ap806_sei_methods, + sizeof(struct mv_ap806_sei_softc), +}; + +EARLY_DRIVER_MODULE(mv_ap806_sei, simplebus, mv_ap806_sei_driver, + mv_ap806_sei_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm/mv/mv_cp110_clock.c ============================================================================== --- head/sys/arm/mv/mv_cp110_clock.c Sun Oct 20 01:09:14 2019 (r353772) +++ head/sys/arm/mv/mv_cp110_clock.c Sun Oct 20 10:48:27 2019 (r353773) @@ -44,17 +44,17 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include +#include +#include #include #include -#include -#include - #include #include "clkdev_if.h" +#include "syscon_if.h" /* Clocks */ static struct clk_fixed_def cp110_clk_pll_0 = { @@ -126,24 +126,19 @@ static struct cp110_gate cp110_gates[] = { }; struct mv_cp110_clock_softc { - struct simplebus_softc simplebus_sc; device_t dev; - struct resource *res; + struct syscon *syscon; struct mtx mtx; }; -static struct resource_spec mv_cp110_clock_res_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE | RF_SHAREABLE }, - { -1, 0 } -}; static struct ofw_compat_data compat_data[] = { {"marvell,cp110-clock", 1}, {NULL, 0} }; -#define RD4(sc, reg) bus_read_4((sc)->res, (reg)) -#define WR4(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) +#define RD4(sc, reg) SYSCON_READ_4((sc)->syscon, (reg)) +#define WR4(sc, reg, val) SYSCON_WRITE_4((sc)->syscon, (reg), (val)) static char * mv_cp110_clock_name(device_t dev, const char *name) @@ -201,8 +196,9 @@ mv_cp110_clock_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - if (bus_alloc_resources(dev, mv_cp110_clock_res_spec, &sc->res) != 0) { - device_printf(dev, "cannot allocate resources for device\n"); + if (SYSCON_GET_HANDLE(sc->dev, &sc->syscon) != 0 || + sc->syscon == NULL) { + device_printf(dev, "cannot get syscon for device\n"); return (ENXIO); } Modified: head/sys/arm/mv/mv_cp110_icu.c ============================================================================== --- head/sys/arm/mv/mv_cp110_icu.c Sun Oct 20 01:09:14 2019 (r353772) +++ head/sys/arm/mv/mv_cp110_icu.c Sun Oct 20 10:48:27 2019 (r353773) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "pic_if.h" #define ICU_GRP_NSR 0x0 @@ -72,6 +73,7 @@ struct mv_cp110_icu_softc { device_t dev; device_t parent; struct resource *res; + struct intr_map_data_fdt *parent_map_data; }; static struct resource_spec mv_cp110_icu_res_spec[] = { @@ -80,8 +82,9 @@ static struct resource_spec mv_cp110_icu_res_spec[] = }; static struct ofw_compat_data compat_data[] = { - {"marvell,cp110-icu", 1}, - {NULL, 0} + {"marvell,cp110-icu-nsr", 1}, + {"marvell,cp110-icu-sei", 2}, + {NULL, 0} }; #define RD4(sc, reg) bus_read_4((sc)->res, (reg)) @@ -130,6 +133,11 @@ mv_cp110_icu_attach(device_t dev) device_printf(dev, "Cannot register ICU\n"); goto fail; } + + /* Allocate GICP compatible mapping entry (2 cells) */ + sc->parent_map_data = (struct intr_map_data_fdt *)intr_alloc_map_data( + INTR_MAP_DATA_FDT, sizeof(struct intr_map_data_fdt) + + + 3 * sizeof(phandle_t), M_WAITOK | M_ZERO); return (0); fail: @@ -137,6 +145,35 @@ fail: return (ENXIO); } +static struct intr_map_data * +mv_cp110_icu_convert_map_data(struct mv_cp110_icu_softc *sc, struct intr_map_data *data) +{ + struct intr_map_data_fdt *daf; + uint32_t reg, irq_no, irq_type; + + daf = (struct intr_map_data_fdt *)data; + if (daf->ncells != 2) + return (NULL); + irq_no = daf->cells[0]; + irq_type = daf->cells[1]; + if (irq_no >= MV_CP110_ICU_MAX_NIRQS) + return (NULL); + if (irq_type != IRQ_TYPE_LEVEL_HIGH && + irq_type != IRQ_TYPE_EDGE_RISING) + return (NULL); + + /* We rely on fact that ICU->GIC mapping is preset by bootstrap. */ + reg = RD4(sc, ICU_INT_CFG(irq_no)); + + /* Construct GICP compatible mapping. */ + sc->parent_map_data->ncells = 2; + sc->parent_map_data->cells[0] = reg & ICU_INT_MASK; + sc->parent_map_data->cells[1] = irq_type; + + return ((struct intr_map_data *)sc->parent_map_data); +} + + static int mv_cp110_icu_detach(device_t dev) { @@ -151,7 +188,9 @@ mv_cp110_icu_activate_intr(device_t dev, struct intr_i struct mv_cp110_icu_softc *sc; sc = device_get_softc(dev); - + data = mv_cp110_icu_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_ACTIVATE_INTR(sc->parent, isrc, res, data)); } @@ -159,7 +198,6 @@ static void mv_cp110_icu_enable_intr(device_t dev, struct intr_irqsrc *isrc) { struct mv_cp110_icu_softc *sc; - sc = device_get_softc(dev); PIC_ENABLE_INTR(sc->parent, isrc); @@ -175,32 +213,43 @@ mv_cp110_icu_disable_intr(device_t dev, struct intr_ir PIC_DISABLE_INTR(sc->parent, isrc); } + + static int mv_cp110_icu_map_intr(device_t dev, struct intr_map_data *data, struct intr_irqsrc **isrcp) { struct mv_cp110_icu_softc *sc; struct intr_map_data_fdt *daf; - uint32_t reg; + uint32_t reg, irq_no, irq_type; + int ret; sc = device_get_softc(dev); if (data->type != INTR_MAP_DATA_FDT) return (ENOTSUP); + /* Parse original */ daf = (struct intr_map_data_fdt *)data; - if (daf->ncells != 3 || daf->cells[0] >= MV_CP110_ICU_MAX_NIRQS) + if (daf->ncells != 2) return (EINVAL); + irq_no = daf->cells[0]; + irq_type = daf->cells[1]; + data = mv_cp110_icu_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); - reg = RD4(sc, ICU_INT_CFG(daf->cells[1])); + reg = RD4(sc, ICU_INT_CFG(irq_no)); + reg |= ICU_INT_ENABLE; + if (irq_type == IRQ_TYPE_LEVEL_HIGH) + reg &= ~ICU_INT_EDGE; + else + reg |= ICU_INT_EDGE; + WR4(sc, ICU_INT_CFG(irq_no), reg); - if ((reg & ICU_INT_ENABLE) == 0) { - reg |= ICU_INT_ENABLE; - WR4(sc, ICU_INT_CFG(daf->cells[1]), reg); - } - - daf->cells[1] = reg & ICU_INT_MASK; - return (PIC_MAP_INTR(sc->parent, data, isrcp)); + ret = PIC_MAP_INTR(sc->parent, data, isrcp); + (*isrcp)->isrc_dev = sc->dev; + return (ret); } static int @@ -210,6 +259,9 @@ mv_cp110_icu_deactivate_intr(device_t dev, struct intr struct mv_cp110_icu_softc *sc; sc = device_get_softc(dev); + data = mv_cp110_icu_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_DEACTIVATE_INTR(sc->parent, isrc, res, data)); } @@ -221,6 +273,9 @@ mv_cp110_icu_setup_intr(device_t dev, struct intr_irqs struct mv_cp110_icu_softc *sc; sc = device_get_softc(dev); + data = mv_cp110_icu_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_SETUP_INTR(sc->parent, isrc, res, data)); } @@ -232,6 +287,9 @@ mv_cp110_icu_teardown_intr(device_t dev, struct intr_i struct mv_cp110_icu_softc *sc; sc = device_get_softc(dev); + data = mv_cp110_icu_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_TEARDOWN_INTR(sc->parent, isrc, res, data)); } @@ -295,5 +353,5 @@ static driver_t mv_cp110_icu_driver = { sizeof(struct mv_cp110_icu_softc), }; -EARLY_DRIVER_MODULE(mv_cp110_icu, simplebus, mv_cp110_icu_driver, +EARLY_DRIVER_MODULE(mv_cp110_icu, mv_cp110_icu_bus, mv_cp110_icu_driver, mv_cp110_icu_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST); Added: head/sys/arm/mv/mv_cp110_icu_bus.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/mv_cp110_icu_bus.c Sun Oct 20 10:48:27 2019 (r353773) @@ -0,0 +1,78 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * 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$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +static struct ofw_compat_data compat_data[] = { + {"marvell,cp110-icu", 1}, + {NULL, 0} +}; + +static int +mv_cp110_icu_bus_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Marvell Interrupt Consolidation Unit Bus"); + return (BUS_PROBE_DEFAULT); +} + +static device_method_t mv_cp110_icu_bus_methods[] = { + DEVMETHOD(device_probe, mv_cp110_icu_bus_probe), + + DEVMETHOD_END +}; + +DEFINE_CLASS_1(mv_cp110_icu_bus, mv_cp110_icu_bus_driver, + mv_cp110_icu_bus_methods, sizeof(struct simple_mfd_softc), + simple_mfd_driver); + +static devclass_t mv_cp110_icu_bus_devclass; +EARLY_DRIVER_MODULE(mv_cp110_icu_bus, simplebus, mv_cp110_icu_bus_driver, + mv_cp110_icu_bus_devclass, 0, 0, BUS_PASS_INTERRUPT); +MODULE_VERSION(mv_cp110_icu_bus, 1); Modified: head/sys/arm/mv/mv_thermal.c ============================================================================== --- head/sys/arm/mv/mv_thermal.c Sun Oct 20 01:09:14 2019 (r353772) +++ head/sys/arm/mv/mv_thermal.c Sun Oct 20 10:48:27 2019 (r353773) @@ -44,13 +44,14 @@ __FBSDID("$FreeBSD$"); #include #include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Oct 20 11:11:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9A3615BB47; Sun, 20 Oct 2019 11:11:33 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46wxsx3t7Lz4d7f; Sun, 20 Oct 2019 11:11:33 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67FDCAD5D; Sun, 20 Oct 2019 11:11:33 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KBBX72049075; Sun, 20 Oct 2019 11:11:33 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KBBWXP049070; Sun, 20 Oct 2019 11:11:32 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201910201111.x9KBBWXP049070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 20 Oct 2019 11:11:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353774 - in head/sys: conf dev/pci X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: conf dev/pci X-SVN-Commit-Revision: 353774 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 11:11:33 -0000 Author: mmel Date: Sun Oct 20 11:11:32 2019 New Revision: 353774 URL: https://svnweb.freebsd.org/changeset/base/353774 Log: Add driver for DesignWare PCIE core, and its Armada 8K specific attachement. MFC after: 3 weeks Added: head/sys/dev/pci/pci_dw.c (contents, props changed) head/sys/dev/pci/pci_dw.h (contents, props changed) head/sys/dev/pci/pci_dw_if.m (contents, props changed) head/sys/dev/pci/pci_dw_mv.c (contents, props changed) Modified: head/sys/conf/files.arm64 Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Sun Oct 20 10:48:27 2019 (r353773) +++ head/sys/conf/files.arm64 Sun Oct 20 11:11:32 2019 (r353774) @@ -246,6 +246,9 @@ dev/ofw/ofwpci.c optional fdt pci dev/pci/pci_host_generic.c optional pci dev/pci/pci_host_generic_acpi.c optional pci acpi dev/pci/pci_host_generic_fdt.c optional pci fdt +dev/pci/pci_dw_mv.c optional pci fdt +dev/pci/pci_dw.c optional pci fdt +dev/pci/pci_dw_if.m optional pci fdt dev/psci/psci.c standard dev/psci/smccc_arm64.S standard dev/psci/smccc.c standard Added: head/sys/dev/pci/pci_dw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/pci/pci_dw.c Sun Oct 20 11:11:32 2019 (r353774) @@ -0,0 +1,697 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * 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. + * + */ + +/* Base class for all Synopsys DesignWare PCI/PCIe drivers */ + +#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 "pcib_if.h" +#include "pci_dw_if.h" + +#define DEBUG +#ifdef DEBUG +#define debugf(fmt, args...) do { printf(fmt,##args); } while (0) +#else +#define debugf(fmt, args...) +#endif + +#define DBI_WR1(sc, reg, val) pci_dw_dbi_wr1((sc)->dev, reg, val) +#define DBI_WR2(sc, reg, val) pci_dw_dbi_wr2((sc)->dev, reg, val) +#define DBI_WR4(sc, reg, val) pci_dw_dbi_wr4((sc)->dev, reg, val) +#define DBI_RD1(sc, reg) pci_dw_dbi_rd1((sc)->dev, reg) +#define DBI_RD2(sc, reg) pci_dw_dbi_rd2((sc)->dev, reg) +#define DBI_RD4(sc, reg) pci_dw_dbi_rd4((sc)->dev, reg) + +#define PCI_BUS_SHIFT 20 +#define PCI_SLOT_SHIFT 15 +#define PCI_FUNC_SHIFT 12 +#define PCI_BUS_MASK 0xFF +#define PCI_SLOT_MASK 0x1F +#define PCI_FUNC_MASK 0x07 +#define PCI_REG_MASK 0xFFF + + +#define IATU_CFG_BUS(bus) ((uint64_t)((bus) & 0xff) << 24) +#define IATU_CFG_SLOT(slot) ((uint64_t)((slot) & 0x1f) << 19) +#define IATU_CFG_FUNC(func) ((uint64_t)((func) & 0x07) << 16) + + + +static uint32_t +pci_dw_dbi_read(device_t dev, u_int reg, int width) +{ + struct pci_dw_softc *sc; + + sc = device_get_softc(dev); + MPASS(sc->dbi_res != NULL); + + switch (width) { + case 4: + return (bus_read_4(sc->dbi_res, reg)); + case 2: + return (bus_read_2(sc->dbi_res, reg)); + case 1: + return (bus_read_1(sc->dbi_res, reg)); + default: + device_printf(sc->dev, "Unsupported width: %d\n", width); + return (0xFFFFFFFF); + } +} + +static void +pci_dw_dbi_write(device_t dev, u_int reg, uint32_t val, int width) +{ + struct pci_dw_softc *sc; + + sc = device_get_softc(dev); + MPASS(sc->dbi_res != NULL); + + switch (width) { + case 4: + bus_write_4(sc->dbi_res, reg, val); + break; + case 2: + bus_write_2(sc->dbi_res, reg, val); + break; + case 1: + bus_write_1(sc->dbi_res, reg, val); + break; + default: + device_printf(sc->dev, "Unsupported width: %d\n", width); + break; + } +} + + +static void +pci_dw_dbi_protect(struct pci_dw_softc *sc, bool protect) +{ + uint32_t reg; + + reg = DBI_RD4(sc, DW_MISC_CONTROL_1); + if (protect) + reg &= ~DBI_RO_WR_EN; + else + reg |= DBI_RO_WR_EN; + DBI_WR4(sc, DW_MISC_CONTROL_1, reg); +} + +static bool +pci_dw_check_dev(struct pci_dw_softc *sc, u_int bus, u_int slot, u_int func, + u_int reg) +{ + bool status; + int rv; + + if (bus < sc->bus_start || bus > sc->bus_end || slot > PCI_SLOTMAX || + func > PCI_FUNCMAX || reg > PCI_REGMAX) + return (false); + + /* link is needed for access to all non-root busses */ + if (bus != sc->root_bus) { + rv = PCI_DW_GET_LINK(sc->dev, &status); + if (rv != 0 || !status) + return (false); + return (true); + } + + /* we have only 1 device with 1 function root port */ + if (slot > 0 || func > 0) + return (false); + return (true); +} + +/* Map one uoutbound ATU region */ +static int +pci_dw_map_out_atu(struct pci_dw_softc *sc, int idx, int type, + uint64_t pa, uint64_t pci_addr, uint32_t size) +{ + uint32_t reg; + int i; + + if (size == 0) + return (0); + + DBI_WR4(sc, DW_IATU_VIEWPORT, IATU_REGION_INDEX(idx)); + DBI_WR4(sc, DW_IATU_LWR_BASE_ADDR, pa & 0xFFFFFFFF); + DBI_WR4(sc, DW_IATU_UPPER_BASE_ADDR, (pa >> 32) & 0xFFFFFFFF); + DBI_WR4(sc, DW_IATU_LIMIT_ADDR, (pa + size - 1) & 0xFFFFFFFF); + DBI_WR4(sc, DW_IATU_LWR_TARGET_ADDR, pci_addr & 0xFFFFFFFF); + DBI_WR4(sc, DW_IATU_UPPER_TARGET_ADDR, (pci_addr >> 32) & 0xFFFFFFFF); + DBI_WR4(sc, DW_IATU_CTRL1, IATU_CTRL1_TYPE(type)); + DBI_WR4(sc, DW_IATU_CTRL2, IATU_CTRL2_REGION_EN); + + /* Wait until setup becomes valid */ + for (i = 10; i > 0; i--) { + reg = DBI_RD4(sc, DW_IATU_CTRL2); + if (reg & IATU_CTRL2_REGION_EN) + return (0); + DELAY(5); + } + device_printf(sc->dev, + "Cannot map outbound region(%d) in iATU\n", idx); + return (ETIMEDOUT); +} + +static int +pci_dw_setup_hw(struct pci_dw_softc *sc) +{ + uint32_t reg; + int rv; + + pci_dw_dbi_protect(sc, false); + + /* Setup config registers */ + DBI_WR1(sc, PCIR_CLASS, PCIC_BRIDGE); + DBI_WR1(sc, PCIR_SUBCLASS, PCIS_BRIDGE_PCI); + DBI_WR4(sc, PCIR_BAR(0), 4); + DBI_WR4(sc, PCIR_BAR(1), 0); + DBI_WR1(sc, PCIR_INTPIN, 1); + DBI_WR1(sc, PCIR_PRIBUS_1, sc->root_bus); + DBI_WR1(sc, PCIR_SECBUS_1, sc->sub_bus); + DBI_WR1(sc, PCIR_SUBBUS_1, sc->bus_end); + DBI_WR2(sc, PCIR_COMMAND, + PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | + PCIM_CMD_BUSMASTEREN | PCIM_CMD_SERRESPEN); + pci_dw_dbi_protect(sc, true); + + /* Setup outbound memory window */ + rv = pci_dw_map_out_atu(sc, 0, IATU_CTRL1_TYPE_MEM, + sc->mem_range.host, sc->mem_range.pci, sc->mem_range.size); + if (rv != 0) + return (rv); + + /* If we have enouht viewports ..*/ + if (sc->num_viewport >= 3) { + /* Setup outbound I/O window */ + rv = pci_dw_map_out_atu(sc, 0, IATU_CTRL1_TYPE_MEM, + sc->io_range.host, sc->io_range.pci, sc->io_range.size); + if (rv != 0) + return (rv); + } + /* XXX Should we handle also prefetch memory? */ + + + /* Adjust number of lanes */ + reg = DBI_RD4(sc, DW_PORT_LINK_CTRL); + reg &= ~PORT_LINK_CAPABLE(~0); + switch (sc->num_lanes) { + case 1: + reg |= PORT_LINK_CAPABLE(PORT_LINK_CAPABLE_1); + break; + case 2: + reg |= PORT_LINK_CAPABLE(PORT_LINK_CAPABLE_2); + break; + case 4: + reg |= PORT_LINK_CAPABLE(PORT_LINK_CAPABLE_4); + break; + case 8: + reg |= PORT_LINK_CAPABLE(PORT_LINK_CAPABLE_8); + break; + case 16: + reg |= PORT_LINK_CAPABLE(PORT_LINK_CAPABLE_16); + break; + case 32: + reg |= PORT_LINK_CAPABLE(PORT_LINK_CAPABLE_32); + break; + default: + device_printf(sc->dev, + "'num-lanes' property have invalid value: %d\n", + sc->num_lanes); + return (EINVAL); + } + DBI_WR4(sc, DW_PORT_LINK_CTRL, reg); + + + /* And link width */ + reg = DBI_RD4(sc, DW_GEN2_CTRL); + reg &= ~GEN2_CTRL_NUM_OF_LANES(~0); + switch (sc->num_lanes) { + case 1: + reg |= GEN2_CTRL_NUM_OF_LANES(GEN2_CTRL_NUM_OF_LANES_1); + break; + case 2: + reg |= GEN2_CTRL_NUM_OF_LANES(GEN2_CTRL_NUM_OF_LANES_2); + break; + case 4: + reg |= GEN2_CTRL_NUM_OF_LANES(GEN2_CTRL_NUM_OF_LANES_4); + break; + case 8: + reg |= GEN2_CTRL_NUM_OF_LANES(GEN2_CTRL_NUM_OF_LANES_8); + break; + case 16: + reg |= GEN2_CTRL_NUM_OF_LANES(GEN2_CTRL_NUM_OF_LANES_16); + break; + case 32: + reg |= GEN2_CTRL_NUM_OF_LANES(GEN2_CTRL_NUM_OF_LANES_32); + break; + } + DBI_WR4(sc, DW_GEN2_CTRL, reg); + + reg = DBI_RD4(sc, DW_GEN2_CTRL); + reg |= DIRECT_SPEED_CHANGE; + DBI_WR4(sc, DW_GEN2_CTRL, reg); + + + return (0); +} + +static int +pci_dw_decode_ranges(struct pci_dw_softc *sc, struct ofw_pci_range *ranges, + int nranges) +{ + int i; + + for (i = 0; i < nranges; i++) { + if ((ranges[i].pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) == + OFW_PCI_PHYS_HI_SPACE_IO) { + if (sc->io_range.size != 0) { + device_printf(sc->dev, + "Duplicated IO range found in DT\n"); + return (ENXIO); + } + sc->io_range = ranges[i]; + } + if (((ranges[i].pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) == + OFW_PCI_PHYS_HI_SPACE_MEM32)) { + if (ranges[i].pci_hi & OFW_PCI_PHYS_HI_PREFETCHABLE) { + if (sc->pref_mem_range.size != 0) { + device_printf(sc->dev, + "Duplicated memory range found " + "in DT\n"); + return (ENXIO); + } + sc->pref_mem_range = ranges[i]; + } else { + if (sc->mem_range.size != 0) { + device_printf(sc->dev, + "Duplicated memory range found " + "in DT\n"); + return (ENXIO); + } + sc->mem_range = ranges[i]; + } + } + } + if ((sc->io_range.size == 0) || (sc->mem_range.size == 0)) { + device_printf(sc->dev, + " Not all required ranges are found in DT\n"); + return (ENXIO); + } + return (0); +} + + + +/*----------------------------------------------------------------------------- + * + * P C I B I N T E R F A C E + */ + +static uint32_t +pci_dw_read_config(device_t dev, u_int bus, u_int slot, + u_int func, u_int reg, int bytes) +{ + struct pci_dw_softc *sc; + struct resource *res; + uint32_t data; + uint64_t addr; + int type, rv; + + sc = device_get_softc(dev); + + if (!pci_dw_check_dev(sc, bus, slot, func, reg)) + return (0xFFFFFFFFU); + + if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || + (reg > PCI_REGMAX)) + return (0xFFFFFFFFU); + + if (bus == sc->root_bus) { + res = (sc->dbi_res); + } else { + addr = IATU_CFG_BUS(bus) | IATU_CFG_SLOT(slot) | + IATU_CFG_FUNC(func); + if (bus == sc->sub_bus) + type = IATU_CTRL1_TYPE_CFG0; + else + type = IATU_CTRL1_TYPE_CFG1; + rv = pci_dw_map_out_atu(sc, 1, type, + sc->cfg_pa, addr, sc->cfg_size); + if (rv != 0) + return (0xFFFFFFFFU); + res = sc->cfg_res; + } + + switch (bytes) { + case 1: + data = bus_read_1(res, reg); + break; + case 2: + data = bus_read_2(res, reg); + break; + case 4: + data = bus_read_4(res, reg); + break; + default: + data = 0xFFFFFFFFU; + } + + return (data); + +} + +static void +pci_dw_write_config(device_t dev, u_int bus, u_int slot, + u_int func, u_int reg, uint32_t val, int bytes) +{ + struct pci_dw_softc *sc; + struct resource *res; + uint64_t addr; + int type, rv; + + sc = device_get_softc(dev); + if (!pci_dw_check_dev(sc, bus, slot, func, reg)) + return; + + if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || + (reg > PCI_REGMAX)) + return; + + if (bus == sc->root_bus) { + res = (sc->dbi_res); + } else { + addr = IATU_CFG_BUS(bus) | IATU_CFG_SLOT(slot) | + IATU_CFG_FUNC(func); + if (bus == sc->sub_bus) + type = IATU_CTRL1_TYPE_CFG0; + else + type = IATU_CTRL1_TYPE_CFG1; + rv = pci_dw_map_out_atu(sc, 1, type, + sc->cfg_pa, addr, sc->cfg_size); + if (rv != 0) + return ; + res = sc->cfg_res; + } + + + switch (bytes) { + case 1: + bus_write_1(res, reg, val); + break; + case 2: + bus_write_2(res, reg, val); + break; + case 4: + bus_write_4(res, reg, val); + break; + default: + break; + } +} + +static int +pci_dw_alloc_msi(device_t pci, device_t child, int count, + int maxcount, int *irqs) +{ + phandle_t msi_parent; + int rv; + + rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), + &msi_parent, NULL); + if (rv != 0) + return (rv); + + return (intr_alloc_msi(pci, child, msi_parent, count, maxcount, + irqs)); +} + +static int +pci_dw_release_msi(device_t pci, device_t child, int count, int *irqs) +{ + phandle_t msi_parent; + int rv; + + rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), + &msi_parent, NULL); + if (rv != 0) + return (rv); + return (intr_release_msi(pci, child, msi_parent, count, irqs)); +} + +static int +pci_dw_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, + uint32_t *data) +{ + phandle_t msi_parent; + int rv; + + rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), + &msi_parent, NULL); + if (rv != 0) + return (rv); + + return (intr_map_msi(pci, child, msi_parent, irq, addr, data)); +} + +static int +pci_dw_alloc_msix(device_t pci, device_t child, int *irq) +{ + phandle_t msi_parent; + int rv; + + rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), + &msi_parent, NULL); + if (rv != 0) + return (rv); + return (intr_alloc_msix(pci, child, msi_parent, irq)); +} + +static int +pci_dw_release_msix(device_t pci, device_t child, int irq) +{ + phandle_t msi_parent; + int rv; + + rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), + &msi_parent, NULL); + if (rv != 0) + return (rv); + return (intr_release_msix(pci, child, msi_parent, irq)); +} + +static int +pci_dw_get_id(device_t pci, device_t child, enum pci_id_type type, + uintptr_t *id) +{ + phandle_t node; + int rv; + uint32_t rid; + uint16_t pci_rid; + + if (type != PCI_ID_MSI) + return (pcib_get_id(pci, child, type, id)); + + node = ofw_bus_get_node(pci); + pci_rid = pci_get_rid(child); + + rv = ofw_bus_msimap(node, pci_rid, NULL, &rid); + if (rv != 0) + return (rv); + *id = rid; + + return (0); +} + +/*----------------------------------------------------------------------------- + * + * B U S / D E V I C E I N T E R F A C E + */ +static bus_dma_tag_t +pci_dw_get_dma_tag(device_t dev, device_t child) +{ + struct pci_dw_softc *sc; + + sc = device_get_softc(dev); + return (sc->dmat); +} + +int +pci_dw_init(device_t dev) +{ + struct pci_dw_softc *sc; + int rv, rid; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->node = ofw_bus_get_node(dev); + + mtx_init(&sc->mtx, "pci_dw_mtx", NULL, MTX_DEF); + + /* XXXn Should not be this configurable ? */ + sc->bus_start = 0; + sc->bus_end = 255; + sc->root_bus = 0; + sc->sub_bus = 1; + + /* Read FDT properties */ + if (!sc->coherent) + sc->coherent = OF_hasprop(sc->node, "dma-coherent"); + + rv = OF_getencprop(sc->node, "num-viewport", &sc->num_viewport, + sizeof(sc->num_viewport)); + if (rv != sizeof(sc->num_viewport)) + sc->num_viewport = 2; + + rv = OF_getencprop(sc->node, "num-lanes", &sc->num_lanes, + sizeof(sc->num_viewport)); + if (rv != sizeof(sc->num_lanes)) + sc->num_lanes = 1; + if (sc->num_lanes != 1 && sc->num_lanes != 2 && + sc->num_lanes != 4 && sc->num_lanes != 8) { + device_printf(dev, + "invalid number of lanes: %d\n",sc->num_lanes); + sc->num_lanes = 0; + rv = ENXIO; + goto out; + } + + rid = 0; + rv = ofw_bus_find_string_index(sc->node, "reg-names", "config", &rid); + if (rv != 0) { + device_printf(dev, "Cannot get config space memory\n"); + rv = ENXIO; + goto out; + } + sc->cfg_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->cfg_res == NULL) { + device_printf(dev, "Cannot allocate config space(rid: %d)\n", + rid); + rv = ENXIO; + goto out; + } + + /* Fill up config region related variables */ + sc->cfg_size = rman_get_size(sc->cfg_res); + sc->cfg_pa = rman_get_start(sc->cfg_res) ; + + if (bootverbose) + device_printf(dev, "Bus is%s cache-coherent\n", + sc->coherent ? "" : " not"); + rv = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ + 1, 0, /* alignment, bounds */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BUS_SPACE_MAXSIZE, /* maxsize */ + BUS_SPACE_UNRESTRICTED, /* nsegments */ + BUS_SPACE_MAXSIZE, /* maxsegsize */ + sc->coherent ? BUS_DMA_COHERENT : 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->dmat); + if (rv != 0) + goto out; + + rv = ofw_pci_init(dev); + if (rv != 0) + goto out; + rv = pci_dw_decode_ranges(sc, sc->ofw_pci.sc_range, + sc->ofw_pci.sc_nrange); + if (rv != 0) + goto out; + + rv = pci_dw_setup_hw(sc); + if (rv != 0) + goto out; + + device_add_child(dev, "pci", -1); + + return (bus_generic_attach(dev)); +out: + /* XXX Cleanup */ + return (rv); +} + +static device_method_t pci_dw_methods[] = { + + /* Bus interface */ + DEVMETHOD(bus_get_dma_tag, pci_dw_get_dma_tag), + + /* pcib interface */ + DEVMETHOD(pcib_read_config, pci_dw_read_config), + DEVMETHOD(pcib_write_config, pci_dw_write_config), + DEVMETHOD(pcib_alloc_msi, pci_dw_alloc_msi), + DEVMETHOD(pcib_release_msi, pci_dw_release_msi), + DEVMETHOD(pcib_alloc_msix, pci_dw_alloc_msix), + DEVMETHOD(pcib_release_msix, pci_dw_release_msix), + DEVMETHOD(pcib_map_msi, pci_dw_map_msi), + DEVMETHOD(pcib_get_id, pci_dw_get_id), + + /* OFW bus interface */ + DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), + DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), + DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), + DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), + DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), + + /* PCI DW interface */ + DEVMETHOD(pci_dw_dbi_read, pci_dw_dbi_read), + DEVMETHOD(pci_dw_dbi_write, pci_dw_dbi_write), + DEVMETHOD_END +}; + +DEFINE_CLASS_1(pcib, pci_dw_driver, pci_dw_methods, + sizeof(struct pci_dw_softc), ofw_pci_driver); Added: head/sys/dev/pci/pci_dw.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/pci/pci_dw.h Sun Oct 20 11:11:32 2019 (r353774) @@ -0,0 +1,158 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * 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 _PCI_DW_H_ +#define _PCI_DW_H_ + +#include "pci_dw_if.h" + + +/* DesignWare CIe configuration registers */ +#define DW_PORT_LINK_CTRL 0x710 +#define PORT_LINK_CAPABLE(n) (((n) & 0x3F) << 16) +#define PORT_LINK_CAPABLE_1 0x01 +#define PORT_LINK_CAPABLE_2 0x03 +#define PORT_LINK_CAPABLE_4 0x07 +#define PORT_LINK_CAPABLE_8 0x0F +#define PORT_LINK_CAPABLE_16 0x1F +#define PORT_LINK_CAPABLE_32 0x3F + + +#define DW_GEN2_CTRL 0x80C +#define DIRECT_SPEED_CHANGE (1 << 17) +#define GEN2_CTRL_NUM_OF_LANES(n) (((n) & 0x3F) << 8) +#define GEN2_CTRL_NUM_OF_LANES_1 0x01 +#define GEN2_CTRL_NUM_OF_LANES_2 0x03 +#define GEN2_CTRL_NUM_OF_LANES_4 0x07 +#define GEN2_CTRL_NUM_OF_LANES_8 0x0F +#define GEN2_CTRL_NUM_OF_LANES_16 0x1F +#define GEN2_CTRL_NUM_OF_LANES_32 0x3F + +#define DW_MSI_ADDR_LO 0x820 +#define DW_MSI_ADDR_HI 0x824 +#define DW_MSI_INTR0_ENABLE 0x828 +#define DW_MSI_INTR0_MASK 0x82C +#define DW_MSI_INTR0_STATUS 0x830 + + +#define DW_MISC_CONTROL_1 0x8BC +#define DBI_RO_WR_EN (1 << 0) + +#define DW_IATU_VIEWPORT 0x900 +#define IATU_REGION_INBOUND (1U << 31) +#define IATU_REGION_INDEX(x) ((x) & 0x7) +#define DW_IATU_CTRL1 0x904 +#define IATU_CTRL1_TYPE(x) ((x) & 0x1F) +#define IATU_CTRL1_TYPE_MEM 0x0 +#define IATU_CTRL1_TYPE_IO 0x2 +#define IATU_CTRL1_TYPE_CFG0 0x4 +#define IATU_CTRL1_TYPE_CFG1 0x5 +#define DW_IATU_CTRL2 0x908 +#define IATU_CTRL2_REGION_EN (1U << 31) +#define DW_IATU_LWR_BASE_ADDR 0x90C +#define DW_IATU_UPPER_BASE_ADDR 0x910 +#define DW_IATU_LIMIT_ADDR 0x914 +#define DW_IATU_LWR_TARGET_ADDR 0x918 +#define DW_IATU_UPPER_TARGET_ADDR 0x91C + + +struct pci_dw_softc { + struct ofw_pci_softc ofw_pci; /* Must be first */ + + /* Filled by attachement stub */ + struct resource *dbi_res; + + /* pci_dw variables */ + device_t dev; + phandle_t node; + struct mtx mtx; + struct resource *cfg_res; + + struct ofw_pci_range mem_range; + struct ofw_pci_range pref_mem_range; + struct ofw_pci_range io_range; + + bool coherent; + bus_dma_tag_t dmat; + + int num_lanes; + int num_viewport; + bus_addr_t cfg_pa; /* PA of config memoty */ + bus_size_t cfg_size; /* size of config region */ + + u_int bus_start; + u_int bus_end; + u_int root_bus; + u_int sub_bus; +}; + +DECLARE_CLASS(pci_dw_driver); + + +static inline void +pci_dw_dbi_wr4(device_t dev, u_int reg, uint32_t val) +{ + PCI_DW_DBI_WRITE(dev, reg, val, 4); +} + +static inline void +pci_dw_dbi_wr2(device_t dev, u_int reg, uint16_t val) +{ + PCI_DW_DBI_WRITE(dev, reg, val, 2); +} + +static inline void +pci_dw_dbi_wr1(device_t dev, u_int reg, uint8_t val) +{ + PCI_DW_DBI_WRITE(dev, reg, val, 1); +} + +static inline uint32_t +pci_dw_dbi_rd4(device_t dev, u_int reg) +{ + return (PCI_DW_DBI_READ(dev, reg, 4)); +} + +static inline uint16_t +pci_dw_dbi_rd2(device_t dev, u_int reg) +{ + return ((uint16_t)PCI_DW_DBI_READ(dev, reg, 2)); +} + +static inline uint8_t +pci_dw_dbi_rd1(device_t dev, u_int reg) +{ + return ((uint8_t)PCI_DW_DBI_READ(dev, reg, 1)); +} + +int pci_dw_init(device_t); + +#endif /* __PCI_HOST_GENERIC_H_ */ Added: head/sys/dev/pci/pci_dw_if.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/pci/pci_dw_if.m Sun Oct 20 11:11:32 2019 (r353774) @@ -0,0 +1,73 @@ +#- +# Copyright (c) 2019 Michal Meloun +# 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 + +INTERFACE pci_dw; + + +/** + * Read from dbi space. + * The reg argument is a byte offset into dbi space. + * The width argument (which should be 1, 2 or 4) specifies how + * many bytes to read from that offset. + */ +METHOD uint32_t dbi_read{ + device_t dev; + u_int reg; + int width; +}; + +/** + * Write to dbi space. + * The reg argument is a byte offset into dbi space. + * The width argument (which should be 1, 2 or 4) specifies how + * many bytes to write to that offset. + */ +METHOD void dbi_write{ + device_t dev; + u_int reg; + uint32_t value; + int width; +}; + +/** + * Start or stop link + */ +METHOD int set_link{ + device_t dev; + bool start; +}; + +/** + * Query link status (up/down) + */ +METHOD int get_link{ + device_t dev; + bool *status; +}; Added: head/sys/dev/pci/pci_dw_mv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/pci/pci_dw_mv.c Sun Oct 20 11:11:32 2019 (r353774) @@ -0,0 +1,328 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * 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. + * + */ + +/* Armada 8k DesignWare PCIe driver */ + +#include +__FBSDID("$FreeBSD$"); + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Oct 20 14:15:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B8451604A1; Sun, 20 Oct 2019 14:15:47 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46x1yW22Jlz3HwH; Sun, 20 Oct 2019 14:15:47 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A05FD07E; Sun, 20 Oct 2019 14:15:47 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KEFlLV059444; Sun, 20 Oct 2019 14:15:47 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KEFkEO059439; Sun, 20 Oct 2019 14:15:46 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201910201415.x9KEFkEO059439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sun, 20 Oct 2019 14:15:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353775 - in head: sys/dev/netmap tools/tools/netmap X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in head: sys/dev/netmap tools/tools/netmap X-SVN-Commit-Revision: 353775 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 14:15:47 -0000 Author: vmaffione Date: Sun Oct 20 14:15:45 2019 New Revision: 353775 URL: https://svnweb.freebsd.org/changeset/base/353775 Log: netmap: minor misc improvements - use ring->head rather than ring->cur in lb(8) - use strlcat() rather than strncat() - fix bandwidth computation in pkt-gen(8) MFC after: 1 week Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_legacy.c head/sys/dev/netmap/netmap_mem2.c head/tools/tools/netmap/lb.c head/tools/tools/netmap/pkt-gen.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Sun Oct 20 11:11:32 2019 (r353774) +++ head/sys/dev/netmap/netmap.c Sun Oct 20 14:15:45 2019 (r353775) @@ -3316,7 +3316,8 @@ nmreq_getoption(struct nmreq_header *hdr, uint16_t req if (!hdr->nr_options) return NULL; - opt_tab = (struct nmreq_option **)(hdr->nr_options) - (NETMAP_REQ_OPT_MAX + 1); + opt_tab = (struct nmreq_option **)((uintptr_t)hdr->nr_options) - + (NETMAP_REQ_OPT_MAX + 1); return opt_tab[reqtype]; } Modified: head/sys/dev/netmap/netmap_legacy.c ============================================================================== --- head/sys/dev/netmap/netmap_legacy.c Sun Oct 20 11:11:32 2019 (r353774) +++ head/sys/dev/netmap/netmap_legacy.c Sun Oct 20 14:15:45 2019 (r353775) @@ -100,7 +100,7 @@ nmreq_register_from_legacy(struct nmreq *nmr, struct n /* No space for the pipe suffix. */ return ENOBUFS; } - strncat(hdr->nr_name, suffix, strlen(suffix)); + strlcat(hdr->nr_name, suffix, sizeof(hdr->nr_name)); req->nr_mode = NR_REG_ALL_NIC; req->nr_ringid = 0; } Modified: head/sys/dev/netmap/netmap_mem2.c ============================================================================== --- head/sys/dev/netmap/netmap_mem2.c Sun Oct 20 11:11:32 2019 (r353774) +++ head/sys/dev/netmap/netmap_mem2.c Sun Oct 20 14:15:45 2019 (r353775) @@ -2447,8 +2447,8 @@ netmap_mem_pt_guest_ifp_del(struct netmap_mem_d *nmd, } else { ptnmd->pt_ifs = curr->next; } - nm_prinf("removed (ifp=%p,nifp_offset=%u)", - curr->ifp, curr->nifp_offset); + nm_prinf("removed (ifp=%s,nifp_offset=%u)", + curr->ifp->if_xname, curr->nifp_offset); nm_os_free(curr); ret = 0; break; Modified: head/tools/tools/netmap/lb.c ============================================================================== --- head/tools/tools/netmap/lb.c Sun Oct 20 11:11:32 2019 (r353774) +++ head/tools/tools/netmap/lb.c Sun Oct 20 14:15:45 2019 (r353775) @@ -652,7 +652,7 @@ int main(int argc, char **argv) /* extract the base name */ char *nscan = strncmp(glob_arg.ifname, "netmap:", 7) ? glob_arg.ifname : glob_arg.ifname + 7; - strncpy(glob_arg.base_name, nscan, MAX_IFNAMELEN-1); + strncpy(glob_arg.base_name, nscan, MAX_IFNAMELEN - 1); for (nscan = glob_arg.base_name; *nscan && !index("-*^{}/@", *nscan); nscan++) ; *nscan = '\0'; @@ -948,8 +948,8 @@ run: struct netmap_ring *rxring = NETMAP_RXRING(rxport->nmd->nifp, i); //D("prepare to scan rings"); - int next_cur = rxring->cur; - struct netmap_slot *next_slot = &rxring->slot[next_cur]; + int next_head = rxring->head; + struct netmap_slot *next_slot = &rxring->slot[next_head]; const char *next_buf = NETMAP_BUF(rxring, next_slot->buf_idx); while (!nm_ring_empty(rxring)) { struct netmap_slot *rs = next_slot; @@ -963,14 +963,14 @@ run: non_ip++; // XXX ?? } // prefetch the buffer for the next round - next_cur = nm_ring_next(rxring, next_cur); - next_slot = &rxring->slot[next_cur]; + next_head = nm_ring_next(rxring, next_head); + next_slot = &rxring->slot[next_head]; next_buf = NETMAP_BUF(rxring, next_slot->buf_idx); __builtin_prefetch(next_buf); // 'B' is just a hashing seed rs->buf_idx = forward_packet(g, rs); rs->flags |= NS_BUF_CHANGED; - rxring->head = rxring->cur = next_cur; + rxring->head = rxring->cur = next_head; batch++; if (unlikely(batch >= glob_arg.batch)) { Modified: head/tools/tools/netmap/pkt-gen.c ============================================================================== --- head/tools/tools/netmap/pkt-gen.c Sun Oct 20 11:11:32 2019 (r353774) +++ head/tools/tools/netmap/pkt-gen.c Sun Oct 20 14:15:45 2019 (r353775) @@ -2634,7 +2634,7 @@ main_thread(struct glob_arg *g) D("%spps %s(%spkts %sbps in %llu usec) %.2f avg_batch %d min_space", norm(b1, pps, normalize), b4, norm(b2, (double)x.pkts, normalize), - norm(b3, (double)x.bytes*8+(double)x.pkts*g->framing, normalize), + norm(b3, 1000000*((double)x.bytes*8+(double)x.pkts*g->framing)/usec, normalize), (unsigned long long)usec, abs, (int)cur.min_space); prev = cur; @@ -2973,6 +2973,7 @@ main(int arc, char **argv) g.options |= OPT_DUMP; break; case 'C': + D("WARNING: the 'C' option is deprecated, use the '+conf:' libnetmap option instead"); g.nmr_config = strdup(optarg); break; case 'H': From owner-svn-src-head@freebsd.org Sun Oct 20 15:50:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9922F161FFD; Sun, 20 Oct 2019 15:50:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46x43t3ZG3z3M5J; Sun, 20 Oct 2019 15:50:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DEBEE044; Sun, 20 Oct 2019 15:50:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KFoY2t012540; Sun, 20 Oct 2019 15:50:34 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KFoYQh012538; Sun, 20 Oct 2019 15:50:34 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910201550.x9KFoYQh012538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 20 Oct 2019 15:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353777 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 353777 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 15:50:34 -0000 Author: jhibbits Date: Sun Oct 20 15:50:33 2019 New Revision: 353777 URL: https://svnweb.freebsd.org/changeset/base/353777 Log: powerpc/booke: Don't zero MAS8, it's unnecessary MAS8 is hypervisor privileged, defining the logical partition (VM) to operate on for TLB accesses. It's already guaranteed to be cleared when booting bare metal (bootloader needs it zeroed to work), and we can't touch it from a guest. Assume that if/when we eventually port bhyve to PowerPC (and Book-E) the hypervisor module will take care of managing MAS8. This saves several (tens) of clocks on each TLB miss. MFC after: 2 weeks Modified: head/sys/powerpc/booke/locore.S head/sys/powerpc/booke/trap_subr.S Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Sun Oct 20 14:45:19 2019 (r353776) +++ head/sys/powerpc/booke/locore.S Sun Oct 20 15:50:33 2019 (r353777) @@ -252,7 +252,6 @@ __start: isync li %r4, 0 mtspr SPR_MAS7, %r4 - bl zero_mas8 isync tlbwe isync @@ -510,7 +509,6 @@ bp_kernload: isync li %r4, 0 mtspr SPR_MAS7, %r4 - bl zero_mas8 isync tlbwe isync @@ -702,7 +700,6 @@ tlb1_temp_mapping_as1: mflr %r3 li %r4, 0 mtspr SPR_MAS7, %r4 - bl zero_mas8 mtlr %r3 isync tlbwe @@ -738,24 +735,6 @@ tlb1_inval_all_but_current: 2: addi %r4, %r4, 1 cmpw %r4, %r3 /* Check if this is the last entry */ bne 1b - blr - -/* - * MAS8 conditional zeroing. - */ -.globl zero_mas8 -zero_mas8: - mfpvr %r20 - rlwinm %r20, %r20, 16, 16, 31 - cmpli 0, 0, %r20, FSL_E500mc - beq 1f - cmpli 0, 0, %r20, FSL_E5500 - beq 1f - - blr -1: - li %r20, 0 - mtspr SPR_MAS8, %r20 blr #endif Modified: head/sys/powerpc/booke/trap_subr.S ============================================================================== --- head/sys/powerpc/booke/trap_subr.S Sun Oct 20 14:45:19 2019 (r353776) +++ head/sys/powerpc/booke/trap_subr.S Sun Oct 20 15:50:33 2019 (r353777) @@ -767,7 +767,6 @@ search_failed: li %r23, 0 mtspr SPR_MAS7, %r23 - bl zero_mas8 isync tlbwe @@ -903,10 +902,6 @@ tlb_fill_entry: mtspr SPR_MAS2, %r27 mtspr SPR_MAS3, %r22 mtspr SPR_MAS7, %r23 - - mflr %r21 - bl zero_mas8 - mtlr %r21 isync tlbwe From owner-svn-src-head@freebsd.org Sun Oct 20 17:40:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9CE516699C; Sun, 20 Oct 2019 17:40:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46x6W644vrz4D3T; Sun, 20 Oct 2019 17:40:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EE8EF4D3; Sun, 20 Oct 2019 17:40:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KHeoVK098420; Sun, 20 Oct 2019 17:40:50 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KHeoFD098419; Sun, 20 Oct 2019 17:40:50 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201910201740.x9KHeoFD098419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 20 Oct 2019 17:40:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353778 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 353778 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 17:40:50 -0000 Author: marius Date: Sun Oct 20 17:40:50 2019 New Revision: 353778 URL: https://svnweb.freebsd.org/changeset/base/353778 Log: - In em_intr(), just call em_handle_link() instead of duplicating it. - In em_msix_link(), properly handle IGB-class devices after the iflib(4) conversion again by only setting EM_MSIX_LINK for the EM-class 82574 and by re-arming link interrupts unconditionally, i. e. not only in case of spurious interrupts. This fixes the interface link state change detection for the IGB-class. [1] - In em_if_update_admin_status(), only re-arm the link state change interrupt for 82574 and also only if such a device uses MSI-X, i. e. takes advantage of autoclearing. In case of INTx and MSI as well as for LEM- and IGB-class devices, re-arming isn't appropriate here and setting EM_MSIX_LINK isn't either. While at it, consistently take advantage of the hw variable. PR: 236724 [1] Differential Revision: https://reviews.freebsd.org/D21924 Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sun Oct 20 15:50:33 2019 (r353777) +++ head/sys/dev/e1000/if_em.c Sun Oct 20 17:40:50 2019 (r353778) @@ -1395,10 +1395,8 @@ em_intr(void *arg) IFDI_INTR_DISABLE(ctx); /* Link status change */ - if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { - adapter->hw.mac.get_link_status = 1; - iflib_admin_intr_deferred(ctx); - } + if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) + em_handle_link(ctx); if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; @@ -1481,22 +1479,24 @@ em_msix_link(void *arg) if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { em_handle_link(adapter->ctx); - } else { - E1000_WRITE_REG(&adapter->hw, E1000_IMS, - EM_MSIX_LINK | E1000_IMS_LSC); - if (adapter->hw.mac.type >= igb_mac_min) - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); + } else if (adapter->hw.mac.type == e1000_82574) { + /* Only re-arm 82574 if em_if_update_admin_status() won't. */ + E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | + E1000_IMS_LSC); } - /* - * Because we must read the ICR for this interrupt - * it may clear other causes using autoclear, for - * this reason we simply create a soft interrupt - * for all these vectors. - */ - if (reg_icr && adapter->hw.mac.type < igb_mac_min) { - E1000_WRITE_REG(&adapter->hw, - E1000_ICS, adapter->ims); + if (adapter->hw.mac.type == e1000_82574) { + /* + * Because we must read the ICR for this interrupt it may + * clear other causes using autoclear, for this reason we + * simply create a soft interrupt for all these vectors. + */ + if (reg_icr) + E1000_WRITE_REG(&adapter->hw, E1000_ICS, adapter->ims); + } else { + /* Re-arm unconditionally */ + E1000_WRITE_REG(&adapter->hw, E1000_IMS, E1000_IMS_LSC); + E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); } return (FILTER_HANDLED); @@ -1512,7 +1512,6 @@ em_handle_link(void *context) iflib_admin_intr_deferred(ctx); } - /********************************************************************* * * Media Ioctl callback @@ -1829,14 +1828,15 @@ em_if_update_admin_status(if_ctx_t ctx) em_update_stats_counters(adapter); /* Reset LAA into RAR[0] on 82571 */ - if ((adapter->hw.mac.type == e1000_82571) && - e1000_get_laa_state_82571(&adapter->hw)) - e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); + if (hw->mac.type == e1000_82571 && e1000_get_laa_state_82571(hw)) + e1000_rar_set(hw, hw->mac.addr, 0); - if (adapter->hw.mac.type < em_mac_min) + if (hw->mac.type < em_mac_min) lem_smartspeed(adapter); - - E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | E1000_IMS_LSC); + else if (hw->mac.type == e1000_82574 && + adapter->intr_type == IFLIB_INTR_MSIX) + E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | + E1000_IMS_LSC); } static void From owner-svn-src-head@freebsd.org Sun Oct 20 20:29:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D06E1697E4; Sun, 20 Oct 2019 20:29:18 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xBFV0qlJz4KW5; Sun, 20 Oct 2019 20:29:18 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3F1919305; Sun, 20 Oct 2019 20:29:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KKTH34098692; Sun, 20 Oct 2019 20:29:17 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KKTHwA098691; Sun, 20 Oct 2019 20:29:17 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201910202029.x9KKTHwA098691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 20 Oct 2019 20:29:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353779 - head/sbin/ping6 X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping6 X-SVN-Commit-Revision: 353779 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 20:29:18 -0000 Author: asomers Date: Sun Oct 20 20:29:17 2019 New Revision: 353779 URL: https://svnweb.freebsd.org/changeset/base/353779 Log: Fix option names in the Examples section of the manual page This corrects an oversight from r351423. Submitted by: Ján Sučan MFC after: Never Differential Revision: https://reviews.freebsd.org/D22093 Modified: head/sbin/ping6/ping6.8 Modified: head/sbin/ping6/ping6.8 ============================================================================== --- head/sbin/ping6/ping6.8 Sun Oct 20 17:40:50 2019 (r353778) +++ head/sbin/ping6/ping6.8 Sun Oct 20 20:29:17 2019 (r353779) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 22, 2019 +.Dd October 20, 2019 .Dt PING6 8 .Os .Sh NAME @@ -473,13 +473,13 @@ The address is named the link-local all-node multicast address, and the packet would reach every node on the network link. .Bd -literal -offset indent -ping6 -w ff02::1%wi0 +ping6 -y ff02::1%wi0 .Ed .Pp The following will probe addresses assigned to the destination node, .Li dst.foo.com . .Bd -literal -offset indent -ping6 -a agl dst.foo.com +ping6 -k agl dst.foo.com .Ed .Sh SEE ALSO .Xr netstat 1 , From owner-svn-src-head@freebsd.org Sun Oct 20 20:57:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D79AB169DC7; Sun, 20 Oct 2019 20:57:58 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xBtZ5P1Hz4LPZ; Sun, 20 Oct 2019 20:57:58 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D25019837; Sun, 20 Oct 2019 20:57:58 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KKvwTC016203; Sun, 20 Oct 2019 20:57:58 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KKvwWF016202; Sun, 20 Oct 2019 20:57:58 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201910202057.x9KKvwWF016202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Sun, 20 Oct 2019 20:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353780 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: brueffer X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 353780 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 20:57:58 -0000 Author: brueffer Date: Sun Oct 20 20:57:57 2019 New Revision: 353780 URL: https://svnweb.freebsd.org/changeset/base/353780 Log: Add a manpage for ng_pipe(4). Submitted by: Lutz Donnerhacke Reviewed by: bcr (previous version) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22067 Added: head/share/man/man4/ng_pipe.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sun Oct 20 20:29:17 2019 (r353779) +++ head/share/man/man4/Makefile Sun Oct 20 20:57:57 2019 (r353780) @@ -351,6 +351,7 @@ MAN= aac.4 \ ng_netflow.4 \ ng_one2many.4 \ ng_patch.4 \ + ng_pipe.4 \ ng_ppp.4 \ ng_pppoe.4 \ ng_pptpgre.4 \ Added: head/share/man/man4/ng_pipe.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ng_pipe.4 Sun Oct 20 20:57:57 2019 (r353780) @@ -0,0 +1,215 @@ +.\" Copyright (c) 2019 Lutz Donnerhacke +.\" Copyright (c) 2004-2008 University of Zagreb +.\" Copyright (c) 2007-2008 FreeBSD Foundation +.\" 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 October 17, 2019 +.Dt NG_PIPE 4 +.Os +.Sh NAME +.Nm ng_pipe +.Nd Traffic manipulating netgraph node type +.Sh SYNOPSIS +.In netgraph/ng_pipe.h +.Sh DESCRIPTION +The +.Nm pipe +node type manipulates traffic by emulating bandwidth and delay, as well as +random packet losses. +.Sh HOOKS +This node type supports the following hooks: +.Bl -tag -width ".Va upper" +.It Va upper +Hook leading to upper layer protocols. +.It Va lower +Hook leading to lower layer protocols. +.El +.Pp +Traffic flowing from +.Va upper +to +.Va lower +is considered +.Sy downstream +traffic. +Traffic flowing from +.Va lower +to +.Va upper +is considered +.Sy upstream +traffic. +.Sh MODE OF OPERATION +Data received on a hook - both in upstream and downstream direction - +is put into an inbound queue. +If inbound queue is full, discard one frame +depending on dropping policy (from the head or from the tail of the +queue). +.Pp +There are three mutually exclusive modes for the input queue: +.Bl -tag -width foo +.It Dv "First In First Out (FIFO)" +A single queue holds packets in chronological order. +.It Dv Weighted fair queuing (WFQ) +There are multiple queues for different traffic flows (based on IPv4 +IPs). +The longest queue is truncated if necessary. +This approach +assumes that the stalling flow is the flow with the most packets currently +on hold. +.It Dv Deficit Round Robin (DRR) +This mode is similar to WFQ, but packets are not taken out in +strict chronological order. +In principle oldest packets come first, +but not too many packets from the same flow. +.El +.Pp +It is possible to configure a duplication probability. +As the dice +decides, the currently active packet stays in the queue while a copy +of the packet is sent out. +Nothing prevents a packet from being +duplicated multiple times. +.Pp +Packets are dropped with an increasing probability depending on the +size of the packet, if a +.Va ber +(bit error rate) is configured. +.Pp +Surviving packets are delayed by the time the packet would need to +travel through a link of the configured bandwidth. +If this outbound +queue is full, the packet is dropped. +.Sh CONTROL MESSAGES +This node type supports the generic control messages and the following +specific messages. +.Bl -tag -width foo +.It Dv NGM_PIPE_SET_CFG Pq Ic setcfg +Set node configuration to the one specified in +.Vt "struct ng_pipe_cfg" +.Pp +Note: To set a value to zero, specify -1 instead. +This allows omitting configuration values, which should not be +modified. +.It Dv NGM_PIPE_GET_CFG Pq Ic getcfg +Return current node configuration as +.Vt "struct ng_pipe_cfg" +.Bd -literal +struct ng_pipe_cfg { + u_int64_t bandwidth; /* bits per second */ + u_int64_t delay; /* additional delay, usec */ + u_int32_t header_offset; /* offset of IP header in bytes */ + u_int32_t overhead; /* assumed L2 overhead in bytes */ + struct ng_pipe_hookcfg downstream; + struct ng_pipe_hookcfg upstream; +}; + +/* Config structure for one hook */ +struct ng_pipe_hookcfg { + u_int64_t bandwidth; /* bits per second */ + u_int64_t ber; /* errors per 2^48 bits */ + u_int32_t qin_size_limit; /* number of queue items */ + u_int32_t qout_size_limit; /* number of queue items */ + u_int32_t duplicate; /* probability in % */ + u_int32_t fifo; /* 0 = off, 1 = on */ + u_int32_t drr; /* 0 = off, 1 = 2048 bytes, or x bytes */ + u_int32_t wfq; /* 0 = off, 1 = on */ + u_int32_t droptail; /* 0 = off, 1 = on */ + u_int32_t drophead; /* 0 = off, 1 = on */ +}; +.Ed +.It Dv NGM_PIPE_GET_STATS Pq Ic getstats +Return node statistics as +.Vt "struct ng_pipe_stats" +.Bd -literal +/* Statistics structure for one hook */ +struct ng_pipe_hookstat { + u_int64_t fwd_octets; + u_int64_t fwd_frames; + u_int64_t in_disc_octets; + u_int64_t in_disc_frames; + u_int64_t out_disc_octets; + u_int64_t out_disc_frames; +}; + +/* Statistics structure returned by NGM_PIPE_GET_STATS */ +struct ng_pipe_stats { + struct ng_pipe_hookstat downstream; + struct ng_pipe_hookstat upstream; +}; +.Ed +.It Dv NGM_PIPE_CLR_STATS Pq Ic clrstats +Clear node statistics. +.It Dv NGM_PIPE_GETCLR_STATS Pq Ic getclrstats +Atomically return and clear node statistics. +.It Dv NGM_PIPE_GET_RUN Pq Ic getrun +Return node statistics as +.Vt "struct ng_pipe_run" +.Bd -literal +/* Runtime structure for one hook */ +struct ng_pipe_hookrun { + u_int32_t fifo_queues; + u_int32_t qin_octets; + u_int32_t qin_frames; + u_int32_t qout_octets; + u_int32_t qout_frames; +}; + +/* Runtime structure returned by NGM_PIPE_GET_RUN */ +struct ng_pipe_run { + struct ng_pipe_hookrun downstream; + struct ng_pipe_hookrun upstream; +}; +.Ed +.El +.Sh SHUTDOWN +This node shuts down upon receipt of a +.Dv NGM_SHUTDOWN +control message, or when all hooks have been disconnected. +.Sh EXAMPLES +Limit outgoing data rate over fxp0 Ethernet interface to 20Mbps in +fifo mode and incoming to 50kbps in drr mode and 2% duplicate +probability. +.Bd -literal -offset indent +/usr/sbin/ngctl -f- <<-SEQ + mkpeer fxp0: pipe lower lower + name fxp0:lower fxp0_pipe + connect fxp0: fxp0_pipe: upper upper + msg fxp0_pipe: setcfg { downstream={ bandwidth=20000000 fifo=1 } } + msg fxp0_pipe: setcfg { upstream={ bandwidth=500000 drr=1 duplicate=2 } } +SEQ +.Ed +.Sh SEE ALSO +.Xr netgraph 4 , +.Xr ngctl 8 +.Sh AUTHORS +.An Lutz Donnerhacke Aq Mt lutz@donnerhacke.de +.Pq man page +.Sh BUGS +Error handling for memory issues is missing. +If kernel memory cannot be allocated immediately, a kernel panic will +be triggered. +Same happens if an mbuf is fragmented within the transport headers. From owner-svn-src-head@freebsd.org Sun Oct 20 21:03:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F402016AF77; Sun, 20 Oct 2019 21:03:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xC1J6Dsqz4Mrx; Sun, 20 Oct 2019 21:03:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9F4119B38; Sun, 20 Oct 2019 21:03:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KL3mtK021741; Sun, 20 Oct 2019 21:03:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KL3md1021740; Sun, 20 Oct 2019 21:03:48 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910202103.x9KL3md1021740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 20 Oct 2019 21:03:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353781 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353781 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 21:03:49 -0000 Author: kevans Date: Sun Oct 20 21:03:48 2019 New Revision: 353781 URL: https://svnweb.freebsd.org/changeset/base/353781 Log: tuntap(4): Drop TUN_IASET This flag appears to have been effectively unused since introduction to if_tun(4) -- drop it now. Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Sun Oct 20 20:57:57 2019 (r353780) +++ head/sys/net/if_tuntap.c Sun Oct 20 21:03:48 2019 (r353781) @@ -120,7 +120,7 @@ struct tuntap_softc { u_short tun_flags; /* misc flags */ #define TUN_OPEN 0x0001 #define TUN_INITED 0x0002 -#define TUN_IASET 0x0008 +#define TUN_UNUSED1 0x0008 #define TUN_DSTADDR 0x0010 #define TUN_LMODE 0x0020 #define TUN_RWAIT 0x0040 @@ -1191,10 +1191,6 @@ tuninit(struct ifnet *ifp) CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET) { struct sockaddr_in *si; - - si = (struct sockaddr_in *)ifa->ifa_addr; - if (si->sin_addr.s_addr) - tp->tun_flags |= TUN_IASET; si = (struct sockaddr_in *)ifa->ifa_dstaddr; if (si && si->sin_addr.s_addr) From owner-svn-src-head@freebsd.org Sun Oct 20 21:06:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B7AF16B0F5; Sun, 20 Oct 2019 21:06:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xC4L3ZXcz4N5n; Sun, 20 Oct 2019 21:06:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DF1D19B3D; Sun, 20 Oct 2019 21:06:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KL6QCr022052; Sun, 20 Oct 2019 21:06:26 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KL6QXN022051; Sun, 20 Oct 2019 21:06:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910202106.x9KL6QXN022051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 20 Oct 2019 21:06:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353782 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353782 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 21:06:26 -0000 Author: kevans Date: Sun Oct 20 21:06:25 2019 New Revision: 353782 URL: https://svnweb.freebsd.org/changeset/base/353782 Log: tuntap(4): break out after setting TUN_DSTADDR This is now the only flag we set in this loop, terminate early. Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Sun Oct 20 21:03:48 2019 (r353781) +++ head/sys/net/if_tuntap.c Sun Oct 20 21:06:25 2019 (r353782) @@ -1193,8 +1193,10 @@ tuninit(struct ifnet *ifp) struct sockaddr_in *si; si = (struct sockaddr_in *)ifa->ifa_dstaddr; - if (si && si->sin_addr.s_addr) + if (si && si->sin_addr.s_addr) { tp->tun_flags |= TUN_DSTADDR; + break; + } } } NET_EPOCH_EXIT(et); From owner-svn-src-head@freebsd.org Sun Oct 20 22:39:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14C6016CF47; Sun, 20 Oct 2019 22:39:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xF7w6pxmz4SFC; Sun, 20 Oct 2019 22:39:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD0A71AB29; Sun, 20 Oct 2019 22:39:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KMdeof075556; Sun, 20 Oct 2019 22:39:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KMdeGT075555; Sun, 20 Oct 2019 22:39:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910202239.x9KMdeGT075555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 20 Oct 2019 22:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353785 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353785 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 22:39:41 -0000 Author: kevans Date: Sun Oct 20 22:39:40 2019 New Revision: 353785 URL: https://svnweb.freebsd.org/changeset/base/353785 Log: tuntap(4): Use make_dev_s to avoid si_drv1 race This allows us to avoid some dance in tunopen for dealing with the possibility of dev->si_drv1 being NULL as it's set prior to the devfs node being created in all cases. There's still the possibility that the tun device hasn't been fully initialized, since that's done after the devfs node was created. Alleviate this by returning ENXIO if we're not to that point of tuncreate yet. This work is what sparked r353128, full initialization of cloned devices w/ specified make_dev_args. Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Sun Oct 20 22:05:57 2019 (r353784) +++ head/sys/net/if_tuntap.c Sun Oct 20 22:39:40 2019 (r353785) @@ -209,6 +209,8 @@ SYSCTL_INT(_net_link_tap, OID_AUTO, devfs_cloning, CTL "Enable legacy devfs interface creation"); SYSCTL_INT(_net_link_tap, OID_AUTO, debug, CTLFLAG_RW, &tundebug, 0, ""); +static int tun_create_device(struct tuntap_driver *drv, int unit, + struct ucred *cr, struct cdev **dev, const char *name); static int tun_busy_locked(struct tuntap_softc *tp); static void tun_unbusy_locked(struct tuntap_softc *tp); static int tun_busy(struct tuntap_softc *tp); @@ -217,7 +219,7 @@ static void tun_unbusy(struct tuntap_softc *tp); static int tuntap_name2info(const char *name, int *unit, int *flags); static void tunclone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev); -static void tuncreate(struct cdev *dev, struct tuntap_driver *); +static void tuncreate(struct cdev *dev); static void tunrename(void *arg, struct ifnet *ifp); static int tunifioctl(struct ifnet *, u_long, caddr_t); static void tuninit(struct ifnet *); @@ -544,16 +546,15 @@ tun_clone_create(struct if_clone *ifc, char *name, siz snprintf(name, IFNAMSIZ, "%s%d", drv->cdevsw.d_name, unit); /* find any existing device, or allocate new unit number */ + dev = NULL; i = clone_create(&drv->clones, &drv->cdevsw, &unit, &dev, 0); - if (i) { - /* No preexisting struct cdev *, create one */ - dev = make_dev(&drv->cdevsw, unit, UID_UUCP, GID_DIALER, 0600, - "%s%d", drv->cdevsw.d_name, unit); - } + /* No preexisting struct cdev *, create one */ + if (i != 0) + i = tun_create_device(drv, unit, NULL, &dev, name); + if (i == 0) + tuncreate(dev); - tuncreate(dev, drv); - - return (0); + return (i); } static void @@ -608,12 +609,11 @@ tunclone(void *arg, struct ucred *cred, char *name, in name, u); name = devname; } - /* No preexisting struct cdev *, create one */ - *dev = make_dev_credf(MAKEDEV_REF, &drv->cdevsw, u, cred, - UID_UUCP, GID_DIALER, 0600, "%s", name); - } - if_clone_create(name, namelen, NULL); + i = tun_create_device(drv, u, cred, dev, name); + } + if (i == 0) + if_clone_create(name, namelen, NULL); out: CURVNET_RESTORE(); } @@ -791,6 +791,46 @@ MODULE_VERSION(if_tuntap, 1); MODULE_VERSION(if_tun, 1); MODULE_VERSION(if_tap, 1); +static int +tun_create_device(struct tuntap_driver *drv, int unit, struct ucred *cr, + struct cdev **dev, const char *name) +{ + struct make_dev_args args; + struct tuntap_softc *tp; + int error; + + tp = malloc(sizeof(*tp), M_TUN, M_WAITOK | M_ZERO); + mtx_init(&tp->tun_mtx, "tun_mtx", NULL, MTX_DEF); + cv_init(&tp->tun_cv, "tun_condvar"); + tp->tun_flags = drv->ident_flags; + tp->tun_drv = drv; + + make_dev_args_init(&args); + if (cr != NULL) + args.mda_flags = MAKEDEV_REF; + args.mda_devsw = &drv->cdevsw; + args.mda_cr = cr; + args.mda_uid = UID_UUCP; + args.mda_gid = GID_DIALER; + args.mda_mode = 0600; + args.mda_unit = unit; + args.mda_si_drv1 = tp; + error = make_dev_s(&args, dev, "%s", name); + if (error != 0) { + free(tp, M_TUN); + return (error); + } + + KASSERT((*dev)->si_drv1 != NULL, + ("Failed to set si_drv1 at %s creation", name)); + tp->tun_dev = *dev; + knlist_init_mtx(&tp->tun_rsel.si_note, &tp->tun_mtx); + mtx_lock(&tunmtx); + TAILQ_INSERT_TAIL(&tunhead, tp, tun_list); + mtx_unlock(&tunmtx); + return (0); +} + static void tunstart(struct ifnet *ifp) { @@ -883,49 +923,43 @@ tunstart_l2(struct ifnet *ifp) TUN_UNLOCK(tp); } /* tunstart_l2 */ - /* XXX: should return an error code so it can fail. */ static void -tuncreate(struct cdev *dev, struct tuntap_driver *drv) +tuncreate(struct cdev *dev) { - struct tuntap_softc *sc; + struct tuntap_driver *drv; + struct tuntap_softc *tp; struct ifnet *ifp; struct ether_addr eaddr; int iflags; u_char type; - sc = malloc(sizeof(*sc), M_TUN, M_WAITOK | M_ZERO); - mtx_init(&sc->tun_mtx, "tun_mtx", NULL, MTX_DEF); - cv_init(&sc->tun_cv, "tun_condvar"); - sc->tun_flags = drv->ident_flags; - sc->tun_dev = dev; - sc->tun_drv = drv; - mtx_lock(&tunmtx); - TAILQ_INSERT_TAIL(&tunhead, sc, tun_list); - mtx_unlock(&tunmtx); + tp = dev->si_drv1; + KASSERT(tp != NULL, + ("si_drv1 should have been initialized at creation")); + drv = tp->tun_drv; iflags = IFF_MULTICAST; - if ((sc->tun_flags & TUN_L2) != 0) { + if ((tp->tun_flags & TUN_L2) != 0) { type = IFT_ETHER; iflags |= IFF_BROADCAST | IFF_SIMPLEX; } else { type = IFT_PPP; iflags |= IFF_POINTOPOINT; } - ifp = sc->tun_ifp = if_alloc(type); + ifp = tp->tun_ifp = if_alloc(type); if (ifp == NULL) panic("%s%d: failed to if_alloc() interface.\n", drv->cdevsw.d_name, dev2unit(dev)); - ifp->if_softc = sc; + ifp->if_softc = tp; if_initname(ifp, drv->cdevsw.d_name, dev2unit(dev)); ifp->if_ioctl = tunifioctl; ifp->if_flags = iflags; IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); - knlist_init_mtx(&sc->tun_rsel.si_note, &sc->tun_mtx); ifp->if_capabilities |= IFCAP_LINKSTATE; ifp->if_capenable |= IFCAP_LINKSTATE; - if ((sc->tun_flags & TUN_L2) != 0) { + if ((tp->tun_flags & TUN_L2) != 0) { ifp->if_mtu = ETHERMTU; ifp->if_init = tunifinit; ifp->if_start = tunstart_l2; @@ -943,11 +977,10 @@ tuncreate(struct cdev *dev, struct tuntap_driver *drv) if_attach(ifp); bpfattach(ifp, DLT_NULL, sizeof(u_int32_t)); } - dev->si_drv1 = sc; - TUN_LOCK(sc); - sc->tun_flags |= TUN_INITED; - TUN_UNLOCK(sc); + TUN_LOCK(tp); + tp->tun_flags |= TUN_INITED; + TUN_UNLOCK(tp); TUNDEBUG(ifp, "interface %s is created, minor = %#x\n", ifp->if_xname, dev2unit(dev)); @@ -1008,7 +1041,6 @@ static int tunopen(struct cdev *dev, int flag, int mode, struct thread *td) { struct ifnet *ifp; - struct tuntap_driver *drv; struct tuntap_softc *tp; int error, tunflags; @@ -1031,22 +1063,16 @@ tunopen(struct cdev *dev, int flag, int mode, struct t } } - /* - * XXXRW: Non-atomic test and set of dev->si_drv1 requires - * synchronization. - */ tp = dev->si_drv1; - if (!tp) { - drv = tuntap_driver_from_flags(tunflags); - if (drv == NULL) { - CURVNET_RESTORE(); - return (ENXIO); - } - tuncreate(dev, drv); - tp = dev->si_drv1; - } + KASSERT(tp != NULL, + ("si_drv1 should have been initialized at creation")); TUN_LOCK(tp); + if ((tp->tun_flags & TUN_INITED) == 0) { + TUN_UNLOCK(tp); + CURVNET_RESTORE(); + return (ENXIO); + } if ((tp->tun_flags & (TUN_OPEN | TUN_DYING)) != 0) { TUN_UNLOCK(tp); CURVNET_RESTORE(); From owner-svn-src-head@freebsd.org Sun Oct 20 22:55:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E27A216D423; Sun, 20 Oct 2019 22:55:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xFVW5m26z4Stc; Sun, 20 Oct 2019 22:55:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA2CE1AEB4; Sun, 20 Oct 2019 22:55:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KMtlT7086928; Sun, 20 Oct 2019 22:55:47 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KMtlki086927; Sun, 20 Oct 2019 22:55:47 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910202255.x9KMtlki086927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 20 Oct 2019 22:55:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353786 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353786 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 22:55:47 -0000 Author: kevans Date: Sun Oct 20 22:55:47 2019 New Revision: 353786 URL: https://svnweb.freebsd.org/changeset/base/353786 Log: tuntap(4): use cdevpriv w/ dtor for last close instead of d_close cdevpriv dtors will be called when the reference count on the associated struct file drops to 0, while d_close can be unreliable for cleaning up state at "last close" for a number of reasons. As far as tunclose/tundtor is concerned the difference is minimal, so make the switch. Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Sun Oct 20 22:39:40 2019 (r353785) +++ head/sys/net/if_tuntap.c Sun Oct 20 22:55:47 2019 (r353786) @@ -220,6 +220,7 @@ static int tuntap_name2info(const char *name, int *uni static void tunclone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev); static void tuncreate(struct cdev *dev); +static void tundtor(void *data); static void tunrename(void *arg, struct ifnet *ifp); static int tunifioctl(struct ifnet *, u_long, caddr_t); static void tuninit(struct ifnet *); @@ -238,7 +239,6 @@ static int tun_clone_destroy(struct if_clone *, struct static void tun_vnethdr_set(struct ifnet *ifp, int vhdrlen); static d_open_t tunopen; -static d_close_t tunclose; static d_read_t tunread; static d_write_t tunwrite; static d_ioctl_t tunioctl; @@ -278,7 +278,6 @@ static struct tuntap_driver { .d_version = D_VERSION, .d_flags = D_NEEDMINOR, .d_open = tunopen, - .d_close = tunclose, .d_read = tunread, .d_write = tunwrite, .d_ioctl = tunioctl, @@ -296,7 +295,6 @@ static struct tuntap_driver { .d_version = D_VERSION, .d_flags = D_NEEDMINOR, .d_open = tunopen, - .d_close = tunclose, .d_read = tunread, .d_write = tunwrite, .d_ioctl = tunioctl, @@ -314,7 +312,6 @@ static struct tuntap_driver { .d_version = D_VERSION, .d_flags = D_NEEDMINOR, .d_open = tunopen, - .d_close = tunclose, .d_read = tunread, .d_write = tunwrite, .d_ioctl = tunioctl, @@ -1100,24 +1097,33 @@ tunopen(struct cdev *dev, int flag, int mode, struct t if_link_state_change(ifp, LINK_STATE_UP); TUNDEBUG(ifp, "open\n"); TUN_UNLOCK(tp); + + /* + * This can fail with either ENOENT or EBUSY. This is in the middle of + * d_open, so ENOENT should not be possible. EBUSY is possible, but + * the only cdevpriv dtor being set will be tundtor and the softc being + * passed is constant for a given cdev. We ignore the possible error + * because of this as either "unlikely" or "not actually a problem." + */ + (void)devfs_set_cdevpriv(tp, tundtor); CURVNET_RESTORE(); return (0); } /* - * tunclose - close the device - mark i/f down & delete + * tundtor - tear down the device - mark i/f down & delete * routing info */ -static int -tunclose(struct cdev *dev, int foo, int bar, struct thread *td) +static void +tundtor(void *data) { struct proc *p; struct tuntap_softc *tp; struct ifnet *ifp; bool l2tun; - p = td->td_proc; - tp = dev->si_drv1; + tp = data; + p = curproc; ifp = TUN2IFP(tp); TUN_LOCK(tp); @@ -1133,7 +1139,7 @@ tunclose(struct cdev *dev, int foo, int bar, struct th if (p->p_pid != tp->tun_pid) { log(LOG_INFO, "pid %d (%s), %s: tun/tap protocol violation, non-controlling process closed last.\n", - p->p_pid, p->p_comm, dev->si_name); + p->p_pid, p->p_comm, tp->tun_dev->si_name); } /* @@ -1193,7 +1199,6 @@ out: tun_unbusy_locked(tp); TUN_UNLOCK(tp); - return (0); } static void From owner-svn-src-head@freebsd.org Mon Oct 21 00:52:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B0E616F54C; Mon, 21 Oct 2019 00:52:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xJ522G5Vz4Y1h; Mon, 21 Oct 2019 00:52:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 310051C3B7; Mon, 21 Oct 2019 00:52:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9L0qMQ7057465; Mon, 21 Oct 2019 00:52:22 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L0qLo9057463; Mon, 21 Oct 2019 00:52:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910210052.x9L0qLo9057463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 00:52:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353788 - in head: release/picobsd/build share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: release/picobsd/build share/man/man8 X-SVN-Commit-Revision: 353788 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 00:52:22 -0000 Author: kevans Date: Mon Oct 21 00:52:21 2019 New Revision: 353788 URL: https://svnweb.freebsd.org/changeset/base/353788 Log: picobsd: add deprecation notices Notices appear both in picobsd(8) (near the top for easy notice) and are also printed to stderr on every invocation of picobsd for visibility. The tentative date for removal is October 31st, as no volunteers have stepped forward at all from postings to -arch@ at least. No objection from: -arch@ MFC after: 3 days Modified: head/release/picobsd/build/picobsd head/share/man/man8/picobsd.8 Modified: head/release/picobsd/build/picobsd ============================================================================== --- head/release/picobsd/build/picobsd Mon Oct 21 00:08:34 2019 (r353787) +++ head/release/picobsd/build/picobsd Mon Oct 21 00:52:21 2019 (r353788) @@ -1019,6 +1019,7 @@ set_build_parameters() { # Main entry of the script. Initialize variables, parse command line # arguments. +1>&2 echo "WARNING: picobsd is deprecated and will be removed in FreeBSD 13.0." set_defaults while [ true ]; do Modified: head/share/man/man8/picobsd.8 ============================================================================== --- head/share/man/man8/picobsd.8 Mon Oct 21 00:08:34 2019 (r353787) +++ head/share/man/man8/picobsd.8 Mon Oct 21 00:52:21 2019 (r353788) @@ -1,6 +1,6 @@ .\" -*- nroff-fill -*- .\" $FreeBSD$ -.Dd October 1, 2013 +.Dd October 20, 2019 .Dt PICOBSD 8 .Os .Sh NAME @@ -11,6 +11,10 @@ .Op Ar options .Op Ar config-name Op Ar site-name .Sh DESCRIPTION +.Nm +is deprecated and will be removed in +.Fx 13.0 . +.Pp The .Nm utility is a script which produces a minimal implementation of From owner-svn-src-head@freebsd.org Mon Oct 21 03:01:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DC071715C2; Mon, 21 Oct 2019 03:01:06 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xLxY6DFDz4dtJ; Mon, 21 Oct 2019 03:01:05 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9B4E1D933; Mon, 21 Oct 2019 03:01:05 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9L315Zk029393; Mon, 21 Oct 2019 03:01:05 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L315Do029392; Mon, 21 Oct 2019 03:01:05 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201910210301.x9L315Do029392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Mon, 21 Oct 2019 03:01:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353791 - head/tools/tools/locale X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/tools/tools/locale X-SVN-Commit-Revision: 353791 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 03:01:06 -0000 Author: yuripv Date: Mon Oct 21 03:01:05 2019 New Revision: 353791 URL: https://svnweb.freebsd.org/changeset/base/353791 Log: tools/tools/locale: allow POSIX target to be built in parallel While it's rarely used target, more so a one not used during the buildworld, it helps when it's not taking hours (literally). Modified: head/tools/tools/locale/Makefile Modified: head/tools/tools/locale/Makefile ============================================================================== --- head/tools/tools/locale/Makefile Mon Oct 21 01:27:01 2019 (r353790) +++ head/tools/tools/locale/Makefile Mon Oct 21 03:01:05 2019 (r353791) @@ -143,37 +143,33 @@ ENCODINGS= Big5 \ KOI8-U \ SJIS \ US-ASCII \ - UTF-8 \ + UTF-8 - -POSIX: -.if exists (${UNIDIR}/tools/java/cldr.jar) - mkdir -p ${UNIDIR}/posix -. for area in ${BASE_LOCALES_OF_INTEREST} -. if !exists(${UNIDIR}/posix/${area}.UTF-8.src) +POSIX: posixsrc posixcol posixcm +.if !exists(${UNIDIR}/tools/java/cldr.jar) +.error check README about building cldr.jar +.endif +.for area in ${BASE_LOCALES_OF_INTEREST} +posixsrc: ${UNIDIR}/posix/${area}.UTF-8.src +${UNIDIR}/posix/${area}.UTF-8.src: java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ org.unicode.cldr.posix.GeneratePOSIX \ -d ${UNIDIR}/posix -m ${area} -c UTF-8 -. endif -. endfor -. for area encoding in ${COLLATION_SPECIAL} -. if !exists(${UNIDIR}/posix/${area}.${encoding}.src) +.endfor +.for area encoding in ${COLLATION_SPECIAL} +posixcol: ${UNIDIR}/posix/${area}.${encoding}.src +${UNIDIR}/posix/${area}.${encoding}.src: java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ org.unicode.cldr.posix.GeneratePOSIX \ -d ${UNIDIR}/posix -m ${area} -c ${encoding} -. endif -. endfor -. for enc in ${ENCODINGS} -. if !exists(${UNIDIR}/posix/${enc}.cm) +.endfor +.for enc in ${ENCODINGS} +posixcm: ${UNIDIR}/posix/${enc}.cm +${UNIDIR}/posix/${enc}.cm: java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ org.unicode.cldr.posix.GenerateCharmap \ -d ${UNIDIR}/posix -c ${enc} -. endif -. endfor -.else - @echo "Please install CLDR toolset for the desired release" - @echo "It should go at ${UNIDIR}/tools" -.endif +.endfor clean-POSIX: rm -f ${UNIDIR}/posix/* From owner-svn-src-head@freebsd.org Mon Oct 21 08:36:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D54551505A3; Mon, 21 Oct 2019 08:36:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xVNJ56XXz3xT9; Mon, 21 Oct 2019 08:36:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2ECF9215CE; Mon, 21 Oct 2019 08:36:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9L8aFDv028034; Mon, 21 Oct 2019 08:36:15 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L8aF3w028033; Mon, 21 Oct 2019 08:36:15 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910210836.x9L8aF3w028033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 21 Oct 2019 08:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353792 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353792 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 08:36:16 -0000 Author: bz Date: Mon Oct 21 08:36:15 2019 New Revision: 353792 URL: https://svnweb.freebsd.org/changeset/base/353792 Log: frag6: add read-only sysctl for nfrags. Add a read-only sysctl exporting the global number of fragments (base system and all vnets). This is helpful to (a) know how many fragments are currently being processed, (b) if there are possible leaks, (c) if vnet teardown is not working correctly, and lastly (d) it can be used as part of test-suits to ensure (a) to (c). MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Mon Oct 21 03:01:05 2019 (r353791) +++ head/sys/netinet6/frag6.c Mon Oct 21 08:36:15 2019 (r353792) @@ -150,6 +150,10 @@ VNET_DEFINE_STATIC(uint32_t, ip6qb_hashseed); */ SYSCTL_DECL(_net_inet6_ip6); +SYSCTL_UINT(_net_inet6_ip6, OID_AUTO, frag6_nfrags, + CTLFLAG_RD, __DEVOLATILE(u_int *, &frag6_nfrags), 0, + "Global number of IPv6 fragments across all reassembly queues."); + static void frag6_set_bucketsize(void) { From owner-svn-src-head@freebsd.org Mon Oct 21 08:48:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49345150A47; Mon, 21 Oct 2019 08:48:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xVfm1ChXz3xyp; Mon, 21 Oct 2019 08:48:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CEC921794; Mon, 21 Oct 2019 08:48:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9L8mlP0033780; Mon, 21 Oct 2019 08:48:47 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L8mlLm033778; Mon, 21 Oct 2019 08:48:47 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910210848.x9L8mlLm033778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 21 Oct 2019 08:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353793 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353793 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 08:48:48 -0000 Author: bz Date: Mon Oct 21 08:48:47 2019 New Revision: 353793 URL: https://svnweb.freebsd.org/changeset/base/353793 Log: frag6: fix vnet teardown leak When shutting down a VNET we did not cleanup the fragmentation hashes. This has multiple problems: (1) leak memory but also (2) leak on the global counters, which might eventually lead to a problem on a system starting and stopping a lot of vnets and dealing with a lot of IPv6 fragments that the counters/limits would be exhausted and processing would no longer take place. Unfortunately we do not have a useable variable to indicate when per-VNET initialization of frag6 has happened (or when destroy happened) so introduce a boolean to flag this. This is needed here as well as it was in r353635 for ip_reass.c in order to avoid tripping over the already destroyed locks if interfaces go away after the frag6 destroy. While splitting things up convert the TRY_LOCK to a LOCK operation in now frag6_drain_one(). The try-lock was derived from a manual hand-rolled implementation and carried forward all the time. We no longer can afford not to get the lock as that would mean we would continue to leak memory. Assert that all the buckets are empty before destroying to lock to ensure long-term stability of a clean shutdown. Reported by: hselasky Reviewed by: hselasky MFC after: 3 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22054 Modified: head/sys/netinet6/frag6.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_var.h Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Mon Oct 21 08:36:15 2019 (r353792) +++ head/sys/netinet6/frag6.c Mon Oct 21 08:48:47 2019 (r353793) @@ -100,6 +100,12 @@ struct ip6asfrag { static MALLOC_DEFINE(M_FRAG6, "frag6", "IPv6 fragment reassembly header"); +#ifdef VIMAGE +/* A flag to indicate if IPv6 fragmentation is initialized. */ +VNET_DEFINE_STATIC(bool, frag6_on); +#define V_frag6_on VNET(frag6_on) +#endif + /* System wide (global) maximum and count of packets in reassembly queues. */ static int ip6_maxfrags; static volatile u_int frag6_nfrags = 0; @@ -289,6 +295,15 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); +#ifdef VIMAGE + /* + * Skip processing if IPv6 reassembly is not initialised or + * torn down by frag6_destroy(). + */ + if (!V_frag6_on) + return; +#endif + CURVNET_SET_QUIET(ifp->if_vnet); for (i = 0; i < IP6REASS_NHASH; i++) { IP6QB_LOCK(i); @@ -929,6 +944,9 @@ frag6_init(void) } V_ip6qb_hashseed = arc4random(); V_ip6_maxfragsperpacket = 64; +#ifdef VIMAGE + V_frag6_on = true; +#endif if (!IS_DEFAULT_VNET(curvnet)) return; @@ -940,31 +958,57 @@ frag6_init(void) /* * Drain off all datagram fragments. */ +static void +frag6_drain_one(void) +{ + struct ip6q *head; + uint32_t bucket; + + for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { + IP6QB_LOCK(bucket); + head = IP6QB_HEAD(bucket); + while (head->ip6q_next != head) { + IP6STAT_INC(ip6s_fragdropped); + /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ + frag6_freef(head->ip6q_next, bucket); + } + IP6QB_UNLOCK(bucket); + } +} + void frag6_drain(void) { VNET_ITERATOR_DECL(vnet_iter); - struct ip6q *head; - uint32_t bucket; VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { - if (IP6QB_TRYLOCK(bucket) == 0) - continue; - head = IP6QB_HEAD(bucket); - while (head->ip6q_next != head) { - IP6STAT_INC(ip6s_fragdropped); - /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(head->ip6q_next, bucket); - } - IP6QB_UNLOCK(bucket); - } + frag6_drain_one(); CURVNET_RESTORE(); } VNET_LIST_RUNLOCK_NOSLEEP(); } + +#ifdef VIMAGE +/* + * Clear up IPv6 reassembly structures. + */ +void +frag6_destroy(void) +{ + uint32_t bucket; + + frag6_drain_one(); + V_frag6_on = false; + for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { + KASSERT(V_ip6qb[bucket].count == 0, + ("%s: V_ip6qb[%d] (%p) count not 0 (%d)", __func__, + bucket, &V_ip6qb[bucket], V_ip6qb[bucket].count)); + mtx_destroy(&V_ip6qb[bucket].lock); + } +} +#endif /* * Put an ip fragment on a reassembly chain. Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Mon Oct 21 08:36:15 2019 (r353792) +++ head/sys/netinet6/ip6_input.c Mon Oct 21 08:48:47 2019 (r353793) @@ -393,6 +393,7 @@ ip6_destroy(void *unused __unused) } IFNET_RUNLOCK(); + frag6_destroy(); nd6_destroy(); in6_ifattach_destroy(); Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Mon Oct 21 08:36:15 2019 (r353792) +++ head/sys/netinet6/ip6_var.h Mon Oct 21 08:48:47 2019 (r353793) @@ -392,6 +392,7 @@ int ip6_fragment(struct ifnet *, struct mbuf *, int, u int route6_input(struct mbuf **, int *, int); void frag6_init(void); +void frag6_destroy(void); int frag6_input(struct mbuf **, int *, int); void frag6_slowtimo(void); void frag6_drain(void); From owner-svn-src-head@freebsd.org Mon Oct 21 09:33:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FD3F15241C; Mon, 21 Oct 2019 09:33:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xWfh0BB5z41WP; Mon, 21 Oct 2019 09:33:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD5822206A; Mon, 21 Oct 2019 09:33:47 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9L9XlIN062779; Mon, 21 Oct 2019 09:33:47 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L9Xkig062769; Mon, 21 Oct 2019 09:33:46 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910210933.x9L9Xkig062769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 21 Oct 2019 09:33:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353794 - in head: etc/mtree tests/sys tests/sys/netinet6 tests/sys/netinet6/frag6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head: etc/mtree tests/sys tests/sys/netinet6 tests/sys/netinet6/frag6 X-SVN-Commit-Revision: 353794 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 09:33:48 -0000 Author: bz Date: Mon Oct 21 09:33:45 2019 New Revision: 353794 URL: https://svnweb.freebsd.org/changeset/base/353794 Log: frag6: import a set of test cases In order to ensure that changing the frag6 code does not change behaviour or break code a set of test cases were implemented. Like some other test cases these use Scapy to generate packets and possibly wait for expected answers. In most cases we do check the global and per interface (netstat) statistics output using the libxo output and grep to validate fields and numbers. This is a bit hackish but we currently have no better way to match a selected number of stats only (we have to ignore some of the ND6 variables; otherwise we could use the entire list). Test cases include atomic fragments, single fragments, multi-fragments, and try to cover most error cases in the code currently. In addition vnet teardown is tested to not panic. A separate set (not in-tree currently) of probes were used in order to make sure that the test cases actually test what they should. The "sniffer" code was copied and adjusted from the netpfil version as we sometimes will not get packets or have longer timeouts to deal with. Sponsored by: Netflix Added: head/tests/sys/netinet6/ head/tests/sys/netinet6/Makefile (contents, props changed) head/tests/sys/netinet6/frag6/ head/tests/sys/netinet6/frag6/Makefile (contents, props changed) head/tests/sys/netinet6/frag6/frag6.subr (contents, props changed) head/tests/sys/netinet6/frag6/frag6_01.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_01.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_02.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_02.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_03.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_03.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_04.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_04.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_05.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_05.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_06.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_06.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_07.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_07.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_08.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_08.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_09.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_09.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_10.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_10.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_11.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_11.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_12.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_12.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_13.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_13.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_14.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_14.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_15.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_15.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_16.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_16.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_17.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_17.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_18.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_18.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_19.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_19.sh (contents, props changed) head/tests/sys/netinet6/frag6/sniffer.py (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/tests/sys/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Mon Oct 21 08:48:47 2019 (r353793) +++ head/etc/mtree/BSD.tests.dist Mon Oct 21 09:33:45 2019 (r353794) @@ -792,6 +792,10 @@ .. netinet .. + netinet6 + frag6 + .. + .. netipsec tunnel .. Modified: head/tests/sys/Makefile ============================================================================== --- head/tests/sys/Makefile Mon Oct 21 08:48:47 2019 (r353793) +++ head/tests/sys/Makefile Mon Oct 21 09:33:45 2019 (r353794) @@ -20,6 +20,7 @@ TESTS_SUBDIRS+= kqueue TESTS_SUBDIRS+= mac TESTS_SUBDIRS+= mqueue TESTS_SUBDIRS+= netinet +TESTS_SUBDIRS+= netinet6 TESTS_SUBDIRS+= netipsec TESTS_SUBDIRS+= netmap TESTS_SUBDIRS+= netpfil Added: head/tests/sys/netinet6/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/Makefile Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/netinet6 + +TESTS_SUBDIRS+= frag6 + +.include Added: head/tests/sys/netinet6/frag6/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/Makefile Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,76 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/sys/netinet6/frag6 +FILESDIR= ${TESTSDIR} + +# We split these up so they can run in parallel. +# Seems kyua is not running the test cases from one file in parallel. +# Otherwise we could cat the files together into one shell file. +ATF_TESTS_SH= \ + frag6_01 \ + frag6_02 \ + frag6_03 \ + frag6_04 \ + frag6_05 \ + frag6_06 \ + frag6_07 \ + frag6_08 \ + frag6_09 \ + frag6_10 \ + frag6_11 \ + frag6_12 \ + frag6_13 \ + frag6_14 \ + frag6_15 \ + frag6_16 \ + frag6_17 \ + frag6_18 \ + frag6_19 + +${PACKAGE}FILES+= frag6.subr +${PACKAGE}FILES+= sniffer.py +${PACKAGE}FILES+= frag6_01.py +${PACKAGE}FILES+= frag6_02.py +${PACKAGE}FILES+= frag6_03.py +${PACKAGE}FILES+= frag6_04.py +${PACKAGE}FILES+= frag6_05.py +${PACKAGE}FILES+= frag6_06.py +${PACKAGE}FILES+= frag6_07.py +${PACKAGE}FILES+= frag6_08.py +${PACKAGE}FILES+= frag6_09.py +${PACKAGE}FILES+= frag6_10.py +${PACKAGE}FILES+= frag6_11.py +${PACKAGE}FILES+= frag6_12.py +${PACKAGE}FILES+= frag6_13.py +${PACKAGE}FILES+= frag6_14.py +${PACKAGE}FILES+= frag6_15.py +${PACKAGE}FILES+= frag6_16.py +${PACKAGE}FILES+= frag6_17.py +${PACKAGE}FILES+= frag6_18.py +${PACKAGE}FILES+= frag6_19.py + +${PACKAGE}FILESMODE_frag6.subr= 0444 +${PACKAGE}FILESMODE_sniffer.py= 0555 +${PACKAGE}FILESMODE_frag6_01.py= 0555 +${PACKAGE}FILESMODE_frag6_02.py= 0555 +${PACKAGE}FILESMODE_frag6_03.py= 0555 +${PACKAGE}FILESMODE_frag6_04.py= 0555 +${PACKAGE}FILESMODE_frag6_05.py= 0555 +${PACKAGE}FILESMODE_frag6_06.py= 0555 +${PACKAGE}FILESMODE_frag6_07.py= 0555 +${PACKAGE}FILESMODE_frag6_08.py= 0555 +${PACKAGE}FILESMODE_frag6_09.py= 0555 +${PACKAGE}FILESMODE_frag6_10.py= 0555 +${PACKAGE}FILESMODE_frag6_11.py= 0555 +${PACKAGE}FILESMODE_frag6_12.py= 0555 +${PACKAGE}FILESMODE_frag6_13.py= 0555 +${PACKAGE}FILESMODE_frag6_14.py= 0555 +${PACKAGE}FILESMODE_frag6_15.py= 0555 +${PACKAGE}FILESMODE_frag6_16.py= 0555 +${PACKAGE}FILESMODE_frag6_17.py= 0555 +${PACKAGE}FILESMODE_frag6_18.py= 0555 +${PACKAGE}FILESMODE_frag6_19.py= 0555 + +.include Added: head/tests/sys/netinet6/frag6/frag6.subr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6.subr Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,122 @@ +# $FreeBSD$ +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 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. +# + +. $(atf_get_srcdir)/../../common/vnet.subr + +frag6_head() +{ + atf_set descr 'Test IPv6 fragmentation code' + atf_set require.user root + atf_set require.progs scapy +} + +frag6_body() +{ + ids=${1:="65533"} + shift + id=`printf "%x" ${ids}` + if [ $$ -gt 65535 ]; then + xl=`printf "%x" $(($$ - 65535))` + yl="1" + else + xl=`printf "%x" $$` + yl="" + fi + + vnet_init + + ip6a="2001:db8:6666:6666:${yl}:${id}:1:${xl}" + ip6b="2001:db8:6666:6666:${yl}:${id}:2:${xl}" + + epair=$(vnet_mkepair) + ifconfig ${epair}a mtu 131071 up + ifconfig ${epair}a inet6 ${ip6a}/64 + + jname="v6t-${id}-${yl}-${xl}" + vnet_mkjail ${jname} ${epair}b + jexec ${jname} ifconfig ${epair}b mtu 131071 up + jexec ${jname} ifconfig ${epair}b inet6 ${ip6b}/64 + + # Let IPv6 ND do its thing. + #ping6 -q -c 1 ff02::1%${epair}a + #ping6 -q -c 1 ${ip6b} + sleep 3 + + # We need to try to make sure all expiry happened, otherwise there might + # be global fragments queued. (This still does not rule out that there + # are no other fragments queued anywhere else in the system). + i=0 + while test $i -lt 60; do + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + esac + sleep 1 + i=$((i + 1)) + done + case ${nf} in + 0) ;; + *) atf_fail "Global frag6_nfrags count is not zero but ${nf}" ;; + esac + + pretestf=$2 + case "${pretestf}" in + "") ;; + [A-Za-z0-9_]*) + eval ${pretestf} "${jname}" "${epair}b" + ;; + esac + + # Clear statistics. + jexec ${jname} netstat -z -s > /dev/null + + # Run fragment tests. + pyname=$(atf_get ident) + pyname=${pyname%*_[0-9]} + atf_check -s exit:0 $(atf_get_srcdir)/${pyname}.py \ + --sendif ${epair}a \ + --recvif ${epair}a \ + --src ${ip6a} \ + --to ${ip6b} + + checkf=$1 + case "${checkf}" in + "") ;; + [A-Za-z0-9_]*) + eval ${checkf} "${jname}" "${epair}b" + ;; + esac +} + +frag6_cleanup() +{ + + vnet_cleanup +} + +# end Added: head/tests/sys/netinet6/frag6/frag6_01.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_01.py Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,115 @@ +#!/usr/bin/env python +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 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$ +# + +import argparse +import scapy.all as sp +import socket +import sys +from sniffer import Sniffer +from time import sleep + +def check_icmp6_error(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6ParamProblem) + if not icmp6: + return False + # ICMP6_PARAMPROB_HEADER 0 + if icmp6.code != 0: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Param Prob so leave it. + #icmp6.display() + return True + +def main(): + parser = argparse.ArgumentParser("frag6.py", + description="IPv6 fragementation test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + parser.add_argument('--debug', + required=False, action='store_true', + help='Enable test debugging') + + args = parser.parse_args() + + + # Start sniffing on recvif + sniffer = Sniffer(args, check_icmp6_error) + + + ######################################################################## + # + # A single start fragment with zero length IPv6 header (jumbo). + # Make sure we do hit the Fragment case, which is tricky as the + # jumbogram needs to be > 64k. + # + # A: Jumbo-Fragment not allowed. + # R: ICMPv6 param problem. + # + #data = "6" * (65536 - 2 - 6 - 8 - 8) + data = "6" * 65512 + ip6f01 = sp.Ether() / \ + sp.IPv6(src=args.src[0], dst=args.to[0], plen=0) / \ + sp.IPv6ExtHdrHopByHop(options=sp.Jumbo(jumboplen=65536)) / \ + sp.IPv6ExtHdrFragment(offset=0, m=1, id=6) / \ + sp.UDP(dport=3456, sport=6543) / \ + data + if args.debug : + ip6f01.display() + sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) + + # We should only need to sleep 0.10 but it seems scapy + # takes time for this one. + sleep(75) + sniffer.setEnd() + sniffer.join() + if not sniffer.foundCorrectPacket: + sys.exit(1) + + sys.exit(0) + +if __name__ == '__main__': + main() Added: head/tests/sys/netinet6/frag6/frag6_01.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_01.sh Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,223 @@ +# $FreeBSD$ +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 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. +# + +. $(atf_get_srcdir)/frag6.subr + +atf_test_case "frag6_01" "cleanup" +frag6_01_head() { + frag6_head 1 +} + +frag6_01_check_stats() { + + local jname ifname + jname=$1 + ifname=$2 + + case "${jname}" in + "") echo "ERROR: jname is empty"; return ;; + esac + case "${ifname}" in + "") echo "ERROR: ifname is empty"; return ;; + esac + + # Defaults are: IPV6_FRAGTTL 120 slowtimo ticks. + # pfslowtimo() is run at hz/2. So this takes 60s. + # This is awefully long for a test case. + # The Python script has to wait for this already to get the ICMPv6 + # hence we do not sleep here anymore. + + + # + # Check selection of global UDP stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p udp --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 9) ;; + *) jexec ${jname} netstat -s -p udp --libxo xml,pretty + atf_fail "Global UDP statistics do not match: ${count} != 9" ;; + esac + + # + # Check selection of global IPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p ip6 --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 20) ;; + *) jexec ${jname} netstat -s -p ip6 --libxo xml,pretty + atf_fail "Global IPv6 statistics do not match: ${count} != 20" ;; + esac + + # + # Check selection of global ICMPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p icmp6 --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 22) ;; + *) jexec ${jname} netstat -s -p icmp6 --libxo xml,pretty + atf_fail "Global ICMPv6 statistics do not match: ${count} != 22" ;; + esac + + # + # Check selection of interface IPv6 stats. + # XXX-BZ TODO FIXME reassembly-failed should be 1? + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 14) ;; + *) jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty + atf_fail "Interface IPv6 statistics do not match: ${count} != 14" ;; + esac + + # + # Check selection of interface ICMPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p icmp6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 21) ;; + *) jexec ${jname} netstat -s -p icmp6 -I ${ifname} --libxo xml,pretty + atf_fail "Interface ICMPv6 statistics do not match: ${count} != 21" ;; + esac +} + +frag6_01_body() { + + atf_skip "Sending IPv6 Jumbograms needs 1 kernel changes and BPF fixes" + + frag6_body 1 frag6_01_check_stats +} + +frag6_01_cleanup() { + frag6_cleanup 1 +} + +atf_init_test_cases() +{ + atf_add_test_case "frag6_01" +} Added: head/tests/sys/netinet6/frag6/frag6_02.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_02.py Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,108 @@ +#!/usr/bin/env python +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 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$ +# + +import argparse +import scapy.all as sp +import socket +import sys +from sniffer import Sniffer +from time import sleep + +def check_icmp6_error(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6ParamProblem) + if not icmp6: + return False + # ICMP6_PARAMPROB_HEADER 0 + if icmp6.code != 0: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Param Prob so leave it. + #icmp6.display() + return True + +def main(): + parser = argparse.ArgumentParser("frag6.py", + description="IPv6 fragementation test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + parser.add_argument('--debug', + required=False, action='store_true', + help='Enable test debugging') + + args = parser.parse_args() + + + # Start sniffing on recvif + sniffer = Sniffer(args, check_icmp6_error) + + + ######################################################################## + # + # A single start fragment with payload length not % 8. + # + # A: Error handling in code. + # R: ICMPv6 param problem. + # + data = "6" * 1287 + ip6f01 = sp.Ether() / \ + sp.IPv6(src=args.src[0], dst=args.to[0]) / \ + sp.IPv6ExtHdrFragment(offset=0, m=1, id=5) / \ + sp.UDP(dport=3456, sport=6543) / \ + data + if args.debug : + ip6f01.display() + sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) + + sleep(0.10) + sniffer.join() + if not sniffer.foundCorrectPacket: + sys.exit(1) + + sys.exit(0) + +if __name__ == '__main__': + main() Added: head/tests/sys/netinet6/frag6/frag6_02.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_02.sh Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,220 @@ +# $FreeBSD$ +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 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. +# + +. $(atf_get_srcdir)/frag6.subr + +atf_test_case "frag6_02" "cleanup" +frag6_02_head() { + frag6_head 2 +} + +frag6_02_check_stats() { + + local jname ifname + jname=$1 + ifname=$2 + + case "${jname}" in + "") echo "ERROR: jname is empty"; return ;; + esac + case "${ifname}" in + "") echo "ERROR: ifname is empty"; return ;; + esac + + # Defaults are: IPV6_FRAGTTL 120 slowtimo ticks. + # pfslowtimo() is run at hz/2. So this takes 60s. + # This is awefully long for a test case. + # The Python script has to wait for this already to get the ICMPv6 + # hence we do not sleep here anymore. + + + # + # Check selection of global UDP stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p udp --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 9) ;; + *) jexec ${jname} netstat -s -p udp --libxo xml,pretty + atf_fail "Global UDP statistics do not match: ${count} != 9" ;; + esac + + # + # Check selection of global IPv6 stats. + # XXX-TODO no global stats for this case? + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p ip6 --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 20) ;; + *) jexec ${jname} netstat -s -p ip6 --libxo xml,pretty + atf_fail "Global IPv6 statistics do not match: ${count} != 20" ;; + esac + + # + # Check selection of global ICMPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p icmp6 --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 22) ;; + *) jexec ${jname} netstat -s -p icmp6 --libxo xml,pretty + atf_fail "Global ICMPv6 statistics do not match: ${count} != 22" ;; + esac + + # + # Check selection of interface IPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +EOF + count=`jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 14) ;; + *) jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty + atf_fail "Interface IPv6 statistics do not match: ${count} != 14" ;; + esac + + # + # Check selection of interface ICMPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p icmp6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 21) ;; + *) jexec ${jname} netstat -s -p icmp6 -I ${ifname} --libxo xml,pretty + atf_fail "Interface ICMPv6 statistics do not match: ${count} != 21" ;; + esac +} + +frag6_02_body() { + frag6_body 2 frag6_02_check_stats +} + +frag6_02_cleanup() { + frag6_cleanup 2 +} + +atf_init_test_cases() +{ + atf_add_test_case "frag6_02" +} Added: head/tests/sys/netinet6/frag6/frag6_03.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_03.py Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,106 @@ +#!/usr/bin/env python +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 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$ +# + +import argparse +import scapy.all as sp +import socket +import sys +from sniffer import Sniffer +from time import sleep + +def check_icmp6_error(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6DestUnreach) + if not icmp6: + return False + # ICMP6_DST_UNREACH_NOPORT 4 + if icmp6.code != 4: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Dest Unreach / Port Unreach so leave it. + #icmp6.display() + return True + +def main(): + parser = argparse.ArgumentParser("frag6.py", + description="IPv6 fragementation test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + parser.add_argument('--debug', + required=False, action='store_true', + help='Enable test debugging') + + args = parser.parse_args() + + + # Start sniffing on recvif + sniffer = Sniffer(args, check_icmp6_error) + + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Oct 21 11:56:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D1A5154E65; Mon, 21 Oct 2019 11:56:58 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xZqt1qJYz47mQ; Mon, 21 Oct 2019 11:56:58 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BF9D239D5; Mon, 21 Oct 2019 11:56:58 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LBuvVs045876; Mon, 21 Oct 2019 11:56:57 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LBuvLB045875; Mon, 21 Oct 2019 11:56:57 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201910211156.x9LBuvLB045875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Mon, 21 Oct 2019 11:56:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353795 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 353795 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 11:56:58 -0000 Author: luporl Date: Mon Oct 21 11:56:57 2019 New Revision: 353795 URL: https://svnweb.freebsd.org/changeset/base/353795 Log: [PPC64] Add minidump support to PowerNV Implementation of PowerNV specific minidump code. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D21643 Modified: head/sys/powerpc/aim/moea64_native.c Modified: head/sys/powerpc/aim/moea64_native.c ============================================================================== --- head/sys/powerpc/aim/moea64_native.c Mon Oct 21 09:33:45 2019 (r353794) +++ head/sys/powerpc/aim/moea64_native.c Mon Oct 21 11:56:57 2019 (r353795) @@ -213,6 +213,12 @@ static struct rwlock moea64_eviction_lock; static volatile struct pate *moea64_part_table; /* + * Dump function. + */ +static void *moea64_dump_pmap_native(mmu_t mmu, void *ctx, void *buf, + u_long *nbytes); + +/* * PTE calls. */ static int moea64_pte_insert_native(mmu_t, struct pvo_entry *); @@ -233,6 +239,7 @@ static mmu_method_t moea64_native_methods[] = { /* Internal interfaces */ MMUMETHOD(mmu_bootstrap, moea64_bootstrap_native), MMUMETHOD(mmu_cpu_bootstrap, moea64_cpu_bootstrap_native), + MMUMETHOD(mmu_dump_pmap, moea64_dump_pmap_native), MMUMETHOD(moea64_pte_synch, moea64_pte_synch_native), MMUMETHOD(moea64_pte_clear, moea64_pte_clear_native), @@ -787,3 +794,21 @@ moea64_pte_insert_native(mmu_t mmu, struct pvo_entry * return (-1); } +static void * +moea64_dump_pmap_native(mmu_t mmu, void *ctx, void *buf, u_long *nbytes) +{ + struct dump_context *dctx; + u_long ptex, ptex_end; + + dctx = (struct dump_context *)ctx; + ptex = dctx->ptex; + ptex_end = ptex + dctx->blksz / sizeof(struct lpte); + ptex_end = MIN(ptex_end, dctx->ptex_end); + *nbytes = (ptex_end - ptex) * sizeof(struct lpte); + + if (*nbytes == 0) + return (NULL); + + dctx->ptex = ptex_end; + return (__DEVOLATILE(struct lpte *, moea64_pteg_table) + ptex); +} From owner-svn-src-head@freebsd.org Mon Oct 21 12:21:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A5F7156053; Mon, 21 Oct 2019 12:21:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xbNh6ndbz49Xb; Mon, 21 Oct 2019 12:21:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD41C23ED8; Mon, 21 Oct 2019 12:21:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LCLuU0062518; Mon, 21 Oct 2019 12:21:56 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LCLuEh062517; Mon, 21 Oct 2019 12:21:56 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910211221.x9LCLuEh062517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 21 Oct 2019 12:21:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353796 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353796 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 12:21:57 -0000 Author: avg Date: Mon Oct 21 12:21:56 2019 New Revision: 353796 URL: https://svnweb.freebsd.org/changeset/base/353796 Log: debug,kassert.warnings is a statistic, not a tunable MFC after: 1 week Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Mon Oct 21 11:56:57 2019 (r353795) +++ head/sys/kern/kern_shutdown.c Mon Oct 21 12:21:56 2019 (r353796) @@ -713,7 +713,7 @@ SYSCTL_INT(_debug_kassert, OID_AUTO, do_log, KASSERT_R &kassert_do_log, 0, "If warn_only is enabled, log (1) or do not log (0) assertion violations"); -SYSCTL_INT(_debug_kassert, OID_AUTO, warnings, KASSERT_RWTUN, +SYSCTL_INT(_debug_kassert, OID_AUTO, warnings, CTLFLAG_RD | CTLFLAG_STATS, &kassert_warnings, 0, "number of KASSERTs that have been triggered"); SYSCTL_INT(_debug_kassert, OID_AUTO, log_panic_at, KASSERT_RWTUN, From owner-svn-src-head@freebsd.org Mon Oct 21 14:38:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95A06158F25; Mon, 21 Oct 2019 14:38:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xfPw3Pg7z4LbM; Mon, 21 Oct 2019 14:38:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53F5A25609; Mon, 21 Oct 2019 14:38:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LEcCt5040600; Mon, 21 Oct 2019 14:38:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LEcB1v040599; Mon, 21 Oct 2019 14:38:11 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910211438.x9LEcB1v040599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 14:38:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353798 - in head: . sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: . sys/net X-SVN-Commit-Revision: 353798 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 14:38:12 -0000 Author: kevans Date: Mon Oct 21 14:38:11 2019 New Revision: 353798 URL: https://svnweb.freebsd.org/changeset/base/353798 Log: tuntap(4): restrict scope of net.link.tap.user_open slightly net.link.tap.user_open has historically allowed non-root users to do devfs cloning and open /dev/tap* nodes based on permissions. Loosen this up to make it only allow users to do devfs cloning -- we no longer check it in tunopen. This allows tap devices to be created that can actually be opened by a user, rather than swiftly restricting them to root because the magic sysctl has not been set. The sysctl has not yet been completely deprecated, because more thought is needed for how to handle the devfs cloning case. There is not an easy suitable replacement for the sysctl there, and more care needs to be placed in determining whether that's OK or not. PR: 200185 Modified: head/UPDATING head/sys/net/if_tuntap.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Oct 21 14:34:40 2019 (r353797) +++ head/UPDATING Mon Oct 21 14:38:11 2019 (r353798) @@ -26,6 +26,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20191021: + The net.link.tap.user_open sysctl no longer prevents user opening of + already created /dev/tapNN devices. Access is still controlled by + node permissions, just like tun devices. The net.link.tap.user_open + sysctl is now used only to allow users to perform devfs cloning of + tap devices, and the subsequent open may not succeed if the user is not + in the appropriate group. This sysctl may be deprecated/removed + completely in the future. + 20191009: mips, powerpc, and sparc64 are no longer built as part of universe / tinderbox unless MAKE_OBSOLETE_GCC is defined. If Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Mon Oct 21 14:34:40 2019 (r353797) +++ head/sys/net/if_tuntap.c Mon Oct 21 14:38:11 2019 (r353798) @@ -181,7 +181,7 @@ static const char vmnetname[] = "vmnet"; static MALLOC_DEFINE(M_TUN, tunname, "Tunnel Interface"); static int tundebug = 0; static int tundclone = 1; -static int tap_allow_uopen = 0; /* allow user open() */ +static int tap_allow_uopen = 0; /* allow user devfs cloning */ static int tapuponopen = 0; /* IFF_UP on open() */ static int tapdclone = 1; /* enable devfs cloning */ @@ -202,7 +202,7 @@ SYSCTL_INT(_net_link_tun, OID_AUTO, devfs_cloning, CTL static SYSCTL_NODE(_net_link, OID_AUTO, tap, CTLFLAG_RW, 0, "Ethernet tunnel software network interface"); SYSCTL_INT(_net_link_tap, OID_AUTO, user_open, CTLFLAG_RW, &tap_allow_uopen, 0, - "Allow user to open /dev/tap (based on node permissions)"); + "Enable legacy devfs interface creation for all users"); SYSCTL_INT(_net_link_tap, OID_AUTO, up_on_open, CTLFLAG_RW, &tapuponopen, 0, "Bring interface up when /dev/tap is opened"); SYSCTL_INT(_net_link_tap, OID_AUTO, devfs_cloning, CTLFLAG_RWTUN, &tapdclone, 0, @@ -1047,17 +1047,6 @@ tunopen(struct cdev *dev, int flag, int mode, struct t if (error != 0) { CURVNET_RESTORE(); return (error); /* Shouldn't happen */ - } - - if ((tunflags & TUN_L2) != 0) { - /* Restrict? */ - if (tap_allow_uopen == 0) { - error = priv_check(td, PRIV_NET_TAP); - if (error != 0) { - CURVNET_RESTORE(); - return (error); - } - } } tp = dev->si_drv1; From owner-svn-src-head@freebsd.org Mon Oct 21 17:59:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F18E415CC5A; Mon, 21 Oct 2019 17:59:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xksf5zhSz4W9s; Mon, 21 Oct 2019 17:59:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACC9F2798F; Mon, 21 Oct 2019 17:59:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LHx2wl058665; Mon, 21 Oct 2019 17:59:02 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LHx2Fx058664; Mon, 21 Oct 2019 17:59:02 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211759.x9LHx2Fx058664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 17:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353802 - head/sys/dev/virtio/network X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/virtio/network X-SVN-Commit-Revision: 353802 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 17:59:03 -0000 Author: glebius Date: Mon Oct 21 17:59:02 2019 New Revision: 353802 URL: https://svnweb.freebsd.org/changeset/base/353802 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/virtio/network/if_vtnet.c Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Mon Oct 21 17:54:53 2019 (r353801) +++ head/sys/dev/virtio/network/if_vtnet.c Mon Oct 21 17:59:02 2019 (r353802) @@ -3285,6 +3285,34 @@ vtnet_rx_filter(struct vtnet_softc *sc) ifp->if_flags & IFF_ALLMULTI ? "enable" : "disable"); } +static u_int +vtnet_copy_ifaddr(void *arg, struct sockaddr_dl *sdl, u_int ucnt) +{ + struct vtnet_softc *sc = arg; + + if (memcmp(LLADDR(sdl), sc->vtnet_hwaddr, ETHER_ADDR_LEN) == 0) + return (0); + + if (ucnt < VTNET_MAX_MAC_ENTRIES) + bcopy(LLADDR(sdl), + &sc->vtnet_mac_filter->vmf_unicast.macs[ucnt], + ETHER_ADDR_LEN); + + return (1); +} + +static u_int +vtnet_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt) +{ + struct vtnet_mac_filter *filter = arg; + + if (mcnt < VTNET_MAX_MAC_ENTRIES) + bcopy(LLADDR(sdl), &filter->vmf_multicast.macs[mcnt], + ETHER_ADDR_LEN); + + return (1); +} + static void vtnet_rx_filter_mac(struct vtnet_softc *sc) { @@ -3293,42 +3321,23 @@ vtnet_rx_filter_mac(struct vtnet_softc *sc) struct sglist_seg segs[4]; struct sglist sg; struct ifnet *ifp; - struct ifaddr *ifa; - struct ifmultiaddr *ifma; - int ucnt, mcnt, promisc, allmulti, error; + bool promisc, allmulti; + u_int ucnt, mcnt; + int error; uint8_t ack; ifp = sc->vtnet_ifp; filter = sc->vtnet_mac_filter; - ucnt = 0; - mcnt = 0; - promisc = 0; - allmulti = 0; VTNET_CORE_LOCK_ASSERT(sc); KASSERT(sc->vtnet_flags & VTNET_FLAG_CTRL_RX, ("%s: CTRL_RX feature not negotiated", __func__)); /* Unicast MAC addresses: */ - if_addr_rlock(ifp); - CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family != AF_LINK) - continue; - else if (memcmp(LLADDR((struct sockaddr_dl *)ifa->ifa_addr), - sc->vtnet_hwaddr, ETHER_ADDR_LEN) == 0) - continue; - else if (ucnt == VTNET_MAX_MAC_ENTRIES) { - promisc = 1; - break; - } + ucnt = if_foreach_lladdr(ifp, vtnet_copy_ifaddr, sc); + promisc = (ucnt > VTNET_MAX_MAC_ENTRIES); - bcopy(LLADDR((struct sockaddr_dl *)ifa->ifa_addr), - &filter->vmf_unicast.macs[ucnt], ETHER_ADDR_LEN); - ucnt++; - } - if_addr_runlock(ifp); - - if (promisc != 0) { + if (promisc) { filter->vmf_unicast.nentries = 0; if_printf(ifp, "more than %d MAC addresses assigned, " "falling back to promiscuous mode\n", @@ -3337,22 +3346,10 @@ vtnet_rx_filter_mac(struct vtnet_softc *sc) filter->vmf_unicast.nentries = ucnt; /* Multicast MAC addresses: */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - else if (mcnt == VTNET_MAX_MAC_ENTRIES) { - allmulti = 1; - break; - } + mcnt = if_foreach_llmaddr(ifp, vtnet_copy_maddr, filter); + allmulti = (mcnt > VTNET_MAX_MAC_ENTRIES); - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - &filter->vmf_multicast.macs[mcnt], ETHER_ADDR_LEN); - mcnt++; - } - if_maddr_runlock(ifp); - - if (allmulti != 0) { + if (allmulti) { filter->vmf_multicast.nentries = 0; if_printf(ifp, "more than %d multicast MAC addresses " "assigned, falling back to all-multicast mode\n", @@ -3360,7 +3357,7 @@ vtnet_rx_filter_mac(struct vtnet_softc *sc) } else filter->vmf_multicast.nentries = mcnt; - if (promisc != 0 && allmulti != 0) + if (promisc && allmulti) goto out; hdr.class = VIRTIO_NET_CTRL_MAC; From owner-svn-src-head@freebsd.org Mon Oct 21 17:59:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C47915CCC2; Mon, 21 Oct 2019 17:59:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xksx0sPPz4WJD; Mon, 21 Oct 2019 17:59:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01B7E27990; Mon, 21 Oct 2019 17:59:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LHxGQQ058721; Mon, 21 Oct 2019 17:59:16 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LHxGZC058720; Mon, 21 Oct 2019 17:59:16 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211759.x9LHxGZC058720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 17:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353803 - head/sys/dev/vmware/vmxnet3 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/vmware/vmxnet3 X-SVN-Commit-Revision: 353803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 17:59:17 -0000 Author: glebius Date: Mon Oct 21 17:59:16 2019 New Revision: 353803 URL: https://svnweb.freebsd.org/changeset/base/353803 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- head/sys/dev/vmware/vmxnet3/if_vmx.c Mon Oct 21 17:59:02 2019 (r353802) +++ head/sys/dev/vmware/vmxnet3/if_vmx.c Mon Oct 21 17:59:16 2019 (r353803) @@ -1995,12 +1995,23 @@ vmxnet3_vlan_unregister(if_ctx_t ctx, uint16_t tag) vmxnet3_update_vlan_filter(iflib_get_softc(ctx), 0, tag); } +static u_int +vmxnet3_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int count) +{ + struct vmxnet3_softc *sc = arg; + + if (count < VMXNET3_MULTICAST_MAX) + bcopy(LLADDR(sdl), &sc->vmx_mcast[count * ETHER_ADDR_LEN], + ETHER_ADDR_LEN); + + return (1); +} + static void vmxnet3_set_rxfilter(struct vmxnet3_softc *sc, int flags) { struct ifnet *ifp; struct vmxnet3_driver_shared *ds; - struct ifmultiaddr *ifma; u_int mode; ifp = sc->vmx_ifp; @@ -2012,24 +2023,10 @@ vmxnet3_set_rxfilter(struct vmxnet3_softc *sc, int fla if (flags & IFF_ALLMULTI) mode |= VMXNET3_RXMODE_ALLMULTI; else { - int cnt = 0, overflow = 0; + int cnt; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - else if (cnt == VMXNET3_MULTICAST_MAX) { - overflow = 1; - break; - } - - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - &sc->vmx_mcast[cnt*ETHER_ADDR_LEN], ETHER_ADDR_LEN); - cnt++; - } - if_maddr_runlock(ifp); - - if (overflow != 0) { + cnt = if_foreach_llmaddr(ifp, vmxnet3_hash_maddr, sc); + if (cnt >= VMXNET3_MULTICAST_MAX) { cnt = 0; mode |= VMXNET3_RXMODE_ALLMULTI; } else if (cnt > 0) From owner-svn-src-head@freebsd.org Mon Oct 21 17:59:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C9B215CD44; Mon, 21 Oct 2019 17:59:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xktf0Nwxz4WR9; Mon, 21 Oct 2019 17:59:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4DF227991; Mon, 21 Oct 2019 17:59:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LHxrxE058790; Mon, 21 Oct 2019 17:59:53 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LHxrcx058789; Mon, 21 Oct 2019 17:59:53 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211759.x9LHxrcx058789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 17:59:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353804 - head/sys/dev/ae X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ae X-SVN-Commit-Revision: 353804 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 17:59:54 -0000 Author: glebius Date: Mon Oct 21 17:59:53 2019 New Revision: 353804 URL: https://svnweb.freebsd.org/changeset/base/353804 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ae/if_ae.c Modified: head/sys/dev/ae/if_ae.c ============================================================================== --- head/sys/dev/ae/if_ae.c Mon Oct 21 17:59:16 2019 (r353803) +++ head/sys/dev/ae/if_ae.c Mon Oct 21 17:59:53 2019 (r353804) @@ -2031,12 +2031,21 @@ ae_rxvlan(ae_softc_t *sc) AE_WRITE_4(sc, AE_MAC_REG, val); } +static u_int +ae_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *mchash = arg; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + + return (1); +} + static void ae_rxfilter(ae_softc_t *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc; uint32_t mchash[2]; uint32_t rxcfg; @@ -2072,15 +2081,7 @@ ae_rxfilter(ae_softc_t *sc) * Load multicast tables. */ bzero(mchash, sizeof(mchash)); - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, ae_hash_maddr, &mchash); AE_WRITE_4(sc, AE_REG_MHT0, mchash[0]); AE_WRITE_4(sc, AE_REG_MHT1, mchash[1]); AE_WRITE_4(sc, AE_MAC_REG, rxcfg); From owner-svn-src-head@freebsd.org Mon Oct 21 18:00:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2529615CDD4; Mon, 21 Oct 2019 18:00:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xkv60FcPz4WZK; Mon, 21 Oct 2019 18:00:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E161D2799A; Mon, 21 Oct 2019 18:00:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI0HUc058934; Mon, 21 Oct 2019 18:00:17 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI0HKV058933; Mon, 21 Oct 2019 18:00:17 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211800.x9LI0HKV058933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:00:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353805 - head/sys/dev/age X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/age X-SVN-Commit-Revision: 353805 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:00:18 -0000 Author: glebius Date: Mon Oct 21 18:00:17 2019 New Revision: 353805 URL: https://svnweb.freebsd.org/changeset/base/353805 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/age/if_age.c Modified: head/sys/dev/age/if_age.c ============================================================================== --- head/sys/dev/age/if_age.c Mon Oct 21 17:59:53 2019 (r353804) +++ head/sys/dev/age/if_age.c Mon Oct 21 18:00:17 2019 (r353805) @@ -3140,12 +3140,22 @@ age_rxvlan(struct age_softc *sc) CSR_WRITE_4(sc, AGE_MAC_CFG, reg); } +static u_int +age_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *mchash = arg; + uint32_t crc; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + + return (1); +} + static void age_rxfilter(struct age_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc; uint32_t mchash[2]; uint32_t rxcfg; @@ -3170,16 +3180,7 @@ age_rxfilter(struct age_softc *sc) /* Program new filter. */ bzero(mchash, sizeof(mchash)); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->age_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, age_hash_maddr, mchash); CSR_WRITE_4(sc, AGE_MAR0, mchash[0]); CSR_WRITE_4(sc, AGE_MAR1, mchash[1]); From owner-svn-src-head@freebsd.org Mon Oct 21 18:05:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22CCA15CFF7; Mon, 21 Oct 2019 18:05:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl1N06GQz4X3X; Mon, 21 Oct 2019 18:05:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D773A27B4D; Mon, 21 Oct 2019 18:05:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI5h1C064761; Mon, 21 Oct 2019 18:05:43 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI5h3h064760; Mon, 21 Oct 2019 18:05:43 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211805.x9LI5h3h064760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:05:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353806 - head/sys/dev/al_eth X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/al_eth X-SVN-Commit-Revision: 353806 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:05:44 -0000 Author: glebius Date: Mon Oct 21 18:05:43 2019 New Revision: 353806 URL: https://svnweb.freebsd.org/changeset/base/353806 Log: Convert to if_foreach_llmaddr() KPI. This driver seems to have a bug. The bug was carefully saved during conversion. In the al_eth_mac_table_unicast_add() the argument 'addr', which is the actual address is unused. So, the function is called as many times as we have addresses, but with the exactly same argument list. This doesn't make any sense, but was preserved. Modified: head/sys/dev/al_eth/al_eth.c Modified: head/sys/dev/al_eth/al_eth.c ============================================================================== --- head/sys/dev/al_eth/al_eth.c Mon Oct 21 18:00:17 2019 (r353805) +++ head/sys/dev/al_eth/al_eth.c Mon Oct 21 18:05:43 2019 (r353806) @@ -603,7 +603,7 @@ al_dma_free_coherent(bus_dma_tag_t tag, bus_dmamap_t m static void al_eth_mac_table_unicast_add(struct al_eth_adapter *adapter, - uint8_t idx, uint8_t *addr, uint8_t udma_mask) + uint8_t idx, uint8_t udma_mask) { struct al_eth_fwd_mac_table_entry entry = { { 0 } }; @@ -2876,6 +2876,30 @@ al_get_counter(struct ifnet *ifp, ift_counter cnt) } } +static u_int +al_count_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + unsigned char *mac; + + mac = LLADDR(sdl); + /* default mc address inside mac address */ + if (mac[3] != 0 && mac[4] != 0 && mac[5] != 1) + return (1); + else + return (0); +} + +static u_int +al_program_addr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct al_eth_adapter *adapter = arg; + + al_eth_mac_table_unicast_add(adapter, + AL_ETH_MAC_TABLE_UNICAST_IDX_BASE + 1 + cnt, 1); + + return (1); +} + /* * Unicast, Multicast and Promiscuous mode set * @@ -2884,44 +2908,17 @@ al_get_counter(struct ifnet *ifp, ift_counter cnt) * responsible for configuring the hardware for proper unicast, multicast, * promiscuous mode, and all-multi behavior. */ -#define MAX_NUM_MULTICAST_ADDRESSES 32 -#define MAX_NUM_ADDRESSES 32 - static void al_eth_set_rx_mode(struct al_eth_adapter *adapter) { struct ifnet *ifp = adapter->netdev; - struct ifmultiaddr *ifma; /* multicast addresses configured */ - struct ifaddr *ifua; /* unicast address */ - int mc = 0; - int uc = 0; + int mc, uc; uint8_t i; - unsigned char *mac; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - if (mc == MAX_NUM_MULTICAST_ADDRESSES) - break; + /* XXXGL: why generic count won't work? */ + mc = if_foreach_llmaddr(ifp, al_count_maddr, NULL); + uc = if_lladdr_count(ifp); - mac = LLADDR((struct sockaddr_dl *) ifma->ifma_addr); - /* default mc address inside mac address */ - if (mac[3] != 0 && mac[4] != 0 && mac[5] != 1) - mc++; - } - if_maddr_runlock(ifp); - - if_addr_rlock(ifp); - CK_STAILQ_FOREACH(ifua, &ifp->if_addrhead, ifa_link) { - if (ifua->ifa_addr->sa_family != AF_LINK) - continue; - if (uc == MAX_NUM_ADDRESSES) - break; - uc++; - } - if_addr_runlock(ifp); - if ((ifp->if_flags & IFF_PROMISC) != 0) { al_eth_mac_table_promiscuous_set(adapter, true); } else { @@ -2957,18 +2954,7 @@ al_eth_set_rx_mode(struct al_eth_adapter *adapter) } /* set new addresses */ - i = AL_ETH_MAC_TABLE_UNICAST_IDX_BASE + 1; - if_addr_rlock(ifp); - CK_STAILQ_FOREACH(ifua, &ifp->if_addrhead, ifa_link) { - if (ifua->ifa_addr->sa_family != AF_LINK) { - continue; - } - al_eth_mac_table_unicast_add(adapter, i, - (unsigned char *)ifua->ifa_addr, 1); - i++; - } - if_addr_runlock(ifp); - + if_foreach_lladdr(ifp, al_program_addr, adapter); } al_eth_mac_table_promiscuous_set(adapter, false); } @@ -3001,7 +2987,7 @@ al_eth_config_rx_fwd(struct al_eth_adapter *adapter) * MAC address and all broadcast. all the rest will be dropped. */ al_eth_mac_table_unicast_add(adapter, AL_ETH_MAC_TABLE_UNICAST_IDX_BASE, - adapter->mac_addr, 1); + 1); al_eth_mac_table_broadcast_add(adapter, AL_ETH_MAC_TABLE_BROADCAST_IDX, 1); al_eth_mac_table_promiscuous_set(adapter, false); From owner-svn-src-head@freebsd.org Mon Oct 21 18:06:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3A4515D061; Mon, 21 Oct 2019 18:06:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl1p4nHKz4XBT; Mon, 21 Oct 2019 18:06:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 886FC27B4E; Mon, 21 Oct 2019 18:06:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI66rt064832; Mon, 21 Oct 2019 18:06:06 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6647064831; Mon, 21 Oct 2019 18:06:06 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6647064831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353807 - head/sys/dev/alc X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/alc X-SVN-Commit-Revision: 353807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:06 -0000 Author: glebius Date: Mon Oct 21 18:06:06 2019 New Revision: 353807 URL: https://svnweb.freebsd.org/changeset/base/353807 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/alc/if_alc.c Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Mon Oct 21 18:05:43 2019 (r353806) +++ head/sys/dev/alc/if_alc.c Mon Oct 21 18:06:06 2019 (r353807) @@ -4581,12 +4581,22 @@ alc_rxvlan(struct alc_softc *sc) CSR_WRITE_4(sc, ALC_MAC_CFG, reg); } +static u_int +alc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *mchash = arg; + uint32_t crc; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + + return (1); +} + static void alc_rxfilter(struct alc_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc; uint32_t mchash[2]; uint32_t rxcfg; @@ -4609,15 +4619,7 @@ alc_rxfilter(struct alc_softc *sc) goto chipit; } - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->alc_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, alc_hash_maddr, mchash); chipit: CSR_WRITE_4(sc, ALC_MAR0, mchash[0]); From owner-svn-src-head@freebsd.org Mon Oct 21 18:06:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0692015D084; Mon, 21 Oct 2019 18:06:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl1s6PrRz4XCh; Mon, 21 Oct 2019 18:06:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB6FA27B4F; Mon, 21 Oct 2019 18:06:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI69x4064879; Mon, 21 Oct 2019 18:06:09 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI69hE064878; Mon, 21 Oct 2019 18:06:09 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI69hE064878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353808 - head/sys/dev/ale X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ale X-SVN-Commit-Revision: 353808 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:10 -0000 Author: glebius Date: Mon Oct 21 18:06:09 2019 New Revision: 353808 URL: https://svnweb.freebsd.org/changeset/base/353808 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ale/if_ale.c Modified: head/sys/dev/ale/if_ale.c ============================================================================== --- head/sys/dev/ale/if_ale.c Mon Oct 21 18:06:06 2019 (r353807) +++ head/sys/dev/ale/if_ale.c Mon Oct 21 18:06:09 2019 (r353808) @@ -3008,12 +3008,21 @@ ale_rxvlan(struct ale_softc *sc) CSR_WRITE_4(sc, ALE_MAC_CFG, reg); } +static u_int +ale_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *mchash = arg; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + + return (1); +} + static void ale_rxfilter(struct ale_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc; uint32_t mchash[2]; uint32_t rxcfg; @@ -3038,16 +3047,7 @@ ale_rxfilter(struct ale_softc *sc) /* Program new filter. */ bzero(mchash, sizeof(mchash)); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->ale_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, ale_hash_maddr, &mchash); CSR_WRITE_4(sc, ALE_MAR0, mchash[0]); CSR_WRITE_4(sc, ALE_MAR1, mchash[1]); From owner-svn-src-head@freebsd.org Mon Oct 21 18:06:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C114B15D0C2; Mon, 21 Oct 2019 18:06:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl1z4nvzz4XQQ; Mon, 21 Oct 2019 18:06:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76E7327B50; Mon, 21 Oct 2019 18:06:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6FNn064929; Mon, 21 Oct 2019 18:06:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6FXS064928; Mon, 21 Oct 2019 18:06:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6FXS064928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353809 - head/sys/dev/ath X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ath X-SVN-Commit-Revision: 353809 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:15 -0000 Author: glebius Date: Mon Oct 21 18:06:15 2019 New Revision: 353809 URL: https://svnweb.freebsd.org/changeset/base/353809 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Oct 21 18:06:09 2019 (r353808) +++ head/sys/dev/ath/if_ath.c Mon Oct 21 18:06:15 2019 (r353809) @@ -3591,6 +3591,25 @@ ath_update_promisc(struct ieee80211com *ic) DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x\n", __func__, rfilt); } +static u_int +ath_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t val, *mfilt = arg; + char *dl; + uint8_t pos; + + /* calculate XOR of eight 6bit values */ + dl = LLADDR(sdl); + val = le32dec(dl + 0); + pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; + val = le32dec(dl + 3); + pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; + pos &= 0x3f; + mfilt[pos / 32] |= (1 << (pos % 32)); + + return (1); +} + /* * Driver-internal mcast update call. * @@ -3605,35 +3624,13 @@ ath_update_mcast_hw(struct ath_softc *sc) /* calculate and install multicast filter */ if (ic->ic_allmulti == 0) { struct ieee80211vap *vap; - struct ifnet *ifp; - struct ifmultiaddr *ifma; /* * Merge multicast addresses to form the hardware filter. */ mfilt[0] = mfilt[1] = 0; - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - caddr_t dl; - uint32_t val; - uint8_t pos; - - /* calculate XOR of eight 6bit values */ - dl = LLADDR((struct sockaddr_dl *) - ifma->ifma_addr); - val = le32dec(dl + 0); - pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ - val; - val = le32dec(dl + 3); - pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ - val; - pos &= 0x3f; - mfilt[pos / 32] |= (1 << (pos % 32)); - } - if_maddr_runlock(ifp); - } + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + if_foreach_llmaddr(vap->iv_ifp, ath_hash_maddr, &mfilt); } else mfilt[0] = mfilt[1] = ~0; From owner-svn-src-head@freebsd.org Mon Oct 21 18:06:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED84815D10E; Mon, 21 Oct 2019 18:06:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl235P38z4XSX; Mon, 21 Oct 2019 18:06:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CDB227B51; Mon, 21 Oct 2019 18:06:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6Jil064979; Mon, 21 Oct 2019 18:06:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6JqS064978; Mon, 21 Oct 2019 18:06:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6JqS064978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353810 - head/sys/dev/bce X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/bce X-SVN-Commit-Revision: 353810 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:20 -0000 Author: glebius Date: Mon Oct 21 18:06:19 2019 New Revision: 353810 URL: https://svnweb.freebsd.org/changeset/base/353810 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/bce/if_bce.c Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Mon Oct 21 18:06:15 2019 (r353809) +++ head/sys/dev/bce/if_bce.c Mon Oct 21 18:06:19 2019 (r353810) @@ -8065,14 +8065,25 @@ bce_intr_exit: /* Returns: */ /* Nothing. */ /****************************************************************************/ +static u_int +bce_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + u32 *hashes = arg; + int h; + + h = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN) & 0xFF; + hashes[(h & 0xE0) >> 5] |= 1 << (h & 0x1F); + + return (1); +} + static void bce_set_rx_mode(struct bce_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; u32 hashes[NUM_MC_HASH_REGISTERS] = { 0, 0, 0, 0, 0, 0, 0, 0 }; u32 rx_mode, sort_mode; - int h, i; + int i; DBENTER(BCE_VERBOSE_MISC); @@ -8115,16 +8126,7 @@ bce_set_rx_mode(struct bce_softc *sc) } else { /* Accept one or more multicast(s). */ DBPRINT(sc, BCE_INFO_MISC, "Enabling selective multicast mode.\n"); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_le(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) & 0xFF; - hashes[(h & 0xE0) >> 5] |= 1 << (h & 0x1F); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, bce_hash_maddr, hashes); for (i = 0; i < NUM_MC_HASH_REGISTERS; i++) REG_WR(sc, BCE_EMAC_MULTICAST_HASH0 + (i * 4), hashes[i]); From owner-svn-src-head@freebsd.org Mon Oct 21 18:06:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41B5615D158; Mon, 21 Oct 2019 18:06:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl276gN8z4XZZ; Mon, 21 Oct 2019 18:06:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF7EC27B52; Mon, 21 Oct 2019 18:06:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6NQK065029; Mon, 21 Oct 2019 18:06:23 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6NVu065028; Mon, 21 Oct 2019 18:06:23 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6NVu065028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353811 - head/sys/dev/bfe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/bfe X-SVN-Commit-Revision: 353811 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:24 -0000 Author: glebius Date: Mon Oct 21 18:06:23 2019 New Revision: 353811 URL: https://svnweb.freebsd.org/changeset/base/353811 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/bfe/if_bfe.c Modified: head/sys/dev/bfe/if_bfe.c ============================================================================== --- head/sys/dev/bfe/if_bfe.c Mon Oct 21 18:06:19 2019 (r353810) +++ head/sys/dev/bfe/if_bfe.c Mon Oct 21 18:06:23 2019 (r353811) @@ -1080,13 +1080,21 @@ bfe_cam_write(struct bfe_softc *sc, u_char *data, int bfe_wait_bit(sc, BFE_CAM_CTRL, BFE_CAM_BUSY, 10000, 1); } +static u_int +bfe_write_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct bfe_softc *sc = arg; + + bfe_cam_write(sc, LLADDR(sdl), cnt + 1); + + return (1); +} + static void bfe_set_rx_mode(struct bfe_softc *sc) { struct ifnet *ifp = sc->bfe_ifp; - struct ifmultiaddr *ifma; u_int32_t val; - int i = 0; BFE_LOCK_ASSERT(sc); @@ -1104,20 +1112,13 @@ bfe_set_rx_mode(struct bfe_softc *sc) CSR_WRITE_4(sc, BFE_CAM_CTRL, 0); - bfe_cam_write(sc, IF_LLADDR(sc->bfe_ifp), i++); + bfe_cam_write(sc, IF_LLADDR(sc->bfe_ifp), 0); if (ifp->if_flags & IFF_ALLMULTI) val |= BFE_RXCONF_ALLMULTI; else { val &= ~BFE_RXCONF_ALLMULTI; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - bfe_cam_write(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr), i++); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, bfe_write_maddr, sc); } CSR_WRITE_4(sc, BFE_RXCONF, val); From owner-svn-src-head@freebsd.org Mon Oct 21 18:06:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3C0F15D19A; Mon, 21 Oct 2019 18:06:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl2C3NqRz4Xh4; Mon, 21 Oct 2019 18:06:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5657A27B53; Mon, 21 Oct 2019 18:06:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6RdD065077; Mon, 21 Oct 2019 18:06:27 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6RQL065076; Mon, 21 Oct 2019 18:06:27 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6RQL065076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353812 - head/sys/dev/bge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/bge X-SVN-Commit-Revision: 353812 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:27 -0000 Author: glebius Date: Mon Oct 21 18:06:26 2019 New Revision: 353812 URL: https://svnweb.freebsd.org/changeset/base/353812 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Mon Oct 21 18:06:23 2019 (r353811) +++ head/sys/dev/bge/if_bge.c Mon Oct 21 18:06:26 2019 (r353812) @@ -1621,33 +1621,32 @@ bge_setpromisc(struct bge_softc *sc) BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_RX_PROMISC); } +static u_int +bge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h; + + h = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN) & 0x7F; + hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F); + + return (1); +} + static void bge_setmulti(struct bge_softc *sc) { if_t ifp; - int mc_count = 0; uint32_t hashes[4] = { 0, 0, 0, 0 }; - int h, i, mcnt; - unsigned char *mta; + int i; BGE_LOCK_ASSERT(sc); ifp = sc->bge_ifp; - mc_count = if_multiaddr_count(ifp, -1); - mta = malloc(sizeof(unsigned char) * ETHER_ADDR_LEN * - mc_count, M_DEVBUF, M_NOWAIT); - - if(mta == NULL) { - device_printf(sc->bge_dev, - "Failed to allocated temp mcast list\n"); - return; - } - if (if_getflags(ifp) & IFF_ALLMULTI || if_getflags(ifp) & IFF_PROMISC) { for (i = 0; i < 4; i++) CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), 0xFFFFFFFF); - free(mta, M_DEVBUF); return; } @@ -1655,17 +1654,10 @@ bge_setmulti(struct bge_softc *sc) for (i = 0; i < 4; i++) CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), 0); - if_multiaddr_array(ifp, mta, &mcnt, mc_count); - for(i = 0; i < mcnt; i++) { - h = ether_crc32_le(mta + (i * ETHER_ADDR_LEN), - ETHER_ADDR_LEN) & 0x7F; - hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F); - } + if_foreach_llmaddr(ifp, bge_hash_maddr, hashes); for (i = 0; i < 4; i++) CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), hashes[i]); - - free(mta, M_DEVBUF); } static void From owner-svn-src-head@freebsd.org Mon Oct 21 18:06:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5DC815D206; Mon, 21 Oct 2019 18:06:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl2J3wMPz4Xr6; Mon, 21 Oct 2019 18:06:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 683EF27B54; Mon, 21 Oct 2019 18:06:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6Wb7065129; Mon, 21 Oct 2019 18:06:32 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6Wtq065127; Mon, 21 Oct 2019 18:06:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6Wtq065127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353813 - head/sys/dev/bxe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/bxe X-SVN-Commit-Revision: 353813 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:33 -0000 Author: glebius Date: Mon Oct 21 18:06:31 2019 New Revision: 353813 URL: https://svnweb.freebsd.org/changeset/base/353813 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/bxe/bxe.c head/sys/dev/bxe/bxe.h Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Mon Oct 21 18:06:26 2019 (r353812) +++ head/sys/dev/bxe/bxe.c Mon Oct 21 18:06:31 2019 (r353813) @@ -12065,27 +12065,31 @@ bxe_initial_phy_init(struct bxe_softc *sc, return (rc); } -/* must be called under IF_ADDR_LOCK */ +static u_int +bxe_push_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct ecore_mcast_list_elem *mc_mac = arg; + + mc_mac += cnt; + mc_mac->mac = (uint8_t *)LLADDR(sdl); + + return (1); +} + static int bxe_init_mcast_macs_list(struct bxe_softc *sc, struct ecore_mcast_ramrod_params *p) { if_t ifp = sc->ifp; - int mc_count = 0; - struct ifmultiaddr *ifma; + int mc_count; struct ecore_mcast_list_elem *mc_mac; - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) { - continue; - } - - mc_count++; - } - ECORE_LIST_INIT(&p->mcast_list); p->mcast_list_len = 0; + /* XXXGL: multicast count may change later */ + mc_count = if_llmaddr_count(ifp); + if (!mc_count) { return (0); } @@ -12097,20 +12101,15 @@ bxe_init_mcast_macs_list(struct bxe_softc return (-1); } bzero(mc_mac, (sizeof(*mc_mac) * mc_count)); + if_foreach_llmaddr(ifp, bxe_push_maddr, mc_mac); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) { - continue; - } - - mc_mac->mac = (uint8_t *)LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - ECORE_LIST_PUSH_TAIL(&mc_mac->link, &p->mcast_list); - + for (int i = 0; i < mc_count; i ++) { + ECORE_LIST_PUSH_TAIL(&mc_mac[i].link, &p->mcast_list); BLOGD(sc, DBG_LOAD, "Setting MCAST %02X:%02X:%02X:%02X:%02X:%02X and mc_count %d\n", - mc_mac->mac[0], mc_mac->mac[1], mc_mac->mac[2], - mc_mac->mac[3], mc_mac->mac[4], mc_mac->mac[5], mc_count); - mc_mac++; + mc_mac[i].mac[0], mc_mac[i].mac[1], mc_mac[i].mac[2], + mc_mac[i].mac[3], mc_mac[i].mac[4], mc_mac[i].mac[5], + mc_count); } p->mcast_list_len = mc_count; @@ -12171,69 +12170,59 @@ bxe_set_mc_list(struct bxe_softc *sc) return (rc); } +struct bxe_set_addr_ctx { + struct bxe_softc *sc; + unsigned long ramrod_flags; + int rc; +}; + +static u_int +bxe_set_addr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct bxe_set_addr_ctx *ctx = arg; + struct ecore_vlan_mac_obj *mac_obj = &ctx->sc->sp_objs->mac_obj; + int rc; + + if (ctx->rc < 0) + return (0); + + rc = bxe_set_mac_one(ctx->sc, (uint8_t *)LLADDR(sdl), mac_obj, TRUE, + ECORE_UC_LIST_MAC, &ctx->ramrod_flags); + + /* do not treat adding same MAC as an error */ + if (rc == -EEXIST) + BLOGD(ctx->sc, DBG_SP, "Failed to schedule ADD operations (EEXIST)\n"); + else if (rc < 0) { + BLOGE(ctx->sc, "Failed to schedule ADD operations (%d)\n", rc); + ctx->rc = rc; + } + + return (1); +} + static int bxe_set_uc_list(struct bxe_softc *sc) { if_t ifp = sc->ifp; struct ecore_vlan_mac_obj *mac_obj = &sc->sp_objs->mac_obj; - struct ifaddr *ifa; - unsigned long ramrod_flags = 0; + struct bxe_set_addr_ctx ctx = { sc, 0, 0 }; int rc; -#if __FreeBSD_version < 800000 - IF_ADDR_LOCK(ifp); -#else - if_addr_rlock(ifp); -#endif - /* first schedule a cleanup up of old configuration */ rc = bxe_del_all_macs(sc, mac_obj, ECORE_UC_LIST_MAC, FALSE); if (rc < 0) { BLOGE(sc, "Failed to schedule delete of all ETH MACs (%d)\n", rc); -#if __FreeBSD_version < 800000 - IF_ADDR_UNLOCK(ifp); -#else - if_addr_runlock(ifp); -#endif return (rc); } - ifa = if_getifaddr(ifp); /* XXX Is this structure */ - while (ifa) { - if (ifa->ifa_addr->sa_family != AF_LINK) { - ifa = CK_STAILQ_NEXT(ifa, ifa_link); - continue; - } + if_foreach_lladdr(ifp, bxe_set_addr, &ctx); + if (ctx.rc < 0) + return (ctx.rc); - rc = bxe_set_mac_one(sc, (uint8_t *)LLADDR((struct sockaddr_dl *)ifa->ifa_addr), - mac_obj, TRUE, ECORE_UC_LIST_MAC, &ramrod_flags); - if (rc == -EEXIST) { - BLOGD(sc, DBG_SP, "Failed to schedule ADD operations (EEXIST)\n"); - /* do not treat adding same MAC as an error */ - rc = 0; - } else if (rc < 0) { - BLOGE(sc, "Failed to schedule ADD operations (%d)\n", rc); -#if __FreeBSD_version < 800000 - IF_ADDR_UNLOCK(ifp); -#else - if_addr_runlock(ifp); -#endif - return (rc); - } - - ifa = CK_STAILQ_NEXT(ifa, ifa_link); - } - -#if __FreeBSD_version < 800000 - IF_ADDR_UNLOCK(ifp); -#else - if_addr_runlock(ifp); -#endif - /* Execute the pending commands */ - bit_set(&ramrod_flags, RAMROD_CONT); + bit_set(&ctx.ramrod_flags, RAMROD_CONT); return (bxe_set_mac_one(sc, NULL, mac_obj, FALSE /* don't care */, - ECORE_UC_LIST_MAC, &ramrod_flags)); + ECORE_UC_LIST_MAC, &ctx.ramrod_flags)); } static void Modified: head/sys/dev/bxe/bxe.h ============================================================================== --- head/sys/dev/bxe/bxe.h Mon Oct 21 18:06:26 2019 (r353812) +++ head/sys/dev/bxe/bxe.h Mon Oct 21 18:06:31 2019 (r353813) @@ -1492,29 +1492,8 @@ struct bxe_softc { #define BXE_STATS_UNLOCK(sc) mtx_unlock(&sc->stats_mtx) #define BXE_STATS_LOCK_ASSERT(sc) mtx_assert(&sc->stats_mtx, MA_OWNED) -#if __FreeBSD_version < 800000 -#define BXE_MCAST_LOCK(sc) \ - do { \ - mtx_lock(&sc->mcast_mtx); \ - IF_ADDR_LOCK(sc->ifp); \ - } while (0) -#define BXE_MCAST_UNLOCK(sc) \ - do { \ - IF_ADDR_UNLOCK(sc->ifp); \ - mtx_unlock(&sc->mcast_mtx); \ - } while (0) -#else -#define BXE_MCAST_LOCK(sc) \ - do { \ - mtx_lock(&sc->mcast_mtx); \ - if_maddr_rlock(sc->ifp); \ - } while (0) -#define BXE_MCAST_UNLOCK(sc) \ - do { \ - if_maddr_runlock(sc->ifp); \ - mtx_unlock(&sc->mcast_mtx); \ - } while (0) -#endif +#define BXE_MCAST_LOCK(sc) mtx_lock(&sc->mcast_mtx); +#define BXE_MCAST_UNLOCK(sc) mtx_unlock(&sc->mcast_mtx); #define BXE_MCAST_LOCK_ASSERT(sc) mtx_assert(&sc->mcast_mtx, MA_OWNED) int dmae_ready; From owner-svn-src-head@freebsd.org Mon Oct 21 18:06:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D76AF15D322; Mon, 21 Oct 2019 18:06:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl2j5Q57z4Y5h; Mon, 21 Oct 2019 18:06:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E2D327B55; Mon, 21 Oct 2019 18:06:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6r85065197; Mon, 21 Oct 2019 18:06:53 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6rou065196; Mon, 21 Oct 2019 18:06:53 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6rou065196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353814 - head/sys/dev/fxp X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/fxp X-SVN-Commit-Revision: 353814 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:53 -0000 Author: glebius Date: Mon Oct 21 18:06:53 2019 New Revision: 353814 URL: https://svnweb.freebsd.org/changeset/base/353814 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Mon Oct 21 18:06:31 2019 (r353813) +++ head/sys/dev/fxp/if_fxp.c Mon Oct 21 18:06:53 2019 (r353814) @@ -245,7 +245,7 @@ static void fxp_discard_rfabuf(struct fxp_softc *sc, struct fxp_rx *rxp); static int fxp_new_rfabuf(struct fxp_softc *sc, struct fxp_rx *rxp); -static int fxp_mc_addrs(struct fxp_softc *sc); +static void fxp_mc_addrs(struct fxp_softc *sc); static void fxp_mc_setup(struct fxp_softc *sc); static uint16_t fxp_eeprom_getword(struct fxp_softc *sc, int offset, int autosize); @@ -2976,27 +2976,37 @@ fxp_ioctl(if_t ifp, u_long command, caddr_t data) return (error); } +static u_int +fxp_setup_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct fxp_softc *sc = arg; + struct fxp_cb_mcs *mcsp = sc->mcsp; + + if (mcsp->mc_cnt < MAXMCADDR) + bcopy(LLADDR(sdl), mcsp->mc_addr[mcsp->mc_cnt * ETHER_ADDR_LEN], + ETHER_ADDR_LEN); + mcsp->mc_cnt++; + return (1); +} + /* * Fill in the multicast address list and return number of entries. */ -static int +static void fxp_mc_addrs(struct fxp_softc *sc) { struct fxp_cb_mcs *mcsp = sc->mcsp; if_t ifp = sc->ifp; - int nmcasts = 0; if ((if_getflags(ifp) & IFF_ALLMULTI) == 0) { - if_maddr_rlock(ifp); - if_setupmultiaddr(ifp, mcsp->mc_addr, &nmcasts, MAXMCADDR); - if (nmcasts >= MAXMCADDR) { + mcsp->mc_cnt = 0; + if_foreach_llmaddr(sc->ifp, fxp_setup_maddr, sc); + if (mcsp->mc_cnt >= MAXMCADDR) { if_setflagbits(ifp, IFF_ALLMULTI, 0); - nmcasts = 0; + mcsp->mc_cnt = 0; } - if_maddr_runlock(ifp); } - mcsp->mc_cnt = htole16(nmcasts * ETHER_ADDR_LEN); - return (nmcasts); + mcsp->mc_cnt = htole16(mcsp->mc_cnt * ETHER_ADDR_LEN); } /* From owner-svn-src-head@freebsd.org Mon Oct 21 18:06:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1EE215D36D; Mon, 21 Oct 2019 18:06:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl2p0Jmcz4Y82; Mon, 21 Oct 2019 18:06:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE6DD27B56; Mon, 21 Oct 2019 18:06:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6vrv065250; Mon, 21 Oct 2019 18:06:57 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6v9b065249; Mon, 21 Oct 2019 18:06:57 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6v9b065249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353815 - head/sys/dev/gem X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/gem X-SVN-Commit-Revision: 353815 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:58 -0000 Author: glebius Date: Mon Oct 21 18:06:57 2019 New Revision: 353815 URL: https://svnweb.freebsd.org/changeset/base/353815 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/gem/if_gem.c Modified: head/sys/dev/gem/if_gem.c ============================================================================== --- head/sys/dev/gem/if_gem.c Mon Oct 21 18:06:53 2019 (r353814) +++ head/sys/dev/gem/if_gem.c Mon Oct 21 18:06:57 2019 (r353815) @@ -2202,14 +2202,27 @@ gem_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (error); } +static u_int +gem_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *hash = arg; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + /* We just want the 8 most significant bits. */ + crc >>= 24; + /* Set the corresponding bit in the filter. */ + hash[crc >> 4] |= 1 << (15 - (crc & 15)); + + return (1); +} + static void gem_setladrf(struct gem_softc *sc) { struct ifnet *ifp = sc->sc_ifp; - struct ifmultiaddr *inm; int i; uint32_t hash[16]; - uint32_t crc, v; + uint32_t v; GEM_LOCK_ASSERT(sc, MA_OWNED); @@ -2245,23 +2258,8 @@ gem_setladrf(struct gem_softc *sc) * is the MSB). */ - /* Clear the hash table. */ memset(hash, 0, sizeof(hash)); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { - if (inm->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - inm->ifma_addr), ETHER_ADDR_LEN); - - /* We just want the 8 most significant bits. */ - crc >>= 24; - - /* Set the corresponding bit in the filter. */ - hash[crc >> 4] |= 1 << (15 - (crc & 15)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, gem_hash_maddr, hash); v |= GEM_MAC_RX_HASH_FILTER; From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32A2615D3BA; Mon, 21 Oct 2019 18:07:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl2v3Zk7z4YKk; Mon, 21 Oct 2019 18:07:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4D2927B57; Mon, 21 Oct 2019 18:07:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI727n065311; Mon, 21 Oct 2019 18:07:02 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI72dA065310; Mon, 21 Oct 2019 18:07:02 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI72dA065310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353816 - head/sys/dev/hme X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/hme X-SVN-Commit-Revision: 353816 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:04 -0000 Author: glebius Date: Mon Oct 21 18:07:02 2019 New Revision: 353816 URL: https://svnweb.freebsd.org/changeset/base/353816 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/hme/if_hme.c Modified: head/sys/dev/hme/if_hme.c ============================================================================== --- head/sys/dev/hme/if_hme.c Mon Oct 21 18:06:57 2019 (r353815) +++ head/sys/dev/hme/if_hme.c Mon Oct 21 18:07:02 2019 (r353816) @@ -1656,6 +1656,20 @@ hme_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (error); } +static u_int +hme_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *hash = arg; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + /* Just want the 6 most significant bits. */ + crc >>= 26; + /* Set the corresponding bit in the filter. */ + hash[crc >> 4] |= 1 << (crc & 0xf); + + return (1); +} + /* * Set up the logical address filter. */ @@ -1663,8 +1677,6 @@ static void hme_setladrf(struct hme_softc *sc, int reenable) { struct ifnet *ifp = sc->sc_ifp; - struct ifmultiaddr *inm; - u_int32_t crc; u_int32_t hash[4]; u_int32_t macc; @@ -1721,21 +1733,7 @@ hme_setladrf(struct hme_softc *sc, int reenable) * selects the word, while the rest of the bits select the bit within * the word. */ - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { - if (inm->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - inm->ifma_addr), ETHER_ADDR_LEN); - - /* Just want the 6 most significant bits. */ - crc >>= 26; - - /* Set the corresponding bit in the filter. */ - hash[crc >> 4] |= 1 << (crc & 0xf); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, hme_hash_maddr, &hash); chipit: /* Now load the hash table into the chip */ From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 170A915D407; Mon, 21 Oct 2019 18:07:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl2z6wMDz4YNP; Mon, 21 Oct 2019 18:07:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D24A727B58; Mon, 21 Oct 2019 18:07:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI77CF065360; Mon, 21 Oct 2019 18:07:07 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI770m065359; Mon, 21 Oct 2019 18:07:07 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI770m065359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353817 - head/sys/dev/le X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/le X-SVN-Commit-Revision: 353817 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:08 -0000 Author: glebius Date: Mon Oct 21 18:07:07 2019 New Revision: 353817 URL: https://svnweb.freebsd.org/changeset/base/353817 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/le/lance.c Modified: head/sys/dev/le/lance.c ============================================================================== --- head/sys/dev/le/lance.c Mon Oct 21 18:07:02 2019 (r353816) +++ head/sys/dev/le/lance.c Mon Oct 21 18:07:07 2019 (r353817) @@ -577,6 +577,27 @@ lance_ioctl(struct ifnet *ifp, u_long cmd, caddr_t dat return (error); } +struct lance_hash_maddr_ctx { + struct lance_softc *sc; + uint16_t *af; +}; + +static u_int +lance_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct lance_hash_maddr_ctx *ctx = arg; + struct lance_softc *sc = ctx->sc; + uint32_t crc; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + /* Just want the 6 most significant bits. */ + crc >>= 26; + /* Set the corresponding bit in the filter. */ + ctx->af[crc >> 4] |= LE_HTOLE16(1 << (crc & 0xf)); + + return (1); +} + /* * Set up the logical address filter. */ @@ -584,8 +605,7 @@ void lance_setladrf(struct lance_softc *sc, uint16_t *af) { struct ifnet *ifp = sc->sc_ifp; - struct ifmultiaddr *ifma; - uint32_t crc; + struct lance_hash_maddr_ctx ctx = { sc, af }; /* * Set up multicast address filter by passing all multicast addresses @@ -601,21 +621,7 @@ lance_setladrf(struct lance_softc *sc, uint16_t *af) } af[0] = af[1] = af[2] = af[3] = 0x0000; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - - /* Just want the 6 most significant bits. */ - crc >>= 26; - - /* Set the corresponding bit in the filter. */ - af[crc >> 4] |= LE_HTOLE16(1 << (crc & 0xf)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, lance_hash_maddr, &ctx); } /* From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 137EB15D45E; Mon, 21 Oct 2019 18:07:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl335zGwz4YTb; Mon, 21 Oct 2019 18:07:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8818227B59; Mon, 21 Oct 2019 18:07:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7BFo065412; Mon, 21 Oct 2019 18:07:11 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7BVI065411; Mon, 21 Oct 2019 18:07:11 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7BVI065411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353818 - head/sys/dev/lge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/lge X-SVN-Commit-Revision: 353818 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:12 -0000 Author: glebius Date: Mon Oct 21 18:07:11 2019 New Revision: 353818 URL: https://svnweb.freebsd.org/changeset/base/353818 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/lge/if_lge.c Modified: head/sys/dev/lge/if_lge.c ============================================================================== --- head/sys/dev/lge/if_lge.c Mon Oct 21 18:07:07 2019 (r353817) +++ head/sys/dev/lge/if_lge.c Mon Oct 21 18:07:11 2019 (r353818) @@ -367,13 +367,25 @@ lge_miibus_statchg(dev) return; } +static u_int +lge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int count) +{ + uint32_t h, *hashes = arg; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + return (1); +} + static void lge_setmulti(sc) struct lge_softc *sc; { struct ifnet *ifp; - struct ifmultiaddr *ifma; - u_int32_t h = 0, hashes[2] = { 0, 0 }; + uint32_t hashes[2] = { 0, 0 }; ifp = sc->lge_ifp; LGE_LOCK_ASSERT(sc); @@ -392,18 +404,7 @@ lge_setmulti(sc) CSR_WRITE_4(sc, LGE_MAR1, 0); /* now program new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, lge_hash_maddr, hashes); CSR_WRITE_4(sc, LGE_MAR0, hashes[0]); CSR_WRITE_4(sc, LGE_MAR1, hashes[1]); From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29B2215D4BD; Mon, 21 Oct 2019 18:07:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl376PKLz4Ybp; Mon, 21 Oct 2019 18:07:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEA7B27B5A; Mon, 21 Oct 2019 18:07:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7Fun065472; Mon, 21 Oct 2019 18:07:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7Ftl065471; Mon, 21 Oct 2019 18:07:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7Ftl065471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353819 - head/sys/dev/mge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/mge X-SVN-Commit-Revision: 353819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:16 -0000 Author: glebius Date: Mon Oct 21 18:07:15 2019 New Revision: 353819 URL: https://svnweb.freebsd.org/changeset/base/353819 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/mge/if_mge.c Modified: head/sys/dev/mge/if_mge.c ============================================================================== --- head/sys/dev/mge/if_mge.c Mon Oct 21 18:07:11 2019 (r353818) +++ head/sys/dev/mge/if_mge.c Mon Oct 21 18:07:15 2019 (r353819) @@ -2032,45 +2032,51 @@ mge_crc8(uint8_t *data, int size) return(crc); } +struct mge_hash_maddr_ctx { + uint32_t smt[MGE_MCAST_REG_NUMBER]; + uint32_t omt[MGE_MCAST_REG_NUMBER]; +}; + +static u_int +mge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + static const uint8_t special[5] = { 0x01, 0x00, 0x5E, 0x00, 0x00 }; + struct mge_hash_maddr_ctx *ctx = arg; + static const uint8_t v = (MGE_RX_DEFAULT_QUEUE << 1) | 1; + uint8_t *mac; + int i; + + mac = LLADDR(sdl); + if (memcmp(mac, special, sizeof(special)) == 0) { + i = mac[5]; + ctx->smt[i >> 2] |= v << ((i & 0x03) << 3); + } else { + i = mge_crc8(mac, ETHER_ADDR_LEN); + ctx->omt[i >> 2] |= v << ((i & 0x03) << 3); + } + return (1); +} + static void mge_setup_multicast(struct mge_softc *sc) { - uint8_t special[5] = { 0x01, 0x00, 0x5E, 0x00, 0x00 }; - uint8_t v = (MGE_RX_DEFAULT_QUEUE << 1) | 1; - uint32_t smt[MGE_MCAST_REG_NUMBER]; - uint32_t omt[MGE_MCAST_REG_NUMBER]; + struct mge_hash_maddr_ctx ctx; struct ifnet *ifp = sc->ifp; - struct ifmultiaddr *ifma; - uint8_t *mac; + static const uint8_t v = (MGE_RX_DEFAULT_QUEUE << 1) | 1; int i; if (ifp->if_flags & IFF_ALLMULTI) { for (i = 0; i < MGE_MCAST_REG_NUMBER; i++) - smt[i] = omt[i] = (v << 24) | (v << 16) | (v << 8) | v; + ctx.smt[i] = ctx.omt[i] = + (v << 24) | (v << 16) | (v << 8) | v; } else { - memset(smt, 0, sizeof(smt)); - memset(omt, 0, sizeof(omt)); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - mac = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - if (memcmp(mac, special, sizeof(special)) == 0) { - i = mac[5]; - smt[i >> 2] |= v << ((i & 0x03) << 3); - } else { - i = mge_crc8(mac, ETHER_ADDR_LEN); - omt[i >> 2] |= v << ((i & 0x03) << 3); - } - } - if_maddr_runlock(ifp); + memset(&ctx, 0, sizeof(ctx)); + if_foreach_llmaddr(ifp, mge_hash_maddr, &ctx); } for (i = 0; i < MGE_MCAST_REG_NUMBER; i++) { - MGE_WRITE(sc, MGE_DA_FILTER_SPEC_MCAST(i), smt[i]); - MGE_WRITE(sc, MGE_DA_FILTER_OTH_MCAST(i), omt[i]); + MGE_WRITE(sc, MGE_DA_FILTER_SPEC_MCAST(i), ctx.smt[i]); + MGE_WRITE(sc, MGE_DA_FILTER_OTH_MCAST(i), ctx.omt[i]); } } From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5069D15D519; Mon, 21 Oct 2019 18:07:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3D1055z4Yjc; Mon, 21 Oct 2019 18:07:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A436427B5B; Mon, 21 Oct 2019 18:07:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7Jfo065519; Mon, 21 Oct 2019 18:07:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7Jar065518; Mon, 21 Oct 2019 18:07:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7Jar065518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353820 - head/sys/dev/msk X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/msk X-SVN-Commit-Revision: 353820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:20 -0000 Author: glebius Date: Mon Oct 21 18:07:19 2019 New Revision: 353820 URL: https://svnweb.freebsd.org/changeset/base/353820 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon Oct 21 18:07:15 2019 (r353819) +++ head/sys/dev/msk/if_msk.c Mon Oct 21 18:07:19 2019 (r353820) @@ -573,14 +573,27 @@ msk_miibus_statchg(device_t dev) } } +static u_int +msk_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *mchash = arg; + uint32_t crc; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + /* Just want the 6 least significant bits. */ + crc &= 0x3f; + /* Set the corresponding bit in the hash table. */ + mchash[crc >> 5] |= 1 << (crc & 0x1f); + + return (1); +} + static void msk_rxfilter(struct msk_if_softc *sc_if) { struct msk_softc *sc; struct ifnet *ifp; - struct ifmultiaddr *ifma; uint32_t mchash[2]; - uint32_t crc; uint16_t mode; sc = sc_if->msk_softc; @@ -599,18 +612,7 @@ msk_rxfilter(struct msk_if_softc *sc_if) mchash[1] = 0xffff; } else { mode |= GM_RXCR_UCF_ENA; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - /* Just want the 6 least significant bits. */ - crc &= 0x3f; - /* Set the corresponding bit in the hash table. */ - mchash[crc >> 5] |= 1 << (crc & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, msk_hash_maddr, mchash); if (mchash[0] != 0 || mchash[1] != 0) mode |= GM_RXCR_MCF_ENA; } From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC9DC15D57C; Mon, 21 Oct 2019 18:07:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3K1KCmz4YrP; Mon, 21 Oct 2019 18:07:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7ABF27B5C; Mon, 21 Oct 2019 18:07:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7OoE065569; Mon, 21 Oct 2019 18:07:24 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7OZu065568; Mon, 21 Oct 2019 18:07:24 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7OZu065568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353821 - head/sys/dev/nfe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/nfe X-SVN-Commit-Revision: 353821 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:25 -0000 Author: glebius Date: Mon Oct 21 18:07:24 2019 New Revision: 353821 URL: https://svnweb.freebsd.org/changeset/base/353821 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/nfe/if_nfe.c Modified: head/sys/dev/nfe/if_nfe.c ============================================================================== --- head/sys/dev/nfe/if_nfe.c Mon Oct 21 18:07:19 2019 (r353820) +++ head/sys/dev/nfe/if_nfe.c Mon Oct 21 18:07:24 2019 (r353821) @@ -2557,75 +2557,67 @@ nfe_encap(struct nfe_softc *sc, struct mbuf **m_head) return (0); } +struct nfe_hash_maddr_ctx { + uint8_t addr[ETHER_ADDR_LEN]; + uint8_t mask[ETHER_ADDR_LEN]; +}; +static u_int +nfe_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct nfe_hash_maddr_ctx *ctx = arg; + uint8_t *addrp, mcaddr; + int j; + + addrp = LLADDR(sdl); + for (j = 0; j < ETHER_ADDR_LEN; j++) { + mcaddr = addrp[j]; + ctx->addr[j] &= mcaddr; + ctx->mask[j] &= ~mcaddr; + } + + return (1); +} + static void nfe_setmulti(struct nfe_softc *sc) { if_t ifp = sc->nfe_ifp; - int i, mc_count, mcnt; + struct nfe_hash_maddr_ctx ctx; uint32_t filter; - uint8_t addr[ETHER_ADDR_LEN], mask[ETHER_ADDR_LEN]; uint8_t etherbroadcastaddr[ETHER_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - uint8_t *mta; + int i; NFE_LOCK_ASSERT(sc); if ((if_getflags(ifp) & (IFF_ALLMULTI | IFF_PROMISC)) != 0) { - bzero(addr, ETHER_ADDR_LEN); - bzero(mask, ETHER_ADDR_LEN); + bzero(ctx.addr, ETHER_ADDR_LEN); + bzero(ctx.mask, ETHER_ADDR_LEN); goto done; } - bcopy(etherbroadcastaddr, addr, ETHER_ADDR_LEN); - bcopy(etherbroadcastaddr, mask, ETHER_ADDR_LEN); + bcopy(etherbroadcastaddr, ctx.addr, ETHER_ADDR_LEN); + bcopy(etherbroadcastaddr, ctx.mask, ETHER_ADDR_LEN); - mc_count = if_multiaddr_count(ifp, -1); - mta = malloc(sizeof(uint8_t) * ETHER_ADDR_LEN * mc_count, M_DEVBUF, - M_NOWAIT); + if_foreach_llmaddr(ifp, nfe_hash_maddr, &ctx); - /* Unable to get memory - process without filtering */ - if (mta == NULL) { - device_printf(sc->nfe_dev, "nfe_setmulti: failed to allocate" - "temp multicast buffer!\n"); - - bzero(addr, ETHER_ADDR_LEN); - bzero(mask, ETHER_ADDR_LEN); - goto done; - } - - if_multiaddr_array(ifp, mta, &mcnt, mc_count); - - for (i = 0; i < mcnt; i++) { - uint8_t *addrp; - int j; - - addrp = mta + (i * ETHER_ADDR_LEN); - for (j = 0; j < ETHER_ADDR_LEN; j++) { - u_int8_t mcaddr = addrp[j]; - addr[j] &= mcaddr; - mask[j] &= ~mcaddr; - } - } - - free(mta, M_DEVBUF); - for (i = 0; i < ETHER_ADDR_LEN; i++) { - mask[i] |= addr[i]; + ctx.mask[i] |= ctx.addr[i]; } done: - addr[0] |= 0x01; /* make sure multicast bit is set */ + ctx.addr[0] |= 0x01; /* make sure multicast bit is set */ - NFE_WRITE(sc, NFE_MULTIADDR_HI, - addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]); + NFE_WRITE(sc, NFE_MULTIADDR_HI, ctx.addr[3] << 24 | ctx.addr[2] << 16 | + ctx.addr[1] << 8 | ctx.addr[0]); NFE_WRITE(sc, NFE_MULTIADDR_LO, - addr[5] << 8 | addr[4]); - NFE_WRITE(sc, NFE_MULTIMASK_HI, - mask[3] << 24 | mask[2] << 16 | mask[1] << 8 | mask[0]); + ctx.addr[5] << 8 | ctx.addr[4]); + NFE_WRITE(sc, NFE_MULTIMASK_HI, ctx.mask[3] << 24 | ctx.mask[2] << 16 | + ctx.mask[1] << 8 | ctx.mask[0]); NFE_WRITE(sc, NFE_MULTIMASK_LO, - mask[5] << 8 | mask[4]); + ctx.mask[5] << 8 | ctx.mask[4]); filter = NFE_READ(sc, NFE_RXFILTER); filter &= NFE_PFF_RX_PAUSE; From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64A1815D5D4; Mon, 21 Oct 2019 18:07:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3N6rYMz4YxW; Mon, 21 Oct 2019 18:07:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCB3527B5D; Mon, 21 Oct 2019 18:07:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7Smj065619; Mon, 21 Oct 2019 18:07:28 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7SSu065618; Mon, 21 Oct 2019 18:07:28 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7SSu065618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353822 - head/sys/dev/nge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/nge X-SVN-Commit-Revision: 353822 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:29 -0000 Author: glebius Date: Mon Oct 21 18:07:28 2019 New Revision: 353822 URL: https://svnweb.freebsd.org/changeset/base/353822 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/nge/if_nge.c Modified: head/sys/dev/nge/if_nge.c ============================================================================== --- head/sys/dev/nge/if_nge.c Mon Oct 21 18:07:24 2019 (r353821) +++ head/sys/dev/nge/if_nge.c Mon Oct 21 18:07:28 2019 (r353822) @@ -661,13 +661,33 @@ nge_miibus_statchg(device_t dev) CSR_READ_4(sc, NGE_GPIO) & ~NGE_GPIO_GP3_OUT); } +static u_int +nge_write_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct nge_softc *sc = arg; + uint32_t h; + int bit, index; + + /* + * From the 11 bits returned by the crc routine, the top 7 + * bits represent the 16-bit word in the mcast hash table + * that needs to be updated, and the lower 4 bits represent + * which bit within that byte needs to be set. + */ + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 21; + index = (h >> 4) & 0x7F; + bit = h & 0xF; + CSR_WRITE_4(sc, NGE_RXFILT_CTL, NGE_FILTADDR_MCAST_LO + (index * 2)); + NGE_SETBIT(sc, NGE_RXFILT_DATA, (1 << bit)); + + return (1); +} + static void nge_rxfilter(struct nge_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t h, i, rxfilt; - int bit, index; + uint32_t i, rxfilt; NGE_LOCK_ASSERT(sc); ifp = sc->nge_ifp; @@ -720,26 +740,7 @@ nge_rxfilter(struct nge_softc *sc) CSR_WRITE_4(sc, NGE_RXFILT_DATA, 0); } - /* - * From the 11 bits returned by the crc routine, the top 7 - * bits represent the 16-bit word in the mcast hash table - * that needs to be updated, and the lower 4 bits represent - * which bit within that byte needs to be set. - */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 21; - index = (h >> 4) & 0x7F; - bit = h & 0xF; - CSR_WRITE_4(sc, NGE_RXFILT_CTL, - NGE_FILTADDR_MCAST_LO + (index * 2)); - NGE_SETBIT(sc, NGE_RXFILT_DATA, (1 << bit)); - } - if_maddr_runlock(ifp); - + if_foreach_llmaddr(ifp, nge_write_maddr, sc); done: CSR_WRITE_4(sc, NGE_RXFILT_CTL, rxfilt); /* Turn the receive filter on. */ From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20F4115D631; Mon, 21 Oct 2019 18:07:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3S6Ydnz4Z61; Mon, 21 Oct 2019 18:07:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FC0627B5E; Mon, 21 Oct 2019 18:07:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7WcX065669; Mon, 21 Oct 2019 18:07:32 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7W13065668; Mon, 21 Oct 2019 18:07:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7W13065668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353823 - head/sys/dev/re X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/re X-SVN-Commit-Revision: 353823 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:33 -0000 Author: glebius Date: Mon Oct 21 18:07:32 2019 New Revision: 353823 URL: https://svnweb.freebsd.org/changeset/base/353823 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Mon Oct 21 18:07:28 2019 (r353822) +++ head/sys/dev/re/if_re.c Mon Oct 21 18:07:32 2019 (r353823) @@ -649,6 +649,20 @@ re_miibus_statchg(device_t dev) */ } +static u_int +re_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t h, *hashes = arg; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + /* * Set the RX configuration and 64-bit multicast hash filter. */ @@ -656,9 +670,8 @@ static void re_set_rxmode(struct rl_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t hashes[2] = { 0, 0 }; - uint32_t h, rxfilt; + uint32_t h, hashes[2] = { 0, 0 }; + uint32_t rxfilt; RL_LOCK_ASSERT(sc); @@ -683,18 +696,7 @@ re_set_rxmode(struct rl_softc *sc) goto done; } - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, re_hash_maddr, hashes); if (hashes[0] != 0 || hashes[1] != 0) { /* From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E69E15D669; Mon, 21 Oct 2019 18:07:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3X6BQ8z4ZBp; Mon, 21 Oct 2019 18:07:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C43727B5F; Mon, 21 Oct 2019 18:07:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7aOj065716; Mon, 21 Oct 2019 18:07:36 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7aVV065715; Mon, 21 Oct 2019 18:07:36 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7aVV065715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353824 - head/sys/dev/rl X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/rl X-SVN-Commit-Revision: 353824 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:37 -0000 Author: glebius Date: Mon Oct 21 18:07:35 2019 New Revision: 353824 URL: https://svnweb.freebsd.org/changeset/base/353824 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/rl/if_rl.c Modified: head/sys/dev/rl/if_rl.c ============================================================================== --- head/sys/dev/rl/if_rl.c Mon Oct 21 18:07:32 2019 (r353823) +++ head/sys/dev/rl/if_rl.c Mon Oct 21 18:07:35 2019 (r353824) @@ -509,6 +509,21 @@ rl_miibus_statchg(device_t dev) */ } +static u_int +rl_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + /* * Program the 64-bit multicast hash filter. */ @@ -516,9 +531,7 @@ static void rl_rxfilter(struct rl_softc *sc) { struct ifnet *ifp = sc->rl_ifp; - int h = 0; uint32_t hashes[2] = { 0, 0 }; - struct ifmultiaddr *ifma; uint32_t rxfilt; RL_LOCK_ASSERT(sc); @@ -539,18 +552,7 @@ rl_rxfilter(struct rl_softc *sc) hashes[1] = 0xFFFFFFFF; } else { /* Now program new ones. */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, rl_hash_maddr, hashes); if (hashes[0] != 0 || hashes[1] != 0) rxfilt |= RL_RXCFG_RX_MULTI; } From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6AF7C15D6E4; Mon, 21 Oct 2019 18:07:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3d1Fs7z4ZKf; Mon, 21 Oct 2019 18:07:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CAE127B60; Mon, 21 Oct 2019 18:07:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7erj065766; Mon, 21 Oct 2019 18:07:40 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7eaP065765; Mon, 21 Oct 2019 18:07:40 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7eaP065765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353825 - head/sys/dev/sge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/sge X-SVN-Commit-Revision: 353825 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:41 -0000 Author: glebius Date: Mon Oct 21 18:07:40 2019 New Revision: 353825 URL: https://svnweb.freebsd.org/changeset/base/353825 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/sge/if_sge.c Modified: head/sys/dev/sge/if_sge.c ============================================================================== --- head/sys/dev/sge/if_sge.c Mon Oct 21 18:07:35 2019 (r353824) +++ head/sys/dev/sge/if_sge.c Mon Oct 21 18:07:40 2019 (r353825) @@ -442,12 +442,22 @@ sge_miibus_statchg(device_t dev) } } +static u_int +sge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int count) +{ + uint32_t crc, *hashes = arg; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + hashes[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + + return (1); +} + static void sge_rxfilter(struct sge_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc, hashes[2]; + uint32_t hashes[2]; uint16_t rxfilt; SGE_LOCK_ASSERT(sc); @@ -468,15 +478,7 @@ sge_rxfilter(struct sge_softc *sc) rxfilt |= AcceptMulticast; hashes[0] = hashes[1] = 0; /* Now program new ones. */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - hashes[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, sge_hash_maddr, hashes); } CSR_WRITE_2(sc, RxMacControl, rxfilt); CSR_WRITE_4(sc, RxHashTable, hashes[0]); From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8829D15D738; Mon, 21 Oct 2019 18:07:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3j2l4pz4ZRg; Mon, 21 Oct 2019 18:07:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3848727B61; Mon, 21 Oct 2019 18:07:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7j0r065816; Mon, 21 Oct 2019 18:07:45 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7j69065815; Mon, 21 Oct 2019 18:07:45 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7j69065815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353826 - head/sys/dev/sis X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/sis X-SVN-Commit-Revision: 353826 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:45 -0000 Author: glebius Date: Mon Oct 21 18:07:44 2019 New Revision: 353826 URL: https://svnweb.freebsd.org/changeset/base/353826 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/sis/if_sis.c Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Mon Oct 21 18:07:40 2019 (r353825) +++ head/sys/dev/sis/if_sis.c Mon Oct 21 18:07:44 2019 (r353826) @@ -694,13 +694,29 @@ sis_rxfilter(struct sis_softc *sc) sis_rxfilter_sis(sc); } +static u_int +sis_write_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct sis_softc *sc = arg; + uint32_t h; + int bit, index; + + h = sis_mchash(sc, LLADDR(sdl)); + index = h >> 3; + bit = h & 0x1F; + CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_FMEM_LO + index); + if (bit > 0xF) + bit -= 0x10; + SIS_SETBIT(sc, SIS_RXFILT_DATA, (1 << bit)); + + return (1); +} + static void sis_rxfilter_ns(struct sis_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t h, i, filter; - int bit, index; + uint32_t i, filter; ifp = sc->sis_ifp; filter = CSR_READ_4(sc, SIS_RXFILT_CTL); @@ -743,21 +759,7 @@ sis_rxfilter_ns(struct sis_softc *sc) CSR_WRITE_4(sc, SIS_RXFILT_DATA, 0); } - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = sis_mchash(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - index = h >> 3; - bit = h & 0x1F; - CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_FMEM_LO + - index); - if (bit > 0xF) - bit -= 0x10; - SIS_SETBIT(sc, SIS_RXFILT_DATA, (1 << bit)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, sis_write_maddr, sc); } /* Turn the receive filter on */ @@ -765,13 +767,29 @@ sis_rxfilter_ns(struct sis_softc *sc) CSR_READ_4(sc, SIS_RXFILT_CTL); } +struct sis_hash_maddr_ctx { + struct sis_softc *sc; + uint16_t hashes[16]; +}; + +static u_int +sis_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct sis_hash_maddr_ctx *ctx = arg; + uint32_t h; + + h = sis_mchash(ctx->sc, LLADDR(sdl)); + ctx->hashes[h >> 4] |= 1 << (h & 0xf); + + return (1); +} + static void sis_rxfilter_sis(struct sis_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t filter, h, i, n; - uint16_t hashes[16]; + struct sis_hash_maddr_ctx ctx; + uint32_t filter, i, n; ifp = sc->sis_ifp; @@ -796,31 +814,21 @@ sis_rxfilter_sis(struct sis_softc *sc) if (ifp->if_flags & IFF_PROMISC) filter |= SIS_RXFILTCTL_ALLPHYS; for (i = 0; i < n; i++) - hashes[i] = ~0; + ctx.hashes[i] = ~0; } else { for (i = 0; i < n; i++) - hashes[i] = 0; - i = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = sis_mchash(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - hashes[h >> 4] |= 1 << (h & 0xf); - i++; - } - if_maddr_runlock(ifp); - if (i > n) { + ctx.hashes[i] = 0; + ctx.sc = sc; + if (if_foreach_llmaddr(ifp, sis_hash_maddr, &ctx) > n) { filter |= SIS_RXFILTCTL_ALLMULTI; for (i = 0; i < n; i++) - hashes[i] = ~0; + ctx.hashes[i] = ~0; } } for (i = 0; i < n; i++) { CSR_WRITE_4(sc, SIS_RXFILT_CTL, (4 + i) << 16); - CSR_WRITE_4(sc, SIS_RXFILT_DATA, hashes[i]); + CSR_WRITE_4(sc, SIS_RXFILT_DATA, ctx.hashes[i]); } /* Turn the receive filter on */ From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBD1415D7A0; Mon, 21 Oct 2019 18:07:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3p4Jjmz4ZYZ; Mon, 21 Oct 2019 18:07:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAAAB27B62; Mon, 21 Oct 2019 18:07:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7nfc065866; Mon, 21 Oct 2019 18:07:49 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7nkp065865; Mon, 21 Oct 2019 18:07:49 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7nkp065865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353827 - head/sys/dev/sk X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/sk X-SVN-Commit-Revision: 353827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:51 -0000 Author: glebius Date: Mon Oct 21 18:07:49 2019 New Revision: 353827 URL: https://svnweb.freebsd.org/changeset/base/353827 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/sk/if_sk.c Modified: head/sys/dev/sk/if_sk.c ============================================================================== --- head/sys/dev/sk/if_sk.c Mon Oct 21 18:07:44 2019 (r353826) +++ head/sys/dev/sk/if_sk.c Mon Oct 21 18:07:49 2019 (r353827) @@ -718,21 +718,49 @@ sk_rxfilter(sc_if) sk_rxfilter_yukon(sc_if); } +struct sk_add_maddr_genesis_ctx { + struct sk_if_softc *sc_if; + uint32_t hashes[2]; + uint32_t mode; +}; + +static u_int +sk_add_maddr_genesis(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct sk_add_maddr_genesis_ctx *ctx = arg; + int h; + + /* + * Program the first XM_RXFILT_MAX multicast groups + * into the perfect filter. + */ + if (cnt + 1 < XM_RXFILT_MAX) { + sk_setfilt(ctx->sc_if, (uint16_t *)LLADDR(sdl), cnt + 1); + ctx->mode |= XM_MODE_RX_USE_PERFECT; + return (1); + } + h = sk_xmchash((const uint8_t *)LLADDR(sdl)); + if (h < 32) + ctx->hashes[0] |= (1 << h); + else + ctx->hashes[1] |= (1 << (h - 32)); + ctx->mode |= XM_MODE_RX_USE_HASH; + + return (1); +} + static void -sk_rxfilter_genesis(sc_if) - struct sk_if_softc *sc_if; +sk_rxfilter_genesis(struct sk_if_softc *sc_if) { struct ifnet *ifp = sc_if->sk_ifp; - u_int32_t hashes[2] = { 0, 0 }, mode; - int h = 0, i; - struct ifmultiaddr *ifma; + struct sk_add_maddr_genesis_ctx ctx = { sc_if, { 0, 0 } }; + int i; u_int16_t dummy[] = { 0, 0, 0 }; - u_int16_t maddr[(ETHER_ADDR_LEN+1)/2]; SK_IF_LOCK_ASSERT(sc_if); - mode = SK_XM_READ_4(sc_if, XM_MODE); - mode &= ~(XM_MODE_RX_PROMISC | XM_MODE_RX_USE_HASH | + ctx.mode = SK_XM_READ_4(sc_if, XM_MODE); + ctx.mode &= ~(XM_MODE_RX_PROMISC | XM_MODE_RX_USE_HASH | XM_MODE_RX_USE_PERFECT); /* First, zot all the existing perfect filters. */ for (i = 1; i < XM_RXFILT_MAX; i++) @@ -741,53 +769,39 @@ sk_rxfilter_genesis(sc_if) /* Now program new ones. */ if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { if (ifp->if_flags & IFF_ALLMULTI) - mode |= XM_MODE_RX_USE_HASH; + ctx.mode |= XM_MODE_RX_USE_HASH; if (ifp->if_flags & IFF_PROMISC) - mode |= XM_MODE_RX_PROMISC; - hashes[0] = 0xFFFFFFFF; - hashes[1] = 0xFFFFFFFF; - } else { - i = 1; - if_maddr_rlock(ifp); + ctx.mode |= XM_MODE_RX_PROMISC; + ctx.hashes[0] = 0xFFFFFFFF; + ctx.hashes[1] = 0xFFFFFFFF; + } else /* XXX want to maintain reverse semantics */ - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, - ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - /* - * Program the first XM_RXFILT_MAX multicast groups - * into the perfect filter. - */ - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - maddr, ETHER_ADDR_LEN); - if (i < XM_RXFILT_MAX) { - sk_setfilt(sc_if, maddr, i); - mode |= XM_MODE_RX_USE_PERFECT; - i++; - continue; - } - h = sk_xmchash((const uint8_t *)maddr); - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - mode |= XM_MODE_RX_USE_HASH; - } - if_maddr_runlock(ifp); - } + if_foreach_llmaddr(ifp, sk_add_maddr_genesis, &ctx); - SK_XM_WRITE_4(sc_if, XM_MODE, mode); - SK_XM_WRITE_4(sc_if, XM_MAR0, hashes[0]); - SK_XM_WRITE_4(sc_if, XM_MAR2, hashes[1]); + SK_XM_WRITE_4(sc_if, XM_MODE, ctx.mode); + SK_XM_WRITE_4(sc_if, XM_MAR0, ctx.hashes[0]); + SK_XM_WRITE_4(sc_if, XM_MAR2, ctx.hashes[1]); } +static u_int +sk_hash_maddr_yukon(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *hashes = arg; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + /* Just want the 6 least significant bits. */ + crc &= 0x3f; + /* Set the corresponding bit in the hash table. */ + hashes[crc >> 5] |= 1 << (crc & 0x1f); + + return (1); +} + static void -sk_rxfilter_yukon(sc_if) - struct sk_if_softc *sc_if; +sk_rxfilter_yukon(struct sk_if_softc *sc_if) { struct ifnet *ifp; - u_int32_t crc, hashes[2] = { 0, 0 }, mode; - struct ifmultiaddr *ifma; + uint32_t hashes[2] = { 0, 0 }, mode; SK_IF_LOCK_ASSERT(sc_if); @@ -801,18 +815,7 @@ sk_rxfilter_yukon(sc_if) hashes[1] = 0xFFFFFFFF; } else { mode |= YU_RCR_UFLEN; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - /* Just want the 6 least significant bits. */ - crc &= 0x3f; - /* Set the corresponding bit in the hash table. */ - hashes[crc >> 5] |= 1 << (crc & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, sk_hash_maddr_yukon, hashes); if (hashes[0] != 0 || hashes[1] != 0) mode |= YU_RCR_MUFLEN; } From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5756F15D7F4; Mon, 21 Oct 2019 18:07:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3s5JzZz4Zgf; Mon, 21 Oct 2019 18:07:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7974727B63; Mon, 21 Oct 2019 18:07:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7rdf065914; Mon, 21 Oct 2019 18:07:53 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7rbM065913; Mon, 21 Oct 2019 18:07:53 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7rbM065913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353828 - head/sys/dev/ste X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ste X-SVN-Commit-Revision: 353828 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:55 -0000 Author: glebius Date: Mon Oct 21 18:07:53 2019 New Revision: 353828 URL: https://svnweb.freebsd.org/changeset/base/353828 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ste/if_ste.c Modified: head/sys/dev/ste/if_ste.c ============================================================================== --- head/sys/dev/ste/if_ste.c Mon Oct 21 18:07:49 2019 (r353827) +++ head/sys/dev/ste/if_ste.c Mon Oct 21 18:07:53 2019 (r353828) @@ -405,14 +405,27 @@ ste_read_eeprom(struct ste_softc *sc, uint16_t *dest, return (err ? 1 : 0); } +static u_int +ste_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) & 0x3F; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + static void ste_rxfilter(struct ste_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; uint32_t hashes[2] = { 0, 0 }; uint8_t rxcfg; - int h; STE_LOCK_ASSERT(sc); @@ -433,18 +446,7 @@ ste_rxfilter(struct ste_softc *sc) rxcfg |= STE_RXMODE_MULTIHASH; /* Now program new ones. */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) & 0x3F; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, ste_hash_maddr, hashes); chipit: CSR_WRITE_2(sc, STE_MAR0, hashes[0] & 0xFFFF); From owner-svn-src-head@freebsd.org Mon Oct 21 18:07:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17E0B15D848; Mon, 21 Oct 2019 18:07:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3x44X1z4Zm5; Mon, 21 Oct 2019 18:07:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF19327B64; Mon, 21 Oct 2019 18:07:56 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7ues065966; Mon, 21 Oct 2019 18:07:56 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7uts065965; Mon, 21 Oct 2019 18:07:56 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7uts065965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353829 - head/sys/dev/stge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/stge X-SVN-Commit-Revision: 353829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:58 -0000 Author: glebius Date: Mon Oct 21 18:07:56 2019 New Revision: 353829 URL: https://svnweb.freebsd.org/changeset/base/353829 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/stge/if_stge.c Modified: head/sys/dev/stge/if_stge.c ============================================================================== --- head/sys/dev/stge/if_stge.c Mon Oct 21 18:07:53 2019 (r353828) +++ head/sys/dev/stge/if_stge.c Mon Oct 21 18:07:56 2019 (r353829) @@ -2507,12 +2507,24 @@ stge_set_filter(struct stge_softc *sc) CSR_WRITE_2(sc, STGE_ReceiveMode, mode); } +static u_int +stge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *mchash = arg; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + /* Just want the 6 least significant bits. */ + crc &= 0x3f; + /* Set the corresponding bit in the hash table. */ + mchash[crc >> 5] |= 1 << (crc & 0x1f); + + return (1); +} + static void stge_set_multi(struct stge_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc; uint32_t mchash[2]; uint16_t mode; int count; @@ -2542,25 +2554,8 @@ stge_set_multi(struct stge_softc *sc) * high order bits select the register, while the rest of the bits * select the bit within the register. */ - bzero(mchash, sizeof(mchash)); - - count = 0; - if_maddr_rlock(sc->sc_ifp); - CK_STAILQ_FOREACH(ifma, &sc->sc_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - - /* Just want the 6 least significant bits. */ - crc &= 0x3f; - - /* Set the corresponding bit in the hash table. */ - mchash[crc >> 5] |= 1 << (crc & 0x1f); - count++; - } - if_maddr_runlock(ifp); + count = if_foreach_llmaddr(ifp, stge_hash_maddr, mchash); mode &= ~(RM_ReceiveMulticast | RM_ReceiveAllFrames); if (count > 0) From owner-svn-src-head@freebsd.org Mon Oct 21 18:08:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D81615D8D0; Mon, 21 Oct 2019 18:08:05 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl445HJ4z4Zxx; Mon, 21 Oct 2019 18:08:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8ECF227B65; Mon, 21 Oct 2019 18:08:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI84Ek066023; Mon, 21 Oct 2019 18:08:04 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI8448066021; Mon, 21 Oct 2019 18:08:04 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211808.x9LI8448066021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353830 - head/sys/dev/ti X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ti X-SVN-Commit-Revision: 353830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:08:05 -0000 Author: glebius Date: Mon Oct 21 18:08:03 2019 New Revision: 353830 URL: https://svnweb.freebsd.org/changeset/base/353830 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ti/if_ti.c head/sys/dev/ti/if_tireg.h Modified: head/sys/dev/ti/if_ti.c ============================================================================== --- head/sys/dev/ti/if_ti.c Mon Oct 21 18:07:56 2019 (r353829) +++ head/sys/dev/ti/if_ti.c Mon Oct 21 18:08:03 2019 (r353830) @@ -207,8 +207,8 @@ static uint32_t ti_eeprom_putbyte(struct ti_softc *, i static uint8_t ti_eeprom_getbyte(struct ti_softc *, int, uint8_t *); static int ti_read_eeprom(struct ti_softc *, caddr_t, int, int); -static void ti_add_mcast(struct ti_softc *, struct ether_addr *); -static void ti_del_mcast(struct ti_softc *, struct ether_addr *); +static u_int ti_add_mcast(void *, struct sockaddr_dl *, u_int); +static u_int ti_del_mcast(void *, struct sockaddr_dl *, u_int); static void ti_setmulti(struct ti_softc *); static void ti_mem_read(struct ti_softc *, uint32_t, uint32_t, void *); @@ -1878,14 +1878,15 @@ ti_init_tx_ring(struct ti_softc *sc) * but we have to support the old way too so that Tigon 1 cards will * work. */ -static void -ti_add_mcast(struct ti_softc *sc, struct ether_addr *addr) +static u_int +ti_add_mcast(void *arg, struct sockaddr_dl *sdl, u_int count) { + struct ti_softc *sc = arg; struct ti_cmd_desc cmd; uint16_t *m; uint32_t ext[2] = {0, 0}; - m = (uint16_t *)&addr->octet[0]; + m = (uint16_t *)LLADDR(sdl); switch (sc->ti_hwrev) { case TI_HWREV_TIGON: @@ -1900,18 +1901,20 @@ ti_add_mcast(struct ti_softc *sc, struct ether_addr *a break; default: device_printf(sc->ti_dev, "unknown hwrev\n"); - break; + return (0); } + return (1); } -static void -ti_del_mcast(struct ti_softc *sc, struct ether_addr *addr) +static u_int +ti_del_mcast(void *arg, struct sockaddr_dl *sdl, u_int count) { + struct ti_softc *sc = arg; struct ti_cmd_desc cmd; uint16_t *m; uint32_t ext[2] = {0, 0}; - m = (uint16_t *)&addr->octet[0]; + m = (uint16_t *)LLADDR(sdl); switch (sc->ti_hwrev) { case TI_HWREV_TIGON: @@ -1926,8 +1929,10 @@ ti_del_mcast(struct ti_softc *sc, struct ether_addr *a break; default: device_printf(sc->ti_dev, "unknown hwrev\n"); - break; + return (0); } + + return (1); } /* @@ -1948,9 +1953,7 @@ static void ti_setmulti(struct ti_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; struct ti_cmd_desc cmd; - struct ti_mc_entry *mc; uint32_t intrs; TI_LOCK_ASSERT(sc); @@ -1969,30 +1972,10 @@ ti_setmulti(struct ti_softc *sc) CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1); /* First, zot all the existing filters. */ - while (SLIST_FIRST(&sc->ti_mc_listhead) != NULL) { - mc = SLIST_FIRST(&sc->ti_mc_listhead); - ti_del_mcast(sc, &mc->mc_addr); - SLIST_REMOVE_HEAD(&sc->ti_mc_listhead, mc_entries); - free(mc, M_DEVBUF); - } + if_foreach_llmaddr(ifp, ti_del_mcast, sc); /* Now program new ones. */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_NOWAIT); - if (mc == NULL) { - device_printf(sc->ti_dev, - "no memory for mcast filter entry\n"); - continue; - } - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - (char *)&mc->mc_addr, ETHER_ADDR_LEN); - SLIST_INSERT_HEAD(&sc->ti_mc_listhead, mc, mc_entries); - ti_add_mcast(sc, &mc->mc_addr); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, ti_add_mcast, sc); /* Re-enable interrupts. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, intrs); Modified: head/sys/dev/ti/if_tireg.h ============================================================================== --- head/sys/dev/ti/if_tireg.h Mon Oct 21 18:07:56 2019 (r353829) +++ head/sys/dev/ti/if_tireg.h Mon Oct 21 18:08:03 2019 (r353830) @@ -1010,11 +1010,6 @@ struct ti_type { #define TI_TIMEOUT 1000 #define TI_TXCONS_UNSET 0xFFFF /* impossible value */ -struct ti_mc_entry { - struct ether_addr mc_addr; - SLIST_ENTRY(ti_mc_entry) mc_entries; -}; - typedef enum { TI_FLAG_NONE = 0x00, TI_FLAG_DEBUGING = 0x01, @@ -1048,7 +1043,6 @@ struct ti_softc { int ti_std; /* current std ring head */ int ti_mini; /* current mini ring head */ int ti_jumbo; /* current jumo ring head */ - SLIST_HEAD(__ti_mchead, ti_mc_entry) ti_mc_listhead; uint32_t ti_stat_ticks; uint32_t ti_rx_coal_ticks; uint32_t ti_tx_coal_ticks; From owner-svn-src-head@freebsd.org Mon Oct 21 18:08:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE86A15D95B; Mon, 21 Oct 2019 18:08:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl4F3hRvz4bBk; Mon, 21 Oct 2019 18:08:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6221427B66; Mon, 21 Oct 2019 18:08:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI8DcT066073; Mon, 21 Oct 2019 18:08:13 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI8Dsm066072; Mon, 21 Oct 2019 18:08:13 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211808.x9LI8Dsm066072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:08:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353831 - head/sys/dev/vge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/vge X-SVN-Commit-Revision: 353831 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:08:13 -0000 Author: glebius Date: Mon Oct 21 18:08:12 2019 New Revision: 353831 URL: https://svnweb.freebsd.org/changeset/base/353831 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/vge/if_vge.c Modified: head/sys/dev/vge/if_vge.c ============================================================================== --- head/sys/dev/vge/if_vge.c Mon Oct 21 18:08:03 2019 (r353830) +++ head/sys/dev/vge/if_vge.c Mon Oct 21 18:08:12 2019 (r353831) @@ -529,6 +529,34 @@ vge_setvlan(struct vge_softc *sc) CSR_WRITE_1(sc, VGE_RXCFG, cfg); } +static u_int +vge_set_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct vge_softc *sc = arg; + + if (sc->vge_camidx == VGE_CAM_MAXADDRS) + return (0); + + (void )vge_cam_set(sc, LLADDR(sdl)); + + return (1); +} + +static u_int +vge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t h, *hashes = arg; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + + /* * Program the multicast filter. We use the 64-entry CAM filter * for perfect filtering. If there's more than 64 multicast addresses, @@ -538,10 +566,8 @@ static void vge_rxfilter(struct vge_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t h, hashes[2]; + uint32_t hashes[2]; uint8_t rxcfg; - int error = 0; VGE_LOCK_ASSERT(sc); @@ -572,33 +598,15 @@ vge_rxfilter(struct vge_softc *sc) } vge_cam_clear(sc); + /* Now program new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - error = vge_cam_set(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - if (error) - break; - } + if_foreach_llmaddr(ifp, vge_set_maddr, sc); /* If there were too many addresses, use the hash filter. */ - if (error) { + if (sc->vge_camidx == VGE_CAM_MAXADDRS) { vge_cam_clear(sc); - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } + if_foreach_llmaddr(ifp, vge_hash_maddr, hashes); } - if_maddr_runlock(ifp); done: if (hashes[0] != 0 || hashes[1] != 0) From owner-svn-src-head@freebsd.org Mon Oct 21 18:08:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 220AF15D98F; Mon, 21 Oct 2019 18:08:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl4J6rrqz4bCq; Mon, 21 Oct 2019 18:08:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB55927B67; Mon, 21 Oct 2019 18:08:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI8G7K066123; Mon, 21 Oct 2019 18:08:16 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI8G9u066122; Mon, 21 Oct 2019 18:08:16 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211808.x9LI8G9u066122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353832 - head/sys/dev/vr X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/vr X-SVN-Commit-Revision: 353832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:08:17 -0000 Author: glebius Date: Mon Oct 21 18:08:16 2019 New Revision: 353832 URL: https://svnweb.freebsd.org/changeset/base/353832 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/vr/if_vr.c Modified: head/sys/dev/vr/if_vr.c ============================================================================== --- head/sys/dev/vr/if_vr.c Mon Oct 21 18:08:12 2019 (r353831) +++ head/sys/dev/vr/if_vr.c Mon Oct 21 18:08:16 2019 (r353832) @@ -432,6 +432,44 @@ vr_cam_data(struct vr_softc *sc, int type, int idx, ui return (i == VR_TIMEOUT ? ETIMEDOUT : 0); } +struct vr_hash_maddr_cam_ctx { + struct vr_softc *sc; + uint32_t mask; + int error; +}; + +static u_int +vr_hash_maddr_cam(void *arg, struct sockaddr_dl *sdl, u_int mcnt) +{ + struct vr_hash_maddr_cam_ctx *ctx = arg; + + if (ctx->error != 0) + return (0); + ctx->error = vr_cam_data(ctx->sc, VR_MCAST_CAM, mcnt, LLADDR(sdl)); + if (ctx->error != 0) { + ctx->mask = 0; + return (0); + } + ctx->mask |= 1 << mcnt; + + return (1); +} + +static u_int +vr_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + /* * Program the 64-bit multicast hash filter. */ @@ -439,12 +477,9 @@ static void vr_set_filter(struct vr_softc *sc) { struct ifnet *ifp; - int h; uint32_t hashes[2] = { 0, 0 }; - struct ifmultiaddr *ifma; uint8_t rxfilt; int error, mcnt; - uint32_t cam_mask; VR_LOCK_ASSERT(sc); @@ -466,27 +501,18 @@ vr_set_filter(struct vr_softc *sc) /* Now program new ones. */ error = 0; - mcnt = 0; - if_maddr_rlock(ifp); if ((sc->vr_quirks & VR_Q_CAM) != 0) { + struct vr_hash_maddr_cam_ctx ctx; + /* * For hardwares that have CAM capability, use * 32 entries multicast perfect filter. */ - cam_mask = 0; - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - error = vr_cam_data(sc, VR_MCAST_CAM, mcnt, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - if (error != 0) { - cam_mask = 0; - break; - } - cam_mask |= 1 << mcnt; - mcnt++; - } - vr_cam_mask(sc, VR_MCAST_CAM, cam_mask); + ctx.sc = sc; + ctx.mask = 0; + ctx.error = 0; + mcnt = if_foreach_llmaddr(ifp, vr_hash_maddr_cam, &ctx); + vr_cam_mask(sc, VR_MCAST_CAM, ctx.mask); } if ((sc->vr_quirks & VR_Q_CAM) == 0 || error != 0) { @@ -495,20 +521,8 @@ vr_set_filter(struct vr_softc *sc) * setting multicast CAM filter failed, use hash * table based filtering. */ - mcnt = 0; - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - mcnt++; - } + mcnt = if_foreach_llmaddr(ifp, vr_hash_maddr, hashes); } - if_maddr_runlock(ifp); if (mcnt > 0) rxfilt |= VR_RXCFG_RX_MULTI; From owner-svn-src-head@freebsd.org Mon Oct 21 18:08:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B13915D9E4; Mon, 21 Oct 2019 18:08:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl4P2Hvtz4bM0; Mon, 21 Oct 2019 18:08:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EA2827B68; Mon, 21 Oct 2019 18:08:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI8Lxq066170; Mon, 21 Oct 2019 18:08:21 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI8LxG066169; Mon, 21 Oct 2019 18:08:21 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211808.x9LI8LxG066169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:08:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353833 - head/sys/dev/vte X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/vte X-SVN-Commit-Revision: 353833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:08:21 -0000 Author: glebius Date: Mon Oct 21 18:08:20 2019 New Revision: 353833 URL: https://svnweb.freebsd.org/changeset/base/353833 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/vte/if_vte.c Modified: head/sys/dev/vte/if_vte.c ============================================================================== --- head/sys/dev/vte/if_vte.c Mon Oct 21 18:08:16 2019 (r353832) +++ head/sys/dev/vte/if_vte.c Mon Oct 21 18:08:20 2019 (r353833) @@ -1955,27 +1955,57 @@ vte_init_rx_ring(struct vte_softc *sc) return (0); } +struct vte_maddr_ctx { + uint16_t rxfilt_perf[VTE_RXFILT_PERFECT_CNT][3]; + uint16_t mchash[4]; + u_int nperf; +}; + +static u_int +vte_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct vte_maddr_ctx *ctx = arg; + uint8_t *eaddr; + uint32_t crc; + + /* + * Program the first 3 multicast groups into the perfect filter. + * For all others, use the hash table. + */ + if (ctx->nperf < VTE_RXFILT_PERFECT_CNT) { + eaddr = LLADDR(sdl); + ctx->rxfilt_perf[ctx->nperf][0] = eaddr[1] << 8 | eaddr[0]; + ctx->rxfilt_perf[ctx->nperf][1] = eaddr[3] << 8 | eaddr[2]; + ctx->rxfilt_perf[ctx->nperf][2] = eaddr[5] << 8 | eaddr[4]; + ctx->nperf++; + + return (1); + } + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + ctx->mchash[crc >> 30] |= 1 << ((crc >> 26) & 0x0F); + + return (1); +} + static void vte_rxfilter(struct vte_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint8_t *eaddr; - uint32_t crc; - uint16_t rxfilt_perf[VTE_RXFILT_PERFECT_CNT][3]; - uint16_t mchash[4], mcr; - int i, nperf; + struct vte_maddr_ctx ctx; + uint16_t mcr; + int i; VTE_LOCK_ASSERT(sc); ifp = sc->vte_ifp; - bzero(mchash, sizeof(mchash)); + bzero(ctx.mchash, sizeof(ctx.mchash)); for (i = 0; i < VTE_RXFILT_PERFECT_CNT; i++) { - rxfilt_perf[i][0] = 0xFFFF; - rxfilt_perf[i][1] = 0xFFFF; - rxfilt_perf[i][2] = 0xFFFF; + ctx.rxfilt_perf[i][0] = 0xFFFF; + ctx.rxfilt_perf[i][1] = 0xFFFF; + ctx.rxfilt_perf[i][2] = 0xFFFF; } + ctx.nperf = 0; mcr = CSR_READ_2(sc, VTE_MCR0); mcr &= ~(MCR0_PROMISC | MCR0_MULTICAST); @@ -1987,54 +2017,32 @@ vte_rxfilter(struct vte_softc *sc) mcr |= MCR0_PROMISC; if ((ifp->if_flags & IFF_ALLMULTI) != 0) mcr |= MCR0_MULTICAST; - mchash[0] = 0xFFFF; - mchash[1] = 0xFFFF; - mchash[2] = 0xFFFF; - mchash[3] = 0xFFFF; + ctx.mchash[0] = 0xFFFF; + ctx.mchash[1] = 0xFFFF; + ctx.mchash[2] = 0xFFFF; + ctx.mchash[3] = 0xFFFF; goto chipit; } - nperf = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->vte_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - /* - * Program the first 3 multicast groups into - * the perfect filter. For all others, use the - * hash table. - */ - if (nperf < VTE_RXFILT_PERFECT_CNT) { - eaddr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - rxfilt_perf[nperf][0] = eaddr[1] << 8 | eaddr[0]; - rxfilt_perf[nperf][1] = eaddr[3] << 8 | eaddr[2]; - rxfilt_perf[nperf][2] = eaddr[5] << 8 | eaddr[4]; - nperf++; - continue; - } - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - mchash[crc >> 30] |= 1 << ((crc >> 26) & 0x0F); - } - if_maddr_runlock(ifp); - if (mchash[0] != 0 || mchash[1] != 0 || mchash[2] != 0 || - mchash[3] != 0) + if_foreach_llmaddr(ifp, vte_hash_maddr, &ctx); + if (ctx.mchash[0] != 0 || ctx.mchash[1] != 0 || + ctx.mchash[2] != 0 || ctx.mchash[3] != 0) mcr |= MCR0_MULTICAST; chipit: /* Program multicast hash table. */ - CSR_WRITE_2(sc, VTE_MAR0, mchash[0]); - CSR_WRITE_2(sc, VTE_MAR1, mchash[1]); - CSR_WRITE_2(sc, VTE_MAR2, mchash[2]); - CSR_WRITE_2(sc, VTE_MAR3, mchash[3]); + CSR_WRITE_2(sc, VTE_MAR0, ctx.mchash[0]); + CSR_WRITE_2(sc, VTE_MAR1, ctx.mchash[1]); + CSR_WRITE_2(sc, VTE_MAR2, ctx.mchash[2]); + CSR_WRITE_2(sc, VTE_MAR3, ctx.mchash[3]); /* Program perfect filter table. */ for (i = 0; i < VTE_RXFILT_PERFECT_CNT; i++) { CSR_WRITE_2(sc, VTE_RXFILTER_PEEFECT_BASE + 8 * i + 0, - rxfilt_perf[i][0]); + ctx.rxfilt_perf[i][0]); CSR_WRITE_2(sc, VTE_RXFILTER_PEEFECT_BASE + 8 * i + 2, - rxfilt_perf[i][1]); + ctx.rxfilt_perf[i][1]); CSR_WRITE_2(sc, VTE_RXFILTER_PEEFECT_BASE + 8 * i + 4, - rxfilt_perf[i][2]); + ctx.rxfilt_perf[i][2]); } CSR_WRITE_2(sc, VTE_MCR0, mcr); CSR_READ_2(sc, VTE_MCR0); From owner-svn-src-head@freebsd.org Mon Oct 21 18:08:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DABCD15DA2E; Mon, 21 Oct 2019 18:08:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl4T4ktKz4bSF; Mon, 21 Oct 2019 18:08:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8528027B69; Mon, 21 Oct 2019 18:08:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI8Psx066230; Mon, 21 Oct 2019 18:08:25 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI8Pa8066229; Mon, 21 Oct 2019 18:08:25 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211808.x9LI8Pa8066229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353834 - head/sys/dev/xl X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/xl X-SVN-Commit-Revision: 353834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:08:26 -0000 Author: glebius Date: Mon Oct 21 18:08:25 2019 New Revision: 353834 URL: https://svnweb.freebsd.org/changeset/base/353834 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/xl/if_xl.c Modified: head/sys/dev/xl/if_xl.c ============================================================================== --- head/sys/dev/xl/if_xl.c Mon Oct 21 18:08:20 2019 (r353833) +++ head/sys/dev/xl/if_xl.c Mon Oct 21 18:08:25 2019 (r353834) @@ -606,11 +606,20 @@ xl_rxfilter(struct xl_softc *sc) * NICs older than the 3c905B have only one multicast option, which * is to enable reception of all multicast frames. */ +static u_int +xl_check_maddr_90x(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint8_t *rxfilt = arg; + + *rxfilt |= XL_RXFILTER_ALLMULTI; + + return (1); +} + static void xl_rxfilter_90x(struct xl_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; u_int8_t rxfilt; XL_LOCK_ASSERT(sc); @@ -634,16 +643,8 @@ xl_rxfilter_90x(struct xl_softc *sc) rxfilt |= XL_RXFILTER_ALLFRAMES; if (ifp->if_flags & IFF_ALLMULTI) rxfilt |= XL_RXFILTER_ALLMULTI; - } else { - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - rxfilt |= XL_RXFILTER_ALLMULTI; - break; - } - if_maddr_runlock(ifp); - } + } else + if_foreach_llmaddr(sc->xl_ifp, xl_check_maddr_90x, &rxfilt); CSR_WRITE_2(sc, XL_COMMAND, rxfilt | XL_CMD_RX_SET_FILT); XL_SEL_WIN(7); @@ -651,14 +652,34 @@ xl_rxfilter_90x(struct xl_softc *sc) /* * 3c905B adapters have a hash filter that we can program. + * Note: the 3c905B currently only supports a 64-bit + * hash table, which means we really only need 6 bits, + * but the manual indicates that future chip revisions + * will have a 256-bit hash table, hence the routine + * is set up to calculate 8 bits of position info in + * case we need it some day. + * Note II, The Sequel: _CURRENT_ versions of the + * 3c905B have a 256 bit hash table. This means we have + * to use all 8 bits regardless. On older cards, the + * upper 2 bits will be ignored. Grrrr.... */ +static u_int +xl_check_maddr_90xB(void *arg, struct sockaddr_dl *sdl, u_int count) +{ + struct xl_softc *sc = arg; + uint16_t h; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) & 0xFF; + CSR_WRITE_2(sc, XL_COMMAND, h | XL_CMD_RX_SET_HASH | XL_HASH_SET); + + return (1); +} + static void xl_rxfilter_90xB(struct xl_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - int i, mcnt; - u_int16_t h; + int i; u_int8_t rxfilt; XL_LOCK_ASSERT(sc); @@ -689,31 +710,7 @@ xl_rxfilter_90xB(struct xl_softc *sc) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_HASH | i); /* Now program new ones. */ - mcnt = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - /* - * Note: the 3c905B currently only supports a 64-bit - * hash table, which means we really only need 6 bits, - * but the manual indicates that future chip revisions - * will have a 256-bit hash table, hence the routine - * is set up to calculate 8 bits of position info in - * case we need it some day. - * Note II, The Sequel: _CURRENT_ versions of the - * 3c905B have a 256 bit hash table. This means we have - * to use all 8 bits regardless. On older cards, the - * upper 2 bits will be ignored. Grrrr.... - */ - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) & 0xFF; - CSR_WRITE_2(sc, XL_COMMAND, - h | XL_CMD_RX_SET_HASH | XL_HASH_SET); - mcnt++; - } - if_maddr_runlock(ifp); - if (mcnt > 0) + if (if_foreach_llmaddr(sc->xl_ifp, xl_check_maddr_90xB, sc) > 0) rxfilt |= XL_RXFILTER_MULTIHASH; } From owner-svn-src-head@freebsd.org Mon Oct 21 18:10:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9C9915DDF9; Mon, 21 Oct 2019 18:10:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7B56MPz4c2C; Mon, 21 Oct 2019 18:10:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93B6527B87; Mon, 21 Oct 2019 18:10:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIAktD066502; Mon, 21 Oct 2019 18:10:46 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIAkWD066501; Mon, 21 Oct 2019 18:10:46 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211810.x9LIAkWD066501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:10:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353836 - head/sys/dev/altera/atse X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/altera/atse X-SVN-Commit-Revision: 353836 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:10:46 -0000 Author: glebius Date: Mon Oct 21 18:10:46 2019 New Revision: 353836 URL: https://svnweb.freebsd.org/changeset/base/353836 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/altera/atse/if_atse.c Modified: head/sys/dev/altera/atse/if_atse.c ============================================================================== --- head/sys/dev/altera/atse/if_atse.c Mon Oct 21 18:08:57 2019 (r353835) +++ head/sys/dev/altera/atse/if_atse.c Mon Oct 21 18:10:46 2019 (r353836) @@ -427,12 +427,14 @@ atse_stop_locked(struct atse_softc *sc) return (0); } -static uint8_t -atse_mchash(struct atse_softc *sc __unused, const uint8_t *addr) +static u_int +atse_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) { - uint8_t x, y; + uint64_t *h = arg; + uint8_t *addr, x, y; int i, j; + addr = LLADDR(sdl); x = 0; for (i = 0; i < ETHER_ADDR_LEN; i++) { y = addr[i] & 0x01; @@ -440,14 +442,14 @@ atse_mchash(struct atse_softc *sc __unused, const uint y ^= (addr[i] >> j) & 0x01; x |= (y << i); } + *h |= (1 << x); - return (x); + return (1); } static int atse_rxfilter_locked(struct atse_softc *sc) { - struct ifmultiaddr *ifma; struct ifnet *ifp; uint32_t val4; int i; @@ -478,22 +480,13 @@ atse_rxfilter_locked(struct atse_softc *sc) */ uint64_t h; - h = 0; /* * Re-build and re-program hash table. First build the * bit-field "yes" or "no" for each slot per address, then * do all the programming afterwards. */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) { - continue; - } - - h |= (1 << atse_mchash(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr))); - } - if_maddr_runlock(ifp); + h = 0; + (void)if_foreach_llmaddr(ifp, atse_hash_maddr, &h); for (i = 0; i <= MHASH_LEN; i++) { CSR_WRITE_4(sc, MHASH_START + i, (h & (1 << i)) ? 0x01 : 0x00); From owner-svn-src-head@freebsd.org Mon Oct 21 18:10:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50E7415DE21; Mon, 21 Oct 2019 18:10:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7J6r4gz4c7r; Mon, 21 Oct 2019 18:10:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3BFA27B94; Mon, 21 Oct 2019 18:10:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIAqg3066552; Mon, 21 Oct 2019 18:10:52 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIAqx4066551; Mon, 21 Oct 2019 18:10:52 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211810.x9LIAqx4066551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:10:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353837 - head/sys/dev/bnxt X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/bnxt X-SVN-Commit-Revision: 353837 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:10:53 -0000 Author: glebius Date: Mon Oct 21 18:10:52 2019 New Revision: 353837 URL: https://svnweb.freebsd.org/changeset/base/353837 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Mon Oct 21 18:10:46 2019 (r353836) +++ head/sys/dev/bnxt/if_bnxt.c Mon Oct 21 18:10:52 2019 (r353837) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1185,30 +1186,41 @@ bnxt_stop(if_ctx_t ctx) return; } +static u_int +bnxt_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint8_t *mta = arg; + + if (cnt == BNXT_MAX_MC_ADDRS) + return (1); + + bcopy(LLADDR(sdl), &mta[cnt * ETHER_ADDR_LEN], ETHER_ADDR_LEN); + + return (1); +} + static void bnxt_multi_set(if_ctx_t ctx) { struct bnxt_softc *softc = iflib_get_softc(ctx); if_t ifp = iflib_get_ifp(ctx); uint8_t *mta; - int cnt, mcnt; + int mcnt; - mcnt = if_multiaddr_count(ifp, -1); + mta = softc->vnic_info.mc_list.idi_vaddr; + bzero(mta, softc->vnic_info.mc_list.idi_size); + mcnt = if_foreach_llmaddr(ifp, bnxt_copy_maddr, mta); if (mcnt > BNXT_MAX_MC_ADDRS) { softc->vnic_info.rx_mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; bnxt_hwrm_cfa_l2_set_rx_mask(softc, &softc->vnic_info); - } - else { + } else { softc->vnic_info.rx_mask &= ~HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; - mta = softc->vnic_info.mc_list.idi_vaddr; - bzero(mta, softc->vnic_info.mc_list.idi_size); - if_multiaddr_array(ifp, mta, &cnt, mcnt); bus_dmamap_sync(softc->vnic_info.mc_list.idi_tag, softc->vnic_info.mc_list.idi_map, BUS_DMASYNC_PREWRITE); - softc->vnic_info.mc_list_count = cnt; + softc->vnic_info.mc_list_count = mcnt; softc->vnic_info.rx_mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST; if (bnxt_hwrm_cfa_l2_set_rx_mask(softc, &softc->vnic_info)) @@ -1370,7 +1382,7 @@ bnxt_promisc_set(if_ctx_t ctx, int flags) int rc; if (ifp->if_flags & IFF_ALLMULTI || - if_multiaddr_count(ifp, -1) > BNXT_MAX_MC_ADDRS) + if_llmaddr_count(ifp) > BNXT_MAX_MC_ADDRS) softc->vnic_info.rx_mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; else From owner-svn-src-head@freebsd.org Mon Oct 21 18:10:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B93CB15DE65; Mon, 21 Oct 2019 18:10:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7R2htmz4cGd; Mon, 21 Oct 2019 18:10:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35AF827BA5; Mon, 21 Oct 2019 18:10:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIAxKl067299; Mon, 21 Oct 2019 18:10:59 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIAxf9067298; Mon, 21 Oct 2019 18:10:59 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211810.x9LIAxf9067298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353838 - head/sys/dev/cadence X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/cadence X-SVN-Commit-Revision: 353838 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:10:59 -0000 Author: glebius Date: Mon Oct 21 18:10:58 2019 New Revision: 353838 URL: https://svnweb.freebsd.org/changeset/base/353838 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/cadence/if_cgem.c Modified: head/sys/dev/cadence/if_cgem.c ============================================================================== --- head/sys/dev/cadence/if_cgem.c Mon Oct 21 18:10:52 2019 (r353837) +++ head/sys/dev/cadence/if_cgem.c Mon Oct 21 18:10:58 2019 (r353838) @@ -299,6 +299,21 @@ cgem_mac_hash(u_char eaddr[]) return hash; } +static u_int +cgem_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int index; + + index = cgem_mac_hash(LLADDR(sdl)); + if (index > 31) + hashes[0] |= (1 << (index - 32)); + else + hashes[1] |= (1 << index); + + return (1); +} + /* After any change in rx flags or multi-cast addresses, set up * hash registers and net config register bits. */ @@ -306,15 +321,9 @@ static void cgem_rx_filter(struct cgem_softc *sc) { if_t ifp = sc->ifp; - u_char *mta; - - int index, i, mcnt; - uint32_t hash_hi, hash_lo; + uint32_t hashes[2] = { 0, 0 }; uint32_t net_cfg; - hash_hi = 0; - hash_lo = 0; - net_cfg = RD4(sc, CGEM_NET_CFG); net_cfg &= ~(CGEM_NET_CFG_MULTI_HASH_EN | @@ -327,36 +336,17 @@ cgem_rx_filter(struct cgem_softc *sc) if ((if_getflags(ifp) & IFF_BROADCAST) == 0) net_cfg |= CGEM_NET_CFG_NO_BCAST; if ((if_getflags(ifp) & IFF_ALLMULTI) != 0) { - hash_hi = 0xffffffff; - hash_lo = 0xffffffff; - } else { - mcnt = if_multiaddr_count(ifp, -1); - mta = malloc(ETHER_ADDR_LEN * mcnt, M_DEVBUF, - M_NOWAIT); - if (mta == NULL) { - device_printf(sc->dev, - "failed to allocate temp mcast list\n"); - return; - } - if_multiaddr_array(ifp, mta, &mcnt, mcnt); - for (i = 0; i < mcnt; i++) { - index = cgem_mac_hash( - LLADDR((struct sockaddr_dl *) - (mta + (i * ETHER_ADDR_LEN)))); - if (index > 31) - hash_hi |= (1 << (index - 32)); - else - hash_lo |= (1 << index); - } - free(mta, M_DEVBUF); - } + hashes[0] = 0xffffffff; + hashes[1] = 0xffffffff; + } else + if_foreach_llmaddr(ifp, cgem_hash_maddr, hashes); - if (hash_hi != 0 || hash_lo != 0) + if (hashes[0] != 0 || hashes[1] != 0) net_cfg |= CGEM_NET_CFG_MULTI_HASH_EN; } - WR4(sc, CGEM_HASH_TOP, hash_hi); - WR4(sc, CGEM_HASH_BOT, hash_lo); + WR4(sc, CGEM_HASH_TOP, hashes[0]); + WR4(sc, CGEM_HASH_BOT, hashes[1]); WR4(sc, CGEM_NET_CFG, net_cfg); } From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCD4B15DEA0; Mon, 21 Oct 2019 18:11:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7X0TJYz4cKD; Mon, 21 Oct 2019 18:11:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DFAD27BA8; Mon, 21 Oct 2019 18:11:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIB3sH067384; Mon, 21 Oct 2019 18:11:03 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIB3Ah067383; Mon, 21 Oct 2019 18:11:03 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIB3Ah067383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353839 - head/sys/dev/cas X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/cas X-SVN-Commit-Revision: 353839 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:04 -0000 Author: glebius Date: Mon Oct 21 18:11:02 2019 New Revision: 353839 URL: https://svnweb.freebsd.org/changeset/base/353839 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/cas/if_cas.c Modified: head/sys/dev/cas/if_cas.c ============================================================================== --- head/sys/dev/cas/if_cas.c Mon Oct 21 18:10:58 2019 (r353838) +++ head/sys/dev/cas/if_cas.c Mon Oct 21 18:11:02 2019 (r353839) @@ -2498,14 +2498,27 @@ cas_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (error); } +static u_int +cas_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *hash = arg; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + /* We just want the 8 most significant bits. */ + crc >>= 24; + /* Set the corresponding bit in the filter. */ + hash[crc >> 4] |= 1 << (15 - (crc & 15)); + + return (1); +} + static void cas_setladrf(struct cas_softc *sc) { struct ifnet *ifp = sc->sc_ifp; - struct ifmultiaddr *inm; int i; uint32_t hash[16]; - uint32_t crc, v; + uint32_t v; CAS_LOCK_ASSERT(sc, MA_OWNED); @@ -2542,23 +2555,8 @@ cas_setladrf(struct cas_softc *sc) * is the MSB). */ - /* Clear the hash table. */ memset(hash, 0, sizeof(hash)); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { - if (inm->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - inm->ifma_addr), ETHER_ADDR_LEN); - - /* We just want the 8 most significant bits. */ - crc >>= 24; - - /* Set the corresponding bit in the filter. */ - hash[crc >> 4] |= 1 << (15 - (crc & 15)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, cas_hash_maddr, &hash); v |= CAS_MAC_RX_CONF_HFILTER; From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4984B15DED0; Mon, 21 Oct 2019 18:11:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7d0gDhz4cWS; Mon, 21 Oct 2019 18:11:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E6D1C27BB0; Mon, 21 Oct 2019 18:11:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIB8pi067435; Mon, 21 Oct 2019 18:11:08 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIB8j5067433; Mon, 21 Oct 2019 18:11:08 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIB8j5067433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353840 - in head/sys/dev/cxgb: . common X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys/dev/cxgb: . common X-SVN-Commit-Revision: 353840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:09 -0000 Author: glebius Date: Mon Oct 21 18:11:08 2019 New Revision: 353840 URL: https://svnweb.freebsd.org/changeset/base/353840 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/cxgb/common/cxgb_xgmac.c head/sys/dev/cxgb/cxgb_adapter.h Modified: head/sys/dev/cxgb/common/cxgb_xgmac.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_xgmac.c Mon Oct 21 18:11:02 2019 (r353839) +++ head/sys/dev/cxgb/common/cxgb_xgmac.c Mon Oct 21 18:11:08 2019 (r353840) @@ -408,9 +408,32 @@ static int hash_hw_addr(const u8 *addr) * Configures the MAC Rx mode (promiscuity, etc) and exact and hash * address filters. */ +struct t3_mcaddr_ctx { + struct cmac *mac; + u32 hash_lo, hash_hi; +}; + +static u_int +t3_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct t3_mcaddr_ctx *ctx = arg; + int hash; + + if (ctx->mac->nucast + cnt < EXACT_ADDR_FILTERS) + set_addr_filter(ctx->mac, ctx->mac->nucast + cnt, LLADDR(sdl)); + else { + hash = hash_hw_addr(LLADDR(sdl)); + if (hash < 32) + ctx->hash_lo |= (1 << hash); + else + ctx->hash_hi |= (1 << (hash - 32)); + } + return (1); +} + int t3_mac_set_rx_mode(struct cmac *mac, struct t3_rx_mode *rm) { - u32 hash_lo, hash_hi; + struct t3_mcaddr_ctx ctx; adapter_t *adap = mac->adapter; unsigned int oft = mac->offset; @@ -422,27 +445,15 @@ int t3_mac_set_rx_mode(struct cmac *mac, struct t3_rx_ mac->promisc_map ? F_COPYALLFRAMES : 0); if (allmulti_rx_mode(rm) || mac->multiport) - hash_lo = hash_hi = 0xffffffff; + ctx.hash_lo = ctx.hash_hi = 0xffffffff; else { - u8 *addr; - int exact_addr_idx = mac->nucast; - - hash_lo = hash_hi = 0; - while ((addr = t3_get_next_mcaddr(rm))) - if (exact_addr_idx < EXACT_ADDR_FILTERS) - set_addr_filter(mac, exact_addr_idx++, addr); - else { - int hash = hash_hw_addr(addr); - - if (hash < 32) - hash_lo |= (1 << hash); - else - hash_hi |= (1 << (hash - 32)); - } + ctx.mac = mac; + ctx.hash_lo = ctx.hash_hi = 0; + if_foreach_llmaddr(rm->port->ifp, t3_hash_maddr, &ctx); } - t3_write_reg(adap, A_XGM_RX_HASH_LOW + oft, hash_lo); - t3_write_reg(adap, A_XGM_RX_HASH_HIGH + oft, hash_hi); + t3_write_reg(adap, A_XGM_RX_HASH_LOW + oft, ctx.hash_lo); + t3_write_reg(adap, A_XGM_RX_HASH_HIGH + oft, ctx.hash_hi); return 0; } Modified: head/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- head/sys/dev/cxgb/cxgb_adapter.h Mon Oct 21 18:11:02 2019 (r353839) +++ head/sys/dev/cxgb/cxgb_adapter.h Mon Oct 21 18:11:08 2019 (r353840) @@ -463,30 +463,6 @@ t3_os_pci_write_config_2(adapter_t *adapter, int reg, pci_write_config(adapter->dev, reg, val, 2); } -static __inline uint8_t * -t3_get_next_mcaddr(struct t3_rx_mode *rm) -{ - uint8_t *macaddr = NULL; - struct ifnet *ifp = rm->port->ifp; - struct ifmultiaddr *ifma; - int i = 0; - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - if (i == rm->idx) { - macaddr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - break; - } - i++; - } - if_maddr_runlock(ifp); - - rm->idx++; - return (macaddr); -} - static __inline void t3_init_rx_mode(struct t3_rx_mode *rm, struct port_info *port) { From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 883D515DF15; Mon, 21 Oct 2019 18:11:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7h2NG6z4ccP; Mon, 21 Oct 2019 18:11:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01D6127BB4; Mon, 21 Oct 2019 18:11:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBBpR067482; Mon, 21 Oct 2019 18:11:11 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBB7m067481; Mon, 21 Oct 2019 18:11:11 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBB7m067481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353841 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 353841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:12 -0000 Author: glebius Date: Mon Oct 21 18:11:11 2019 New Revision: 353841 URL: https://svnweb.freebsd.org/changeset/base/353841 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Mon Oct 21 18:11:08 2019 (r353840) +++ head/sys/dev/cxgbe/t4_main.c Mon Oct 21 18:11:11 2019 (r353841) @@ -4782,7 +4782,55 @@ apply_link_config(struct port_info *pi) } #define FW_MAC_EXACT_CHUNK 7 +struct mcaddr_ctx { + struct ifnet *ifp; + const uint8_t *mcaddr[FW_MAC_EXACT_CHUNK]; + uint64_t hash; + int i; + int del; + int rc; +}; +static u_int +add_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct mcaddr_ctx *ctx = arg; + struct vi_info *vi = ctx->ifp->if_softc; + struct port_info *pi = vi->pi; + struct adapter *sc = pi->adapter; + + if (ctx->rc < 0) + return (0); + + ctx->mcaddr[ctx->i] = LLADDR(sdl); + MPASS(ETHER_IS_MULTICAST(ctx->mcaddr[ctx->i])); + ctx->i++; + + if (ctx->i == FW_MAC_EXACT_CHUNK) { + ctx->rc = t4_alloc_mac_filt(sc, sc->mbox, vi->viid, ctx->del, + ctx->i, ctx->mcaddr, NULL, &ctx->hash, 0); + if (ctx->rc < 0) { + int j; + + for (j = 0; j < ctx->i; j++) { + if_printf(ctx->ifp, + "failed to add mc address" + " %02x:%02x:%02x:" + "%02x:%02x:%02x rc=%d\n", + ctx->mcaddr[j][0], ctx->mcaddr[j][1], + ctx->mcaddr[j][2], ctx->mcaddr[j][3], + ctx->mcaddr[j][4], ctx->mcaddr[j][5], + -ctx->rc); + } + return (0); + } + ctx->del = 0; + ctx->i = 0; + } + + return (1); +} + /* * Program the port's XGMAC based on parameters in ifnet. The caller also * indicates which parameters should be programmed (the rest are left alone). @@ -4838,66 +4886,51 @@ update_mac_settings(struct ifnet *ifp, int flags) } if (flags & XGMAC_MCADDRS) { - const uint8_t *mcaddr[FW_MAC_EXACT_CHUNK]; - int del = 1; - uint64_t hash = 0; - struct ifmultiaddr *ifma; - int i = 0, j; + struct epoch_tracker et; + struct mcaddr_ctx ctx; + int j; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - mcaddr[i] = - LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - MPASS(ETHER_IS_MULTICAST(mcaddr[i])); - i++; - - if (i == FW_MAC_EXACT_CHUNK) { - rc = t4_alloc_mac_filt(sc, sc->mbox, vi->viid, - del, i, mcaddr, NULL, &hash, 0); - if (rc < 0) { - rc = -rc; - for (j = 0; j < i; j++) { - if_printf(ifp, - "failed to add mc address" - " %02x:%02x:%02x:" - "%02x:%02x:%02x rc=%d\n", - mcaddr[j][0], mcaddr[j][1], - mcaddr[j][2], mcaddr[j][3], - mcaddr[j][4], mcaddr[j][5], - rc); - } - goto mcfail; - } - del = 0; - i = 0; - } + ctx.ifp = ifp; + ctx.hash = 0; + ctx.i = 0; + ctx.del = 1; + /* + * Unlike other drivers, we accumulate list of pointers into + * interface address lists and we need to keep it safe even + * after if_foreach_llmaddr() returns, thus we must enter the + * network epoch. + */ + NET_EPOCH_ENTER(et); + if_foreach_llmaddr(ifp, add_maddr, &ctx); + if (ctx.rc < 0) { + NET_EPOCH_EXIT(et); + rc = -ctx.rc; + return (rc); } - if (i > 0) { - rc = t4_alloc_mac_filt(sc, sc->mbox, vi->viid, del, i, - mcaddr, NULL, &hash, 0); + if (ctx.i > 0) { + rc = t4_alloc_mac_filt(sc, sc->mbox, vi->viid, + ctx.del, ctx.i, ctx.mcaddr, NULL, &ctx.hash, 0); + NET_EPOCH_EXIT(et); if (rc < 0) { rc = -rc; - for (j = 0; j < i; j++) { + for (j = 0; j < ctx.i; j++) { if_printf(ifp, "failed to add mc address" " %02x:%02x:%02x:" "%02x:%02x:%02x rc=%d\n", - mcaddr[j][0], mcaddr[j][1], - mcaddr[j][2], mcaddr[j][3], - mcaddr[j][4], mcaddr[j][5], + ctx.mcaddr[j][0], ctx.mcaddr[j][1], + ctx.mcaddr[j][2], ctx.mcaddr[j][3], + ctx.mcaddr[j][4], ctx.mcaddr[j][5], rc); } - goto mcfail; + return (rc); } - } + } else + NET_EPOCH_EXIT(et); - rc = -t4_set_addr_hash(sc, sc->mbox, vi->viid, 0, hash, 0); + rc = -t4_set_addr_hash(sc, sc->mbox, vi->viid, 0, ctx.hash, 0); if (rc != 0) if_printf(ifp, "failed to set mc address hash: %d", rc); -mcfail: - if_maddr_runlock(ifp); } return (rc); From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52B2C15DF47; Mon, 21 Oct 2019 18:11:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7m0nGFz4ckY; Mon, 21 Oct 2019 18:11:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5E6A27BBC; Mon, 21 Oct 2019 18:11:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBF6T067532; Mon, 21 Oct 2019 18:11:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBFO3067531; Mon, 21 Oct 2019 18:11:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBFO3067531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353842 - head/sys/dev/dc X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/dc X-SVN-Commit-Revision: 353842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:16 -0000 Author: glebius Date: Mon Oct 21 18:11:15 2019 New Revision: 353842 URL: https://svnweb.freebsd.org/changeset/base/353842 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/dc/if_dc.c Modified: head/sys/dev/dc/if_dc.c ============================================================================== --- head/sys/dev/dc/if_dc.c Mon Oct 21 18:11:11 2019 (r353841) +++ head/sys/dev/dc/if_dc.c Mon Oct 21 18:11:15 2019 (r353842) @@ -962,13 +962,24 @@ dc_mchash_be(const uint8_t *addr) * frames. We also sneak the broadcast address into the hash filter since * we need that too. */ +static u_int +dc_hash_maddr_21143(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct dc_softc *sc = arg; + uint32_t h; + + h = dc_mchash_le(sc, LLADDR(sdl)); + sc->dc_cdata.dc_sbuf[h >> 4] |= htole32(1 << (h & 0xF)); + + return (1); +} + static void dc_setfilt_21143(struct dc_softc *sc) { uint16_t eaddr[(ETHER_ADDR_LEN+1)/2]; struct dc_desc *sframe; uint32_t h, *sp; - struct ifmultiaddr *ifma; struct ifnet *ifp; int i; @@ -998,15 +1009,7 @@ dc_setfilt_21143(struct dc_softc *sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = dc_mchash_le(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - sp[h >> 4] |= htole32(1 << (h & 0xF)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, dc_hash_maddr_21143, sp); if (ifp->if_flags & IFF_BROADCAST) { h = dc_mchash_le(sc, ifp->if_broadcastaddr); @@ -1036,14 +1039,47 @@ dc_setfilt_21143(struct dc_softc *sc) sc->dc_wdog_timer = 5; } +static u_int +dc_hash_maddr_admtek_be(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h = 0; + + h = dc_mchash_be(LLADDR(sdl)); + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + +struct dc_hash_maddr_admtek_le_ctx { + struct dc_softc *sc; + uint32_t hashes[2]; +}; + +static u_int +dc_hash_maddr_admtek_le(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct dc_hash_maddr_admtek_le_ctx *ctx = arg; + int h = 0; + + h = dc_mchash_le(ctx->sc, LLADDR(sdl)); + if (h < 32) + ctx->hashes[0] |= (1 << h); + else + ctx->hashes[1] |= (1 << (h - 32)); + + return (1); +} + static void dc_setfilt_admtek(struct dc_softc *sc) { uint8_t eaddr[ETHER_ADDR_LEN]; struct ifnet *ifp; - struct ifmultiaddr *ifma; - int h = 0; - uint32_t hashes[2] = { 0, 0 }; + struct dc_hash_maddr_admtek_le_ctx ctx = { sc, { 0, 0 }}; ifp = sc->dc_ifp; @@ -1076,25 +1112,13 @@ dc_setfilt_admtek(struct dc_softc *sc) return; /* Now program new ones. */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - if (DC_IS_CENTAUR(sc)) - h = dc_mchash_le(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - else - h = dc_mchash_be( - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if (DC_IS_CENTAUR(sc)) + if_foreach_llmaddr(ifp, dc_hash_maddr_admtek_le, &ctx); + else + if_foreach_llmaddr(ifp, dc_hash_maddr_admtek_be, &ctx.hashes); - CSR_WRITE_4(sc, DC_AL_MAR0, hashes[0]); - CSR_WRITE_4(sc, DC_AL_MAR1, hashes[1]); + CSR_WRITE_4(sc, DC_AL_MAR0, ctx.hashes[0]); + CSR_WRITE_4(sc, DC_AL_MAR1, ctx.hashes[1]); } static void @@ -1102,8 +1126,6 @@ dc_setfilt_asix(struct dc_softc *sc) { uint32_t eaddr[(ETHER_ADDR_LEN+3)/4]; struct ifnet *ifp; - struct ifmultiaddr *ifma; - int h = 0; uint32_t hashes[2] = { 0, 0 }; ifp = sc->dc_ifp; @@ -1149,17 +1171,7 @@ dc_setfilt_asix(struct dc_softc *sc) return; /* now program new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = dc_mchash_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, dc_hash_maddr_admtek_be, hashes); CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_MAR0); CSR_WRITE_4(sc, DC_AX_FILTDATA, hashes[0]); @@ -1167,15 +1179,29 @@ dc_setfilt_asix(struct dc_softc *sc) CSR_WRITE_4(sc, DC_AX_FILTDATA, hashes[1]); } +static u_int +dc_hash_maddr_uli(void *arg, struct sockaddr_dl *sdl, u_int mcnt) +{ + uint32_t **sp = arg; + uint8_t *ma; + + if (mcnt == DC_ULI_FILTER_NPERF) + return (0); + ma = LLADDR(sdl); + *(*sp)++ = DC_SP_MAC(ma[1] << 8 | ma[0]); + *(*sp)++ = DC_SP_MAC(ma[3] << 8 | ma[2]); + *(*sp)++ = DC_SP_MAC(ma[5] << 8 | ma[4]); + + return (1); +} + static void dc_setfilt_uli(struct dc_softc *sc) { uint8_t eaddr[ETHER_ADDR_LEN]; struct ifnet *ifp; - struct ifmultiaddr *ifma; struct dc_desc *sframe; uint32_t filter, *sp; - uint8_t *ma; int i, mcnt; ifp = sc->dc_ifp; @@ -1209,29 +1235,17 @@ dc_setfilt_uli(struct dc_softc *sc) filter &= ~(DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI); /* Now build perfect filters. */ - mcnt = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - if (mcnt >= DC_ULI_FILTER_NPERF) { - filter |= DC_NETCFG_RX_ALLMULTI; - break; + mcnt = if_foreach_llmaddr(ifp, dc_hash_maddr_uli, &sp); + + if (mcnt == DC_ULI_FILTER_NPERF) + filter |= DC_NETCFG_RX_ALLMULTI; + else + for (; mcnt < DC_ULI_FILTER_NPERF; mcnt++) { + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); } - ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - *sp++ = DC_SP_MAC(ma[1] << 8 | ma[0]); - *sp++ = DC_SP_MAC(ma[3] << 8 | ma[2]); - *sp++ = DC_SP_MAC(ma[5] << 8 | ma[4]); - mcnt++; - } - if_maddr_runlock(ifp); - for (; mcnt < DC_ULI_FILTER_NPERF; mcnt++) { - *sp++ = DC_SP_MAC(0xFFFF); - *sp++ = DC_SP_MAC(0xFFFF); - *sp++ = DC_SP_MAC(0xFFFF); - } - if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) CSR_WRITE_4(sc, DC_NETCFG, filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); @@ -1258,12 +1272,22 @@ dc_setfilt_uli(struct dc_softc *sc) sc->dc_wdog_timer = 5; } +static u_int +dc_hash_maddr_xircom(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct dc_softc *sc = arg; + uint32_t h; + + h = dc_mchash_le(sc, LLADDR(sdl)); + sc->dc_cdata.dc_sbuf[h >> 4] |= htole32(1 << (h & 0xF)); + return (1); +} + static void dc_setfilt_xircom(struct dc_softc *sc) { uint16_t eaddr[(ETHER_ADDR_LEN+1)/2]; struct ifnet *ifp; - struct ifmultiaddr *ifma; struct dc_desc *sframe; uint32_t h, *sp; int i; @@ -1295,15 +1319,7 @@ dc_setfilt_xircom(struct dc_softc *sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = dc_mchash_le(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - sp[h >> 4] |= htole32(1 << (h & 0xF)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, dc_hash_maddr_xircom, &sp); if (ifp->if_flags & IFF_BROADCAST) { h = dc_mchash_le(sc, ifp->if_broadcastaddr); From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E78E15E0BC; Mon, 21 Oct 2019 18:11:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7r5b2cz4cs3; Mon, 21 Oct 2019 18:11:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51AE627BC7; Mon, 21 Oct 2019 18:11:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBKUv068212; Mon, 21 Oct 2019 18:11:20 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBKlx068211; Mon, 21 Oct 2019 18:11:20 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBKlx068211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353843 - head/sys/dev/dwc X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/dwc X-SVN-Commit-Revision: 353843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:21 -0000 Author: glebius Date: Mon Oct 21 18:11:19 2019 New Revision: 353843 URL: https://svnweb.freebsd.org/changeset/base/353843 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/dwc/if_dwc.c Modified: head/sys/dev/dwc/if_dwc.c ============================================================================== --- head/sys/dev/dwc/if_dwc.c Mon Oct 21 18:11:15 2019 (r353842) +++ head/sys/dev/dwc/if_dwc.c Mon Oct 21 18:11:19 2019 (r353843) @@ -581,13 +581,37 @@ bitreverse(uint8_t x) return (nibbletab[x & 0xf] << 4) | nibbletab[x >> 4]; } +struct dwc_hash_maddr_ctx { + struct dwc_softc *sc; + uint32_t hash[8]; +}; + +static u_int +dwc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct dwc_hash_maddr_ctx *ctx = arg; + uint32_t crc, hashbit, hashreg; + uint8_t val; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + /* Take lower 8 bits and reverse it */ + val = bitreverse(~crc & 0xff); + if (ctx->sc->mactype == DWC_GMAC_ALT_DESC) + val >>= 2; /* Only need lower 6 bits */ + hashreg = (val >> 5); + hashbit = (val & 31); + ctx->hash[hashreg] |= (1 << hashbit); + + return (1); +} + static void dwc_setup_rxfilter(struct dwc_softc *sc) { - struct ifmultiaddr *ifma; + struct dwc_hash_maddr_ctx ctx; struct ifnet *ifp; - uint8_t *eaddr, val; - uint32_t crc, ffval, hashbit, hashreg, hi, lo, hash[8]; + uint8_t *eaddr; + uint32_t ffval, hi, lo; int nhash, i; DWC_ASSERT_LOCKED(sc); @@ -601,27 +625,13 @@ dwc_setup_rxfilter(struct dwc_softc *sc) if ((ifp->if_flags & IFF_ALLMULTI) != 0) { ffval = (FRAME_FILTER_PM); for (i = 0; i < nhash; i++) - hash[i] = ~0; + ctx.hash[i] = ~0; } else { ffval = (FRAME_FILTER_HMC); for (i = 0; i < nhash; i++) - hash[i] = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - - /* Take lower 8 bits and reverse it */ - val = bitreverse(~crc & 0xff); - if (sc->mactype == DWC_GMAC_ALT_DESC) - val >>= nhash; /* Only need lower 6 bits */ - hashreg = (val >> 5); - hashbit = (val & 31); - hash[hashreg] |= (1 << hashbit); - } - if_maddr_runlock(ifp); + ctx.hash[i] = 0; + ctx.sc = sc; + if_foreach_llmaddr(ifp, dwc_hash_maddr, &ctx); } /* @@ -641,11 +651,11 @@ dwc_setup_rxfilter(struct dwc_softc *sc) WRITE4(sc, MAC_ADDRESS_HIGH(0), hi); WRITE4(sc, MAC_FRAME_FILTER, ffval); if (sc->mactype == DWC_GMAC_ALT_DESC) { - WRITE4(sc, GMAC_MAC_HTLOW, hash[0]); - WRITE4(sc, GMAC_MAC_HTHIGH, hash[1]); + WRITE4(sc, GMAC_MAC_HTLOW, ctx.hash[0]); + WRITE4(sc, GMAC_MAC_HTHIGH, ctx.hash[1]); } else { for (i = 0; i < nhash; i++) - WRITE4(sc, HASH_TABLE_REG(i), hash[i]); + WRITE4(sc, HASH_TABLE_REG(i), ctx.hash[i]); } } From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7727715E0EA; Mon, 21 Oct 2019 18:11:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8024LTz4d5G; Mon, 21 Oct 2019 18:11:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E98427BCD; Mon, 21 Oct 2019 18:11:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBOSY068264; Mon, 21 Oct 2019 18:11:24 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBOwE068263; Mon, 21 Oct 2019 18:11:24 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBOwE068263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353844 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 353844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:28 -0000 Author: glebius Date: Mon Oct 21 18:11:24 2019 New Revision: 353844 URL: https://svnweb.freebsd.org/changeset/base/353844 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Oct 21 18:11:19 2019 (r353843) +++ head/sys/dev/e1000/if_em.c Mon Oct 21 18:11:24 2019 (r353844) @@ -1655,7 +1655,7 @@ em_disable_promisc(if_ctx_t ctx) if (if_getflags(ifp) & IFF_ALLMULTI) mcnt = MAX_NUM_MULTICAST_ADDRESSES; else - mcnt = if_multiaddr_count(ifp, MAX_NUM_MULTICAST_ADDRESSES); + mcnt = if_llmaddr_count(ifp); /* Don't disable if in MAX groups */ if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) reg_rctl &= (~E1000_RCTL_MPE); @@ -1664,6 +1664,19 @@ em_disable_promisc(if_ctx_t ctx) } +static u_int +em_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + u8 *mta = arg; + + if (cnt == MAX_NUM_MULTICAST_ADDRESSES) + return (1); + + bcopy(LLADDR(sdl), &mta[cnt * ETH_ADDR_LEN], ETH_ADDR_LEN); + + return (1); +} + /********************************************************************* * Multicast Update * @@ -1695,7 +1708,7 @@ em_if_multi_set(if_ctx_t ctx) msec_delay(5); } - if_multiaddr_array(ifp, mta, &mcnt, MAX_NUM_MULTICAST_ADDRESSES); + mcnt = if_foreach_llmaddr(ifp, em_copy_maddr, mta); if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) { reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B81BD15E101; Mon, 21 Oct 2019 18:11:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl812PWgz4d5Y; Mon, 21 Oct 2019 18:11:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E049327BD3; Mon, 21 Oct 2019 18:11:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBS0Q068311; Mon, 21 Oct 2019 18:11:28 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBSjG068310; Mon, 21 Oct 2019 18:11:28 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBSjG068310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353845 - head/sys/dev/et X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/et X-SVN-Commit-Revision: 353845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:29 -0000 Author: glebius Date: Mon Oct 21 18:11:28 2019 New Revision: 353845 URL: https://svnweb.freebsd.org/changeset/base/353845 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Mon Oct 21 18:11:24 2019 (r353844) +++ head/sys/dev/et/if_et.c Mon Oct 21 18:11:28 2019 (r353845) @@ -1560,13 +1560,36 @@ et_free_rx_ring(struct et_softc *sc) } } +static u_int +et_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t h, *hp, *hash = arg; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + h = (h & 0x3f800000) >> 23; + + hp = &hash[0]; + if (h >= 32 && h < 64) { + h -= 32; + hp = &hash[1]; + } else if (h >= 64 && h < 96) { + h -= 64; + hp = &hash[2]; + } else if (h >= 96) { + h -= 96; + hp = &hash[3]; + } + *hp |= (1 << h); + + return (1); +} + static void et_setmulti(struct et_softc *sc) { struct ifnet *ifp; uint32_t hash[4] = { 0, 0, 0, 0 }; uint32_t rxmac_ctrl, pktfilt; - struct ifmultiaddr *ifma; int i, count; ET_LOCK_ASSERT(sc); @@ -1581,34 +1604,7 @@ et_setmulti(struct et_softc *sc) goto back; } - count = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - uint32_t *hp, h; - - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - h = (h & 0x3f800000) >> 23; - - hp = &hash[0]; - if (h >= 32 && h < 64) { - h -= 32; - hp = &hash[1]; - } else if (h >= 64 && h < 96) { - h -= 64; - hp = &hash[2]; - } else if (h >= 96) { - h -= 96; - hp = &hash[3]; - } - *hp |= (1 << h); - - ++count; - } - if_maddr_runlock(ifp); + count = if_foreach_llmaddr(ifp, et_hash_maddr, &hash); for (i = 0; i < 4; ++i) CSR_WRITE_4(sc, ET_MULTI_HASH + (i * 4), hash[i]); From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A26715E12E; Mon, 21 Oct 2019 18:11:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl856Gk0z4d9L; Mon, 21 Oct 2019 18:11:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B0E127BD6; Mon, 21 Oct 2019 18:11:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBXAl068361; Mon, 21 Oct 2019 18:11:33 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBXrV068360; Mon, 21 Oct 2019 18:11:33 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBXrV068360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353846 - head/sys/dev/ffec X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ffec X-SVN-Commit-Revision: 353846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:34 -0000 Author: glebius Date: Mon Oct 21 18:11:32 2019 New Revision: 353846 URL: https://svnweb.freebsd.org/changeset/base/353846 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ffec/if_ffec.c Modified: head/sys/dev/ffec/if_ffec.c ============================================================================== --- head/sys/dev/ffec/if_ffec.c Mon Oct 21 18:11:28 2019 (r353845) +++ head/sys/dev/ffec/if_ffec.c Mon Oct 21 18:11:32 2019 (r353846) @@ -974,13 +974,24 @@ ffec_get_hwaddr(struct ffec_softc *sc, uint8_t *hwaddr } } +static u_int +ffec_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint64_t *ghash = arg; + uint32_t crc; + + /* 6 bits from MSB in LE CRC32 are used for hash. */ + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + *ghash |= 1LLU << (((uint8_t *)&crc)[3] >> 2); + + return (1); +} + static void ffec_setup_rxfilter(struct ffec_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; uint8_t *eaddr; - uint32_t crc; uint64_t ghash, ihash; FFEC_ASSERT_LOCKED(sc); @@ -994,16 +1005,7 @@ ffec_setup_rxfilter(struct ffec_softc *sc) ghash = 0xffffffffffffffffLLU; else { ghash = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - /* 6 bits from MSB in LE CRC32 are used for hash. */ - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - ghash |= 1LLU << (((uint8_t *)&crc)[3] >> 2); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, ffec_hash_maddr, &ghash); } WR4(sc, FEC_GAUR_REG, (uint32_t)(ghash >> 32)); WR4(sc, FEC_GALR_REG, (uint32_t)ghash); From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2094915E15D; Mon, 21 Oct 2019 18:11:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8B5kQTz4dKB; Mon, 21 Oct 2019 18:11:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C44727BDD; Mon, 21 Oct 2019 18:11:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBcMF068411; Mon, 21 Oct 2019 18:11:38 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBcpK068410; Mon, 21 Oct 2019 18:11:38 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBcpK068410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353847 - head/sys/dev/if_ndis X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/if_ndis X-SVN-Commit-Revision: 353847 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:39 -0000 Author: glebius Date: Mon Oct 21 18:11:38 2019 New Revision: 353847 URL: https://svnweb.freebsd.org/changeset/base/353847 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Mon Oct 21 18:11:32 2019 (r353846) +++ head/sys/dev/if_ndis/if_ndis.c Mon Oct 21 18:11:38 2019 (r353847) @@ -282,6 +282,22 @@ ndisdrv_modevent(mod, cmd, arg) return (error); } +struct mclist_ctx { + uint8_t *mclist; + int mclistsz; +}; + +static u_int +ndis_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct mclist_ctx *ctx = arg; + + if (cnt < ctx->mclistsz) + bcopy(LLADDR(sdl), ctx->mclist + (ETHER_ADDR_LEN * cnt), + ETHER_ADDR_LEN); + return (1); +} + /* * Program the 64-bit multicast hash filter. */ @@ -290,9 +306,8 @@ ndis_setmulti(sc) struct ndis_softc *sc; { struct ifnet *ifp; - struct ifmultiaddr *ifma; - int len, mclistsz, error; - uint8_t *mclist; + struct mclist_ctx ctx; + int len, error; if (!NDIS_INITIALIZED(sc)) @@ -313,40 +328,31 @@ ndis_setmulti(sc) return; } - if (CK_STAILQ_EMPTY(&ifp->if_multiaddrs)) + if (if_llmaddr_count(ifp) == 0) return; - len = sizeof(mclistsz); - ndis_get_info(sc, OID_802_3_MAXIMUM_LIST_SIZE, &mclistsz, &len); + len = sizeof(ctx.mclistsz); + ndis_get_info(sc, OID_802_3_MAXIMUM_LIST_SIZE, &ctx.mclistsz, &len); - mclist = malloc(ETHER_ADDR_LEN * mclistsz, M_TEMP, M_NOWAIT|M_ZERO); + ctx.mclist = malloc(ETHER_ADDR_LEN * ctx.mclistsz, M_TEMP, + M_NOWAIT | M_ZERO); - if (mclist == NULL) { + if (ctx.mclist == NULL) { sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; goto out; } sc->ndis_filter |= NDIS_PACKET_TYPE_MULTICAST; - len = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - mclist + (ETHER_ADDR_LEN * len), ETHER_ADDR_LEN); - len++; - if (len > mclistsz) { - if_maddr_runlock(ifp); - sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; - sc->ndis_filter &= ~NDIS_PACKET_TYPE_MULTICAST; + len = if_foreach_llmaddr(ifp, ndis_copy_maddr, &ctx); + if (len > ctx.mclistsz) { + sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; + sc->ndis_filter &= ~NDIS_PACKET_TYPE_MULTICAST; goto out; - } } - if_maddr_runlock(ifp); len = len * ETHER_ADDR_LEN; - error = ndis_set_info(sc, OID_802_3_MULTICAST_LIST, mclist, &len); + error = ndis_set_info(sc, OID_802_3_MULTICAST_LIST, ctx.mclist, &len); if (error) { device_printf(sc->ndis_dev, "set mclist failed: %d\n", error); sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; @@ -354,7 +360,7 @@ ndis_setmulti(sc) } out: - free(mclist, M_TEMP); + free(ctx.mclist, M_TEMP); len = sizeof(sc->ndis_filter); error = ndis_set_info(sc, OID_GEN_CURRENT_PACKET_FILTER, From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:45 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8EF615E193; Mon, 21 Oct 2019 18:11:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8K0Y01z4dVq; Mon, 21 Oct 2019 18:11:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CF9C27BE3; Mon, 21 Oct 2019 18:11:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBhCf069589; Mon, 21 Oct 2019 18:11:43 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBhea069573; Mon, 21 Oct 2019 18:11:43 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBhea069573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353848 - head/sys/dev/jme X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/jme X-SVN-Commit-Revision: 353848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:45 -0000 Author: glebius Date: Mon Oct 21 18:11:43 2019 New Revision: 353848 URL: https://svnweb.freebsd.org/changeset/base/353848 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/jme/if_jme.c Modified: head/sys/dev/jme/if_jme.c ============================================================================== --- head/sys/dev/jme/if_jme.c Mon Oct 21 18:11:38 2019 (r353847) +++ head/sys/dev/jme/if_jme.c Mon Oct 21 18:11:43 2019 (r353848) @@ -3236,12 +3236,26 @@ jme_set_vlan(struct jme_softc *sc) CSR_WRITE_4(sc, JME_RXMAC, reg); } +static u_int +jme_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *mchash = arg; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + + /* Just want the 6 least significant bits. */ + crc &= 0x3f; + + /* Set the corresponding bit in the hash table. */ + mchash[crc >> 5] |= 1 << (crc & 0x1f); + + return (1); +} + static void jme_set_filter(struct jme_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc; uint32_t mchash[2]; uint32_t rxcfg; @@ -3276,21 +3290,7 @@ jme_set_filter(struct jme_softc *sc) */ rxcfg |= RXMAC_MULTICAST; bzero(mchash, sizeof(mchash)); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->jme_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - - /* Just want the 6 least significant bits. */ - crc &= 0x3f; - - /* Set the corresponding bit in the hash table. */ - mchash[crc >> 5] |= 1 << (crc & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, jme_hash_maddr, &mchash); CSR_WRITE_4(sc, JME_MAR0, mchash[0]); CSR_WRITE_4(sc, JME_MAR1, mchash[1]); From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A43DE15E1C7; Mon, 21 Oct 2019 18:11:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8P3C6lz4dY0; Mon, 21 Oct 2019 18:11:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 404B527BEA; Mon, 21 Oct 2019 18:11:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBnJ4070756; Mon, 21 Oct 2019 18:11:49 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBn28070755; Mon, 21 Oct 2019 18:11:49 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBn28070755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353849 - head/sys/dev/liquidio X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/liquidio X-SVN-Commit-Revision: 353849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:49 -0000 Author: glebius Date: Mon Oct 21 18:11:48 2019 New Revision: 353849 URL: https://svnweb.freebsd.org/changeset/base/353849 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/liquidio/lio_ioctl.c Modified: head/sys/dev/liquidio/lio_ioctl.c ============================================================================== --- head/sys/dev/liquidio/lio_ioctl.c Mon Oct 21 18:11:43 2019 (r353848) +++ head/sys/dev/liquidio/lio_ioctl.c Mon Oct 21 18:11:48 2019 (r353849) @@ -491,6 +491,22 @@ lio_get_new_flags(struct ifnet *ifp) return (f); } +static u_int +lio_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint64_t *mc = arg; + + if (cnt == LIO_MAX_MULTICAST_ADDR) + return (0); + + mc += cnt; + *mc = 0; + memcpy(((uint8_t *)mc) + 2, LLADDR(sdl), ETHER_ADDR_LEN); + /* no need to swap bytes */ + + return (1); +} + /* @param ifp network device */ static int lio_set_mcast_list(struct ifnet *ifp) @@ -498,9 +514,7 @@ lio_set_mcast_list(struct ifnet *ifp) struct lio *lio = if_getsoftc(ifp); struct octeon_device *oct = lio->oct_dev; struct lio_ctrl_pkt nctrl; - struct ifmultiaddr *ifma; - uint64_t *mc; - int mc_count = 0; + int mc_count; int ret; bzero(&nctrl, sizeof(struct lio_ctrl_pkt)); @@ -514,26 +528,7 @@ lio_set_mcast_list(struct ifnet *ifp) nctrl.cb_fn = lio_ctrl_cmd_completion; /* copy all the addresses into the udd */ - mc = &nctrl.udd[0]; - - /* to protect access to if_multiaddrs */ - if_maddr_rlock(ifp); - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - *mc = 0; - memcpy(((uint8_t *)mc) + 2, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - ETHER_ADDR_LEN); - /* no need to swap bytes */ - - mc_count++; - if (++mc > &nctrl.udd[LIO_MAX_MULTICAST_ADDR]) - break; - } - - if_maddr_runlock(ifp); + mc_count = if_foreach_llmaddr(ifp, lio_copy_maddr, &nctrl.udd[0]); /* * Apparently, any activity in this call from the kernel has to From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC64A15E1F6; Mon, 21 Oct 2019 18:11:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8W0szFz4dfs; Mon, 21 Oct 2019 18:11:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C375427CD0; Mon, 21 Oct 2019 18:11:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBssV072315; Mon, 21 Oct 2019 18:11:54 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBscd072314; Mon, 21 Oct 2019 18:11:54 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBscd072314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353850 - head/sys/dev/malo X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/malo X-SVN-Commit-Revision: 353850 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:55 -0000 Author: glebius Date: Mon Oct 21 18:11:54 2019 New Revision: 353850 URL: https://svnweb.freebsd.org/changeset/base/353850 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/malo/if_malo.c Modified: head/sys/dev/malo/if_malo.c ============================================================================== --- head/sys/dev/malo/if_malo.c Mon Oct 21 18:11:48 2019 (r353849) +++ head/sys/dev/malo/if_malo.c Mon Oct 21 18:11:54 2019 (r353850) @@ -1510,49 +1510,46 @@ malo_init(void *arg) ieee80211_start_all(ic); /* start all vap's */ } +struct malo_copy_maddr_ctx { + uint8_t macs[IEEE80211_ADDR_LEN * MALO_HAL_MCAST_MAX]; + int nmc; +}; + +static u_int +malo_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int nmc) +{ + struct malo_copy_maddr_ctx *ctx = arg; + + if (ctx->nmc == MALO_HAL_MCAST_MAX) + return (0); + + IEEE80211_ADDR_COPY(ctx->macs + (ctx->nmc * IEEE80211_ADDR_LEN), + LLADDR(sdl)); + ctx->nmc++; + + return (1); +} + /* * Set the multicast filter contents into the hardware. */ static void malo_setmcastfilter(struct malo_softc *sc) { + struct malo_copy_maddr_ctx ctx; struct ieee80211com *ic = &sc->malo_ic; struct ieee80211vap *vap; - uint8_t macs[IEEE80211_ADDR_LEN * MALO_HAL_MCAST_MAX]; - uint8_t *mp; - int nmc; - mp = macs; - nmc = 0; if (ic->ic_opmode == IEEE80211_M_MONITOR || ic->ic_allmulti > 0 || ic->ic_promisc > 0) goto all; - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - struct ifnet *ifp; - struct ifmultiaddr *ifma; + ctx.nmc = 0; + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + if_foreach_llmaddr(vap->iv_ifp, malo_copy_maddr, &ctx); - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (nmc == MALO_HAL_MCAST_MAX) { - ifp->if_flags |= IFF_ALLMULTI; - if_maddr_runlock(ifp); - goto all; - } - IEEE80211_ADDR_COPY(mp, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - - mp += IEEE80211_ADDR_LEN, nmc++; - } - if_maddr_runlock(ifp); - } - - malo_hal_setmcast(sc->malo_mh, nmc, macs); + malo_hal_setmcast(sc->malo_mh, ctx.nmc, ctx.macs); all: /* From owner-svn-src-head@freebsd.org Mon Oct 21 18:11:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EDF1415E228; Mon, 21 Oct 2019 18:11:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8Z5MFqz4dn0; Mon, 21 Oct 2019 18:11:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F6F427CF7; Mon, 21 Oct 2019 18:11:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBw2i072365; Mon, 21 Oct 2019 18:11:58 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBw87072364; Mon, 21 Oct 2019 18:11:58 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBw87072364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353851 - head/sys/dev/my X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/my X-SVN-Commit-Revision: 353851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:59 -0000 Author: glebius Date: Mon Oct 21 18:11:58 2019 New Revision: 353851 URL: https://svnweb.freebsd.org/changeset/base/353851 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/my/if_my.c Modified: head/sys/dev/my/if_my.c ============================================================================== --- head/sys/dev/my/if_my.c Mon Oct 21 18:11:54 2019 (r353850) +++ head/sys/dev/my/if_my.c Mon Oct 21 18:11:58 2019 (r353851) @@ -304,7 +304,20 @@ my_phy_writereg(struct my_softc * sc, int reg, int dat return; } +static u_int +my_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h; + h = ~ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} /* * Program the 64-bit multicast hash filter. */ @@ -312,11 +325,8 @@ static void my_setmulti(struct my_softc * sc) { struct ifnet *ifp; - int h = 0; u_int32_t hashes[2] = {0, 0}; - struct ifmultiaddr *ifma; u_int32_t rxfilt; - int mcnt = 0; MY_LOCK_ASSERT(sc); @@ -337,28 +347,13 @@ my_setmulti(struct my_softc * sc) CSR_WRITE_4(sc, MY_MAR1, 0); /* now program new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ~ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - mcnt++; - } - if_maddr_runlock(ifp); - - if (mcnt) + if (if_foreach_llmaddr(ifp, my_hash_maddr, hashes) > 0) rxfilt |= MY_AM; else rxfilt &= ~MY_AM; CSR_WRITE_4(sc, MY_MAR0, hashes[0]); CSR_WRITE_4(sc, MY_MAR1, hashes[1]); CSR_WRITE_4(sc, MY_TCRRCR, rxfilt); - return; } /* From owner-svn-src-head@freebsd.org Mon Oct 21 18:12:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 025C215E256; Mon, 21 Oct 2019 18:12:05 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8h4FHFz4dvK; Mon, 21 Oct 2019 18:12:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DDFE27D03; Mon, 21 Oct 2019 18:12:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIC37o072419; Mon, 21 Oct 2019 18:12:03 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIC3XM072418; Mon, 21 Oct 2019 18:12:03 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LIC3XM072418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353852 - head/sys/dev/oce X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/oce X-SVN-Commit-Revision: 353852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:05 -0000 Author: glebius Date: Mon Oct 21 18:12:02 2019 New Revision: 353852 URL: https://svnweb.freebsd.org/changeset/base/353852 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/oce/oce_hw.c Modified: head/sys/dev/oce/oce_hw.c ============================================================================== --- head/sys/dev/oce/oce_hw.c Mon Oct 21 18:11:58 2019 (r353851) +++ head/sys/dev/oce/oce_hw.c Mon Oct 21 18:12:02 2019 (r353852) @@ -544,7 +544,21 @@ oce_hw_intr_disable(POCE_SOFTC sc) } +static u_int +oce_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct mbx_set_common_iface_multicast *req = arg; + if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE) + return (0); + + bcopy(LLADDR(sdl), &req->params.req.mac[req->params.req.num_mac++], + ETH_ADDR_LEN); + + return (1); +} + + /** * @brief Function for hardware update multicast filter * @param sc software handle to the device @@ -553,7 +567,6 @@ int oce_hw_update_multicast(POCE_SOFTC sc) { struct ifnet *ifp = sc->ifp; - struct ifmultiaddr *ifma; struct mbx_set_common_iface_multicast *req = NULL; OCE_DMA_MEM dma; int rc = 0; @@ -566,29 +579,15 @@ oce_hw_update_multicast(POCE_SOFTC sc) req = OCE_DMAPTR(&dma, struct mbx_set_common_iface_multicast); bzero(req, sizeof(struct mbx_set_common_iface_multicast)); -#if __FreeBSD_version > 800000 - if_maddr_rlock(ifp); -#endif - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE) { - /*More multicast addresses than our hardware table - So Enable multicast promiscus in our hardware to - accept all multicat packets - */ - req->params.req.promiscuous = 1; - break; - } - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - &req->params.req.mac[req->params.req.num_mac], - ETH_ADDR_LEN); - req->params.req.num_mac = req->params.req.num_mac + 1; + if_foreach_llmaddr(ifp, oce_copy_maddr, req); + if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE) { + /*More multicast addresses than our hardware table + So Enable multicast promiscus in our hardware to + accept all multicat packets + */ + req->params.req.promiscuous = 1; } -#if __FreeBSD_version > 800000 - if_maddr_runlock(ifp); -#endif + req->params.req.if_id = sc->if_id; rc = oce_update_multicast(sc, &dma); oce_dma_free(sc, &dma); From owner-svn-src-head@freebsd.org Mon Oct 21 18:12:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4EDB715E27E; Mon, 21 Oct 2019 18:12:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8m6VYpz4f2c; Mon, 21 Oct 2019 18:12:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D28827D09; Mon, 21 Oct 2019 18:12:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIC7Iu072466; Mon, 21 Oct 2019 18:12:07 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIC7gl072465; Mon, 21 Oct 2019 18:12:07 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LIC7gl072465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353853 - head/sys/dev/otus X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/otus X-SVN-Commit-Revision: 353853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:09 -0000 Author: glebius Date: Mon Oct 21 18:12:07 2019 New Revision: 353853 URL: https://svnweb.freebsd.org/changeset/base/353853 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/otus/if_otus.c Modified: head/sys/dev/otus/if_otus.c ============================================================================== --- head/sys/dev/otus/if_otus.c Mon Oct 21 18:12:02 2019 (r353852) +++ head/sys/dev/otus/if_otus.c Mon Oct 21 18:12:07 2019 (r353853) @@ -2308,63 +2308,63 @@ otus_tx(struct otus_softc *sc, struct ieee80211_node * return 0; } +static u_int +otus_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t val, *hashes = arg; + + val = le32dec(LLADDR(sdl) + 4); + /* Get address byte 5 */ + val = val & 0x0000ff00; + val = val >> 8; + + /* As per below, shift it >> 2 to get only 6 bits */ + val = val >> 2; + if (val < 32) + hashes[0] |= 1 << val; + else + hashes[1] |= 1 << (val - 32); + + return (1); +} + + int otus_set_multi(struct otus_softc *sc) { - uint32_t lo, hi; struct ieee80211com *ic = &sc->sc_ic; + uint32_t hashes[2]; int r; if (ic->ic_allmulti > 0 || ic->ic_promisc > 0 || ic->ic_opmode == IEEE80211_M_MONITOR) { - lo = 0xffffffff; - hi = 0xffffffff; + hashes[0] = 0xffffffff; + hashes[1] = 0xffffffff; } else { struct ieee80211vap *vap; - struct ifnet *ifp; - struct ifmultiaddr *ifma; - lo = hi = 0; - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - caddr_t dl; - uint32_t val; - - dl = LLADDR((struct sockaddr_dl *) ifma->ifma_addr); - val = le32dec(dl + 4); - /* Get address byte 5 */ - val = val & 0x0000ff00; - val = val >> 8; - - /* As per below, shift it >> 2 to get only 6 bits */ - val = val >> 2; - if (val < 32) - lo |= 1 << val; - else - hi |= 1 << (val - 32); - } - if_maddr_runlock(ifp); - } + hashes[0] = hashes[1] = 0; + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + if_foreach_llmaddr(vap->iv_ifp, otus_hash_maddr, + hashes); } #if 0 /* XXX openbsd code */ while (enm != NULL) { bit = enm->enm_addrlo[5] >> 2; if (bit < 32) - lo |= 1 << bit; + hashes[0] |= 1 << bit; else - hi |= 1 << (bit - 32); + hashes[1] |= 1 << (bit - 32); ETHER_NEXT_MULTI(step, enm); } #endif - hi |= 1U << 31; /* Make sure the broadcast bit is set. */ + hashes[1] |= 1U << 31; /* Make sure the broadcast bit is set. */ OTUS_LOCK(sc); - otus_write(sc, AR_MAC_REG_GROUP_HASH_TBL_L, lo); - otus_write(sc, AR_MAC_REG_GROUP_HASH_TBL_H, hi); + otus_write(sc, AR_MAC_REG_GROUP_HASH_TBL_L, hashes[0]); + otus_write(sc, AR_MAC_REG_GROUP_HASH_TBL_H, hashes[1]); r = otus_write_barrier(sc); /* XXX operating mode? filter? */ OTUS_UNLOCK(sc); From owner-svn-src-head@freebsd.org Mon Oct 21 18:12:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 472D315E2A4; Mon, 21 Oct 2019 18:12:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8r5YFpz4f6b; Mon, 21 Oct 2019 18:12:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F56B27D10; Mon, 21 Oct 2019 18:12:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICCRT072516; Mon, 21 Oct 2019 18:12:12 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICC5d072515; Mon, 21 Oct 2019 18:12:12 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICC5d072515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353854 - head/sys/dev/qlnx/qlnxe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/qlnx/qlnxe X-SVN-Commit-Revision: 353854 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:13 -0000 Author: glebius Date: Mon Oct 21 18:12:12 2019 New Revision: 353854 URL: https://svnweb.freebsd.org/changeset/base/353854 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_os.c Mon Oct 21 18:12:07 2019 (r353853) +++ head/sys/dev/qlnx/qlnxe/qlnx_os.c Mon Oct 21 18:12:12 2019 (r353854) @@ -2644,42 +2644,36 @@ qlnx_hw_set_multi(qlnx_host_t *ha, uint8_t *mta, uint3 } -#define QLNX_MCAST_ADDRS_SIZE (QLNX_MAX_NUM_MULTICAST_ADDRS * ETHER_HDR_LEN) -static int -qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi) +static u_int +qlnx_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt) { - uint8_t mta[QLNX_MCAST_ADDRS_SIZE]; - struct ifmultiaddr *ifma; - int mcnt = 0; - struct ifnet *ifp = ha->ifp; - int ret = 0; + uint8_t *mta = arg; - if (qlnx_vf_device(ha) == 0) + if (mcnt == QLNX_MAX_NUM_MULTICAST_ADDRS) return (0); - if_maddr_rlock(ifp); + bcopy(LLADDR(sdl), &mta[mcnt * ETHER_HDR_LEN], ETHER_HDR_LEN); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + return (1); +} - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; +static int +qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi) +{ + uint8_t mta[QLNX_MAX_NUM_MULTICAST_ADDRS * ETHER_HDR_LEN]; + struct ifnet *ifp = ha->ifp; + u_int mcnt; - if (mcnt == QLNX_MAX_NUM_MULTICAST_ADDRS) - break; + if (qlnx_vf_device(ha) == 0) + return (0); - bcopy(LLADDR((struct sockaddr_dl *) ifma->ifma_addr), - &mta[mcnt * ETHER_HDR_LEN], ETHER_HDR_LEN); + mcnt = if_foreach_llmaddr(ifp, qlnx_copy_maddr, mta); - mcnt++; - } - - if_maddr_runlock(ifp); - QLNX_LOCK(ha); qlnx_hw_set_multi(ha, mta, mcnt, add_multi); QLNX_UNLOCK(ha); - return (ret); + return (0); } static int From owner-svn-src-head@freebsd.org Mon Oct 21 18:12:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BEBC15E2CD; Mon, 21 Oct 2019 18:12:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8y1brxz4fGW; Mon, 21 Oct 2019 18:12:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB89A27D1A; Mon, 21 Oct 2019 18:12:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICHlR072567; Mon, 21 Oct 2019 18:12:17 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICHXk072566; Mon, 21 Oct 2019 18:12:17 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICHXk072566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353855 - head/sys/dev/qlxgb X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/qlxgb X-SVN-Commit-Revision: 353855 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:18 -0000 Author: glebius Date: Mon Oct 21 18:12:17 2019 New Revision: 353855 URL: https://svnweb.freebsd.org/changeset/base/353855 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/qlxgb/qla_os.c Modified: head/sys/dev/qlxgb/qla_os.c ============================================================================== --- head/sys/dev/qlxgb/qla_os.c Mon Oct 21 18:12:12 2019 (r353854) +++ head/sys/dev/qlxgb/qla_os.c Mon Oct 21 18:12:17 2019 (r353855) @@ -763,32 +763,26 @@ qla_init(void *arg) QL_DPRINT2((ha->pci_dev, "%s: exit\n", __func__)); } +static u_int +qla_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt) +{ + uint8_t *mta = arg; + + if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS) + return (0); + bcopy(LLADDR(sdl), &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN); + + return (1); +} + static void qla_set_multi(qla_host_t *ha, uint32_t add_multi) { uint8_t mta[Q8_MAX_NUM_MULTICAST_ADDRS * Q8_MAC_ADDR_LEN]; - struct ifmultiaddr *ifma; - int mcnt = 0; struct ifnet *ifp = ha->ifp; + int mcnt; - if_maddr_rlock(ifp); - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS) - break; - - bcopy(LLADDR((struct sockaddr_dl *) ifma->ifma_addr), - &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN); - - mcnt++; - } - - if_maddr_runlock(ifp); - + mcnt = if_foreach_llmaddr(ifp, qla_copy_maddr, mta); qla_hw_set_multi(ha, mta, mcnt, add_multi); return; From owner-svn-src-head@freebsd.org Mon Oct 21 18:12:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 484EA15E302; Mon, 21 Oct 2019 18:12:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl920lntz4fPH; Mon, 21 Oct 2019 18:12:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA76F27D25; Mon, 21 Oct 2019 18:12:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICLJn072617; Mon, 21 Oct 2019 18:12:21 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICLE9072616; Mon, 21 Oct 2019 18:12:21 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICLE9072616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353856 - head/sys/dev/qlxgbe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/qlxgbe X-SVN-Commit-Revision: 353856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:22 -0000 Author: glebius Date: Mon Oct 21 18:12:21 2019 New Revision: 353856 URL: https://svnweb.freebsd.org/changeset/base/353856 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/qlxgbe/ql_os.c Modified: head/sys/dev/qlxgbe/ql_os.c ============================================================================== --- head/sys/dev/qlxgbe/ql_os.c Mon Oct 21 18:12:17 2019 (r353855) +++ head/sys/dev/qlxgbe/ql_os.c Mon Oct 21 18:12:21 2019 (r353856) @@ -977,32 +977,28 @@ qla_init(void *arg) QL_DPRINT2(ha, (ha->pci_dev, "%s: exit\n", __func__)); } +static u_int +qla_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt) +{ + uint8_t *mta = arg; + + if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS) + return (0); + + bcopy(LLADDR(sdl), &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN); + + return (1); +} + static int qla_set_multi(qla_host_t *ha, uint32_t add_multi) { uint8_t mta[Q8_MAX_NUM_MULTICAST_ADDRS * Q8_MAC_ADDR_LEN]; - struct ifmultiaddr *ifma; int mcnt = 0; struct ifnet *ifp = ha->ifp; int ret = 0; - if_maddr_rlock(ifp); - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS) - break; - - bcopy(LLADDR((struct sockaddr_dl *) ifma->ifma_addr), - &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN); - - mcnt++; - } - - if_maddr_runlock(ifp); + mcnt = if_foreach_llmaddr(ifp, qla_copy_maddr, mta); if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, QLA_LOCK_NO_SLEEP) != 0) From owner-svn-src-head@freebsd.org Mon Oct 21 18:12:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D25215E336; Mon, 21 Oct 2019 18:12:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl9731m6z4fWM; Mon, 21 Oct 2019 18:12:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46B7827D30; Mon, 21 Oct 2019 18:12:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICR98072667; Mon, 21 Oct 2019 18:12:27 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICRg7072666; Mon, 21 Oct 2019 18:12:27 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICRg7072666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353857 - head/sys/dev/qlxge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/qlxge X-SVN-Commit-Revision: 353857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:27 -0000 Author: glebius Date: Mon Oct 21 18:12:26 2019 New Revision: 353857 URL: https://svnweb.freebsd.org/changeset/base/353857 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/qlxge/qls_os.c Modified: head/sys/dev/qlxge/qls_os.c ============================================================================== --- head/sys/dev/qlxge/qls_os.c Mon Oct 21 18:12:21 2019 (r353856) +++ head/sys/dev/qlxge/qls_os.c Mon Oct 21 18:12:26 2019 (r353857) @@ -835,31 +835,27 @@ qls_init(void *arg) QL_DPRINT2((ha->pci_dev, "%s: exit\n", __func__)); } +static u_int +qls_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt) +{ + uint8_t *mta = arg; + + if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS) + return (0); + + bcopy(LLADDR(sdl), &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN); + + return (1); +} + static void qls_set_multi(qla_host_t *ha, uint32_t add_multi) { uint8_t mta[Q8_MAX_NUM_MULTICAST_ADDRS * Q8_MAC_ADDR_LEN]; - struct ifmultiaddr *ifma; - int mcnt = 0; struct ifnet *ifp = ha->ifp; + int mcnt; - if_maddr_rlock(ifp); - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS) - break; - - bcopy(LLADDR((struct sockaddr_dl *) ifma->ifma_addr), - &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN); - - mcnt++; - } - - if_maddr_runlock(ifp); + mcnt = if_foreach_llmaddr(ifp, qls_copy_maddr, mta); if (QLA_LOCK(ha, __func__, 1) == 0) { qls_hw_set_multi(ha, mta, mcnt, add_multi); From owner-svn-src-head@freebsd.org Mon Oct 21 18:12:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D57515E361; Mon, 21 Oct 2019 18:12:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl9D2bqVz4fdW; Mon, 21 Oct 2019 18:12:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C0DF27D36; Mon, 21 Oct 2019 18:12:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICWR8072715; Mon, 21 Oct 2019 18:12:32 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICWSG072714; Mon, 21 Oct 2019 18:12:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICWSG072714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353858 - head/sys/dev/rtwn X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/rtwn X-SVN-Commit-Revision: 353858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:32 -0000 Author: glebius Date: Mon Oct 21 18:12:31 2019 New Revision: 353858 URL: https://svnweb.freebsd.org/changeset/base/353858 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/rtwn/if_rtwn_rx.c Modified: head/sys/dev/rtwn/if_rtwn_rx.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn_rx.c Mon Oct 21 18:12:26 2019 (r353857) +++ head/sys/dev/rtwn/if_rtwn_rx.c Mon Oct 21 18:12:31 2019 (r353858) @@ -366,6 +366,18 @@ rtwn_get_multi_pos(const uint8_t maddr[]) return (pos); } +static u_int +rtwm_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *mfilt = arg; + uint8_t pos; + + pos = rtwn_get_multi_pos(LLADDR(sdl)); + mfilt[pos / 32] |= (1 << (pos % 32)); + + return (1); +} + void rtwn_set_multi(struct rtwn_softc *sc) { @@ -377,28 +389,13 @@ rtwn_set_multi(struct rtwn_softc *sc) /* general structure was copied from ath(4). */ if (ic->ic_allmulti == 0) { struct ieee80211vap *vap; - struct ifnet *ifp; - struct ifmultiaddr *ifma; /* * Merge multicast addresses to form the hardware filter. */ mfilt[0] = mfilt[1] = 0; - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - caddr_t dl; - uint8_t pos; - - dl = LLADDR((struct sockaddr_dl *) - ifma->ifma_addr); - pos = rtwn_get_multi_pos(dl); - - mfilt[pos / 32] |= (1 << (pos % 32)); - } - if_maddr_runlock(ifp); - } + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + if_foreach_llmaddr(vap->iv_ifp, rtwm_hash_maddr, mfilt); } else mfilt[0] = mfilt[1] = ~0; From owner-svn-src-head@freebsd.org Mon Oct 21 18:12:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4377915E38A; Mon, 21 Oct 2019 18:12:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl9J6CFzz4fm6; Mon, 21 Oct 2019 18:12:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2E0227D37; Mon, 21 Oct 2019 18:12:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICakZ072766; Mon, 21 Oct 2019 18:12:36 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICaS8072765; Mon, 21 Oct 2019 18:12:36 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICaS8072765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353859 - head/sys/dev/tsec X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/tsec X-SVN-Commit-Revision: 353859 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:37 -0000 Author: glebius Date: Mon Oct 21 18:12:36 2019 New Revision: 353859 URL: https://svnweb.freebsd.org/changeset/base/353859 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/tsec/if_tsec.c Modified: head/sys/dev/tsec/if_tsec.c ============================================================================== --- head/sys/dev/tsec/if_tsec.c Mon Oct 21 18:12:31 2019 (r353858) +++ head/sys/dev/tsec/if_tsec.c Mon Oct 21 18:12:36 2019 (r353859) @@ -1886,13 +1886,22 @@ tsec_offload_process_frame(struct tsec_softc *sc, stru m_adj(m, sizeof(struct tsec_rx_fcb)); } +static u_int +tsec_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t h, *hashtable = arg; + + h = (ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 24) & 0xFF; + hashtable[(h >> 5)] |= 1 << (0x1F - (h & 0x1F)); + + return (1); +} + static void tsec_setup_multicast(struct tsec_softc *sc) { uint32_t hashtable[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; struct ifnet *ifp = sc->tsec_ifp; - struct ifmultiaddr *ifma; - uint32_t h; int i; TSEC_GLOBAL_LOCK_ASSERT(sc); @@ -1904,18 +1913,7 @@ tsec_setup_multicast(struct tsec_softc *sc) return; } - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - h = (ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 24) & 0xFF; - - hashtable[(h >> 5)] |= 1 << (0x1F - (h & 0x1F)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, tsec_hash_maddr, &hashtable); for (i = 0; i < 8; i++) TSEC_WRITE(sc, TSEC_REG_GADDR(i), hashtable[i]); From owner-svn-src-head@freebsd.org Mon Oct 21 18:12:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A8EA15E3DB; Mon, 21 Oct 2019 18:12:42 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl9Q1nxJz4ft0; Mon, 21 Oct 2019 18:12:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDB4C27D38; Mon, 21 Oct 2019 18:12:40 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICe9k072818; Mon, 21 Oct 2019 18:12:40 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICerP072817; Mon, 21 Oct 2019 18:12:40 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICerP072817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353860 - head/sys/dev/wi X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/wi X-SVN-Commit-Revision: 353860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:42 -0000 Author: glebius Date: Mon Oct 21 18:12:40 2019 New Revision: 353860 URL: https://svnweb.freebsd.org/changeset/base/353860 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/wi/if_wi.c Modified: head/sys/dev/wi/if_wi.c ============================================================================== --- head/sys/dev/wi/if_wi.c Mon Oct 21 18:12:36 2019 (r353859) +++ head/sys/dev/wi/if_wi.c Mon Oct 21 18:12:40 2019 (r353860) @@ -1506,41 +1506,45 @@ finish: CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_INFO); } +struct wi_mcast_ctx { + struct wi_mcast mlist; + int mcnt; +}; + +static u_int +wi_copy_mcast(void *arg, struct sockaddr_dl *sdl, u_int count) +{ + struct wi_mcast_ctx *ctx = arg; + + if (ctx->mcnt >= 16) + return (0); + IEEE80211_ADDR_COPY(&ctx->mlist.wi_mcast[ctx->mcnt++], LLADDR(sdl)); + + return (1); +} + static int wi_write_multi(struct wi_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap; - struct wi_mcast mlist; - int n; + struct wi_mcast_ctx ctx; if (ic->ic_allmulti > 0 || ic->ic_promisc > 0) { allmulti: - memset(&mlist, 0, sizeof(mlist)); - return wi_write_rid(sc, WI_RID_MCAST_LIST, &mlist, - sizeof(mlist)); + memset(&ctx.mlist, 0, sizeof(ctx.mlist)); + return wi_write_rid(sc, WI_RID_MCAST_LIST, &ctx.mlist, + sizeof(ctx.mlist)); } - n = 0; + ctx.mcnt = 0; TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - struct ifnet *ifp; - struct ifmultiaddr *ifma; - - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - if (n >= 16) - goto allmulti; - IEEE80211_ADDR_COPY(&mlist.wi_mcast[n], - (LLADDR((struct sockaddr_dl *)ifma->ifma_addr))); - n++; - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(vap->iv_ifp, wi_copy_mcast, &ctx); + if (ctx.mcnt >= 16) + goto allmulti; } - return wi_write_rid(sc, WI_RID_MCAST_LIST, &mlist, - IEEE80211_ADDR_LEN * n); + return wi_write_rid(sc, WI_RID_MCAST_LIST, &ctx.mlist, + IEEE80211_ADDR_LEN * ctx.mcnt); } static void From owner-svn-src-head@freebsd.org Mon Oct 21 18:12:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0C9215E437; Mon, 21 Oct 2019 18:12:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl9l5Mrbz4g8r; Mon, 21 Oct 2019 18:12:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0033627D39; Mon, 21 Oct 2019 18:12:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICwpT072877; Mon, 21 Oct 2019 18:12:58 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICw1T072876; Mon, 21 Oct 2019 18:12:58 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICw1T072876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353861 - head/sys/dev/xilinx X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/xilinx X-SVN-Commit-Revision: 353861 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:00 -0000 Author: glebius Date: Mon Oct 21 18:12:58 2019 New Revision: 353861 URL: https://svnweb.freebsd.org/changeset/base/353861 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/xilinx/if_xae.c Modified: head/sys/dev/xilinx/if_xae.c ============================================================================== --- head/sys/dev/xilinx/if_xae.c Mon Oct 21 18:12:40 2019 (r353860) +++ head/sys/dev/xilinx/if_xae.c Mon Oct 21 18:12:58 2019 (r353861) @@ -514,14 +514,40 @@ xae_media_change(struct ifnet * ifp) return (error); } +static u_int +xae_write_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct xae_softc *sc = arg; + uint32_t reg; + uint8_t *ma; + + if (cnt >= XAE_MULTICAST_TABLE_SIZE) + return (1); + + ma = LLADDR(sdl); + + reg = READ4(sc, XAE_FFC) & 0xffffff00; + reg |= cnt; + WRITE4(sc, XAE_FFC, reg); + + reg = (ma[0]); + reg |= (ma[1] << 8); + reg |= (ma[2] << 16); + reg |= (ma[3] << 24); + WRITE4(sc, XAE_FFV(0), reg); + + reg = ma[4]; + reg |= ma[5] << 8; + WRITE4(sc, XAE_FFV(1), reg); + + return (1); +} + static void xae_setup_rxfilter(struct xae_softc *sc) { - struct ifmultiaddr *ifma; struct ifnet *ifp; uint32_t reg; - uint8_t *ma; - int i; XAE_ASSERT_LOCKED(sc); @@ -539,33 +565,7 @@ xae_setup_rxfilter(struct xae_softc *sc) reg &= ~FFC_PM; WRITE4(sc, XAE_FFC, reg); - if_maddr_rlock(ifp); - - i = 0; - CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (i >= XAE_MULTICAST_TABLE_SIZE) - break; - - ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - - reg = READ4(sc, XAE_FFC) & 0xffffff00; - reg |= i++; - WRITE4(sc, XAE_FFC, reg); - - reg = (ma[0]); - reg |= (ma[1] << 8); - reg |= (ma[2] << 16); - reg |= (ma[3] << 24); - WRITE4(sc, XAE_FFV(0), reg); - - reg = ma[4]; - reg |= ma[5] << 8; - WRITE4(sc, XAE_FFV(1), reg); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, xae_write_maddr, sc); } /* From owner-svn-src-head@freebsd.org Mon Oct 21 18:13:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CF5E15E476; Mon, 21 Oct 2019 18:13:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlB26JK8z4gHB; Mon, 21 Oct 2019 18:13:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A31A627D3A; Mon, 21 Oct 2019 18:13:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDEdm072937; Mon, 21 Oct 2019 18:13:14 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDE0P072936; Mon, 21 Oct 2019 18:13:14 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDE0P072936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353862 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 353862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:15 -0000 Author: glebius Date: Mon Oct 21 18:13:14 2019 New Revision: 353862 URL: https://svnweb.freebsd.org/changeset/base/353862 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/arm/allwinner/if_awg.c Modified: head/sys/arm/allwinner/if_awg.c ============================================================================== --- head/sys/arm/allwinner/if_awg.c Mon Oct 21 18:12:58 2019 (r353861) +++ head/sys/arm/allwinner/if_awg.c Mon Oct 21 18:13:14 2019 (r353862) @@ -675,12 +675,25 @@ bitrev32(uint32_t x) return (x >> 16) | (x << 16); } +static u_int +awg_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, hashreg, hashbit, *hash = arg; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN) & 0x7f; + crc = bitrev32(~crc) >> 26; + hashreg = (crc >> 5); + hashbit = (crc & 0x1f); + hash[hashreg] |= (1 << hashbit); + + return (1); +} + static void awg_setup_rxfilter(struct awg_softc *sc) { - uint32_t val, crc, hashreg, hashbit, hash[2], machi, maclo; - int mc_count, mcnt, i; - uint8_t *eaddr, *mta; + uint32_t val, hash[2], machi, maclo; + uint8_t *eaddr; if_t ifp; AWG_ASSERT_LOCKED(sc); @@ -689,36 +702,13 @@ awg_setup_rxfilter(struct awg_softc *sc) val = 0; hash[0] = hash[1] = 0; - mc_count = if_multiaddr_count(ifp, -1); - if (if_getflags(ifp) & IFF_PROMISC) val |= DIS_ADDR_FILTER; else if (if_getflags(ifp) & IFF_ALLMULTI) { val |= RX_ALL_MULTICAST; hash[0] = hash[1] = ~0; - } else if (mc_count > 0) { + } else if (if_foreach_llmaddr(ifp, awg_hash_maddr, hash) > 0) val |= HASH_MULTICAST; - - mta = malloc(sizeof(unsigned char) * ETHER_ADDR_LEN * mc_count, - M_DEVBUF, M_NOWAIT); - if (mta == NULL) { - if_printf(ifp, - "failed to allocate temporary multicast list\n"); - return; - } - - if_multiaddr_array(ifp, mta, &mcnt, mc_count); - for (i = 0; i < mcnt; i++) { - crc = ether_crc32_le(mta + (i * ETHER_ADDR_LEN), - ETHER_ADDR_LEN) & 0x7f; - crc = bitrev32(~crc) >> 26; - hashreg = (crc >> 5); - hashbit = (crc & 0x1f); - hash[hashreg] |= (1 << hashbit); - } - - free(mta, M_DEVBUF); - } /* Write our unicast address */ eaddr = IF_LLADDR(ifp); From owner-svn-src-head@freebsd.org Mon Oct 21 18:13:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB35515E4A2; Mon, 21 Oct 2019 18:13:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlB84MgFz4gLL; Mon, 21 Oct 2019 18:13:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F44B27D3B; Mon, 21 Oct 2019 18:13:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDJtU072989; Mon, 21 Oct 2019 18:13:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDJ0F072988; Mon, 21 Oct 2019 18:13:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDJ0F072988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353863 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 353863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:21 -0000 Author: glebius Date: Mon Oct 21 18:13:19 2019 New Revision: 353863 URL: https://svnweb.freebsd.org/changeset/base/353863 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/arm/allwinner/if_emac.c Modified: head/sys/arm/allwinner/if_emac.c ============================================================================== --- head/sys/arm/allwinner/if_emac.c Mon Oct 21 18:13:14 2019 (r353862) +++ head/sys/arm/allwinner/if_emac.c Mon Oct 21 18:13:19 2019 (r353863) @@ -218,12 +218,22 @@ emac_get_hwaddr(struct emac_softc *sc, uint8_t *hwaddr printf("MAC address: %s\n", ether_sprintf(hwaddr)); } +static u_int +emac_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t h, *hashes = arg; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + hashes[h >> 5] |= 1 << (h & 0x1f); + + return (1); +} + static void emac_set_rx_mode(struct emac_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t h, hashes[2]; + uint32_t hashes[2]; uint32_t rcr = 0; EMAC_ASSERT_LOCKED(sc); @@ -241,17 +251,8 @@ emac_set_rx_mode(struct emac_softc *sc) if (ifp->if_flags & IFF_ALLMULTI) { hashes[0] = 0xffffffff; hashes[1] = 0xffffffff; - } else { - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->emac_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - hashes[h >> 5] |= 1 << (h & 0x1f); - } - if_maddr_runlock(ifp); - } + } else + if_foreach_llmaddr(ifp, emac_hash_maddr, hashes); rcr |= EMAC_RX_MCO; rcr |= EMAC_RX_MHF; EMAC_WRITE_REG(sc, EMAC_RX_HASH0, hashes[0]); From owner-svn-src-head@freebsd.org Mon Oct 21 18:13:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58D0A15E4D8; Mon, 21 Oct 2019 18:13:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlBF0JFwz3Bq5; Mon, 21 Oct 2019 18:13:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B746327D3C; Mon, 21 Oct 2019 18:13:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDOWK073039; Mon, 21 Oct 2019 18:13:24 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDO1c073038; Mon, 21 Oct 2019 18:13:24 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDO1c073038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353864 - head/sys/arm/ralink X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/arm/ralink X-SVN-Commit-Revision: 353864 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:25 -0000 Author: glebius Date: Mon Oct 21 18:13:24 2019 New Revision: 353864 URL: https://svnweb.freebsd.org/changeset/base/353864 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/arm/ralink/if_fv.c Modified: head/sys/arm/ralink/if_fv.c ============================================================================== --- head/sys/arm/ralink/if_fv.c Mon Oct 21 18:13:19 2019 (r353863) +++ head/sys/arm/ralink/if_fv.c Mon Oct 21 18:13:24 2019 (r353864) @@ -200,8 +200,25 @@ DRIVER_MODULE(fvmdio, simplebus, fvmdio_driver, fvmdio DRIVER_MODULE(mdio, fvmdio, mdio_driver, mdio_devclass, 0, 0); #endif -/* setup frame code refer dc code */ +static u_int +fv_set_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint16_t *sp = arg; + uint8_t *ma; + int i; + ma = LLADDR(sdl); + i = cnt * 6; + sp[i] = sp[i+1] = (ma[1] << 8 | ma[0]); + i += 2; + sp[i] = sp[i+1] = (ma[3] << 8 | ma[2]); + i += 2; + sp[i] = sp[i+1] = (ma[5] << 8 | ma[4]); + + return (1); +} + +/* setup frame code refer dc code */ static void fv_setfilt(struct fv_softc *sc) { @@ -209,9 +226,7 @@ fv_setfilt(struct fv_softc *sc) struct fv_desc *sframe; int i; struct ifnet *ifp; - struct ifmultiaddr *ifma; uint16_t *sp; - uint8_t *ma; ifp = sc->fv_ifp; @@ -225,20 +240,7 @@ fv_setfilt(struct fv_softc *sc) sframe->fv_addr = sc->fv_rdata.fv_sf_paddr; sframe->fv_devcs = ADCTL_Tx_SETUP | FV_DMASIZE(FV_SFRAME_LEN); - i = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - sp[i] = sp[i+1] = (ma[1] << 8 | ma[0]); - i += 2; - sp[i] = sp[i+1] = (ma[3] << 8 | ma[2]); - i += 2; - sp[i] = sp[i+1] = (ma[5] << 8 | ma[4]); - i += 2; - } - if_maddr_runlock(ifp); + i = if_foreach_llmaddr(ifp, fv_set_maddr, sp) * 6; bcopy(IF_LLADDR(sc->fv_ifp), eaddr, ETHER_ADDR_LEN); sp[90] = sp[91] = eaddr[0]; From owner-svn-src-head@freebsd.org Mon Oct 21 18:13:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D81B815E505; Mon, 21 Oct 2019 18:13:30 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlBL0z6sz3C1c; Mon, 21 Oct 2019 18:13:30 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2ABC327D3D; Mon, 21 Oct 2019 18:13:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDT6e073089; Mon, 21 Oct 2019 18:13:29 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDT74073088; Mon, 21 Oct 2019 18:13:29 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDT74073088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353865 - head/sys/arm/ti/cpsw X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/arm/ti/cpsw X-SVN-Commit-Revision: 353865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:30 -0000 Author: glebius Date: Mon Oct 21 18:13:28 2019 New Revision: 353865 URL: https://svnweb.freebsd.org/changeset/base/353865 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/arm/ti/cpsw/if_cpsw.c Modified: head/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- head/sys/arm/ti/cpsw/if_cpsw.c Mon Oct 21 18:13:24 2019 (r353864) +++ head/sys/arm/ti/cpsw/if_cpsw.c Mon Oct 21 18:13:28 2019 (r353865) @@ -2425,12 +2425,27 @@ cpsw_ale_dump_table(struct cpsw_softc *sc) { printf("\n"); } +static u_int +cpswp_set_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct cpswp_softc *sc = arg; + uint32_t portmask; + + if (sc->swsc->dualemac) + portmask = 1 << (sc->unit + 1) | 1 << 0; + else + portmask = 7; + + cpsw_ale_mc_entry_set(sc->swsc, portmask, sc->vlan, LLADDR(sdl)); + + return (1); +} + static int cpswp_ale_update_addresses(struct cpswp_softc *sc, int purge) { uint8_t *mac; uint32_t ale_entry[3], ale_type, portmask; - struct ifmultiaddr *ifma; if (sc->swsc->dualemac) { ale_type = ALE_TYPE_VLAN_ADDR << 28 | sc->vlan << 16; @@ -2445,7 +2460,6 @@ cpswp_ale_update_addresses(struct cpswp_softc *sc, int * For simplicity, keep this entry at table index 0 for port 1 and * at index 2 for port 2 in the ALE. */ - if_addr_rlock(sc->ifp); mac = LLADDR((struct sockaddr_dl *)sc->ifp->if_addr->ifa_addr); ale_entry[0] = mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5]; ale_entry[1] = ale_type | mac[0] << 8 | mac[1]; /* addr entry + mac */ @@ -2457,7 +2471,6 @@ cpswp_ale_update_addresses(struct cpswp_softc *sc, int mac[3] << 24 | mac[2] << 16 | mac[1] << 8 | mac[0]); cpsw_write_4(sc->swsc, CPSW_PORT_P_SA_LO(sc->unit + 1), mac[5] << 8 | mac[4]); - if_addr_runlock(sc->ifp); /* Keep the broadcast address at table entry 1 (or 3). */ ale_entry[0] = 0xffffffff; /* Lower 32 bits of MAC */ @@ -2472,14 +2485,7 @@ cpswp_ale_update_addresses(struct cpswp_softc *sc, int cpsw_ale_remove_all_mc_entries(sc->swsc); /* Set other multicast addrs desired. */ - if_maddr_rlock(sc->ifp); - CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - cpsw_ale_mc_entry_set(sc->swsc, portmask, sc->vlan, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - } - if_maddr_runlock(sc->ifp); + if_foreach_llmaddr(sc->ifp, cpswp_set_maddr, sc); return (0); } From owner-svn-src-head@freebsd.org Mon Oct 21 18:13:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E67315E533; Mon, 21 Oct 2019 18:13:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlBP6Vn5z3C5D; Mon, 21 Oct 2019 18:13:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B964B27D3E; Mon, 21 Oct 2019 18:13:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDXoh073137; Mon, 21 Oct 2019 18:13:33 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDXRk073136; Mon, 21 Oct 2019 18:13:33 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDXRk073136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353866 - head/sys/powerpc/ps3 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/powerpc/ps3 X-SVN-Commit-Revision: 353866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:34 -0000 Author: glebius Date: Mon Oct 21 18:13:33 2019 New Revision: 353866 URL: https://svnweb.freebsd.org/changeset/base/353866 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/powerpc/ps3/if_glc.c Modified: head/sys/powerpc/ps3/if_glc.c ============================================================================== --- head/sys/powerpc/ps3/if_glc.c Mon Oct 21 18:13:28 2019 (r353865) +++ head/sys/powerpc/ps3/if_glc.c Mon Oct 21 18:13:33 2019 (r353866) @@ -504,12 +504,31 @@ glc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (err); } +static u_int +glc_add_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct glc_softc *sc = arg; + uint64_t addr; + + /* + * Filter can only hold 32 addresses, so fall back to + * the IFF_ALLMULTI case if we have too many. +1 is for + * broadcast. + */ + if (cnt + 1 == 32) + return (0); + + addr = 0; + memcpy(&((uint8_t *)(&addr))[2], LLADDR(sdl), ETHER_ADDR_LEN); + lv1_net_add_multicast_address(sc->sc_bus, sc->sc_dev, addr, 0); + + return (1); +} + static void glc_set_multicast(struct glc_softc *sc) { struct ifnet *ifp = sc->sc_ifp; - struct ifmultiaddr *inm; - uint64_t addr; int naddrs; /* Clear multicast filter */ @@ -522,30 +541,10 @@ glc_set_multicast(struct glc_softc *sc) if ((ifp->if_flags & IFF_ALLMULTI) != 0) { lv1_net_add_multicast_address(sc->sc_bus, sc->sc_dev, 0, 1); } else { - if_maddr_rlock(ifp); - naddrs = 1; /* Include broadcast */ - CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { - if (inm->ifma_addr->sa_family != AF_LINK) - continue; - addr = 0; - memcpy(&((uint8_t *)(&addr))[2], - LLADDR((struct sockaddr_dl *)inm->ifma_addr), - ETHER_ADDR_LEN); - - lv1_net_add_multicast_address(sc->sc_bus, sc->sc_dev, - addr, 0); - - /* - * Filter can only hold 32 addresses, so fall back to - * the IFF_ALLMULTI case if we have too many. - */ - if (++naddrs >= 32) { - lv1_net_add_multicast_address(sc->sc_bus, - sc->sc_dev, 0, 1); - break; - } - } - if_maddr_runlock(ifp); + naddrs = if_foreach_llmaddr(ifp, glc_add_maddr, sc); + if (naddrs + 1 == 32) + lv1_net_add_multicast_address(sc->sc_bus, + sc->sc_dev, 0, 1); } } From owner-svn-src-head@freebsd.org Mon Oct 21 18:13:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 485E315E563; Mon, 21 Oct 2019 18:13:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlBT6sWyz3CBQ; Mon, 21 Oct 2019 18:13:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B386B27D3F; Mon, 21 Oct 2019 18:13:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDbEN073188; Mon, 21 Oct 2019 18:13:37 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDb4J073187; Mon, 21 Oct 2019 18:13:37 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDb4J073187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353867 - head/sys/powerpc/pseries X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/powerpc/pseries X-SVN-Commit-Revision: 353867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:38 -0000 Author: glebius Date: Mon Oct 21 18:13:37 2019 New Revision: 353867 URL: https://svnweb.freebsd.org/changeset/base/353867 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/powerpc/pseries/phyp_llan.c Modified: head/sys/powerpc/pseries/phyp_llan.c ============================================================================== --- head/sys/powerpc/pseries/phyp_llan.c Mon Oct 21 18:13:33 2019 (r353866) +++ head/sys/powerpc/pseries/phyp_llan.c Mon Oct 21 18:13:37 2019 (r353867) @@ -508,28 +508,28 @@ llan_start(struct ifnet *ifp) mtx_unlock(&sc->io_lock); } +static u_int +llan_set_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct llan_softc *sc = arg; + uint64_t macaddr = 0; + + memcpy((uint8_t *)&macaddr + 2, LLADDR(sdl), 6); + phyp_hcall(H_MULTICAST_CTRL, sc->unit, LLAN_ADD_MULTICAST, macaddr); + + return (1); +} + static int llan_set_multicast(struct llan_softc *sc) { struct ifnet *ifp = sc->ifp; - struct ifmultiaddr *inm; - uint64_t macaddr = 0; mtx_assert(&sc->io_lock, MA_OWNED); phyp_hcall(H_MULTICAST_CTRL, sc->unit, LLAN_CLEAR_MULTICAST, 0); - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { - if (inm->ifma_addr->sa_family != AF_LINK) - continue; - - memcpy((uint8_t *)&macaddr + 2, - LLADDR((struct sockaddr_dl *)inm->ifma_addr), 6); - phyp_hcall(H_MULTICAST_CTRL, sc->unit, LLAN_ADD_MULTICAST, - macaddr); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, llan_set_maddr, sc); return (0); } From owner-svn-src-head@freebsd.org Mon Oct 21 18:17:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC46015E8BF; Mon, 21 Oct 2019 18:17:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlGS5wc9z3Cbn; Mon, 21 Oct 2019 18:17:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF78227D45; Mon, 21 Oct 2019 18:17:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIH4DK073413; Mon, 21 Oct 2019 18:17:04 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIH34m073408; Mon, 21 Oct 2019 18:17:03 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211817.x9LIH34m073408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353868 - in head: . sys/net sys/sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head: . sys/net sys/sys X-SVN-Commit-Revision: 353868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:17:05 -0000 Author: glebius Date: Mon Oct 21 18:17:03 2019 New Revision: 353868 URL: https://svnweb.freebsd.org/changeset/base/353868 Log: Remove obsoleted KPIs that were used to access interface address lists. Modified: head/UPDATING head/sys/net/if.c head/sys/net/if_var.h head/sys/sys/param.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Oct 21 18:13:37 2019 (r353867) +++ head/UPDATING Mon Oct 21 18:17:03 2019 (r353868) @@ -27,6 +27,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: "ln -s 'abort:false,junk:false' /etc/malloc.conf".) 20191021: + KPIs for network drivers to access interface addresses have changed. + Users need to recompile NIC driver modules together with kernel. + +20191021: The net.link.tap.user_open sysctl no longer prevents user opening of already created /dev/tapNN devices. Access is still controlled by node permissions, just like tun devices. The net.link.tap.user_open Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Oct 21 18:13:37 2019 (r353867) +++ head/sys/net/if.c Mon Oct 21 18:17:03 2019 (r353868) @@ -1768,40 +1768,6 @@ if_data_copy(struct ifnet *ifp, struct if_data *ifd) } /* - * Wrapper functions for struct ifnet address list locking macros. These are - * used by kernel modules to avoid encoding programming interface or binary - * interface assumptions that may be violated when kernel-internal locking - * approaches change. - */ -void -if_addr_rlock(struct ifnet *ifp) -{ - - epoch_enter_preempt(net_epoch_preempt, curthread->td_et); -} - -void -if_addr_runlock(struct ifnet *ifp) -{ - - epoch_exit_preempt(net_epoch_preempt, curthread->td_et); -} - -void -if_maddr_rlock(if_t ifp) -{ - - epoch_enter_preempt(net_epoch_preempt, curthread->td_et); -} - -void -if_maddr_runlock(if_t ifp) -{ - - epoch_exit_preempt(net_epoch_preempt, curthread->td_et); -} - -/* * Initialization, destruction and refcounting functions for ifaddrs. */ struct ifaddr * @@ -4403,77 +4369,6 @@ if_input(if_t ifp, struct mbuf* sendmp) (*((struct ifnet *)ifp)->if_input)((struct ifnet *)ifp, sendmp); return (0); -} - -/* XXX */ -#ifndef ETH_ADDR_LEN -#define ETH_ADDR_LEN 6 -#endif - -int -if_setupmultiaddr(if_t ifp, void *mta, int *cnt, int max) -{ - struct ifmultiaddr *ifma; - uint8_t *lmta = (uint8_t *)mta; - int mcnt = 0; - - CK_STAILQ_FOREACH(ifma, &((struct ifnet *)ifp)->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (mcnt == max) - break; - - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - &lmta[mcnt * ETH_ADDR_LEN], ETH_ADDR_LEN); - mcnt++; - } - *cnt = mcnt; - - return (0); -} - -int -if_multiaddr_array(if_t ifp, void *mta, int *cnt, int max) -{ - int error; - - if_maddr_rlock(ifp); - error = if_setupmultiaddr(ifp, mta, cnt, max); - if_maddr_runlock(ifp); - return (error); -} - -int -if_multiaddr_count(if_t ifp, int max) -{ - struct ifmultiaddr *ifma; - int count; - - count = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &((struct ifnet *)ifp)->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - count++; - if (count == max) - break; - } - if_maddr_runlock(ifp); - return (count); -} - -int -if_multi_apply(struct ifnet *ifp, int (*filter)(void *, struct ifmultiaddr *, int), void *arg) -{ - struct ifmultiaddr *ifma; - int cnt = 0; - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) - cnt += filter(arg, ifma, cnt); - if_maddr_runlock(ifp); - return (cnt); } struct mbuf * Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Mon Oct 21 18:13:37 2019 (r353867) +++ head/sys/net/if_var.h Mon Oct 21 18:17:03 2019 (r353868) @@ -449,16 +449,6 @@ struct ifnet { #define NET_EPOCH_WAIT() epoch_wait_preempt(net_epoch_preempt) #define NET_EPOCH_ASSERT() MPASS(in_epoch(net_epoch_preempt)) -/* - * Function variations on locking macros intended to be used by loadable - * kernel modules in order to divorce them from the internals of address list - * locking. - */ -void if_addr_rlock(struct ifnet *ifp); /* if_addrhead */ -void if_addr_runlock(struct ifnet *ifp); /* if_addrhead */ -void if_maddr_rlock(if_t ifp); /* if_multiaddrs */ -void if_maddr_runlock(if_t ifp); /* if_multiaddrs */ - #ifdef _KERNEL /* interface link layer address change event */ typedef void (*iflladdr_event_handler_t)(void *, struct ifnet *); @@ -773,12 +763,6 @@ u_int if_foreach_lladdr(if_t, iflladdr_cb_t, void *); u_int if_foreach_llmaddr(if_t, iflladdr_cb_t, void *); u_int if_lladdr_count(if_t); u_int if_llmaddr_count(if_t); -int if_multiaddr_count(if_t ifp, int max); - -/* Obsoleted multicast management functions. */ -int if_setupmultiaddr(if_t ifp, void *mta, int *cnt, int max); -int if_multiaddr_array(if_t ifp, void *mta, int *cnt, int max); -int if_multi_apply(struct ifnet *ifp, int (*filter)(void *, struct ifmultiaddr *, int), void *arg); int if_getamcount(if_t ifp); struct ifaddr * if_getifaddr(if_t ifp); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Oct 21 18:13:37 2019 (r353867) +++ head/sys/sys/param.h Mon Oct 21 18:17:03 2019 (r353868) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300053 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300054 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Mon Oct 21 18:19:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B0DC15F2D8; Mon, 21 Oct 2019 18:19:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlKK6pt8z3DF6; Mon, 21 Oct 2019 18:19:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE38427D4C; Mon, 21 Oct 2019 18:19:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIJXUq073566; Mon, 21 Oct 2019 18:19:33 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIJWad073561; Mon, 21 Oct 2019 18:19:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211819.x9LIJWad073561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:19:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353869 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 353869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:19:34 -0000 Author: glebius Date: Mon Oct 21 18:19:32 2019 New Revision: 353869 URL: https://svnweb.freebsd.org/changeset/base/353869 Log: Remove epoch tracker from struct thread. It was an ugly crutch to emulate locking semantics for if_addr_rlock() and if_maddr_rlock(). Modified: head/sys/kern/init_main.c head/sys/kern/kern_thread.c head/sys/kern/subr_epoch.c head/sys/sys/epoch.h head/sys/sys/proc.h Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Mon Oct 21 18:17:03 2019 (r353868) +++ head/sys/kern/init_main.c Mon Oct 21 18:19:32 2019 (r353869) @@ -514,7 +514,6 @@ proc0_init(void *dummy __unused) td->td_pflags = TDP_KTHREAD; td->td_cpuset = cpuset_thread0(); td->td_domain.dr_policy = td->td_cpuset->cs_domain; - epoch_thread_init(td); prison0_init(); p->p_peers = 0; p->p_leader = p; Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Mon Oct 21 18:17:03 2019 (r353868) +++ head/sys/kern/kern_thread.c Mon Oct 21 18:19:32 2019 (r353869) @@ -273,7 +273,6 @@ thread_init(void *mem, int size, int flags) td->td_rlqe = NULL; EVENTHANDLER_DIRECT_INVOKE(thread_init, td); umtx_thread_init(td); - epoch_thread_init(td); td->td_kstack = 0; td->td_sel = NULL; return (0); @@ -293,7 +292,6 @@ thread_fini(void *mem, int size) turnstile_free(td->td_turnstile); sleepq_free(td->td_sleepqueue); umtx_thread_fini(td); - epoch_thread_fini(td); seltdfini(td); } Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Mon Oct 21 18:17:03 2019 (r353868) +++ head/sys/kern/subr_epoch.c Mon Oct 21 18:19:32 2019 (r353869) @@ -842,17 +842,3 @@ epoch_drain_callbacks(epoch_t epoch) PICKUP_GIANT(); } - -void -epoch_thread_init(struct thread *td) -{ - - td->td_et = malloc(sizeof(struct epoch_tracker), M_EPOCH, M_WAITOK); -} - -void -epoch_thread_fini(struct thread *td) -{ - - free(td->td_et, M_EPOCH); -} Modified: head/sys/sys/epoch.h ============================================================================== --- head/sys/sys/epoch.h Mon Oct 21 18:17:03 2019 (r353868) +++ head/sys/sys/epoch.h Mon Oct 21 18:19:32 2019 (r353869) @@ -93,8 +93,5 @@ void epoch_trace_list(struct thread *); void epoch_enter(epoch_t epoch); void epoch_exit(epoch_t epoch); -void epoch_thread_init(struct thread *); -void epoch_thread_fini(struct thread *); - #endif /* _KERNEL */ #endif /* _SYS_EPOCH_H_ */ Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Mon Oct 21 18:17:03 2019 (r353868) +++ head/sys/sys/proc.h Mon Oct 21 18:19:32 2019 (r353869) @@ -365,7 +365,6 @@ struct thread { int td_lastcpu; /* (t) Last cpu we were on. */ int td_oncpu; /* (t) Which cpu we are on. */ void *td_lkpi_task; /* LinuxKPI task struct pointer */ - struct epoch_tracker *td_et; /* (k) compat KPI spare tracker */ int td_pmcpend; #ifdef EPOCH_TRACE SLIST_HEAD(, epoch_tracker) td_epochs; From owner-svn-src-head@freebsd.org Mon Oct 21 18:40:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43DF115F9B5; Mon, 21 Oct 2019 18:40:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xln014Z8z3FW5; Mon, 21 Oct 2019 18:40:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0531D143; Mon, 21 Oct 2019 18:40:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIe3kP086160; Mon, 21 Oct 2019 18:40:03 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIe3Gx086159; Mon, 21 Oct 2019 18:40:03 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910211840.x9LIe3Gx086159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 21 Oct 2019 18:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353871 - head X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 353871 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:40:04 -0000 Author: emaste Date: Mon Oct 21 18:40:03 2019 New Revision: 353871 URL: https://svnweb.freebsd.org/changeset/base/353871 Log: Additional fix for -DNO_CLEAN build across r353340 and r353381 opensolaris_atomic.S is now only used on i386 with opensolaris_atomic.c used on other platforms. After r353381 it doesn't exist on those platforms so the stale dependency would result in a build error. r353408 addressed this issue for cddl/lib/libzpool, but it persisted with the opensolaris and zfs modules. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Oct 21 18:27:12 2019 (r353870) +++ head/Makefile.inc1 Mon Oct 21 18:40:03 2019 (r353871) @@ -1620,6 +1620,18 @@ _cleankernobj_fast_depend_hack: .PHONY rm -f ${OBJTOP}/sys/${KERNCONF}/assym.* \ ${OBJTOP}/sys/${KERNCONF}/.depend.assym.*; \ fi +# 20191009 r353340 removal of opensolaris_atomic.S (also r353381) +.if ${MACHINE} != i386 +.for f in opensolaris_atomic +.for m in opensolaris zfs + @if [ -e "${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.o" ] && \ + grep -q ${f}.S "${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.o"; then \ + echo "Removing stale dependencies for opensolaris_atomic"; \ + rm -f ${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.*; \ + fi +.endfor +.endfor +.endif ${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY From owner-svn-src-head@freebsd.org Mon Oct 21 20:09:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37B2616100C; Mon, 21 Oct 2019 20:09:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xnmS0Wt0z3Klh; Mon, 21 Oct 2019 20:09:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E58D7116F; Mon, 21 Oct 2019 20:09:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LK9hoH038987; Mon, 21 Oct 2019 20:09:43 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LK9hDd038985; Mon, 21 Oct 2019 20:09:43 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910212009.x9LK9hDd038985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 20:09:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353872 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 353872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 20:09:44 -0000 Author: kevans Date: Mon Oct 21 20:09:43 2019 New Revision: 353872 URL: https://svnweb.freebsd.org/changeset/base/353872 Log: lualoader: don't botch disabling of color When colors are disabled, color.escape{fg,bg} would return the passed in color rather than the proper ANSI sequence for the color. color.escape{fg,bg} would be wrong. Instead return '', as the associated reset* functions will also return ''. This should get rid of the funky '2' and '4' in the kernel selector if you're booting serial. Reported by: npn Modified: head/stand/lua/color.lua head/stand/lua/screen.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Mon Oct 21 18:40:03 2019 (r353871) +++ head/stand/lua/color.lua Mon Oct 21 20:09:43 2019 (r353872) @@ -58,7 +58,7 @@ color.disabled = not color.isEnabled() function color.escapefg(color_value) if color.disabled then - return color_value + return '' end return core.KEYSTR_CSI .. "3" .. color_value .. "m" end @@ -72,7 +72,7 @@ end function color.escapebg(color_value) if color.disabled then - return color_value + return '' end return core.KEYSTR_CSI .. "4" .. color_value .. "m" end Modified: head/stand/lua/screen.lua ============================================================================== --- head/stand/lua/screen.lua Mon Oct 21 18:40:03 2019 (r353871) +++ head/stand/lua/screen.lua Mon Oct 21 20:09:43 2019 (r353872) @@ -47,14 +47,14 @@ end function screen.setforeground(color_value) if color.disabled then - return color_value + return end printc(color.escapefg(color_value)) end function screen.setbackground(color_value) if color.disabled then - return color_value + return end printc(color.escapebg(color_value)) end From owner-svn-src-head@freebsd.org Mon Oct 21 20:17:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1046416132F; Mon, 21 Oct 2019 20:17:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xnxR6Vt6z3LL4; Mon, 21 Oct 2019 20:17:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE7A81359; Mon, 21 Oct 2019 20:17:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LKHVP2044762; Mon, 21 Oct 2019 20:17:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LKHVx9044761; Mon, 21 Oct 2019 20:17:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910212017.x9LKHVx9044761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 20:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353873 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 353873 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 20:17:32 -0000 Author: kevans Date: Mon Oct 21 20:17:31 2019 New Revision: 353873 URL: https://svnweb.freebsd.org/changeset/base/353873 Log: lualoader: fix setting of loader_color=NO in loader.conf(5) Previously color.disabled would be calculated at color module load time, then never touched again. We can detect serial boots beyond just what we're told by loader.conf(5) so this works out in many cases, but we must re-evaluate the situation after the config is loaded to make sure we're not supposed to be forcing it enabled/disabled. Discovered while trying to test r353872. Modified: head/stand/lua/color.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Mon Oct 21 20:09:43 2019 (r353872) +++ head/stand/lua/color.lua Mon Oct 21 20:17:31 2019 (r353873) @@ -29,9 +29,14 @@ -- local core = require("core") +local hook = require("hook") local color = {} +local function recalcDisabled() + color.disabled = not color.isEnabled() +end + -- Module exports color.BLACK = 0 color.RED = 1 @@ -54,8 +59,6 @@ function color.isEnabled() return not core.isSerialBoot() end -color.disabled = not color.isEnabled() - function color.escapefg(color_value) if color.disabled then return '' @@ -112,5 +115,8 @@ function color.highlight(str) -- case the terminal defaults don't match what we're expecting. return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "22m" end + +recalcDisabled() +hook.register("config.loaded", recalcDisabled) return color From owner-svn-src-head@freebsd.org Mon Oct 21 20:28:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7BA7161864; Mon, 21 Oct 2019 20:28:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xpBG5qkVz3MGX; Mon, 21 Oct 2019 20:28:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6F63152B; Mon, 21 Oct 2019 20:28:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LKSc4H051484; Mon, 21 Oct 2019 20:28:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LKScQw051483; Mon, 21 Oct 2019 20:28:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910212028.x9LKScQw051483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 20:28:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353874 - head/sys/modules/if_tuntap X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/modules/if_tuntap X-SVN-Commit-Revision: 353874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 20:28:39 -0000 Author: kevans Date: Mon Oct 21 20:28:38 2019 New Revision: 353874 URL: https://svnweb.freebsd.org/changeset/base/353874 Log: if_tuntap: remove if_{tun,tap}.ko -> if_tuntap.ko links These drivers have been merged into a single if_tuntap in 13.0. The compatibility links existed only for the interim and will be MFC'd along with the if_tuntap merge shortly. MFC after: never Modified: head/sys/modules/if_tuntap/Makefile Modified: head/sys/modules/if_tuntap/Makefile ============================================================================== --- head/sys/modules/if_tuntap/Makefile Mon Oct 21 20:17:31 2019 (r353873) +++ head/sys/modules/if_tuntap/Makefile Mon Oct 21 20:28:38 2019 (r353874) @@ -5,31 +5,4 @@ KMOD= if_tuntap SRCS= if_tuntap.c opt_inet.h opt_inet6.h -# Symlink for backwards compatibility with systems installed at 12.0 or older -.if ${MACHINE_CPUARCH} != "powerpc" -SYMLINKS= ${KMOD}.ko ${KMODDIR}/if_tun.ko \ - ${KMOD}.ko ${KMODDIR}/if_tap.ko -.else -# Some PPC systems use msdosfs for /boot, which can't handle links or symlinks -afterinstall: alias alias_debug -alias: .PHONY - ${INSTALL} -T release -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}/if_tun.ko - ${INSTALL} -T release -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}/if_tap.ko -.if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG) && \ - "${MK_KERNEL_SYMBOLS}" != "no" -alias_debug: .PHONY - ${INSTALL} -T debug -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${PROG}.debug \ - ${DESTDIR}${KERN_DEBUGDIR}${KMODDIR}/if_tun.ko - ${INSTALL} -T debug -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${PROG}.debug \ - ${DESTDIR}${KERN_DEBUGDIR}${KMODDIR}/if_tap.ko -.else -alias_debug: .PHONY -.endif -.endif - - .include From owner-svn-src-head@freebsd.org Mon Oct 21 20:31:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9151A161960; Mon, 21 Oct 2019 20:31:01 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46xpF12tF2z3MSJ; Mon, 21 Oct 2019 20:31:01 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: by mail-lj1-x232.google.com with SMTP id j19so14782142lja.1; Mon, 21 Oct 2019 13:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5OQPc7HOoicHxEaOyv5dO1i1bkjasc4q6NgxqiquHFU=; b=gHIpK6C47cG5CDqR+UzVpKVsAFgp/X/t0COVMCSDp3H4DoAMdn+5Y5QH/+4Dv87E0l auehFSFI/Ny8xjDu+hUc6e5O3wUsH73y8ywXkch8QdXTAFlro1N8OkpoBH4feTwjyRPv m7NKBO2B5xJNonrbWfqKcsZVbG/DphV7C8DNymt5lyfbkRykTgUMe5CkkqLJIO/5fPbm L3qc5VYf3VXG1HGe85rB6rAH9InS7Kd4YGLubD6OLQURgroUYqW91IUVsQX2EJZmS9wG SBUhu02VAOiJvmN3C+yari/rreqlmEqjawFCXm8Pm7xMmJ9VERZf+8LS7pySd3ot2jIE xwUg== 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=5OQPc7HOoicHxEaOyv5dO1i1bkjasc4q6NgxqiquHFU=; b=CJivc4s2SaFtWgkU45RtF1re18rxg9CS2P6yZSLgc1Q0IZ3sfXwFFyrpMuFPYbuz5/ lGMEIgiI1hVLZ6mD9ID4++cZs/uVqdh2/jFsClGhL0Yvh7MJV23UyLrVXoTNsQX03hCY UJiNZTYjw+5GuoB0oNgX959H+u7R/qk+4FoaF422463tXkVx+lm8fLH/RtU5LBorUMJf rlb3UhPPE66qaj0M1AmyKIAUlSQgsvYCjX+LPHTgz5y7moPlg3zFpH6wuliArCkpEmQF gsErZZA2AuLCGvWOSsDIHzHbthmyXGMFLQ1B+MZTh3Ksx+mGHSzYyAWHL/2vQw1j6rRm HFSw== X-Gm-Message-State: APjAAAUoxiPLWyNM6RZi42EW3EgVsCyJgClsfTLclO8+U5VEiGK7JW7W UhqUM4Q47YepYeWDTq/mQmLqJEnovac9Hv9s1bVdIg== X-Google-Smtp-Source: APXvYqyQA8f1lOyOdOW4/bo4bq3fkxJpbYvE97IG+XuJoB3cAcLy1vWISV46tMKOom8qi+FU+XZeglX2TdXhIbFgZvE= X-Received: by 2002:a2e:b17b:: with SMTP id a27mr16074852ljm.7.1571689859087; Mon, 21 Oct 2019 13:30:59 -0700 (PDT) MIME-Version: 1.0 References: <201910211811.x9LIBhea069573@repo.freebsd.org> In-Reply-To: <201910211811.x9LIBhea069573@repo.freebsd.org> From: Sergey Kandaurov Date: Mon, 21 Oct 2019 23:30:46 +0300 Message-ID: Subject: Re: svn commit: r353848 - head/sys/dev/jme To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 46xpF12tF2z3MSJ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 20:31:01 -0000 =D0=BF=D0=BD, 21 =D0=BE=D0=BA=D1=82. 2019 =D0=B3. =D0=B2 21:14, Gleb Smirno= ff : > Author: glebius > Date: Mon Oct 21 18:11:43 2019 > New Revision: 353848 > URL: https://svnweb.freebsd.org/changeset/base/353848 > > Log: > Convert to if_foreach_llmaddr() KPI. > > Modified: > head/sys/dev/jme/if_jme.c > > Modified: head/sys/dev/jme/if_jme.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/jme/if_jme.c Mon Oct 21 18:11:38 2019 (r353847) > +++ head/sys/dev/jme/if_jme.c Mon Oct 21 18:11:43 2019 (r353848) > @@ -3236,12 +3236,26 @@ jme_set_vlan(struct jme_softc *sc) > CSR_WRITE_4(sc, JME_RXMAC, reg); > } > > +static u_int > +jme_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) > +{ > + uint32_t crc, *mchash =3D arg; > + > + crc =3D ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); > + > + /* Just want the 6 least significant bits. */ > + crc &=3D 0x3f; > + > + /* Set the corresponding bit in the hash table. */ > + mchash[crc >> 5] |=3D 1 << (crc & 0x1f); > + > + return (1); > +} > + > static void > jme_set_filter(struct jme_softc *sc) > { > struct ifnet *ifp; > - struct ifmultiaddr *ifma; > - uint32_t crc; > uint32_t mchash[2]; > uint32_t rxcfg; > > @@ -3276,21 +3290,7 @@ jme_set_filter(struct jme_softc *sc) > */ > rxcfg |=3D RXMAC_MULTICAST; > bzero(mchash, sizeof(mchash)); > - > - if_maddr_rlock(ifp); > - CK_STAILQ_FOREACH(ifma, &sc->jme_ifp->if_multiaddrs, ifma_link) { > - if (ifma->ifma_addr->sa_family !=3D AF_LINK) > - continue; > - crc =3D ether_crc32_be(LLADDR((struct sockaddr_dl *) > - ifma->ifma_addr), ETHER_ADDR_LEN); > - > - /* Just want the 6 least significant bits. */ > - crc &=3D 0x3f; > - > - /* Set the corresponding bit in the hash table. */ > - mchash[crc >> 5] |=3D 1 << (crc & 0x1f); > - } > - if_maddr_runlock(ifp); > + if_foreach_llmaddr(ifp, jme_hash_maddr, &mchash); > Should not be there just =E2=80=9Cmchash=E2=80=9D? You seems to be passing (uint32_t **), also in tsec. > CSR_WRITE_4(sc, JME_MAR0, mchash[0]); > CSR_WRITE_4(sc, JME_MAR1, mchash[1]); > From owner-svn-src-head@freebsd.org Mon Oct 21 20:36:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E581161C8D; Mon, 21 Oct 2019 20:36:46 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xpMf00BSz3Msk; Mon, 21 Oct 2019 20:36:45 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x9LKaZH0080998 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 21 Oct 2019 13:36:36 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9LKaZdN080997; Mon, 21 Oct 2019 13:36:35 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Mon, 21 Oct 2019 13:36:35 -0700 From: Gleb Smirnoff To: Sergey Kandaurov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353848 - head/sys/dev/jme Message-ID: <20191021203635.GF4086@FreeBSD.org> References: <201910211811.x9LIBhea069573@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46xpMf00BSz3Msk X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.52 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.518,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 20:36:46 -0000 Sergey, On Mon, Oct 21, 2019 at 11:30:46PM +0300, Sergey Kandaurov wrote: S> > struct ifnet *ifp; S> > - struct ifmultiaddr *ifma; S> > - uint32_t crc; S> > uint32_t mchash[2]; S> > uint32_t rxcfg; S> > S> > @@ -3276,21 +3290,7 @@ jme_set_filter(struct jme_softc *sc) S> > */ S> > rxcfg |= RXMAC_MULTICAST; S> > bzero(mchash, sizeof(mchash)); S> > - S> > - if_maddr_rlock(ifp); S> > - CK_STAILQ_FOREACH(ifma, &sc->jme_ifp->if_multiaddrs, ifma_link) { S> > - if (ifma->ifma_addr->sa_family != AF_LINK) S> > - continue; S> > - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) S> > - ifma->ifma_addr), ETHER_ADDR_LEN); S> > - S> > - /* Just want the 6 least significant bits. */ S> > - crc &= 0x3f; S> > - S> > - /* Set the corresponding bit in the hash table. */ S> > - mchash[crc >> 5] |= 1 << (crc & 0x1f); S> > - } S> > - if_maddr_runlock(ifp); S> > + if_foreach_llmaddr(ifp, jme_hash_maddr, &mchash); S> > S> S> Should not be there just “mchash”? S> You seems to be passing (uint32_t **), S> also in tsec. mchash and &mchash are the same here. -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Mon Oct 21 21:21:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79D7C1627DC; Mon, 21 Oct 2019 21:21:37 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xqMP2FTCz3PqF; Mon, 21 Oct 2019 21:21:37 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31BD01F86; Mon, 21 Oct 2019 21:21:37 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LLLbix085130; Mon, 21 Oct 2019 21:21:37 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LLLZFj085115; Mon, 21 Oct 2019 21:21:35 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910212121.x9LLLZFj085115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 21 Oct 2019 21:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353875 - head/contrib/tcsh X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/contrib/tcsh X-SVN-Commit-Revision: 353875 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 21:21:37 -0000 Author: brooks Date: Mon Oct 21 21:21:34 2019 New Revision: 353875 URL: https://svnweb.freebsd.org/changeset/base/353875 Log: Update tcsh to git revision 83c5be0 bringing in a number of bug fixes. Reported by: sobomax MFC after: 3 days Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22099 Modified: head/contrib/tcsh/Fixes head/contrib/tcsh/README.md head/contrib/tcsh/glob.c head/contrib/tcsh/host.defs head/contrib/tcsh/sh.c head/contrib/tcsh/sh.err.c head/contrib/tcsh/sh.h head/contrib/tcsh/sh.hist.c head/contrib/tcsh/sh.lex.c head/contrib/tcsh/tc.const.c head/contrib/tcsh/tc.sig.h head/contrib/tcsh/tcsh.man.new Directory Properties: head/contrib/tcsh/ (props changed) Modified: head/contrib/tcsh/Fixes ============================================================================== --- head/contrib/tcsh/Fixes Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/Fixes Mon Oct 21 21:21:34 2019 (r353875) @@ -1,3 +1,11 @@ + 5. PR/113: Sobomax: avoid infinite loops for -c commands when stdout is + not a tty. + 4. Avoid infinite loops during history loads when merging, print a better + error for errors during history load. + 3. PR/88: Preserve empty arguments in :q + 2. PR/94: Small apple issues (SAVESIGVEC, HOSTTYPE) + 1. PR/81: Fix range matching issue where we were comparing with the + range character instead of the start of range. [l-z]* would match foo 12. V6.21.00 - 20190508 11. Abort history loading on words and lines too long https://bugzilla.redhat.com/show_bug.cgi?id=1598502 Modified: head/contrib/tcsh/README.md ============================================================================== --- head/contrib/tcsh/README.md Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/README.md Mon Oct 21 21:21:34 2019 (r353875) @@ -1,4 +1,4 @@ -# Tcsh +# TCSH *C shell with file name completion and command line editing* @@ -14,10 +14,10 @@ PLEASE file any bug reports, fixes, and code for new f > https://bugs.astron.com/ Comments, questions, etc. (even flames) are welcome via email to -the Tcsh Bugs mailing list: +the tcsh mailing list: -> tcsh-bugs@astron.com -> https://mailman.astron.com/ +> tcsh@astron.com +> https://mailman.astron.com/mailman/listinfo/tcsh [![Build Status][status]][travis] Modified: head/contrib/tcsh/glob.c ============================================================================== --- head/contrib/tcsh/glob.c Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/glob.c Mon Oct 21 21:21:34 2019 (r353875) @@ -100,7 +100,7 @@ static int Lstat (const char *, struct stat *); static int Stat (const char *, struct stat *sb); static Char *Strchr (Char *, int); #ifdef DEBUG -static void qprintf (const Char *); +static void qprintf (const char *, const Char *); #endif #define DOLLAR '$' @@ -256,19 +256,20 @@ Strchr(Char *str, int ch) #ifdef DEBUG static void -qprintf(const Char *s) +qprintf(const char *pre, const Char *s) { const Char *p; - + + xprintf("%s", pre); for (p = s; *p; p++) - printf("%c", *p & 0xff); - printf("\n"); + xprintf("%c", *p & 0xff); + xprintf("\n%s", pre); for (p = s; *p; p++) - printf("%c", *p & M_PROTECT ? '"' : ' '); - printf("\n"); + xprintf("%c", *p & M_PROTECT ? '"' : ' '); + xprintf("\n%s", pre); for (p = s; *p; p++) - printf("%c", *p & M_META ? '_' : ' '); - printf("\n"); + xprintf("%c", *p & M_META ? '_' : ' '); + xprintf("\n"); } #endif /* DEBUG */ @@ -412,7 +413,7 @@ glob(const char *pattern, int flags, int (*errfunc) (c } *bufnext = EOS; #ifdef DEBUG - qprintf(patbuf); + qprintf("patbuf=", patbuf); #endif if ((err = glob1(patbuf, pglob, no_match)) != 0) { @@ -709,7 +710,7 @@ match(const char *name, const Char *pat, const Char *p while (pat < patend || *name) { size_t lwk, pwk; - __Char wc, wk; + __Char wc, wk, wc1; c = *pat; /* Only for M_MASK bits */ if (*name == EOS) @@ -744,18 +745,20 @@ match(const char *name, const Char *pat, const Char *p pat += pwk; pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); } + wc1 = wc; while ((*pat & M_MASK) != M_END) { if ((*pat & M_MASK) == M_RNG) { __Char wc2; pat += pwk; pwk = One_Char_mbtowc(&wc2, pat, MB_LEN_MAX); - if (globcharcoll(wc, wk, 0) <= 0 && + if (globcharcoll(wc1, wk, 0) <= 0 && globcharcoll(wk, wc2, 0) <= 0) ok = 1; } else if (wc == wk) ok = 1; pat += pwk; + wc1 = wc; pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); } pat += pwk; Modified: head/contrib/tcsh/host.defs ============================================================================== --- head/contrib/tcsh/host.defs Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/host.defs Mon Oct 21 21:21:34 2019 (r353875) @@ -854,9 +854,9 @@ enddef : newdef : defined(APPLE) && defined(MACH) comment : OS X vendor : : "apple" -hosttype: defined(i386) : "intel-pc" +hosttype: defined(i386) : "intel-mac" hosttype: defined(ppc) : "powermac" -hosttype: defined(M_amd64) : "amd" +hosttype: defined(M_amd64) : "intel-mac" ostype : : "darwin" machtype: defined(i386) : "i386" machtype: defined(M_amd64) : "x86_64" Modified: head/contrib/tcsh/sh.c ============================================================================== --- head/contrib/tcsh/sh.c Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/sh.c Mon Oct 21 21:21:34 2019 (r353875) @@ -237,6 +237,7 @@ main(int argc, char **argv) int nofile = 0; volatile int nverbose = 0; volatile int rdirs = 0; + volatile int exitcode = 0; int quitit = 0; Char *cp; #ifdef AUTOLOGOUT @@ -1390,6 +1391,12 @@ main(int argc, char **argv) if (targinp) { + /* If this -c command caused an error before, skip processing */ + if (reenter && arginp) { + exitcode = 1; + goto done; + } + arginp = SAVE(targinp); /* * we put the command into a variable @@ -1422,6 +1429,7 @@ main(int argc, char **argv) */ process(setintr); +done: /* * Mop-up. */ @@ -1443,7 +1451,7 @@ main(int argc, char **argv) } record(); exitstat(); - return (0); + return exitcode; } void Modified: head/contrib/tcsh/sh.err.c ============================================================================== --- head/contrib/tcsh/sh.err.c Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/sh.err.c Mon Oct 21 21:21:34 2019 (r353875) @@ -43,6 +43,7 @@ #endif char *seterr = NULL; /* Holds last error if there was one */ +extern int enterhist; #define ERR_FLAGS 0xf0000000 #define ERR_NAME 0x10000000 @@ -630,6 +631,8 @@ stderror(unsigned int id, ...) */ flush();/*FIXRESET*/ haderr = 1; /* Now to diagnostic output */ + if (enterhist) + xprintf("Can't load history: ");/*FIXRESET*/ if (flags & ERR_NAME) xprintf("%s: ", bname);/*FIXRESET*/ if ((flags & ERR_OLD)) { Modified: head/contrib/tcsh/sh.h ============================================================================== --- head/contrib/tcsh/sh.h Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/sh.h Mon Oct 21 21:21:34 2019 (r353875) @@ -682,13 +682,27 @@ EXTERN int OLDSTD IZERO; /* Old standard input (def */ #ifdef SIGSETJMP - typedef struct { sigjmp_buf j; } jmp_buf_t; -# define setexit() sigsetjmp(reslab.j, 1) -# define _reset() siglongjmp(reslab.j, 1) + typedef struct { const char *f; size_t l; sigjmp_buf j; } jmp_buf_t; +# define tcsh_setjmp() sigsetjmp(reslab.j, 1) +# define tcsh_longjmp() siglongjmp(reslab.j, 1) +# define setexit() (reslab.f = __func__, \ + reslab.l = __LINE__, \ + sigsetjmp(reslab.j, 1)) +# define _reset() siglongjmp(reslab.j, 1) #else - typedef struct { jmp_buf j; } jmp_buf_t; -# define setexit() setjmp(reslab.j) -# define _reset() longjmp(reslab.j, 1) + typedef struct { const char *f; size_t l; jmp_buf j; } jmp_buf_t; +# define tcsh_setjmp() setjmp(reslab.j) +# define tcsh_longjmp() longjmp(reslab.j, 1) +#endif + +#define setexit() (reslab.f = __func__, \ + reslab.l = __LINE__, \ + tcsh_setjmp()) +#ifdef SETJMP_DEBUG +# define _reset() xprintf("reset %s %zu\n", reslab.f, reslab.l), \ + flush(), tcsh_longjmp() +#else +# define _reset() tcsh_longjmp() #endif #define getexit(a) (void) ((a) = reslab) Modified: head/contrib/tcsh/sh.hist.c ============================================================================== --- head/contrib/tcsh/sh.hist.c Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/sh.hist.c Mon Oct 21 21:21:34 2019 (r353875) @@ -1281,6 +1281,7 @@ rechist(Char *fname, int ref) } if (merge) { + jmp_buf_t osetexit; if (lock) { #ifndef WINNT_NATIVE char *lockpath = strsave(short2str(fname)); @@ -1290,7 +1291,10 @@ rechist(Char *fname, int ref) cleanup_push(lockpath, dotlock_cleanup); #endif } - loadhist(fname, 1); + getexit(osetexit); + if (setexit()) + loadhist(fname, 1); + resexit(osetexit); } } rs = randsuf(); Modified: head/contrib/tcsh/sh.lex.c ============================================================================== --- head/contrib/tcsh/sh.lex.c Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/sh.lex.c Mon Oct 21 21:21:34 2019 (r353875) @@ -1020,8 +1020,10 @@ domod(Char *cp, Char type) switch (type) { - case 'x': case 'q': + case 'x': + if (*cp == '\0') + return Strsave(STRQNULL); wp = Strsave(cp); for (xp = wp; (c = *xp) != 0; xp++) if ((c != ' ' && c != '\t') || type == 'q') Modified: head/contrib/tcsh/tc.const.c ============================================================================== --- head/contrib/tcsh/tc.const.c Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/tc.const.c Mon Oct 21 21:21:34 2019 (r353875) @@ -253,10 +253,10 @@ Char STRnormal[] = { 'n', 'o', 'r', 'm', 'a', 'l', '\0 Char STRsldtlogout[] = { '/', '.', 'l', 'o', 'g', 'o', 'u', 't', '\0' }; Char STRjobs[] = { 'j', 'o', 'b', 's', '\0' }; Char STRdefprompt[] = { '%', '#', ' ', '\0' }; -Char STRmquestion[] = { '%', 'R', '?' | QUOTE, ' ', '\0' }; +Char STRmquestion[] = { '%', 'R', (Char)('?' | QUOTE), ' ', '\0' }; Char STRKCORRECT[] = { 'C', 'O', 'R', 'R', 'E', 'C', 'T', '>', '%', 'R', ' ', '(', 'y', '|', 'n', '|', 'e', '|', 'a', ')', - '?' | QUOTE, ' ', '\0' }; + (Char)('?' | QUOTE), ' ', '\0' }; Char STRunalias[] = { 'u', 'n', 'a', 'l', 'i', 'a', 's', '\0' }; Char STRalias[] = { 'a', 'l', 'i', 'a', 's', '\0' }; Char STRprecmd[] = { 'p', 'r', 'e', 'c', 'm', 'd', '\0' }; @@ -380,7 +380,7 @@ Char STRlistmaxrows[] = { 'l', 'i', 's', 't', 'm', 'a' Char STRlistmax[] = { 'l', 'i', 's', 't', 'm', 'a', 'x', '\0' }; Char STRlistlinks[] = { 'l', 'i', 's', 't', 'l', 'i', 'n', 'k', 's', '\0' }; Char STRDING[] = { 'D', 'I', 'N', 'G', '!', '\0' }; -Char STRQNULL[] = { '\0' | QUOTE, '\0' }; +Char STRQNULL[] = { (Char)('\0' | QUOTE), '\0' }; Char STRcorrect[] = { 'c', 'o', 'r', 'r', 'e', 'c', 't', '\0' }; Char STRcmd[] = { 'c', 'm', 'd', '\0' }; Char STRall[] = { 'a', 'l', 'l', '\0' }; Modified: head/contrib/tcsh/tc.sig.h ============================================================================== --- head/contrib/tcsh/tc.sig.h Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/tc.sig.h Mon Oct 21 21:21:34 2019 (r353875) @@ -42,7 +42,7 @@ # include #endif /* SYSVREL > 0 */ -#if defined(__APPLE__) || defined(SUNOS4) || defined(DGUX) || defined(hp800) || (SYSVREL > 3 && defined(VFORK)) +#if defined(SUNOS4) || defined(DGUX) || defined(hp800) || (SYSVREL > 3 && defined(VFORK)) # define SAVESIGVEC #endif /* SUNOS4 || DGUX || hp800 || SVR4 & VFORK */ Modified: head/contrib/tcsh/tcsh.man.new ============================================================================== --- head/contrib/tcsh/tcsh.man.new Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/tcsh.man.new Mon Oct 21 21:21:34 2019 (r353875) @@ -391,7 +391,7 @@ variants; see .Sx FILES . .Ss Editing We first describe -.Sx The command-line editor" +.Sx The command-line editor The .Sx Completion and listing and @@ -402,7 +402,7 @@ Finally, .Sx Editor commands lists and describes the editor commands specific to the shell and their default bindings. -.It Sx The command-line editor (+) +.Ss The command-line editor (+) Command-line input can be edited using key sequences much like those used in .Xr emacs 1 or @@ -684,9 +684,8 @@ If the .Va complete shell variable is set to .Sq enhance , -completion -1) ignores case and 2) considers periods, hyphens and underscores -.Sq ( . , +completion 1) ignores case and 2) considers periods, hyphens and underscores +.Sq ( \&. , .Sq \&- and .Sq _ ) @@ -727,7 +726,7 @@ hyphens or underscores. If the .Va complete shell variable is set to -.Sq enhance , +.Sq Enhance , completion ignores case and differences between a hyphen and an underscore word separator only when the user types a lowercase character or a hyphen. @@ -1093,17 +1092,20 @@ must be bound to a single character for this to work) or one of the following special characters may be typed: .Pp -.Sq ^W +.Bl -tag -width indent -compact +.It ^W Appends the rest of the word under the cursor to the search pattern. -delete (or any character bound to +.It delete +(or any character bound to .Ic backward-delete-char ) Undoes the effect of the last character typed and deletes a character from the search pattern if appropriate. -.Sq ^G +.It ^G If the previous search was successful, aborts the entire search. If not, goes back to the last successful search. -escape +.It escape Ends the search, leaving the current line in the input buffer. +.El .Pp Any other character not bound to .Ic self-insert-command @@ -1664,6 +1666,7 @@ The words of an input line are numbered from 0, the first (usually command) word being 0, the second word (first argument) being 1, etc. The basic word designators are: +.Pp .Bl -tag -width XXXX -offset indent -compact .It Ar 0 The first (command) word @@ -2021,7 +2024,7 @@ cause an error. .Pp Some aliases are referred to by the shell; see .Va Special aliases -.Sx Variable substitution +.Ss Variable substitution The shell maintains a list of variables, each of which has as value a list of zero or more words. The values of shell variables can be displayed and changed with the @@ -2219,7 +2222,7 @@ The following substitutions can not be modified with .Sq \&: modifiers. .Pp -.Bl -tag -width XXXXXXXX -offset indent -compact +.Bl -tag -width XXXXXXXXXX -offset indent -compact .It Ar $?name .It Ar ${?name} Substitutes the string @@ -2238,27 +2241,21 @@ if it is not. Always .Sq 0 in interactive shells. -.It Ar -$#name -${#name} +.It Ar $#name +.It Ar ${#name} Substitutes the number of words in .Va name -.It Ar -$# +.It Ar $# Equivalent to .Sq $#argv (+) -.It Ar -$% -.Va name +.It Ar $%name .It Ar ${%name} Substitutes the number of characters in .Va name (+) .Pp -$% -.Va number -.TP 8 +.It Ar $%number .It Ar ${%number} Substitutes the number of characters in .Va $argv[number] . @@ -2749,7 +2746,7 @@ file to it on standard input. The standard input and standard output of a command may be redirected with the following syntax: .Pp -.Bl -tag -width XXXXXX -offset indent -compact +.Bl -tag -width XXXXXXXXX -offset indent -compact .It Ar < name Open file .Va name @@ -3143,63 +3140,47 @@ They have the same format as before; .Va op may be one of .Pp -.PD 0 -.RS +4 -.TP 8 -.B A +.Bl -tag -width XXX -offset indent -compact +.It Ar A Last file access time, as the number of seconds since the epoch -.TP 8 -.B A: +.It Ar A: Like -.Va A +.Va Ar A , but in timestamp format, e.g., .Sq Fri May 14 16:36:10 1993 -.TP 8 -.B M +.It Ar M Last file modification time -.TP 8 -.B M: +.It Ar M: Like .Va M , but in timestamp format -.TP 8 -.B C +.It Ar C Last inode modification time -.TP 8 -.B C: +.It Ar C: Like .Va C , but in timestamp format -.TP 8 -.B D +.It Ar D Device number -.TP 8 -.B I +.It Ar I Inode number -.TP 8 -.B F +.It Ar F Composite .Va f ile identifier, in the form -.Va device -: +.Va device : .Va inode -.TP 8 -.B L +.It Ar L The name of the file pointed to by a symbolic link -.TP 8 -.B N +.It Ar N Number of (hard) links -.TP 8 -.B P +.It Ar P Permissions, in octal, without leading zero -.TP 8 -.B P: +.It Ar P: Like .Va P , with leading zero -.TP 8 -.B P\fImode +.It Ar P Equivalent to .Sq \-P .Va file @@ -3217,28 +3198,22 @@ if by group only, and .Sq 0 if by neither -.TP 8 -.B P\fImode\fB: -Like \fBP +.It Ar P: +Like +.Ar BP .Va mode , with leading zero -.TP 8 -.B U +.It Ar U Numeric userid -.TP 8 -.B U: +.It Ar U: Username, or the numeric userid if the username is unknown -.TP 8 -.B G +.It Ar G Numeric groupid -.TP 8 -.B G: +.It Ar G: Groupname, or the numeric groupid if the groupname is unknown -.TP 8 -.B Z +.It Ar Z Size, in bytes -.RE -.PD +.El .Pp Only one of these operators may appear in a multiple-operator test, and it must be the last. @@ -3791,45 +3766,24 @@ The next sections of this manual describe all of the a and .Va Special shell variables .Ss "Builtin commands" -.TP 8 -.B %\fIjob +.Bl -tag -width XXXXXXX -offset indent +.It Ar %job A synonym for the .Va fg builtin command. -.TP 8 -.B %\fIjob \fB& +.It Ar %job \&& A synonym for the .Va bg builtin command. -.TP 8 -.B : +.It Ar \&: Does nothing, successfully. .Pp -.B @ -.br -.B @ \fIname\fB = \fIexpr -.br -.B @ -.Va name -[ -.Va index -]\fB = \fIexpr -.br -.B @ \fIname -.Va ++ -|\fB-- -.PD 0 -.TP 8 -.B @ -.Va name -[ -.Va index -] -.Va ++ -|\fB-- +.It Ar @ +.It Ar @ name = expr +.It Ar @ name[index] = expr +.It Ar @ name++|-- +.It Ar @name[index]++|-- The first form prints the values of all shell variables. -.PD -.RS +8 .Pp The second form assigns the value of .Va expr @@ -3875,7 +3829,10 @@ has nothing to do with that described under .Va Expressions .Pp -The fourth and fifth forms increment (`++') or decrement (`\-\-') +The fourth and fifth forms increment ( +.Sq ++ ) +or decrement +.Sq ( -- ) .Va name or its .Va index @@ -3898,14 +3855,7 @@ are optional. Components of .Va expr must be separated by spaces. -.RE -.PD -.TP 8 -.B alias \fR[ -.Va name -[ -.Va wordlist -]] +.It Ar alias[name[wordlist]] Without arguments, prints all aliases. With .Va name @@ -3928,8 +3878,7 @@ or See also the .Va unalias builtin command. -.TP 8 -.B alloc +.It Ar alloc Shows the amount of dynamic memory acquired, broken down into used and free memory. With an argument shows the number of free and used blocks in each size @@ -3939,9 +3888,7 @@ This command's output may vary across system types, because systems other than the VAX may use a different memory allocator. .TP 8 -.B bg \fR[\fB% -.Va job -...] +.It Ar bg[%job...] Puts the specified jobs (or, without arguments, the current job) into the background, continuing each if it is stopped. .Va job @@ -3957,35 +3904,10 @@ as described under .Va Jobs .Pp -.B bindkey \fR[ -.Fl l\fR| -.Fl d\fR| -.Fl e\fR| -.Fl v\fR| -.Fl u\fR] (+) -.br -.Va bindkey -[ -.Fl a\fR] [ -.Fl b\fR] [ -.Fl k\fR] [ -.Fl r\fR] [ -.Fl \-\fR] -.Va key -(+) -.PD 0 -.TP 8 -.Va bindkey -[ -.Fl a\fR] [ -.Fl b\fR] [ -.Fl k\fR] [ -.Fl c\fR| -.Fl s\fR] [ -.Fl \-\fR] -.Va key command -(+) -.\" .B macro can't take too many words, so I used \fB in the previous tags +.It Ar bindkey Oo Fl l Ns | Ns Fl d Ns | Ns Fl e Ns | Ns Fl v Ns | Ns Fl u Oc (+) +.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl r Oc Oo Fl Fl Oc Ar key (+) +.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl c Ns | Ns Fl s Oc Oo Fl Fl Oc Ar key command (+) +.\" .It Ar macro can't take too many words, so I used \fB in the previous tags Without options, the first form lists all bound keys and the editor command to which each is bound, the second form lists the editor command to which .Va key @@ -3995,43 +3917,35 @@ the third form binds the editor command to .Va key Options include: -.PD .Pp -.PD 0 -.RS +8 -.TP 4 -.Fl l +.Bl -tag -width XXX -compact +.It Fl l Lists all editor commands and a short description of each. -.TP 4 -.Fl d +.It Fl d Binds all keys to the standard bindings for the default editor, as per .Va -e and .Va -v below. -.TP 4 -.Fl e +.It Fl e Binds all keys to .Va emacs (1)\-style bindings. Unsets .Va vimode -.TP 4 -.Fl v +.It Fl v Binds all keys to .Va vi (1)\-style bindings. Sets .Va vimode -.TP 4 -.Fl a +.It Fl a Lists or changes key-bindings in the alternative key map. This is the key map used in .Va vimode command mode. -.TP 4 -.Fl b +.It Fl b .Va key is interpreted as a control character written ^ @@ -4059,8 +3973,7 @@ or an extended prefix key written X- (e.g., .Sq X-A ). -.TP 4 -.Fl k +.It Fl k .Va key is interpreted as a symbolic arrow key name, which may be one of `down', @@ -4069,8 +3982,7 @@ is interpreted as a symbolic arrow key name, which may .Sq left or .Sq right -.TP 4 -.Fl r +.It Fl r Removes .Va key 's binding. @@ -4085,13 +3997,11 @@ to (q.v.), it unbinds .Va key completely. -.TP 4 -.Fl c +.It Fl c .Va command is interpreted as a builtin or external command instead of an editor command. -.TP 4 -.Fl s +.It Fl s .Va command is taken as a literal string and treated as terminal input when @@ -4101,15 +4011,14 @@ Bound keys in .Va command are themselves reinterpreted, and this continues for ten levels of interpretation. -.TP 4 -.Fl \- +.It Fl \&- Forces a break from option processing, so the next word is taken as .Va key -even if it begins with '\-'. -.TP 4 -.Fl u \fR(or any invalid option) +even if it begins with '\&-'. +.It Fl u +(or any invalid option) Prints a usage message. -.PD +.El .Pp .Va key may be a single character or a string. @@ -4137,48 +4046,35 @@ can contain backslashed escape sequences (in the style of System V .Va echo (1)) as follows: -.RS +4 -.TP 8 -.PD 0 -.B \ea +.Pp +.Bl -tag -width XXXX -compact -offset indent +.It \ea Bell -.TP 8 -.B \eb +.It \eb Backspace -.TP 8 -.B \ee +.It \ee Escape -.TP 8 -.B \ef +.It \ef Form feed -.TP 8 -.B \en +.It \en Newline -.TP 8 -.B \er +.It \er Carriage return -.TP 8 -.B \et +.It \et Horizontal tab -.TP 8 -.B \ev +.It \ev Vertical tab -.TP 8 -.B \e\fInnn +.It \e\fInnn The ASCII character corresponding to the octal number .Va nnn -.PD -.RE +.El .Pp `\e' nullifies the special meaning of the following character, if it has any, notably .Sq \e and .Sq ^ -.RE -.TP 8 -.B bs2cmd -.Va bs2000-command +.It bs2cmd Va bs2000-command (+) Passes .Va bs2000-command @@ -4186,8 +4082,7 @@ to the BS2000 command interpreter for execution. Only non-interactive commands can be executed, and it is not possible to execute any command that would overlay the image of the current process, like /EXECUTE or /CALL-PROCEDURE. (BS2000 only) -.TP 8 -.B break +.It break Causes execution to resume after the .Va end of the nearest @@ -4199,17 +4094,16 @@ The remaining commands on the current line are executed. Multi-level breaks are thus possible by writing them all on one line. -.TP 8 -.B breaksw +.It breaksw Causes a break from a .Va switch , resuming after the .Va endsw -.TP 8 -.B builtins \fR(+) + +.It builtins \fR(+) Prints the names of all builtin commands. -.TP 8 -.B bye \fR(+) + +.It bye \fR(+) A synonym for the .Va logout builtin command. @@ -4217,13 +4111,13 @@ Available only if the shell was so compiled; see the .Va version shell variable. -.TP 8 -.B case \fIlabel\fB: + +.It case \fIlabel\fB: A label in a .Va switch statement as discussed below. -.TP 8 -.B cd \fR[ + +.It cd \fR[ .Fl p\fR] [ .Fl l\fR] [ .Fl n\fR| @@ -4300,13 +4194,13 @@ and .Va cdtohome shell variables. .RE -.TP 8 -.B chdir + +.It chdir A synonym for the .Va cd builtin command. -.TP 8 -.B complete \fR[ + +.It complete \fR[ .Va command [\fIword\fB/\fIpattern\fB/ .Va list @@ -4350,7 +4244,7 @@ is to be completed, and may be one of the following: .PD 0 .RS +4 .TP 4 -.B c +.It c Current-word completion. .Va pattern is a glob-pattern which must match the beginning of the current word on @@ -4358,25 +4252,25 @@ the command line. .Va pattern is ignored when completing the current word. .TP 4 -.B C +.It C Like .Va c , but includes .Va pattern when completing the current word. .TP 4 -.B n +.It n Next-word completion. .Va pattern is a glob-pattern which must match the beginning of the previous word on the command line. .TP 4 -.B N +.It N Like .Va n , but must match the beginning of the word two before the current word. .TP 4 -.B p +.It p Position-dependent completion. .Va pattern is a numeric range, with the same syntax used to index shell @@ -4387,71 +4281,50 @@ variables, which must include the current word. .Va list , the list of possible completions, may be one of the following: .Pp -.PD 0 -.RS +4 -.TP 8 -.B a +.Bl -tag +.It a Aliases -.TP 8 -.B b +.It b Bindings (editor commands) -.TP 8 -.B c +.It c Commands (builtin or external commands) -.TP 8 -.B C +.It C External commands which begin with the supplied path prefix -.TP 8 -.B d +.It d Directories -.TP 8 -.B D *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Oct 21 23:12:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 416BA16460A; Mon, 21 Oct 2019 23:12:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xsq30xlDz40JM; Mon, 21 Oct 2019 23:12:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03D57322E; Mon, 21 Oct 2019 23:12:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LNCEmf052415; Mon, 21 Oct 2019 23:12:14 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LNCEbX052414; Mon, 21 Oct 2019 23:12:14 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910212312.x9LNCEbX052414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 23:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353876 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 23:12:15 -0000 Author: glebius Date: Mon Oct 21 23:12:14 2019 New Revision: 353876 URL: https://svnweb.freebsd.org/changeset/base/353876 Log: Assert that any epoch tracker belongs to the thread stack. Reviewed by: kib Modified: head/sys/kern/subr_epoch.c Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Mon Oct 21 21:21:34 2019 (r353875) +++ head/sys/kern/subr_epoch.c Mon Oct 21 23:12:14 2019 (r353876) @@ -366,9 +366,13 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et struct thread *td; MPASS(cold || epoch != NULL); - INIT_CHECK(epoch); MPASS(epoch->e_flags & EPOCH_PREEMPT); td = curthread; + MPASS((vm_offset_t)et >= td->td_kstack && + (vm_offset_t)et + sizeof(struct epoch_tracker) < + td->td_kstack + td->td_kstack_pages * PAGE_SIZE); + + INIT_CHECK(epoch); #ifdef EPOCH_TRACE epoch_trace_enter(td, epoch, et, file, line); #endif From owner-svn-src-head@freebsd.org Tue Oct 22 00:18:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0237E165F57; Tue, 22 Oct 2019 00:18:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xvHD67Jxz44Z2; Tue, 22 Oct 2019 00:18:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B16A440B4; Tue, 22 Oct 2019 00:18:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9M0IGhX090845; Tue, 22 Oct 2019 00:18:16 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9M0IGgO090844; Tue, 22 Oct 2019 00:18:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910220018.x9M0IGgO090844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 22 Oct 2019 00:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353877 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 00:18:17 -0000 Author: kevans Date: Tue Oct 22 00:18:16 2019 New Revision: 353877 URL: https://svnweb.freebsd.org/changeset/base/353877 Log: tuntap(4): properly declare if_tun and if_tap modules Simply adding MODULE_VERSION does not do the trick, because the modules haven't been declared. This should actually fix modfind/kldstat, which r351229 aimed and failed to do. This should make vm-bhyve do the right thing again when using the ports version, rather than the latest version not in ports. MFC after: 3 days Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Mon Oct 21 23:12:14 2019 (r353876) +++ head/sys/net/if_tuntap.c Tue Oct 22 00:18:16 2019 (r353877) @@ -783,9 +783,15 @@ static moduledata_t tuntap_mod = { 0 }; +/* We'll only ever have these two, so no need for a macro. */ +static moduledata_t tun_mod = { "if_tun", NULL, 0 }; +static moduledata_t tap_mod = { "if_tap", NULL, 0 }; + DECLARE_MODULE(if_tuntap, tuntap_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_tuntap, 1); +DECLARE_MODULE(if_tun, tun_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_tun, 1); +DECLARE_MODULE(if_tap, tap_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_tap, 1); static int From owner-svn-src-head@freebsd.org Tue Oct 22 08:29:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F658154047; Tue, 22 Oct 2019 08:29:00 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46y69S1MTNz4TQd; Tue, 22 Oct 2019 08:28:59 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-yb1-f175.google.com with SMTP id z2so4888963ybn.6; Tue, 22 Oct 2019 01:28:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hJl+PtRA18XzIvQvqvbNXkJdcbhldrxutFupXGUIXho=; b=K35zrO/KA9884lRJ2Y682t48FEDPW/BiwpD7ETXohGpiQfCSJ0nBv0GdFrfdzrrJaz KxN4Fqqrer/SNMeoL/6F0fq3z8waobjgX/g0WQ6MqIkFxWrc+mj7VyoFeMscjsslxATS ybUwPnasKNeberzBxWD5b367cZrVwHOL/DoZoMuwCd2WiF4ebcq9YFovcOhbULVheRkv 3hylGqVZfS9Owd72y+HLpG18CzM/W8WvQUJJXNVtyfuNhv2JLPXbrfpjy/pqaXBjXRrL ts5Z7ieQ0Ux5RdqWs1ucpZRt1ktGPk4Y0gMPj1/msFixC1YeqXYgGTS6hGF2Y7sFcJUU Xqag== X-Gm-Message-State: APjAAAV6fwk6H1CmHqEq04Xb5SF0QK5SxMMShsm669Aa3IO3/YwFeDb5 Kt5MoxPJzvy6+Iq4rr71quOwd0+Sgio2NqXYJgzHcFgg X-Google-Smtp-Source: APXvYqyL0xHdxNQgDSTpXb50tenyqsfKXf44npWJKmd2TaQifn/R2bkBrY5z4FC7Kh+E8u0xBRDP01pWMxxA9BiY/K8= X-Received: by 2002:a25:9087:: with SMTP id t7mr1518915ybl.451.1571732938347; Tue, 22 Oct 2019 01:28:58 -0700 (PDT) MIME-Version: 1.0 References: <201910212312.x9LNCEbX052414@repo.freebsd.org> In-Reply-To: <201910212312.x9LNCEbX052414@repo.freebsd.org> From: Li-Wen Hsu Date: Tue, 22 Oct 2019 16:28:45 +0800 Message-ID: Subject: Re: svn commit: r353876 - head/sys/kern To: Gleb Smirnoff Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46y69S1MTNz4TQd X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 08:29:00 -0000 On Tue, Oct 22, 2019 at 7:12 AM Gleb Smirnoff wrote: > > Author: glebius > Date: Mon Oct 21 23:12:14 2019 > New Revision: 353876 > URL: https://svnweb.freebsd.org/changeset/base/353876 > > Log: > Assert that any epoch tracker belongs to the thread stack. > > Reviewed by: kib > > Modified: > head/sys/kern/subr_epoch.c > > Modified: head/sys/kern/subr_epoch.c > ============================================================================== > --- head/sys/kern/subr_epoch.c Mon Oct 21 21:21:34 2019 (r353875) > +++ head/sys/kern/subr_epoch.c Mon Oct 21 23:12:14 2019 (r353876) > @@ -366,9 +366,13 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et > struct thread *td; > > MPASS(cold || epoch != NULL); > - INIT_CHECK(epoch); > MPASS(epoch->e_flags & EPOCH_PREEMPT); > td = curthread; > + MPASS((vm_offset_t)et >= td->td_kstack && > + (vm_offset_t)et + sizeof(struct epoch_tracker) < > + td->td_kstack + td->td_kstack_pages * PAGE_SIZE); > + > + INIT_CHECK(epoch); > #ifdef EPOCH_TRACE > epoch_trace_enter(td, epoch, et, file, line); > #endif Hello Gleb, RISC-V boot panics with this message: panic: Assertion (vm_offset_t)et >= td->td_kstack && (vm_offset_t)et + sizeof(struct epoch_tracker) < td->td_kstack + td->td_kstack_pages * PAGE_SIZE failed at /workspace/src/sys/kern/subr_epoch.c:373 Full log: https://ci.freebsd.org/job/FreeBSD-head-riscv64-test/12334/console Can you help check this? Thanks, Li-Wen From owner-svn-src-head@freebsd.org Tue Oct 22 14:20:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE6B815BF03; Tue, 22 Oct 2019 14:20:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yFyZ63Z5z3L5c; Tue, 22 Oct 2019 14:20:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94AFDD8B4; Tue, 22 Oct 2019 14:20:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MEK6Sq088426; Tue, 22 Oct 2019 14:20:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MEK60F088425; Tue, 22 Oct 2019 14:20:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221420.x9MEK60F088425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 14:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353886 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353886 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 14:20:07 -0000 Author: markj Date: Tue Oct 22 14:20:06 2019 New Revision: 353886 URL: https://svnweb.freebsd.org/changeset/base/353886 Log: Avoid reloading bucket pointers in uma_vm_zone_stats(). The correctness of per-CPU cache accounting in that function is dependent on reading per-CPU pointers exactly once. Ensure that the compiler does not emit multiple loads of those pointers. Reported and tested by: pho Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22081 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Tue Oct 22 14:11:22 2019 (r353885) +++ head/sys/vm/uma_core.c Tue Oct 22 14:20:06 2019 (r353886) @@ -4055,6 +4055,7 @@ uma_vm_zone_stats(struct uma_type_header *uth, uma_zon struct uma_percpu_stat *ups, bool internal) { uma_zone_domain_t zdom; + uma_bucket_t bucket; uma_cache_t cache; int i; @@ -4068,28 +4069,29 @@ uma_vm_zone_stats(struct uma_type_header *uth, uma_zon uth->uth_fails = counter_u64_fetch(z->uz_fails); uth->uth_sleeps = z->uz_sleeps; uth->uth_xdomain = z->uz_xdomain; + /* - * While it is not normally safe to access the cache - * bucket pointers while not on the CPU that owns the - * cache, we only allow the pointers to be exchanged - * without the zone lock held, not invalidated, so - * accept the possible race associated with bucket - * exchange during monitoring. + * While it is not normally safe to access the cache bucket pointers + * while not on the CPU that owns the cache, we only allow the pointers + * to be exchanged without the zone lock held, not invalidated, so + * accept the possible race associated with bucket exchange during + * monitoring. Use atomic_load_ptr() to ensure that the bucket pointers + * are loaded only once. */ for (i = 0; i < mp_maxid + 1; i++) { bzero(&ups[i], sizeof(*ups)); if (internal || CPU_ABSENT(i)) continue; cache = &z->uz_cpu[i]; - if (cache->uc_allocbucket != NULL) - ups[i].ups_cache_free += - cache->uc_allocbucket->ub_cnt; - if (cache->uc_freebucket != NULL) - ups[i].ups_cache_free += - cache->uc_freebucket->ub_cnt; - if (cache->uc_crossbucket != NULL) - ups[i].ups_cache_free += - cache->uc_crossbucket->ub_cnt; + bucket = (uma_bucket_t)atomic_load_ptr(&cache->uc_allocbucket); + if (bucket != NULL) + ups[i].ups_cache_free += bucket->ub_cnt; + bucket = (uma_bucket_t)atomic_load_ptr(&cache->uc_freebucket); + if (bucket != NULL) + ups[i].ups_cache_free += bucket->ub_cnt; + bucket = (uma_bucket_t)atomic_load_ptr(&cache->uc_crossbucket); + if (bucket != NULL) + ups[i].ups_cache_free += bucket->ub_cnt; ups[i].ups_allocs = cache->uc_allocs; ups[i].ups_frees = cache->uc_frees; } From owner-svn-src-head@freebsd.org Tue Oct 22 14:20:36 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3221B15BF6C; Tue, 22 Oct 2019 14:20:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yFz81LGBz3LDg; Tue, 22 Oct 2019 14:20:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11389D8C1; Tue, 22 Oct 2019 14:20:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MEKaOE088496; Tue, 22 Oct 2019 14:20:36 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MEKaqg088495; Tue, 22 Oct 2019 14:20:36 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910221420.x9MEKaqg088495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 22 Oct 2019 14:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353887 - head/sys/dev/nctgpio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/nctgpio X-SVN-Commit-Revision: 353887 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 14:20:36 -0000 Author: avg Date: Tue Oct 22 14:20:35 2019 New Revision: 353887 URL: https://svnweb.freebsd.org/changeset/base/353887 Log: nctgpio: improve performance (latency) of operation This change consists of two parts. First, nctgpio now supports hardware access via an I/O port window if it's configured by firmware. For instance, PC Engines firmware v4.10.0.2 does that. This is faster than going through the Super I/O configuration registers. Second, nctgpio now caches values of bits that it controls. For example, the driver does not need to access the hardware to determine if a pin is an output or an input, or a state of an output. Also, the driver makes use of the fact that the hardware preserves an output state of a pin accross a switch to the input mode and back. With this change I am able to use the 1-Wire bus over nctgpio whereas previously the driver introduced too much latency to be compliant with the relatively strict protocol timings. superio0: at port 0x2e-0x2f on isa0 gpio1: at GPIO ldn 0x07 on superio0 pcib0: allocated type 4 (0x220-0x226) for rid 0 of gpio1 gpiobus1: on gpio1 owc0: at pin 4 on gpiobus1 ow0: <1 Wire Bus> on owc0 ow0: romid 28:b2:9e:45:92:10:02:34: no driver ow_temp0: romid 28:b2:9e:45:92:10:02:34 on ow0 MFC after: 4 weeks Modified: head/sys/dev/nctgpio/nctgpio.c Modified: head/sys/dev/nctgpio/nctgpio.c ============================================================================== --- head/sys/dev/nctgpio/nctgpio.c Tue Oct 22 14:20:06 2019 (r353886) +++ head/sys/dev/nctgpio/nctgpio.c Tue Oct 22 14:20:35 2019 (r353887) @@ -69,21 +69,49 @@ #define NCT_LDF_GPIO0_OUTCFG 0xe0 #define NCT_LDF_GPIO1_OUTCFG 0xe1 +/* Direct I/O port access. */ +#define NCT_IO_GSR 0 +#define NCT_IO_IOR 1 +#define NCT_IO_DAT 2 +#define NCT_IO_INV 3 #define NCT_MAX_PIN 15 #define NCT_IS_VALID_PIN(_p) ((_p) >= 0 && (_p) <= NCT_MAX_PIN) -#define NCT_PIN_BIT(_p) (1 << ((_p) % 8)) +#define NCT_PIN_BIT(_p) (1 << ((_p) & 7)) #define NCT_GPIO_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL | \ GPIO_PIN_INVIN | GPIO_PIN_INVOUT) +/* + * Note that the values are important. + * They match actual register offsets. + */ +typedef enum { + REG_IOR = 0, + REG_DAT = 1, + REG_INV = 2, +} reg_t; + struct nct_softc { device_t dev; device_t dev_f; device_t busdev; struct mtx mtx; + struct resource *iores; + int iorid; + int curgrp; + struct { + /* direction, 1: pin is input */ + uint8_t ior[2]; + /* output value */ + uint8_t out[2]; + /* whether out is valid */ + uint8_t out_known[2]; + /* inversion, 1: pin is inverted */ + uint8_t inv[2]; + } cache; struct gpio_pin pins[NCT_MAX_PIN + 1]; }; @@ -113,97 +141,142 @@ struct nuvoton_vendor_device_id { }, }; -/* - * Get the GPIO Input/Output register address - * for a pin. - */ +static void +nct_io_set_group(struct nct_softc *sc, int group) +{ + + GPIO_ASSERT_LOCKED(sc); + if (group != sc->curgrp) { + bus_write_1(sc->iores, NCT_IO_GSR, group); + sc->curgrp = group; + } +} + static uint8_t -nct_ior_addr(uint32_t pin_num) +nct_io_read(struct nct_softc *sc, int group, uint8_t reg) { - uint8_t addr; + nct_io_set_group(sc, group); + return (bus_read_1(sc->iores, reg)); +} - addr = NCT_LD7_GPIO0_IOR; - if (pin_num > 7) - addr = NCT_LD7_GPIO1_IOR; +static void +nct_io_write(struct nct_softc *sc, int group, uint8_t reg, uint8_t val) +{ + nct_io_set_group(sc, group); + return (bus_write_1(sc->iores, reg, val)); +} - return (addr); +static uint8_t +nct_get_ioreg(struct nct_softc *sc, reg_t reg, int group) +{ + uint8_t ioreg; + + if (sc->iores != NULL) + ioreg = NCT_IO_IOR + reg; + else if (group == 0) + ioreg = NCT_LD7_GPIO0_IOR + reg; + else + ioreg = NCT_LD7_GPIO1_IOR + reg; + return (ioreg); } -/* - * Get the GPIO Data register address for a pin. - */ static uint8_t -nct_dat_addr(uint32_t pin_num) +nct_read_reg(struct nct_softc *sc, reg_t reg, int group) { - uint8_t addr; + uint8_t ioreg; + uint8_t val; - addr = NCT_LD7_GPIO0_DAT; - if (pin_num > 7) - addr = NCT_LD7_GPIO1_DAT; + ioreg = nct_get_ioreg(sc, reg, group); + if (sc->iores != NULL) + val = nct_io_read(sc, group, ioreg); + else + val = superio_read(sc->dev, ioreg); - return (addr); + return (val); } -/* - * Get the GPIO Inversion register address - * for a pin. - */ -static uint8_t -nct_inv_addr(uint32_t pin_num) +#define GET_BIT(v, b) (((v) >> (b)) & 1) +static bool +nct_get_pin_reg(struct nct_softc *sc, reg_t reg, uint32_t pin_num) { - uint8_t addr; + uint8_t bit; + uint8_t group; + uint8_t val; - addr = NCT_LD7_GPIO0_INV; - if (pin_num > 7) - addr = NCT_LD7_GPIO1_INV; + KASSERT(NCT_IS_VALID_PIN(pin_num), ("%s: invalid pin number %d", + __func__, pin_num)); - return (addr); + group = pin_num >> 3; + bit = pin_num & 7; + val = nct_read_reg(sc, reg, group); + return (GET_BIT(val, bit)); } -/* - * Get the GPIO Output Configuration/Mode - * register address for a pin. - */ -static uint8_t -nct_outcfg_addr(uint32_t pin_num) +static int +nct_get_pin_cache(struct nct_softc *sc, uint32_t pin_num, uint8_t *cache) { - uint8_t addr; + uint8_t bit; + uint8_t group; + uint8_t val; - addr = NCT_LDF_GPIO0_OUTCFG; - if (pin_num > 7) - addr = NCT_LDF_GPIO1_OUTCFG; + KASSERT(NCT_IS_VALID_PIN(pin_num), ("%s: invalid pin number %d", + __func__, pin_num)); - return (addr); + group = pin_num >> 3; + bit = pin_num & 7; + val = cache[group]; + return (GET_BIT(val, bit)); } -/* - * Set a pin to output mode. - */ static void -nct_set_pin_is_output(struct nct_softc *sc, uint32_t pin_num) +nct_write_reg(struct nct_softc *sc, reg_t reg, int group, uint8_t val) { - uint8_t reg; - uint8_t ior; + uint8_t ioreg; - reg = nct_ior_addr(pin_num); - ior = superio_read(sc->dev, reg); - ior &= ~(NCT_PIN_BIT(pin_num)); - superio_write(sc->dev, reg, ior); + ioreg = nct_get_ioreg(sc, reg, group); + if (sc->iores != NULL) + nct_io_write(sc, group, ioreg, val); + else + superio_write(sc->dev, ioreg, val); } +static void +nct_set_pin_reg(struct nct_softc *sc, reg_t reg, uint32_t pin_num, bool val) +{ + uint8_t *cache; + uint8_t bit; + uint8_t bitval; + uint8_t group; + uint8_t mask; + + KASSERT(NCT_IS_VALID_PIN(pin_num), + ("%s: invalid pin number %d", __func__, pin_num)); + KASSERT(reg == REG_IOR || reg == REG_INV, + ("%s: unsupported register %d", __func__, reg)); + + group = pin_num >> 3; + bit = pin_num & 7; + mask = (uint8_t)1 << bit; + bitval = (uint8_t)val << bit; + + if (reg == REG_IOR) + cache = &sc->cache.ior[group]; + else + cache = &sc->cache.inv[group]; + if ((*cache & mask) == bitval) + return; + *cache &= ~mask; + *cache |= bitval; + nct_write_reg(sc, reg, group, *cache); +} + /* - * Set a pin to input mode. + * Set a pin to input (val is true) or output (val is false) mode. */ static void -nct_set_pin_is_input(struct nct_softc *sc, uint32_t pin_num) +nct_set_pin_input(struct nct_softc *sc, uint32_t pin_num, bool val) { - uint8_t reg; - uint8_t ior; - - reg = nct_ior_addr(pin_num); - ior = superio_read(sc->dev, reg); - ior |= NCT_PIN_BIT(pin_num); - superio_write(sc->dev, reg, ior); + nct_set_pin_reg(sc, REG_IOR, pin_num, val); } /* @@ -212,80 +285,98 @@ nct_set_pin_is_input(struct nct_softc *sc, uint32_t pi static bool nct_pin_is_input(struct nct_softc *sc, uint32_t pin_num) { - uint8_t reg; - uint8_t ior; + return (nct_get_pin_cache(sc, pin_num, sc->cache.ior)); +} - reg = nct_ior_addr(pin_num); - ior = superio_read(sc->dev, reg); +/* + * Set a pin to inverted (val is true) or normal (val is false) mode. + */ +static void +nct_set_pin_inverted(struct nct_softc *sc, uint32_t pin_num, bool val) +{ + nct_set_pin_reg(sc, REG_INV, pin_num, val); +} - return (ior & NCT_PIN_BIT(pin_num)); +static bool +nct_pin_is_inverted(struct nct_softc *sc, uint32_t pin_num) +{ + return (nct_get_pin_cache(sc, pin_num, sc->cache.inv)); } /* * Write a value to an output pin. + * NB: the hardware remembers last output value across switching from + * output mode to input mode and back. + * Writes to a pin in input mode are not allowed here as they cannot + * have any effect and would corrupt the output value cache. */ static void -nct_write_pin(struct nct_softc *sc, uint32_t pin_num, uint8_t data) +nct_write_pin(struct nct_softc *sc, uint32_t pin_num, bool val) { - uint8_t reg; - uint8_t value; + uint8_t bit; + uint8_t group; - reg = nct_dat_addr(pin_num); - value = superio_read(sc->dev, reg); - if (data) - value |= NCT_PIN_BIT(pin_num); + KASSERT(!nct_pin_is_input(sc, pin_num), ("attempt to write input pin")); + group = pin_num >> 3; + bit = pin_num & 7; + if (GET_BIT(sc->cache.out_known[group], bit) && + GET_BIT(sc->cache.out[group], bit) == val) { + /* The pin is already in requested state. */ + return; + } + sc->cache.out_known[group] |= 1 << bit; + if (val) + sc->cache.out[group] |= 1 << bit; else - value &= ~(NCT_PIN_BIT(pin_num)); - - superio_write(sc->dev, reg, value); + sc->cache.out[group] &= ~(1 << bit); + nct_write_reg(sc, REG_DAT, group, sc->cache.out[group]); } +/* + * NB: state of an input pin cannot be cached, of course. + * For an output we can either take the value from the cache if it's valid + * or read the state from the hadrware and cache it. + */ static bool nct_read_pin(struct nct_softc *sc, uint32_t pin_num) { - uint8_t reg; + uint8_t bit; + uint8_t group; + bool val; - reg = nct_dat_addr(pin_num); + if (nct_pin_is_input(sc, pin_num)) + return (nct_get_pin_reg(sc, REG_DAT, pin_num)); - return (superio_read(sc->dev, reg) & NCT_PIN_BIT(pin_num)); -} + group = pin_num >> 3; + bit = pin_num & 7; + if (GET_BIT(sc->cache.out_known[group], bit)) + return (GET_BIT(sc->cache.out[group], bit)); -static void -nct_set_pin_is_inverted(struct nct_softc *sc, uint32_t pin_num) -{ - uint8_t reg; - uint8_t inv; - - reg = nct_inv_addr(pin_num); - inv = superio_read(sc->dev, reg); - inv |= (NCT_PIN_BIT(pin_num)); - superio_write(sc->dev, reg, inv); + val = nct_get_pin_reg(sc, REG_DAT, pin_num); + sc->cache.out_known[group] |= 1 << bit; + if (val) + sc->cache.out[group] |= 1 << bit; + else + sc->cache.out[group] &= ~(1 << bit); + return (val); } -static void -nct_set_pin_not_inverted(struct nct_softc *sc, uint32_t pin_num) +static uint8_t +nct_outcfg_addr(uint32_t pin_num) { - uint8_t reg; - uint8_t inv; - - reg = nct_inv_addr(pin_num); - inv = superio_read(sc->dev, reg); - inv &= ~(NCT_PIN_BIT(pin_num)); - superio_write(sc->dev, reg, inv); + KASSERT(NCT_IS_VALID_PIN(pin_num), ("%s: invalid pin number %d", + __func__, pin_num)); + if ((pin_num >> 3) == 0) + return (NCT_LDF_GPIO0_OUTCFG); + else + return (NCT_LDF_GPIO1_OUTCFG); } -static bool -nct_pin_is_inverted(struct nct_softc *sc, uint32_t pin_num) -{ - uint8_t reg; - uint8_t inv; - - reg = nct_inv_addr(pin_num); - inv = superio_read(sc->dev, reg); - - return (inv & NCT_PIN_BIT(pin_num)); -} - +/* + * NB: PP/OD can be configured only via configuration registers. + * Also, the registers are in a different logical device. + * So, this is a special case. No caching too. + */ static void nct_set_pin_opendrain(struct nct_softc *sc, uint32_t pin_num) { @@ -353,6 +444,9 @@ static int nct_attach(device_t dev) { struct nct_softc *sc; + device_t dev_8; + uint16_t iobase; + int err; int i; sc = device_get_softc(dev); @@ -364,12 +458,67 @@ nct_attach(device_t dev) return (ENXIO); } + /* + * As strange as it may seem, I/O port base is configured in the + * Logical Device 8 which is primarily used for WDT, but also plays + * a role in GPIO configuration. + */ + iobase = 0; + dev_8 = superio_find_dev(device_get_parent(dev), SUPERIO_DEV_WDT, 8); + if (dev_8 != NULL) + iobase = superio_get_iobase(dev_8); + if (iobase != 0 && iobase != 0xffff) { + sc->curgrp = -1; + sc->iorid = 0; + err = bus_set_resource(dev, SYS_RES_IOPORT, sc->iorid, + iobase, 7); + if (err == 0) { + sc->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT, + &sc->iorid, RF_ACTIVE); + if (sc->iores == NULL) { + device_printf(dev, "can't map i/o space, " + "iobase=0x%04x\n", iobase); + } + } else { + device_printf(dev, + "failed to set io port resource at 0x%x\n", iobase); + } + } + /* Enable gpio0 and gpio1. */ superio_dev_enable(dev, 0x03); GPIO_LOCK_INIT(sc); GPIO_LOCK(sc); + sc->cache.inv[0] = nct_read_reg(sc, REG_INV, 0); + sc->cache.inv[1] = nct_read_reg(sc, REG_INV, 1); + sc->cache.ior[0] = nct_read_reg(sc, REG_IOR, 0); + sc->cache.ior[1] = nct_read_reg(sc, REG_IOR, 1); + + /* + * Caching input values is meaningless as an input can be changed at any + * time by an external agent. But outputs are controlled by this + * driver, so it can cache their state. Also, the hardware remembers + * the output state of a pin when the pin is switched to input mode and + * then back to output mode. So, the cache stays valid. + * The only problem is with pins that are in input mode at the attach + * time. For them the output state is not known until it is set by the + * driver for the first time. + * 'out' and 'out_known' bits form a tri-state output cache: + * |-----+-----------+---------| + * | out | out_known | cache | + * |-----+-----------+---------| + * | X | 0 | invalid | + * | 0 | 1 | 0 | + * | 1 | 1 | 1 | + * |-----+-----------+---------| + */ + sc->cache.out[0] = nct_read_reg(sc, REG_DAT, 0); + sc->cache.out[1] = nct_read_reg(sc, REG_DAT, 1); + sc->cache.out_known[0] = ~sc->cache.ior[0]; + sc->cache.out_known[1] = ~sc->cache.ior[1]; + for (i = 0; i <= NCT_MAX_PIN; i++) { struct gpio_pin *pin; @@ -398,7 +547,6 @@ nct_attach(device_t dev) sc->busdev = gpiobus_attach_bus(dev); if (sc->busdev == NULL) { - GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK_DESTROY(sc); return (ENXIO); } @@ -414,6 +562,8 @@ nct_detach(device_t dev) sc = device_get_softc(dev); gpiobus_detach_bus(dev); + if (sc->iores != NULL) + bus_release_resource(dev, SYS_RES_IOPORT, sc->iorid, sc->iores); GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK_DESTROY(sc); @@ -447,8 +597,11 @@ nct_gpio_pin_set(device_t dev, uint32_t pin_num, uint3 return (EINVAL); sc = device_get_softc(dev); - GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK(sc); + if ((sc->pins[pin_num].gp_flags & GPIO_PIN_OUTPUT) == 0) { + GPIO_UNLOCK(sc); + return (EINVAL); + } nct_write_pin(sc, pin_num, pin_value); GPIO_UNLOCK(sc); @@ -483,6 +636,10 @@ nct_gpio_pin_toggle(device_t dev, uint32_t pin_num) sc = device_get_softc(dev); GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK(sc); + if ((sc->pins[pin_num].gp_flags & GPIO_PIN_OUTPUT) == 0) { + GPIO_UNLOCK(sc); + return (EINVAL); + } if (nct_read_pin(sc, pin_num)) nct_write_pin(sc, pin_num, 0); else @@ -558,53 +715,41 @@ nct_gpio_pin_setflags(device_t dev, uint32_t pin_num, if ((flags & pin->gp_caps) != flags) return (EINVAL); - GPIO_ASSERT_UNLOCKED(sc); - GPIO_LOCK(sc); - if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { - if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) == - (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { - GPIO_UNLOCK(sc); - return (EINVAL); - } - - if (flags & GPIO_PIN_INPUT) - nct_set_pin_is_input(sc, pin_num); - else - nct_set_pin_is_output(sc, pin_num); + if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) == + (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { + return (EINVAL); } - - if (flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) { - if (flags & GPIO_PIN_INPUT) { - GPIO_UNLOCK(sc); + if ((flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) == + (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) { return (EINVAL); - } + } + if ((flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) == + (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) { + return (EINVAL); + } - if ((flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) == - (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) { - GPIO_UNLOCK(sc); - return (EINVAL); - } - + GPIO_ASSERT_UNLOCKED(sc); + GPIO_LOCK(sc); + if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) != 0) { + nct_set_pin_input(sc, pin_num, (flags & GPIO_PIN_INPUT) != 0); + pin->gp_flags &= ~(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); + pin->gp_flags |= flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); + } + if ((flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) != 0) { + nct_set_pin_inverted(sc, pin_num, + (flags & GPIO_PIN_INVIN) != 0); + pin->gp_flags &= ~(GPIO_PIN_INVIN | GPIO_PIN_INVOUT); + pin->gp_flags |= flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT); + } + if ((flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) != 0) { if (flags & GPIO_PIN_OPENDRAIN) nct_set_pin_opendrain(sc, pin_num); else nct_set_pin_pushpull(sc, pin_num); + pin->gp_flags &= ~(GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL); + pin->gp_flags |= + flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL); } - - if (flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) { - if ((flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) != - (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) { - GPIO_UNLOCK(sc); - return (EINVAL); - } - - if (flags & GPIO_PIN_INVIN) - nct_set_pin_is_inverted(sc, pin_num); - else - nct_set_pin_not_inverted(sc, pin_num); - } - - pin->gp_flags = flags; GPIO_UNLOCK(sc); return (0); From owner-svn-src-head@freebsd.org Tue Oct 22 14:55:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92A4815CB37; Tue, 22 Oct 2019 14:55:00 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46yGkp6h2Bz3N65; Tue, 22 Oct 2019 14:54:58 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg1-x536.google.com with SMTP id t3so10091816pga.8; Tue, 22 Oct 2019 07:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=n+CZ3y62x65ARvqHZB8K7t9vhrNRrkOUwlwcaNPJtsg=; b=aog64XUqH1oN7FxOfKNg/jayTyCJ7jie/2c8ppbMn3nkRSplZzC/5GPJJubQVVbuVx CryDAnhsJ0zi57HxAQUFa5lEMr3CReNiJvv2FCYKJwWy5ITHu2UJ34ZjeRVST2pBZ08S 5qSGP7KK8QJGLnxOq+fgPA9pHtfFe1tISMZwQqywxcc526E38ResuamtEtQvFFC6kNJj wlQCGJ+gySRzrfnM3uVYFJMKVh/Lq/8deh5soRy/lkpxCDXtOeFgyDUhwbbIx7+qIYbd Kj+9nT7LtAabzwg5sVPiozn+5GK1vobPaO9o11JUlMdXwZBtod0D7t5hKH/2ObcU/bl0 x27g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=n+CZ3y62x65ARvqHZB8K7t9vhrNRrkOUwlwcaNPJtsg=; b=O9X8g18fTbQAxoGh9uJvYUHIFJe63OXkwf9W3FB2E/PVtWyQW2lMBhGp7ydIYQzsEn pg0defUxFEfcAbdp4ETmGnKsUqorGUKUVMJi907O8cmiBQEl9D+j+pYZaCW2cRf30n5a yM9OJvANJzDq4H20uXoPyu0Fcwo3TjCcpEiJw9BMYdpqcyXEsKC/Lgp+bijiHPQWMAVr 6HZ7D7syiMeKvcXehwKtVZhXZOLSG2E5Rv1NPLVz32Sp+gX22VbG9iEBDXlmv51fBnp1 69xWN7szNRELkkg85sBLwcnHq4BZK2Psc7ZcsfZJdNCVPgDCn3qq6qaJL4Fv7Vy7uQMG WPjA== X-Gm-Message-State: APjAAAWZn3WQTg7mw6KVplnUbDJzqVLblLKkTN288yew4xk+pL4E0kzS hVSs9iCASDINwilyfe55TTUlahoZlqo= X-Google-Smtp-Source: APXvYqytO06+rxWzntSoNJrYuh1+g/MeTvJXgizUvMiXQm1N7Y88qD3ktNjx9rIv5qTulQCrISOS+w== X-Received: by 2002:a63:950c:: with SMTP id p12mr4471880pgd.238.1571756096986; Tue, 22 Oct 2019 07:54:56 -0700 (PDT) Received: from [192.168.20.22] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id p24sm29394018pgc.72.2019.10.22.07.54.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Oct 2019 07:54:56 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Enji Cooper Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r353732 - head/sys/net Date: Tue, 22 Oct 2019 07:53:31 -0700 Message-Id: <21F302BD-CF03-4129-B5DD-7DC3BE481152@gmail.com> References: <201910181520.x9IFKOd2094171@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201910181520.x9IFKOd2094171@repo.freebsd.org> To: Gleb Smirnoff X-Mailer: iPhone Mail (17A878) X-Rspamd-Queue-Id: 46yGkp6h2Bz3N65 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=aog64XUq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::536 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RECEIVED_SPAMHAUS_PBL(0.00)[228.52.19.73.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (-8.17), ipnet: 2607:f8b0::/32(-2.43), asn: 15169(-2.07), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[6.3.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 14:55:00 -0000 > On Oct 18, 2019, at 08:20, Gleb Smirnoff wrote: >=20 > =EF=BB=BFAuthor: glebius > Date: Fri Oct 18 15:20:24 2019 > New Revision: 353732 > URL: https://svnweb.freebsd.org/changeset/base/353732 >=20 > Log: > Make rt_getifa_fib() static. Why should it be made static? The answer to this question is missing from th= e commit message. -Enji= From owner-svn-src-head@freebsd.org Tue Oct 22 15:26:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7331815D872; Tue, 22 Oct 2019 15:26:50 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yHRY5Fwjz3Q7j; Tue, 22 Oct 2019 15:26:49 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x9MFQkLX086227 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 22 Oct 2019 08:26:46 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9MFQkqA086226; Tue, 22 Oct 2019 08:26:46 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Tue, 22 Oct 2019 08:26:46 -0700 From: Gleb Smirnoff To: Enji Cooper Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353732 - head/sys/net Message-ID: <20191022152646.GI4086@FreeBSD.org> References: <201910181520.x9IFKOd2094171@repo.freebsd.org> <21F302BD-CF03-4129-B5DD-7DC3BE481152@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <21F302BD-CF03-4129-B5DD-7DC3BE481152@gmail.com> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46yHRY5Fwjz3Q7j X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.54 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.544,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 15:26:50 -0000 On Tue, Oct 22, 2019 at 07:53:31AM -0700, Enji Cooper wrote: E> > Author: glebius E> > Date: Fri Oct 18 15:20:24 2019 E> > New Revision: 353732 E> > URL: https://svnweb.freebsd.org/changeset/base/353732 E> > E> > Log: E> > Make rt_getifa_fib() static. E> E> Why should it be made static? The answer to this question is missing from the commit message. Because a function used only in a scope of a single file and not intended to be used outside should be made static. -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Tue Oct 22 15:29:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9B5415D929; Tue, 22 Oct 2019 15:29:15 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yHVM3HZXz3QJ0; Tue, 22 Oct 2019 15:29:15 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x9MFTDes086245 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 22 Oct 2019 08:29:13 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9MFTDqM086244; Tue, 22 Oct 2019 08:29:13 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Tue, 22 Oct 2019 08:29:13 -0700 From: Gleb Smirnoff To: Li-Wen Hsu , br@freebsd.org Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r353876 - head/sys/kern Message-ID: <20191022152913.GJ4086@FreeBSD.org> References: <201910212312.x9LNCEbX052414@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46yHVM3HZXz3QJ0 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.95 / 15.00]; NEURAL_HAM_MEDIUM(-0.95)[-0.954,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 15:29:15 -0000 Li-Wen, On Tue, Oct 22, 2019 at 04:28:45PM +0800, Li-Wen Hsu wrote: L> > Modified: head/sys/kern/subr_epoch.c L> > ============================================================================== L> > --- head/sys/kern/subr_epoch.c Mon Oct 21 21:21:34 2019 (r353875) L> > +++ head/sys/kern/subr_epoch.c Mon Oct 21 23:12:14 2019 (r353876) L> > @@ -366,9 +366,13 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et L> > struct thread *td; L> > L> > MPASS(cold || epoch != NULL); L> > - INIT_CHECK(epoch); L> > MPASS(epoch->e_flags & EPOCH_PREEMPT); L> > td = curthread; L> > + MPASS((vm_offset_t)et >= td->td_kstack && L> > + (vm_offset_t)et + sizeof(struct epoch_tracker) < L> > + td->td_kstack + td->td_kstack_pages * PAGE_SIZE); L> > + L> > + INIT_CHECK(epoch); L> > #ifdef EPOCH_TRACE L> > epoch_trace_enter(td, epoch, et, file, line); L> > #endif L> L> Hello Gleb, L> L> RISC-V boot panics with this message: L> L> panic: Assertion (vm_offset_t)et >= td->td_kstack && (vm_offset_t)et + L> sizeof(struct epoch_tracker) < td->td_kstack + td->td_kstack_pages * L> PAGE_SIZE failed at /workspace/src/sys/kern/subr_epoch.c:373 L> L> Full log: https://ci.freebsd.org/job/FreeBSD-head-riscv64-test/12334/console L> L> Can you help check this? I need help from RISC-V experts. Can you please meanwhile print out values of et and td->td_kstack? -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Tue Oct 22 15:33:58 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 866CD15DB3F; Tue, 22 Oct 2019 15:33:58 +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) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46yHbn3qk2z3Qqv; Tue, 22 Oct 2019 15:33:57 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 9326C260105; Tue, 22 Oct 2019 17:33:48 +0200 (CEST) Subject: Re: svn commit: r353876 - head/sys/kern To: Gleb Smirnoff , Li-Wen Hsu , br@freebsd.org Cc: src-committers , svn-src-all , svn-src-head References: <201910212312.x9LNCEbX052414@repo.freebsd.org> <20191022152913.GJ4086@FreeBSD.org> From: Hans Petter Selasky Message-ID: <55116590-d3ca-00ea-29c6-f32adfcdea9e@selasky.org> Date: Tue, 22 Oct 2019 17:31:27 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <20191022152913.GJ4086@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46yHbn3qk2z3Qqv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-4.93 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[6]; IP_SCORE(-2.63)[ip: (-9.16), ipnet: 2a01:4f8::/29(-2.15), asn: 24940(-1.82), country: DE(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 15:33:58 -0000 On 2019-10-22 17:29, Gleb Smirnoff wrote: > L> > L> panic: Assertion (vm_offset_t)et >= td->td_kstack && (vm_offset_t)et + > L> sizeof(struct epoch_tracker) < td->td_kstack + td->td_kstack_pages * > L> PAGE_SIZE failed at /workspace/src/sys/kern/subr_epoch.c:373 Probably doesn't matter that much, but the last comparison should be less than or equal, instead of only less than, off-by-one, if the element is on top of stack ??? sizeof(struct epoch_tracker) XXX <= XXX td->td_kstack + td->td_kstack_pages --HPS From owner-svn-src-head@freebsd.org Tue Oct 22 15:40:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 921CB15DCA8; Tue, 22 Oct 2019 15:40:41 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46yHlY3H9sz3RJl; Tue, 22 Oct 2019 15:40:41 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x741.google.com with SMTP id w2so16663838qkf.2; Tue, 22 Oct 2019 08:40:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=i3VHXEVUeWf/W/lIellzl2O2hyjwBWYQ3Rtd5M48ETI=; b=MJP2olE1FNAKAwS8OSr10uvfWFpTvc5LMT2GRs1Y1qAUH0iQruF9IfVs8N3EZ39eBz Uxvm94HxrtCDT/NyDWdoIdD49vh43LrB0mIix9Gu+EJmm7QfMSC4FC/gYQdruoCQRjqo Au/wPTR7+pU+kuGqtWIoxg0HaL20I5tISOll1nqyTKL4Epr8FBDxSRmiC4pI9q6qkp/r 8v0v9tq3NE1TWgkPr/ZHMq0M4cfS7x3CMGvL0DroGE6zHVJmYPd/KedEdo/CmvewrtHi UrRXUp7AsCOpDrTFX/3fYCMvoL0Vhy8ss6eGYYu0k87vuLZTFJtojnOojfw1q2Qo4cXf HiZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=i3VHXEVUeWf/W/lIellzl2O2hyjwBWYQ3Rtd5M48ETI=; b=MXIYZWgu4w0dFZH8rZQCEC9Pr9LGBVkffCdnLcTsuax8rEIe3TLD7juC5fWenaTPN6 1sagPlRzzBaRQX/9KD7kFo4/7d8JIDnGoOuaKMQAdPQIp1IAV9LVxXE9PChcbc4OPhGj /1J5Zqi1pKc+kac3ict0cVLupqYauag8MQVzoBWDDITlfO7UkyniCHKpLiWZ4FMbZa34 X1Nxm8xriyjiKhdBK8uxWWn9y7U4hSHCLSNVGrHtPJjGGgQZz3XHLVioO1pHWL5ZUBup dPbS85z2f0wMJqiDgliTwUUmQeTwLR4XZPyejuBGeDDefbUox8R0i7uiSOkSMvBTlCUt i26A== X-Gm-Message-State: APjAAAX8EITCvzk4M8LjKZrJOv2oo1TP9SyroJ9utN25MJBZtaqd1sNq niAOSfGZec3aEvKFvQgyK5vyQZmK X-Google-Smtp-Source: APXvYqymhEvJOl9gcqYbUUnPUh+YLcEhCfcIloBs7S2ukH+l9T2Ay1brp0MUevvIhUS2wAkSQvkR7A== X-Received: by 2002:a37:a448:: with SMTP id n69mr3595498qke.325.1571758839613; Tue, 22 Oct 2019 08:40:39 -0700 (PDT) Received: from raichu (toroon0560w-lp130-05-69-158-183-252.dsl.bell.ca. [69.158.183.252]) by smtp.gmail.com with ESMTPSA id a15sm1448541qtp.77.2019.10.22.08.40.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 08:40:38 -0700 (PDT) Sender: Mark Johnston Date: Tue, 22 Oct 2019 11:40:36 -0400 From: Mark Johnston To: Gleb Smirnoff Cc: Li-Wen Hsu , br@freebsd.org, src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r353876 - head/sys/kern Message-ID: <20191022154036.GE540@raichu> References: <201910212312.x9LNCEbX052414@repo.freebsd.org> <20191022152913.GJ4086@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191022152913.GJ4086@FreeBSD.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46yHlY3H9sz3RJl X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.985,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 15:40:41 -0000 On Tue, Oct 22, 2019 at 08:29:13AM -0700, Gleb Smirnoff wrote: > Li-Wen, > > On Tue, Oct 22, 2019 at 04:28:45PM +0800, Li-Wen Hsu wrote: > L> > Modified: head/sys/kern/subr_epoch.c > L> > ============================================================================== > L> > --- head/sys/kern/subr_epoch.c Mon Oct 21 21:21:34 2019 (r353875) > L> > +++ head/sys/kern/subr_epoch.c Mon Oct 21 23:12:14 2019 (r353876) > L> > @@ -366,9 +366,13 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et > L> > struct thread *td; > L> > > L> > MPASS(cold || epoch != NULL); > L> > - INIT_CHECK(epoch); > L> > MPASS(epoch->e_flags & EPOCH_PREEMPT); > L> > td = curthread; > L> > + MPASS((vm_offset_t)et >= td->td_kstack && > L> > + (vm_offset_t)et + sizeof(struct epoch_tracker) < > L> > + td->td_kstack + td->td_kstack_pages * PAGE_SIZE); > L> > + > L> > + INIT_CHECK(epoch); > L> > #ifdef EPOCH_TRACE > L> > epoch_trace_enter(td, epoch, et, file, line); > L> > #endif > L> > L> Hello Gleb, > L> > L> RISC-V boot panics with this message: > L> > L> panic: Assertion (vm_offset_t)et >= td->td_kstack && (vm_offset_t)et + > L> sizeof(struct epoch_tracker) < td->td_kstack + td->td_kstack_pages * > L> PAGE_SIZE failed at /workspace/src/sys/kern/subr_epoch.c:373 > L> > L> Full log: https://ci.freebsd.org/job/FreeBSD-head-riscv64-test/12334/console > L> > L> Can you help check this? > > I need help from RISC-V experts. I suspect the problem is that init_proc0() on several arches does not initialize td_kstack_pages. I will test this patch and commit if it fixes the panic. Note that on arm64 and riscv thread0's kernel stack is statically allocated. diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index dc0a84404f02..990c3df49328 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -771,6 +771,7 @@ init_proc0(vm_offset_t kstack) { proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; + thread0.td_kstack_pages = kstack_pages; thread0.td_pcb = (struct pcb *) (thread0.td_kstack + kstack_pages * PAGE_SIZE) - 1; thread0.td_pcb->pcb_flags = 0; diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 4356add12aa0..967e1deaa55e 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -745,6 +745,7 @@ init_proc0(vm_offset_t kstack) proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; + thread0.td_kstack_pages = KSTACK_PAGES; thread0.td_pcb = (struct pcb *)(thread0.td_kstack) - 1; thread0.td_pcb->pcb_fpflags = 0; thread0.td_pcb->pcb_fpusaved = &thread0.td_pcb->pcb_fpustate; diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c index e01f7e42895d..07113534706e 100644 --- a/sys/riscv/riscv/machdep.c +++ b/sys/riscv/riscv/machdep.c @@ -658,6 +658,7 @@ init_proc0(vm_offset_t kstack) proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; + thread0.td_kstack_pages = KSTACK_PAGES; thread0.td_pcb = (struct pcb *)(thread0.td_kstack) - 1; thread0.td_pcb->pcb_fpflags = 0; thread0.td_frame = &proc0_tf; From owner-svn-src-head@freebsd.org Tue Oct 22 15:51:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81DE515DFDF; Tue, 22 Oct 2019 15:51:07 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f193.google.com (mail-oi1-f193.google.com [209.85.167.193]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46yHzZ1hfzz3wyp; Tue, 22 Oct 2019 15:51:05 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f193.google.com with SMTP id 83so14637538oii.1; Tue, 22 Oct 2019 08:51:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1lAivZ/PejKRaDklOO3ee6kcG8Bv1t1oGUsOe7JVTHo=; b=WRyHtOpva9ygtHv7SyRoYDN5xtmEneB2Xe5aGjNJRt9ncZUONlFVpowiD5msiiLLhh SY12vv6pVVyXRNsOqxaXsj0cmE3tbdv2oAlV2nivSgF/UcHs7Y8r6ILlxHIYP9bm4Y/G jBHPVJU23gfA4sHC/U/QyhRqY3uTIFLnEM91cp5zP5QS2R/yJpoMBRj2r6ZRyz2a902Y MjnGCo6R0QJthkHF+OAF7BpI/ETPR72jdUSMd55XsLsMu/MyVWOXnHNzBSonmxzui0Rq hiNw2ov6KVqwQaZxcSMtBpTO6ylAamkqiCJR1SLgLOjwNDfIE95aOI7AIKeLZQwp1VFM yq1Q== X-Gm-Message-State: APjAAAVPUjdXuR9AnT3jSuqM4849g4c3wmqtYJi3YZrTOHtEmMmYu1xL mthKU55n9SECsTAcr7Vurp1j4KTV0BR/VdkIaxlJfntE X-Google-Smtp-Source: APXvYqwXMu0i06dhEEm3fzhrks5rMElr6c41XXU1q6KQtXj3YX5eTNVBNjrCozfmhKUt5tVNpCE6LZp4OHEH3v/phaE= X-Received: by 2002:a54:480d:: with SMTP id j13mr457227oij.55.1571759464580; Tue, 22 Oct 2019 08:51:04 -0700 (PDT) MIME-Version: 1.0 References: <201910161321.x9GDL2ee021543@repo.freebsd.org> In-Reply-To: <201910161321.x9GDL2ee021543@repo.freebsd.org> From: Alan Somers Date: Tue, 22 Oct 2019 09:50:53 -0600 Message-ID: Subject: Re: svn commit: r353640 - head/sys/kern To: Andrew Turner Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46yHzZ1hfzz3wyp X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.167.193 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-2.06 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; URI_COUNT_ODD(1.00)[3]; IP_SCORE(-1.07)[ipnet: 209.85.128.0/17(-3.23), asn: 15169(-2.07), country: US(-0.05)]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[193.167.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[193.167.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+,1:+,2:~]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 15:51:07 -0000 On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner wrote: > Author: andrew > Date: Wed Oct 16 13:21:01 2019 > New Revision: 353640 > URL: https://svnweb.freebsd.org/changeset/base/353640 > > Log: > Stop leaking information from the kernel through timespec > > The timespec struct holds a seconds value in a time_t and a nanoseconds > value in a long. On most architectures these are the same size, however > on 32-bit architectures other than i386 time_t is 8 bytes and long is > 4 bytes. > > Most ABIs will then pad a struct holding an 8 byte and 4 byte value to > 16 bytes with 4 bytes of padding. When copying one of these structs the > compiler is free to copy the padding if it wishes. > > In this case the padding may contain kernel data that is then leaked to > userspace. Fix this by copying the timespec elements rather than the > entire struct. > > This doesn't affect Tier-1 architectures so no SA is expected. > > admbugs: 651 > MFC after: 1 week > Sponsored by: DARPA, AFRL > Good catch. Might I ask how you found it, or who reported it? From owner-svn-src-head@freebsd.org Tue Oct 22 15:59:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B55EF15E48A; Tue, 22 Oct 2019 15:59:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yJ904KlKz3xXW; Tue, 22 Oct 2019 15:59:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 780F2EAA9; Tue, 22 Oct 2019 15:59:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MFxGiP047534; Tue, 22 Oct 2019 15:59:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MFxG2R047533; Tue, 22 Oct 2019 15:59:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910221559.x9MFxG2R047533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 22 Oct 2019 15:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353888 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353888 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 15:59:16 -0000 Author: kib Date: Tue Oct 22 15:59:16 2019 New Revision: 353888 URL: https://svnweb.freebsd.org/changeset/base/353888 Log: vm_fault(): extract code to lock the vnode into a helper vn_fault_lock_vnode(). Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D21883 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Oct 22 14:20:35 2019 (r353887) +++ head/sys/vm/vm_fault.c Tue Oct 22 15:59:16 2019 (r353888) @@ -628,19 +628,62 @@ vm_fault_trap(vm_map_t map, vm_offset_t vaddr, vm_prot return (result); } +static int +vm_fault_lock_vnode(struct faultstate *fs) +{ + struct vnode *vp; + int error, locked; + + if (fs->object->type != OBJT_VNODE) + return (KERN_SUCCESS); + vp = fs->object->handle; + if (vp == fs->vp) + return (KERN_SUCCESS); + + /* + * Perform an unlock in case the desired vnode changed while + * the map was unlocked during a retry. + */ + unlock_vp(fs); + + locked = VOP_ISLOCKED(vp); + if (locked != LK_EXCLUSIVE) + locked = LK_SHARED; + + /* + * We must not sleep acquiring the vnode lock while we have + * the page exclusive busied or the object's + * paging-in-progress count incremented. Otherwise, we could + * deadlock. + */ + error = vget(vp, locked | LK_CANRECURSE | LK_NOWAIT, curthread); + if (error == 0) { + fs->vp = vp; + return (KERN_SUCCESS); + } + + vhold(vp); + release_page(fs); + unlock_and_deallocate(fs); + error = vget(vp, locked | LK_RETRY | LK_CANRECURSE, curthread); + vdrop(vp); + fs->vp = vp; + KASSERT(error == 0, ("vm_fault: vget failed %d", error)); + return (KERN_RESOURCE_SHORTAGE); +} + int vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, int fault_flags, vm_page_t *m_hold) { struct faultstate fs; - struct vnode *vp; struct domainset *dset; vm_object_t next_object, retry_object; vm_offset_t e_end, e_start; vm_pindex_t retry_pindex; vm_prot_t prot, retry_prot; - int ahead, alloc_req, behind, cluster_offset, error, era, faultcount; - int locked, nera, oom, result, rv; + int ahead, alloc_req, behind, cluster_offset, era, faultcount; + int nera, oom, result, rv; u_char behavior; boolean_t wired; /* Passed by reference. */ bool dead, hardfault, is_first_object_locked; @@ -1001,41 +1044,11 @@ readrest: */ unlock_map(&fs); - if (fs.object->type == OBJT_VNODE && - (vp = fs.object->handle) != fs.vp) { - /* - * Perform an unlock in case the desired vnode - * changed while the map was unlocked during a - * retry. - */ - unlock_vp(&fs); - - locked = VOP_ISLOCKED(vp); - if (locked != LK_EXCLUSIVE) - locked = LK_SHARED; - - /* - * We must not sleep acquiring the vnode lock - * while we have the page exclusive busied or - * the object's paging-in-progress count - * incremented. Otherwise, we could deadlock. - */ - error = vget(vp, locked | LK_CANRECURSE | - LK_NOWAIT, curthread); - if (error != 0) { - vhold(vp); - release_page(&fs); - unlock_and_deallocate(&fs); - error = vget(vp, locked | LK_RETRY | - LK_CANRECURSE, curthread); - vdrop(vp); - fs.vp = vp; - KASSERT(error == 0, - ("vm_fault: vget failed")); - goto RetryFault; - } - fs.vp = vp; - } + rv = vm_fault_lock_vnode(&fs); + MPASS(rv == KERN_SUCCESS || + rv == KERN_RESOURCE_SHORTAGE); + if (rv == KERN_RESOURCE_SHORTAGE) + goto RetryFault; KASSERT(fs.vp == NULL || !fs.map->system_map, ("vm_fault: vnode-backed object mapped by system map")); From owner-svn-src-head@freebsd.org Tue Oct 22 16:06:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AB7A15E88E; Tue, 22 Oct 2019 16:06:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yJKQ1J14z3y8s; Tue, 22 Oct 2019 16:06:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 109E4EC9C; Tue, 22 Oct 2019 16:06:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MG6Xp1053239; Tue, 22 Oct 2019 16:06:33 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MG6XQB053238; Tue, 22 Oct 2019 16:06:33 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910221606.x9MG6XQB053238@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 22 Oct 2019 16:06:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353889 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:06:34 -0000 Author: glebius Date: Tue Oct 22 16:06:33 2019 New Revision: 353889 URL: https://svnweb.freebsd.org/changeset/base/353889 Log: Execute nd6_dad_timer() in the network epoch, since nd6_dad_duplicated() requires it. Make nd6_dad_starttimer() require network epoch. Two calls out of three happen from nd6_dad_timer(). Enter epoch in the remaining one. Modified: head/sys/netinet6/nd6_nbr.c Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Tue Oct 22 15:59:16 2019 (r353888) +++ head/sys/netinet6/nd6_nbr.c Tue Oct 22 16:06:33 2019 (r353889) @@ -1192,13 +1192,10 @@ static void nd6_dad_starttimer(struct dadq *dp, int ticks, int send_ns) { - if (send_ns != 0) { - struct epoch_tracker et; + NET_EPOCH_ASSERT(); - NET_EPOCH_ENTER(et); + if (send_ns != 0) nd6_dad_ns_output(dp); - NET_EPOCH_EXIT(et); - } callout_reset(&dp->dad_timer_ch, ticks, (void (*)(void *))nd6_dad_timer, (void *)dp); } @@ -1237,6 +1234,7 @@ nd6_dad_start(struct ifaddr *ifa, int delay) struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; struct dadq *dp; char ip6buf[INET6_ADDRSTRLEN]; + struct epoch_tracker et; KASSERT((ia->ia6_flags & IN6_IFF_TENTATIVE) != 0, ("starting DAD on non-tentative address %p", ifa)); @@ -1298,7 +1296,9 @@ nd6_dad_start(struct ifaddr *ifa, int delay) /* Add this to the dadq and add a reference for the dadq. */ refcount_init(&dp->dad_refcnt, 1); nd6_dad_add(dp); + NET_EPOCH_ENTER(et); nd6_dad_starttimer(dp, delay, 0); + NET_EPOCH_EXIT(et); } /* @@ -1330,9 +1330,11 @@ nd6_dad_timer(struct dadq *dp) struct ifnet *ifp = dp->dad_ifa->ifa_ifp; struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; char ip6buf[INET6_ADDRSTRLEN]; + struct epoch_tracker et; KASSERT(ia != NULL, ("DAD entry %p with no address", dp)); + NET_EPOCH_ENTER(et); if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) { /* Do not need DAD for ifdisabled interface. */ log(LOG_ERR, "nd6_dad_timer: cancel DAD on %s because of " @@ -1429,6 +1431,7 @@ nd6_dad_timer(struct dadq *dp) err: nd6_dad_del(dp); done: + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); } From owner-svn-src-head@freebsd.org Tue Oct 22 16:09:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4824F15EA61; Tue, 22 Oct 2019 16:09:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yJNl1DxJz3yPJ; Tue, 22 Oct 2019 16:09:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AB7DECA5; Tue, 22 Oct 2019 16:09:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MG9Qqe053424; Tue, 22 Oct 2019 16:09:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MG9Q4x053420; Tue, 22 Oct 2019 16:09:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910221609.x9MG9Q4x053420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 22 Oct 2019 16:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353890 - in head/sys: sys vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: sys vm X-SVN-Commit-Revision: 353890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:09:27 -0000 Author: kib Date: Tue Oct 22 16:09:25 2019 New Revision: 353890 URL: https://svnweb.freebsd.org/changeset/base/353890 Log: Add VV_VMSIZEVNLOCK flag. The flag specifies that vm_fault() handler should check the vnode' vm_object size under the vnode lock. It is converted into the object' OBJ_SIZEVNLOCK flag in vnode_pager_alloc(). Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D21883 Modified: head/sys/sys/vnode.h head/sys/vm/vm_fault.c head/sys/vm/vm_object.h head/sys/vm/vnode_pager.c Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Tue Oct 22 16:06:33 2019 (r353889) +++ head/sys/sys/vnode.h Tue Oct 22 16:09:25 2019 (r353890) @@ -247,6 +247,7 @@ struct xvnode { #define VV_NOSYNC 0x0004 /* unlinked, stop syncing */ #define VV_ETERNALDEV 0x0008 /* device that is never destroyed */ #define VV_CACHEDLABEL 0x0010 /* Vnode has valid cached MAC label */ +#define VV_VMSIZEVNLOCK 0x0020 /* object size check requires vnode lock */ #define VV_COPYONWRITE 0x0040 /* vnode is doing copy-on-write */ #define VV_SYSTEM 0x0080 /* vnode being used by kernel */ #define VV_PROCDEP 0x0100 /* vnode is process dependent */ Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Oct 22 16:06:33 2019 (r353889) +++ head/sys/vm/vm_fault.c Tue Oct 22 16:09:25 2019 (r353890) @@ -887,6 +887,13 @@ RetryFault_oom: */ if (fs.object->type != OBJT_DEFAULT || fs.object == fs.first_object) { + if ((fs.object->flags & OBJ_SIZEVNLOCK) != 0) { + rv = vm_fault_lock_vnode(&fs); + MPASS(rv == KERN_SUCCESS || + rv == KERN_RESOURCE_SHORTAGE); + if (rv == KERN_RESOURCE_SHORTAGE) + goto RetryFault; + } if (fs.pindex >= fs.object->size) { unlock_and_deallocate(&fs); return (KERN_OUT_OF_BOUNDS); Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Tue Oct 22 16:06:33 2019 (r353889) +++ head/sys/vm/vm_object.h Tue Oct 22 16:09:25 2019 (r353890) @@ -186,6 +186,7 @@ struct vm_object { #define OBJ_DEAD 0x0008 /* dead objects (during rundown) */ #define OBJ_NOSPLIT 0x0010 /* dont split this object */ #define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */ +#define OBJ_SIZEVNLOCK 0x0040 /* lock vnode to check obj size */ #define OBJ_PG_DTOR 0x0080 /* dont reset object, leave that for dtor */ #define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */ #define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */ Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Tue Oct 22 16:06:33 2019 (r353889) +++ head/sys/vm/vnode_pager.c Tue Oct 22 16:09:25 2019 (r353890) @@ -269,8 +269,12 @@ retry: object->un_pager.vnp.vnp_size = size; object->un_pager.vnp.writemappings = 0; object->domain.dr_policy = vnode_domainset; - object->handle = handle; + if ((vp->v_vflag & VV_VMSIZEVNLOCK) != 0) { + VM_OBJECT_WLOCK(object); + vm_object_set_flag(object, OBJ_SIZEVNLOCK); + VM_OBJECT_WUNLOCK(object); + } VI_LOCK(vp); if (vp->v_object != NULL) { /* From owner-svn-src-head@freebsd.org Tue Oct 22 16:17:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0DA415ED84; Tue, 22 Oct 2019 16:17:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yJZD3ZYKz4034; Tue, 22 Oct 2019 16:17:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F772EE75; Tue, 22 Oct 2019 16:17:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MGHeQm059399; Tue, 22 Oct 2019 16:17:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MGHd32059393; Tue, 22 Oct 2019 16:17:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910221617.x9MGHd32059393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 22 Oct 2019 16:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353891 - in head/sys/fs: nfs nfsclient X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 353891 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:17:40 -0000 Author: kib Date: Tue Oct 22 16:17:38 2019 New Revision: 353891 URL: https://svnweb.freebsd.org/changeset/base/353891 Log: Fix interface between nfsclient and vnode pager. Make the nfsclient always call vnode_pager_setsize() with the vnode exclusively locked. This ensures that page fault always can find the backing page if the object size check succeeded. Set VV_VMSIZEVNLOCK flag on NFS nodes. The main offender breaking the interface in nfsclient is nfs_loadattrcache(), which is used whenever server responded with updated attributes, which can happen on non-changing operations as well. Also, iod threads only have buffers locked (and even that is LK_KERNPROC), but they still may call nfs_loadattrcache() on RPC response. Instead of immediately calling vnode_pager_setsize() if server response indicated changed file size, but the vnode is not exclusively locked, set a new node flag NVNSETSZSKIP. When the vnode exclusively locked, or when we can temporary upgrade the lock to exclusive, call vnode_pager_setsize(), by providing the nfsclient VOP_LOCK() implementation. Tested by: pho Discussed with: rmacklem Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D21883 Modified: head/sys/fs/nfs/nfsport.h head/sys/fs/nfsclient/nfs_clnode.c head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clsubs.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/nfsclient/nfsnode.h Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Tue Oct 22 16:09:25 2019 (r353890) +++ head/sys/fs/nfs/nfsport.h Tue Oct 22 16:17:38 2019 (r353891) @@ -878,6 +878,7 @@ MALLOC_DECLARE(M_NEWNFSDSESSION); int nfscl_loadattrcache(struct vnode **, struct nfsvattr *, void *, void *, int, int); int newnfs_realign(struct mbuf **, int); +bool ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep); /* * If the port runs on an SMP box that can enforce Atomic ops with low Modified: head/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clnode.c Tue Oct 22 16:09:25 2019 (r353890) +++ head/sys/fs/nfsclient/nfs_clnode.c Tue Oct 22 16:17:38 2019 (r353891) @@ -162,6 +162,8 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize vp->v_type = VDIR; vp->v_vflag |= VV_ROOT; } + + vp->v_vflag |= VV_VMSIZEVNLOCK; np->n_fhp = malloc(sizeof (struct nfsfh) + fhsize, M_NFSFH, M_WAITOK); Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Tue Oct 22 16:09:25 2019 (r353890) +++ head/sys/fs/nfsclient/nfs_clport.c Tue Oct 22 16:17:38 2019 (r353891) @@ -246,6 +246,8 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru vp->v_type = VDIR; vp->v_vflag |= VV_ROOT; } + + vp->v_vflag |= VV_VMSIZEVNLOCK; np->n_fhp = nfhp; /* @@ -414,10 +416,7 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt struct nfsnode *np; struct nfsmount *nmp; struct timespec mtime_save; - vm_object_t object; - u_quad_t nsize; int error, force_fid_err; - bool setnsize; error = 0; @@ -565,27 +564,53 @@ out: if (np->n_attrstamp != 0) KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error); #endif + (void)ncl_pager_setsize(vp, NULL); + return (error); +} + +/* + * Call vnode_pager_setsize() if the size of the node changed, as + * recorded in nfsnode vs. v_object, or delay the call if notifying + * the pager is not possible at the moment. + * + * If nsizep is non-NULL, the call is delayed and the new node size is + * provided. Caller should itself call vnode_pager_setsize() if + * function returned true. If nsizep is NULL, function tries to call + * vnode_pager_setsize() itself if needed and possible, and the nfs + * node is unlocked unconditionally, the return value is not useful. + */ +bool +ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep) +{ + struct nfsnode *np; + vm_object_t object; + struct vattr *vap; + u_quad_t nsize; + bool setnsize; + + np = VTONFS(vp); + NFSASSERTNODE(np); + + vap = &np->n_vattr.na_vattr; nsize = vap->va_size; object = vp->v_object; setnsize = false; - if (object != NULL) { - if (OFF_TO_IDX(nsize + PAGE_MASK) < object->size) { - /* - * When shrinking the size, the call to - * vnode_pager_setsize() cannot be done with - * the mutex held, because we might need to - * wait for a busy page. Delay it until after - * the node is unlocked. - */ + + if (object != NULL && nsize != object->un_pager.vnp.vnp_size) { + if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) setnsize = true; - } else { + else + np->n_flag |= NVNSETSZSKIP; + } + if (nsizep == NULL) { + NFSUNLOCKNODE(np); + if (setnsize) vnode_pager_setsize(vp, nsize); - } + setnsize = false; + } else { + *nsizep = nsize; } - NFSUNLOCKNODE(np); - if (setnsize) - vnode_pager_setsize(vp, nsize); - return (error); + return (setnsize); } /* Modified: head/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clsubs.c Tue Oct 22 16:09:25 2019 (r353890) +++ head/sys/fs/nfsclient/nfs_clsubs.c Tue Oct 22 16:17:38 2019 (r353891) @@ -185,6 +185,8 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper struct vattr *vap; struct nfsmount *nmp; int timeo, mustflush; + u_quad_t nsize; + bool setnsize; np = VTONFS(vp); vap = &np->n_vattr.na_vattr; @@ -230,6 +232,7 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper return( ENOENT); } nfsstatsv1.attrcache_hits++; + setnsize = false; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { if (np->n_flag & NMODIFIED) { @@ -240,7 +243,7 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper } else { np->n_size = vap->va_size; } - vnode_pager_setsize(vp, np->n_size); + setnsize = ncl_pager_setsize(vp, &nsize); } else { np->n_size = vap->va_size; } @@ -253,6 +256,8 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper vaper->va_mtime = np->n_mtim; } NFSUNLOCKNODE(np); + if (setnsize) + vnode_pager_setsize(vp, nsize); KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap); return (0); } Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Tue Oct 22 16:09:25 2019 (r353890) +++ head/sys/fs/nfsclient/nfs_clvnops.c Tue Oct 22 16:17:38 2019 (r353891) @@ -142,6 +142,7 @@ static vop_advlock_t nfs_advlock; static vop_advlockasync_t nfs_advlockasync; static vop_getacl_t nfs_getacl; static vop_setacl_t nfs_setacl; +static vop_lock1_t nfs_lock; /* * Global vfs data structures for nfs @@ -160,6 +161,7 @@ static struct vop_vector newnfs_vnodeops_nosig = { .vop_putpages = ncl_putpages, .vop_inactive = ncl_inactive, .vop_link = nfs_link, + .vop_lock1 = nfs_lock, .vop_lookup = nfs_lookup, .vop_mkdir = nfs_mkdir, .vop_mknod = nfs_mknod, @@ -294,6 +296,73 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_allow_mmap rep->r_mtx * rep->r_mtx : Protects the fields in an nfsreq. */ + +static int +nfs_lock(struct vop_lock1_args *ap) +{ + struct vnode *vp; + struct nfsnode *np; + u_quad_t nsize; + int error, lktype; + bool onfault; + + vp = ap->a_vp; + lktype = ap->a_flags & LK_TYPE_MASK; + error = VOP_LOCK1_APV(&default_vnodeops, ap); + if (error != 0 || vp->v_op != &newnfs_vnodeops) + return (error); + np = VTONFS(vp); + NFSLOCKNODE(np); + if ((np->n_flag & NVNSETSZSKIP) == 0 || (lktype != LK_SHARED && + lktype != LK_EXCLUSIVE && lktype != LK_UPGRADE && + lktype != LK_TRYUPGRADE)) { + NFSUNLOCKNODE(np); + return (0); + } + onfault = (ap->a_flags & LK_EATTR_MASK) == LK_NOWAIT && + (ap->a_flags & LK_INIT_MASK) == LK_CANRECURSE && + (lktype == LK_SHARED || lktype == LK_EXCLUSIVE); + if (onfault && vp->v_vnlock->lk_recurse == 0) { + /* + * Force retry in vm_fault(), to make the lock request + * sleepable, which allows us to piggy-back the + * sleepable call to vnode_pager_setsize(). + */ + NFSUNLOCKNODE(np); + VOP_UNLOCK(vp, 0); + return (EBUSY); + } + if ((ap->a_flags & LK_NOWAIT) != 0 || + (lktype == LK_SHARED && vp->v_vnlock->lk_recurse > 0)) { + NFSUNLOCKNODE(np); + return (0); + } + if (lktype == LK_SHARED) { + NFSUNLOCKNODE(np); + VOP_UNLOCK(vp, 0); + ap->a_flags &= ~(LK_TYPE_MASK | LK_INTERLOCK); + ap->a_flags |= LK_EXCLUSIVE; + error = VOP_LOCK1_APV(&default_vnodeops, ap); + if (error != 0 || vp->v_op != &newnfs_vnodeops) + return (error); + NFSLOCKNODE(np); + if ((np->n_flag & NVNSETSZSKIP) == 0) { + NFSUNLOCKNODE(np); + goto downgrade; + } + } + np->n_flag &= ~NVNSETSZSKIP; + nsize = np->n_size; + NFSUNLOCKNODE(np); + vnode_pager_setsize(vp, nsize); +downgrade: + if (lktype == LK_SHARED) { + ap->a_flags &= ~(LK_TYPE_MASK | LK_INTERLOCK); + ap->a_flags |= LK_DOWNGRADE; + (void)VOP_LOCK1_APV(&default_vnodeops, ap); + } + return (0); +} static int nfs34_access_otw(struct vnode *vp, int wmode, struct thread *td, Modified: head/sys/fs/nfsclient/nfsnode.h ============================================================================== --- head/sys/fs/nfsclient/nfsnode.h Tue Oct 22 16:09:25 2019 (r353890) +++ head/sys/fs/nfsclient/nfsnode.h Tue Oct 22 16:17:38 2019 (r353891) @@ -163,6 +163,7 @@ struct nfsnode { #define NWRITEOPENED 0x00040000 /* Has been opened for writing */ #define NHASBEENLOCKED 0x00080000 /* Has been file locked. */ #define NDSCOMMIT 0x00100000 /* Commit is done via the DS. */ +#define NVNSETSZSKIP 0x00200000 /* Skipped vnode_pager_setsize() */ /* * Convert between nfsnode pointers and vnode pointers From owner-svn-src-head@freebsd.org Tue Oct 22 16:21:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3816E15EE75; Tue, 22 Oct 2019 16:21:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yJfY0pxZz40RK; Tue, 22 Oct 2019 16:21:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 002B1EEC7; Tue, 22 Oct 2019 16:21:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MGLOEM062102; Tue, 22 Oct 2019 16:21:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MGLOjW062099; Tue, 22 Oct 2019 16:21:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910221621.x9MGLOjW062099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 22 Oct 2019 16:21:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353892 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs sys vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs sys vm X-SVN-Commit-Revision: 353892 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:21:25 -0000 Author: kib Date: Tue Oct 22 16:21:24 2019 New Revision: 353892 URL: https://svnweb.freebsd.org/changeset/base/353892 Log: Assert that vnode_pager_setsize() is called with the vnode exclusively locked except for filesystems that set the MNTK_VMSETSIZE_BUG, Set the flag for ZFS. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D21883 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/sys/mount.h head/sys/vm/vnode_pager.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Oct 22 16:17:38 2019 (r353891) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Oct 22 16:21:24 2019 (r353892) @@ -1394,6 +1394,7 @@ zfs_domount(vfs_t *vfsp, char *osname) vfsp->mnt_kern_flag |= MNTK_EXTENDED_SHARED; vfsp->mnt_kern_flag |= MNTK_NO_IOPF; /* vn_io_fault can be used */ vfsp->mnt_kern_flag |= MNTK_NOMSYNC; + vfsp->mnt_kern_flag |= MNTK_VMSETSIZE_BUG; /* * The fsid is 64 bits, composed of an 8-bit fs type, which Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Tue Oct 22 16:17:38 2019 (r353891) +++ head/sys/sys/mount.h Tue Oct 22 16:21:24 2019 (r353892) @@ -411,6 +411,7 @@ void __mnt_vnode_markerfree_active(struct vno #define MNTK_UNMAPPED_BUFS 0x00002000 #define MNTK_USES_BCACHE 0x00004000 /* FS uses the buffer cache. */ #define MNTK_TEXT_REFS 0x00008000 /* Keep use ref for text */ +#define MNTK_VMSETSIZE_BUG 0x00010000 #define MNTK_NOASYNC 0x00800000 /* disable async */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Tue Oct 22 16:17:38 2019 (r353891) +++ head/sys/vm/vnode_pager.c Tue Oct 22 16:21:24 2019 (r353892) @@ -444,7 +444,16 @@ vnode_pager_setsize(struct vnode *vp, vm_ooffset_t nsi if ((object = vp->v_object) == NULL) return; -/* ASSERT_VOP_ELOCKED(vp, "vnode_pager_setsize and not locked vnode"); */ +#ifdef DEBUG_VFS_LOCKS + { + struct mount *mp; + + mp = vp->v_mount; + if (mp != NULL && (mp->mnt_kern_flag & MNTK_VMSETSIZE_BUG) == 0) + assert_vop_elocked(vp, + "vnode_pager_setsize and not locked vnode"); + } +#endif VM_OBJECT_WLOCK(object); if (object->type == OBJT_DEAD) { VM_OBJECT_WUNLOCK(object); From owner-svn-src-head@freebsd.org Tue Oct 22 16:35:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3280615F212; Tue, 22 Oct 2019 16:35:18 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46yJyZ0Hyzz413N; Tue, 22 Oct 2019 16:35:17 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf1-x442.google.com with SMTP id h195so10975379pfe.5; Tue, 22 Oct 2019 09:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=LBWVaAZnUfWZzW7If0qTeYULMKgLM6bPt4biAqhQ4WM=; b=p2tStdaui1irzhRezQ/maPMiHxa58jd5d3qpV1ipYWKpwWW59+zwfii72OYy/BXKKC 0EBvr/6NRBgwBemw9dnX91AWSkKLDeqNuBxzLZejPz19txT8bvH/GXIkzUvedRvngrrC eFDmjUILDIJy5Ql/mAd5apPQVHLOrIZjJtnViUSkQ62M7iml6lIjBzV08x0fsx/jAkSV IG8+t0Vjqcx8IrNj+ffA09608DPV3lpCuWe21WE5cNp36uzsP2RmI08JVh6Icua53GJK pmKbTimsgA4GO3dRBEwNdJPpQAtbzUudAUdfwzXlb7YhGpibQ6kP5H3lYEXn4JrU8wbr tCbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=LBWVaAZnUfWZzW7If0qTeYULMKgLM6bPt4biAqhQ4WM=; b=ck1pGlAykaGFkL/3yUBfjb3F0zPT8sGPQ2wwP/OrC44wZzH6siwoj2WBf1kX0MAdUb MR6iwezUpKA5irBpNC2K1gRVJsGJexQDXR/XiX2pfFhCOEsDogLwBGvMaxktDPemsQNw XyZsy8w5kcGq493hUKibodSnSxZao7qnbNJTcGm+NfclqdRNEehzmLrfqnrBgaFlfn26 Xal9aDLdeIQyxXepyDtk675jVDYzX9EkyMXeh4qmI1DXdRzp6M/eeelr8OZOhl5f97Yw CXXA54Yx88ipQdPIipuiFO6TRuOdFep4BJDJi14Og9vz1lFBMONdks9+tj0H6xnebhcS +Trw== X-Gm-Message-State: APjAAAWpScICFCJOobmc5ugW6BE2lRav+S56Iy9R0foLpKQQjuqNaGZk 3aDmOQWc1zx2g34Jrd/UzK53YJ0d X-Google-Smtp-Source: APXvYqyatgwap5YkPwYxKjh0xRFR77/V8+OrRwuBgvtPiUN2bn/p4AtgtCFO4jY9jjUlNib6DpfJGA== X-Received: by 2002:a63:b5b:: with SMTP id a27mr4945273pgl.262.1571762116419; Tue, 22 Oct 2019 09:35:16 -0700 (PDT) Received: from ?IPv6:2607:fb90:8364:7608:20b8:9b0:3e3e:87bc? ([2607:fb90:8364:7608:20b8:9b0:3e3e:87bc]) by smtp.gmail.com with ESMTPSA id p17sm18674270pfn.50.2019.10.22.09.35.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Oct 2019 09:35:15 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Enji Cooper Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r353732 - head/sys/net Date: Tue, 22 Oct 2019 09:35:14 -0700 Message-Id: References: <20191022152646.GI4086@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <20191022152646.GI4086@FreeBSD.org> To: Gleb Smirnoff X-Mailer: iPhone Mail (17A878) X-Rspamd-Queue-Id: 46yJyZ0Hyzz413N X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:35:18 -0000 > On Oct 22, 2019, at 08:26, Gleb Smirnoff wrote: >=20 > =EF=BB=BFOn Tue, Oct 22, 2019 at 07:53:31AM -0700, Enji Cooper wrote: > E> > =EF=BB=BFAuthor: glebius > E> > Date: Fri Oct 18 15:20:24 2019 > E> > New Revision: 353732 > E> > URL: https://svnweb.freebsd.org/changeset/base/353732 > E> >=20 > E> > Log: > E> > Make rt_getifa_fib() static. > E>=20 > E> Why should it be made static? The answer to this question is missing fr= om the commit message. >=20 > Because a function used only in a scope of a single file and not > intended to be used outside should be made static. Gleb, Yep :)! I appreciate your doing this because it limits scopes and calls, all= owing compilers to optimize away unnecessary calls and external symbol linka= ge. My concern is coming back to the time old issue of providing sufficient cont= ext behind commits when making changes. Looking at the code change you made,= I understand what you did... I just lack the context as to why the changes w= as made. This issue is true for the recent KPI rototilling related to interface prope= rty enumeration. If I hadn=E2=80=99t seen your mailing list RFC, I would lac= k all context as to why the changes are being made. Even a quick reference t= o a one page write up on the wiki, a proposal, or release notes would be won= derful moves towards documenting why interface changes are being made. I want to thank you so very much for all of the awesome work you have done a= nd are continuing to do in the network space =E2=80=94 I really appreciate i= t a lot! Again, I just wish the reasoning behind the work was made more appa= rent to onlookers as to why changes are being made. Cheers :)! -Enji= From owner-svn-src-head@freebsd.org Tue Oct 22 16:39:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0324E15F2FA; Tue, 22 Oct 2019 16:39:15 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46yK360lX3z41Pr; Tue, 22 Oct 2019 16:39:13 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf1-x435.google.com with SMTP id 205so10991966pfw.2; Tue, 22 Oct 2019 09:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=4f58rO93MrajBUtAwKwsIxIFnQpeM3oHsCMWfWv4vws=; b=lSjb7krJApiHjUk10N4bLRF874UHVaiaPyFdenj98dYqlb4MQs27wd4eNa9MSx1bFu cSqcV3AU/BOQL+qv0fdNzBTFtSHweMJAJJNzAya1+VjtC0jUIprsgqnTe3IR/RhXqyCj iq889AdjbRwtueNFI8A4DvGYay26pg78qVCg2vHxf3wB5O+u8nLB+Yq2ykh2/tNe/Rkc Wh+W9QVnSwdWROFIAZZKdGwruIppcfAEJWbg3IE9U1+jJCw1DUXGCSH5XnJQgWErBHid Frkbgdf/d3QxNEXhQ48s+Ce1Kv2RLL5neJJTX7JpDzH16PUppFRDBt0JQyNnUreoCOnQ cD8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=4f58rO93MrajBUtAwKwsIxIFnQpeM3oHsCMWfWv4vws=; b=jpi29nkv9fRduNsMANc6+pKnq5UzK4Q9+ZwvtVET934eE7em88sgkrO2SF9FTNMHgM ElKERuXTqDkvO3ySGzzBAVsk9dk9glMRZK38Ped/nyEoiibcDKyIGtb+qakwb83+b/DU Jxxap88fp6T7kzwRjJEJd5Lobn2jNT0dIcSbNu4JjU1DkH5vglLMmSnPyaX9aGJf4NS1 OfpQv0zv7yCVna62K8hMHDYWi63nBIFlInJQGZemvV+11bibEQw0mlXqBtq/w9ZJulTi OeC5mX3jGYzLe4HYAsQ+iVrfuJ+Lt9niUX0rGhiEghLGQeHcE57QAadD0SKeWwunYpYZ 8oww== X-Gm-Message-State: APjAAAXKsEUpz3XQ9CkaQ6R9Cj2xDRNSGn3pODEprStpWKv5+A/De/IE XYwV6WkWiW5wmSCssiPBmrBbprkl X-Google-Smtp-Source: APXvYqwrFxn4yk9HIF5NXAkuYd9w50U0+d9XdTIgNraH3bv3POKEYLM5XrNR0jy5K20+uCBrBCHQKA== X-Received: by 2002:a63:d246:: with SMTP id t6mr4816747pgi.5.1571762352132; Tue, 22 Oct 2019 09:39:12 -0700 (PDT) Received: from ?IPv6:2607:fb90:8364:7608:20b8:9b0:3e3e:87bc? ([2607:fb90:8364:7608:20b8:9b0:3e3e:87bc]) by smtp.gmail.com with ESMTPSA id z13sm22270122pfg.172.2019.10.22.09.39.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Oct 2019 09:39:11 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Enji Cooper Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r353888 - head/sys/vm Date: Tue, 22 Oct 2019 09:39:09 -0700 Message-Id: <6B3B03C7-FF4A-4A57-853A-00090DA0E6D8@gmail.com> References: <201910221559.x9MFxG2R047533@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201910221559.x9MFxG2R047533@repo.freebsd.org> To: Konstantin Belousov X-Mailer: iPhone Mail (17A878) X-Rspamd-Queue-Id: 46yK360lX3z41Pr X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=lSjb7krJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::435 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-9.16), ipnet: 2607:f8b0::/32(-2.43), asn: 15169(-2.07), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[5.3.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:39:15 -0000 > On Oct 22, 2019, at 08:59, Konstantin Belousov wrote: >=20 > =EF=BB=BFAuthor: kib > Date: Tue Oct 22 15:59:16 2019 > New Revision: 353888 > URL: https://svnweb.freebsd.org/changeset/base/353888 >=20 > Log: > vm_fault(): extract code to lock the vnode into a helper vn_fault_lock_vn= ode(). =46rom an external perspective, I ask myself, =E2=80=9CWhat is the purpo= se in extracting the code out?=E2=80=9D The answer to this question is missi= ng from the commit message. Thank you, -Enji= From owner-svn-src-head@freebsd.org Tue Oct 22 16:52:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 892DB15F76A; Tue, 22 Oct 2019 16:52:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yKLx2wL6z42GB; Tue, 22 Oct 2019 16:52:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48E5DF59C; Tue, 22 Oct 2019 16:52:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MGqv3c082613; Tue, 22 Oct 2019 16:52:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MGquxu082611; Tue, 22 Oct 2019 16:52:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221652.x9MGquxu082611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 16:52:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353893 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 353893 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:52:57 -0000 Author: markj Date: Tue Oct 22 16:52:56 2019 New Revision: 353893 URL: https://svnweb.freebsd.org/changeset/base/353893 Log: Fix thread0 kernel stack initialization on riscv. - td_kstack_pages was not being initialized. - td_kstack is supposed to be the base address of the stack region, not the top. The arm ports seem to have similar problems and will be fixed next. Reported by: Jenkins via lwhsu MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/riscv/riscv/locore.S head/sys/riscv/riscv/machdep.c Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Tue Oct 22 16:21:24 2019 (r353892) +++ head/sys/riscv/riscv/locore.S Tue Oct 22 16:52:56 2019 (r353893) @@ -209,7 +209,7 @@ va: sd t0, 0(sp) /* kern_l1pt */ sd s9, 8(sp) /* kern_phys */ - la t0, initstack_end + la t0, initstack sd t0, 16(sp) /* kern_stack */ li t0, (VM_MAX_KERNEL_ADDRESS - 2 * L2_SIZE) Modified: head/sys/riscv/riscv/machdep.c ============================================================================== --- head/sys/riscv/riscv/machdep.c Tue Oct 22 16:21:24 2019 (r353892) +++ head/sys/riscv/riscv/machdep.c Tue Oct 22 16:52:56 2019 (r353893) @@ -123,7 +123,6 @@ uint32_t boot_hart; /* The hart we booted on. */ cpuset_t all_harts; extern int *end; -extern int *initstack_end; static void cpu_startup(void *dummy) @@ -658,7 +657,9 @@ init_proc0(vm_offset_t kstack) proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; - thread0.td_pcb = (struct pcb *)(thread0.td_kstack) - 1; + thread0.td_kstack_pages = KSTACK_PAGES; + thread0.td_pcb = (struct pcb *)(thread0.td_kstack + + thread0.td_kstack_pages * PAGE_SIZE) - 1; thread0.td_pcb->pcb_fpflags = 0; thread0.td_frame = &proc0_tf; pcpup->pc_curpcb = thread0.td_pcb; From owner-svn-src-head@freebsd.org Tue Oct 22 17:21:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67176160193 for ; Tue, 22 Oct 2019 17:21:11 +0000 (UTC) (envelope-from www-data@ws05.it.works-gmbh.de) Received: from ws05.it.works-gmbh.de (ws05.it.works-gmbh.de [83.169.18.148]) by mx1.freebsd.org (Postfix) with ESMTP id 46yKzW0M8jz43dF for ; Tue, 22 Oct 2019 17:21:10 +0000 (UTC) (envelope-from www-data@ws05.it.works-gmbh.de) Received: by ws05.it.works-gmbh.de (Postfix, from userid 33) id 14925123FD6; Tue, 22 Oct 2019 19:14:53 +0200 (CEST) To: svn-src-head@freebsd.org Subject: =?UTF-8?B?IE9ubGluZSBCYW5raW5nIEFsZXJ0?= X-PHP-Originating-Script: 33:new.php From: =?UTF-8?B?QmFuayBvZiBBbWVyaWNh?= MIME-Version: 1.0; Message-Id: <20191022171453.14925123FD6@ws05.it.works-gmbh.de> Date: Tue, 22 Oct 2019 19:14:53 +0200 (CEST) X-Rspamd-Queue-Id: 46yKzW0M8jz43dF X-Spamd-Bar: ++++++++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of www-data@ws05.it.works-gmbh.de has no SPF policy when checking 83.169.18.148) smtp.mailfrom=www-data@ws05.it.works-gmbh.de X-Spamd-Result: default: False [10.83 / 15.00]; SUBJ_EXCESS_BASE64(1.50)[]; ENVFROM_SERVICE_ACCT(1.00)[]; FROM_EXCESS_BASE64(1.50)[]; HAS_X_POS(0.00)[]; TO_DN_NONE(0.00)[]; CTYPE_MIXED_BOGUS(1.00)[]; FORGED_SENDER(0.30)[onlinebanking@bankofamerica---online.com,www-data@ws05.it.works-gmbh.de]; RCVD_COUNT_ZERO(0.00)[0]; IP_SCORE(1.38)[ipnet: 83.169.16.0/21(4.35), asn: 8972(2.55), country: DE(-0.01)]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:8972, ipnet:83.169.16.0/21, country:DE]; MIME_TRACE(0.00)[0:+,1:~,2:+]; FROM_NEQ_ENVFROM(0.00)[onlinebanking@bankofamerica---online.com,www-data@ws05.it.works-gmbh.de]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; AUTOGEN_PHP_SPAMMY(1.00)[]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(1.00)[1.000,0]; RCPT_COUNT_ONE(0.00)[1]; MANY_INVISIBLE_PARTS(0.05)[1]; DMARC_NA(0.00)[bankofamerica---online.com]; NEURAL_SPAM_LONG(1.00)[1.000,0]; MIME_HTML_ONLY(0.20)[]; R_SPF_NA(0.00)[]; GREYLIST(0.00)[pass,body] X-Spam: Yes Content-Type: text/plain X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 17:21:11 -0000 From owner-svn-src-head@freebsd.org Tue Oct 22 17:21:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1ECAA1601F1; Tue, 22 Oct 2019 17:21:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yKzm00fWz43ns; Tue, 22 Oct 2019 17:21:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D903DF982; Tue, 22 Oct 2019 17:21:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MHLNdJ097905; Tue, 22 Oct 2019 17:21:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MHLNVI097869; Tue, 22 Oct 2019 17:21:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221721.x9MHLNVI097869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 17:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353894 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 353894 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 17:21:24 -0000 Author: markj Date: Tue Oct 22 17:21:23 2019 New Revision: 353894 URL: https://svnweb.freebsd.org/changeset/base/353894 Log: Initialize thread0.td_kstack_pages on arm. Fix style on the line below. Reported by: Jenkins (hardware CI lab) MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Tue Oct 22 16:52:56 2019 (r353893) +++ head/sys/arm/arm/machdep.c Tue Oct 22 17:21:23 2019 (r353894) @@ -771,8 +771,9 @@ init_proc0(vm_offset_t kstack) { proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + kstack_pages * PAGE_SIZE) - 1; + thread0.td_kstack_pages = kstack_pages; + thread0.td_pcb = (struct pcb *)(thread0.td_kstack + + thread0.td_kstack_pages * PAGE_SIZE) - 1; thread0.td_pcb->pcb_flags = 0; thread0.td_pcb->pcb_vfpcpu = -1; thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN; From owner-svn-src-head@freebsd.org Tue Oct 22 17:22:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4EDFD160299; Tue, 22 Oct 2019 17:22:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yL0g1QN6z4411; Tue, 22 Oct 2019 17:22:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 144F6FAC5; Tue, 22 Oct 2019 17:22:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MHMALH000366; Tue, 22 Oct 2019 17:22:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MHMAOd000364; Tue, 22 Oct 2019 17:22:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221722.x9MHMAOd000364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 17:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353895 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 353895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 17:22:11 -0000 Author: markj Date: Tue Oct 22 17:22:10 2019 New Revision: 353895 URL: https://svnweb.freebsd.org/changeset/base/353895 Log: Apply r353893 to arm64. Reported by: Jenkins (hardware CI lab) MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/locore.S head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Tue Oct 22 17:21:23 2019 (r353894) +++ head/sys/arm64/arm64/locore.S Tue Oct 22 17:22:10 2019 (r353895) @@ -132,6 +132,7 @@ virtdone: str x1, [x0] /* modulep */ str x26, [x0, 8] /* kern_l1pt */ str x29, [x0, 16] /* kern_delta */ + adr x25, initstack str x25, [x0, 24] /* kern_stack */ str x24, [x0, 32] /* kern_l0pt */ Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Tue Oct 22 17:21:23 2019 (r353894) +++ head/sys/arm64/arm64/machdep.c Tue Oct 22 17:22:10 2019 (r353895) @@ -745,7 +745,9 @@ init_proc0(vm_offset_t kstack) proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; - thread0.td_pcb = (struct pcb *)(thread0.td_kstack) - 1; + thread0.td_kstack_pages = KSTACK_PAGES; + thread0.td_pcb = (struct pcb *)(thread0.td_kstack + + thread0.td_kstack_pages * KSTACK_PAGES) - 1; thread0.td_pcb->pcb_fpflags = 0; thread0.td_pcb->pcb_fpusaved = &thread0.td_pcb->pcb_fpustate; thread0.td_pcb->pcb_vfpcpu = UINT_MAX; From owner-svn-src-head@freebsd.org Tue Oct 22 18:02:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58487160F05; Tue, 22 Oct 2019 18:02:04 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yLth0sdlz45qd; Tue, 22 Oct 2019 18:02:03 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x9MI21F4087106 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 22 Oct 2019 11:02:01 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9MI21IH087105; Tue, 22 Oct 2019 11:02:01 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Tue, 22 Oct 2019 11:02:01 -0700 From: Gleb Smirnoff To: Mark Johnston Cc: Li-Wen Hsu , br@freebsd.org, src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r353876 - head/sys/kern Message-ID: <20191022180201.GL4086@FreeBSD.org> References: <201910212312.x9LNCEbX052414@repo.freebsd.org> <20191022152913.GJ4086@FreeBSD.org> <20191022154036.GE540@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191022154036.GE540@raichu> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46yLth0sdlz45qd X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.95 / 15.00]; NEURAL_HAM_MEDIUM(-0.95)[-0.955,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:02:04 -0000 On Tue, Oct 22, 2019 at 11:40:36AM -0400, Mark Johnston wrote: M> > I need help from RISC-V experts. M> M> I suspect the problem is that init_proc0() on several arches does not M> initialize td_kstack_pages. I will test this patch and commit if it M> fixes the panic. M> M> Note that on arm64 and riscv thread0's kernel stack is statically M> allocated. I see you already committed it. Thanks a lot, Mark! -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Tue Oct 22 18:05:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61B4E160FD9; Tue, 22 Oct 2019 18:05:08 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f68.google.com (mail-ot1-f68.google.com [209.85.210.68]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46yLyD1mV6z46Jy; Tue, 22 Oct 2019 18:05:07 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f68.google.com with SMTP id 53so3400860otv.4; Tue, 22 Oct 2019 11:05:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=wnMBDC0NZzsABxMqO+U1/zz9s0ugwLwDFWrJNppFlpE=; b=gLSqcY+Yx405M8gsRDNHcdCPKoi+AXC6ZfNRh0DTGy6xMPV8pZjjWaYdJHDpb14odq 53Gsi1s76Pc2wk7ADiEG7mN4BEP98kYUd2WrsBJlIJqWMkzoN1wMEwUDgxx2GKGlK2QL FOIYhppAye8iA7BJh4ZHAo8Y5PDmA4lGEpOvqZ/GqLs5fFdSnrqEjcINIz4V28sLku42 mXX+rEdub4RKvqSWPaCMbHPH0yVR/BrdQJ1QD2UAr446rn1d8ZhI2X7BaA5WSTGzRDdF UmuKMsueLI+/MX0wBq1wJDm9aq9i9ELmp+7elI2tXeR4cbuBsmK+10suAfmXFTTAToE6 SzNA== X-Gm-Message-State: APjAAAVbCwoZyJOdmv7fnvEVXhWQWBbFfyabmtM1DP4sU1EtLSHUrxSh xtDTZswiPUvxU0eIoJJc5rLSHLmm X-Google-Smtp-Source: APXvYqxksP9p8+AL9cPk3fIb5zdTKtZu1mPvzzDkNsBNjxiVlFA+IvcyZ4q7o5tPnAbBAEXIredO0A== X-Received: by 2002:a9d:3df7:: with SMTP id l110mr3612429otc.245.1571767506224; Tue, 22 Oct 2019 11:05:06 -0700 (PDT) Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com. [209.85.210.42]) by smtp.gmail.com with ESMTPSA id s194sm4903944oie.19.2019.10.22.11.05.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Oct 2019 11:05:05 -0700 (PDT) Received: by mail-ot1-f42.google.com with SMTP id s22so14999256otr.6; Tue, 22 Oct 2019 11:05:05 -0700 (PDT) X-Received: by 2002:a05:6830:1609:: with SMTP id g9mr3557848otr.175.1571767505426; Tue, 22 Oct 2019 11:05:05 -0700 (PDT) MIME-Version: 1.0 References: <201910161321.x9GDL2ee021543@repo.freebsd.org> In-Reply-To: Reply-To: cem@freebsd.org From: Conrad Meyer Date: Tue, 22 Oct 2019 11:04:54 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r353640 - head/sys/kern To: Alan Somers Cc: Andrew Turner , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46yLyD1mV6z46Jy X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:05:08 -0000 Theoretically the information should be here, but it's still locked: https://admbugs.freebsd.org/show_bug.cgi?id=651 . On Tue, Oct 22, 2019 at 8:51 AM Alan Somers wrote: > > On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner wrote: >> >> Author: andrew >> Date: Wed Oct 16 13:21:01 2019 >> New Revision: 353640 >> URL: https://svnweb.freebsd.org/changeset/base/353640 >> >> Log: >> Stop leaking information from the kernel through timespec >> >> The timespec struct holds a seconds value in a time_t and a nanoseconds >> value in a long. On most architectures these are the same size, however >> on 32-bit architectures other than i386 time_t is 8 bytes and long is >> 4 bytes. >> >> Most ABIs will then pad a struct holding an 8 byte and 4 byte value to >> 16 bytes with 4 bytes of padding. When copying one of these structs the >> compiler is free to copy the padding if it wishes. >> >> In this case the padding may contain kernel data that is then leaked to >> userspace. Fix this by copying the timespec elements rather than the >> entire struct. >> >> This doesn't affect Tier-1 architectures so no SA is expected. >> >> admbugs: 651 >> MFC after: 1 week >> Sponsored by: DARPA, AFRL > > > Good catch. Might I ask how you found it, or who reported it? From owner-svn-src-head@freebsd.org Tue Oct 22 18:05:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F2FF16100A; Tue, 22 Oct 2019 18:05:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yLyN0x8Nz46R5; Tue, 22 Oct 2019 18:05:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 035CF18212; Tue, 22 Oct 2019 18:05:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MI5Fnt024098; Tue, 22 Oct 2019 18:05:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MI5FQr024097; Tue, 22 Oct 2019 18:05:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910221805.x9MI5FQr024097@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 22 Oct 2019 18:05:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353896 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353896 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:05:16 -0000 Author: glebius Date: Tue Oct 22 18:05:15 2019 New Revision: 353896 URL: https://svnweb.freebsd.org/changeset/base/353896 Log: Allow epoch tracker to use the very last byte of the stack. Not sure this will help to avoid panic in this function, since it will also use some stack, but makes code more strict. Submitted by: hselasky Modified: head/sys/kern/subr_epoch.c Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Tue Oct 22 17:22:10 2019 (r353895) +++ head/sys/kern/subr_epoch.c Tue Oct 22 18:05:15 2019 (r353896) @@ -369,7 +369,7 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et MPASS(epoch->e_flags & EPOCH_PREEMPT); td = curthread; MPASS((vm_offset_t)et >= td->td_kstack && - (vm_offset_t)et + sizeof(struct epoch_tracker) < + (vm_offset_t)et + sizeof(struct epoch_tracker) <= td->td_kstack + td->td_kstack_pages * PAGE_SIZE); INIT_CHECK(epoch); From owner-svn-src-head@freebsd.org Tue Oct 22 18:15:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7545F1614BD; Tue, 22 Oct 2019 18:15:55 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46yMBg2K9vz46v7; Tue, 22 Oct 2019 18:15:55 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-yw1-f67.google.com with SMTP id g77so2497416ywb.10; Tue, 22 Oct 2019 11:15:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=63ntdn9FydyiYraLWhx7qxQ+j3dIVUm94qz2d1/uJpM=; b=kGk9VuMi+2zOiPJovodrn4aQG6/6tGjWHYljIpTdy/TjXNJs7opyi7insJoRnT86R7 4jxo10+3/nWJDCrtabu9SnAcyIYUe1t/psDgjrYntWMgQUvoUoDhozm5V16ydJQfhge6 H0iAizQikyWgt5+0NU8Wa3od0r/ADNI2PhPAWD4YO2/egFxIGIThCqq1UvXaDNc3SWOO eDJ032FVMv6ksBR90lUVcl+0Qdn39kJ04bqX+RRMDneaB/kZxRzl+UrpnYtZknzJH1Vx 2GUThmDIfJuCxbA8e+DVuLXxM2srjOatZLlHSTcfTAEM2THoYwTX1mWAlBV6UoG8NNuI gzPQ== X-Gm-Message-State: APjAAAVo4g3MvWVbrWu8VQGij74DnDJlO6kW7FyoV6v80qbq52RHG0UZ fhtXQqQX8iAclFvVZC5w1y322Lt6S1joINimSG66mW4m X-Google-Smtp-Source: APXvYqz8anG2WBSvkWnJs6WKdd2n2V2P1PBf4b6oor4E1rtTw34gwoalmOCgk1HxiMzUsbhArURCx/k8ZXAxxo93q3g= X-Received: by 2002:a81:7c0b:: with SMTP id x11mr3096387ywc.385.1571768153732; Tue, 22 Oct 2019 11:15:53 -0700 (PDT) MIME-Version: 1.0 References: <201910212312.x9LNCEbX052414@repo.freebsd.org> <20191022152913.GJ4086@FreeBSD.org> <20191022154036.GE540@raichu> <20191022180201.GL4086@FreeBSD.org> In-Reply-To: <20191022180201.GL4086@FreeBSD.org> From: Li-Wen Hsu Date: Wed, 23 Oct 2019 02:15:41 +0800 Message-ID: Subject: Re: svn commit: r353876 - head/sys/kern To: Gleb Smirnoff Cc: Mark Johnston , Ruslan Bukin , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46yMBg2K9vz46v7 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:15:55 -0000 On Wed, Oct 23, 2019 at 2:02 AM Gleb Smirnoff wrote: > > On Tue, Oct 22, 2019 at 11:40:36AM -0400, Mark Johnston wrote: > M> > I need help from RISC-V experts. > M> > M> I suspect the problem is that init_proc0() on several arches does not > M> initialize td_kstack_pages. I will test this patch and commit if it > M> fixes the panic. > M> > M> Note that on arm64 and riscv thread0's kernel stack is statically > M> allocated. > > I see you already committed it. Thanks a lot, Mark! Yeah, thank you! r353893 fixed it and riscv64-test backed to green: https://ci.freebsd.org/job/FreeBSD-head-riscv64-test/12339/ From owner-svn-src-head@freebsd.org Tue Oct 22 18:28:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78AD3161ABA; Tue, 22 Oct 2019 18:28:59 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yMTl2f1Zz47W4; Tue, 22 Oct 2019 18:28:59 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E981185A8; Tue, 22 Oct 2019 18:28:59 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MISx7t035954; Tue, 22 Oct 2019 18:28:59 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MISwK5035952; Tue, 22 Oct 2019 18:28:58 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201910221828.x9MISwK5035952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Tue, 22 Oct 2019 18:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353897 - head/sys/powerpc/ofw X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/sys/powerpc/ofw X-SVN-Commit-Revision: 353897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:28:59 -0000 Author: luporl Date: Tue Oct 22 18:28:58 2019 New Revision: 353897 URL: https://svnweb.freebsd.org/changeset/base/353897 Log: [PPC] Avoid underflows in NUMA domains On POWER8 systems with only one memory domain, the "ibm,associativity" number that corresponds to it is 0, unlike POWER9 systems with two or more domains, in which the minimum value is 1. In POWER8 case, subtracting 1 causes an underflow on the unsigned domain variable and a subsequent index out-of-bounds access. Reviewed by: jhibbits Tested by: bdragon, luporl Modified: head/sys/powerpc/ofw/ofw_machdep.c head/sys/powerpc/ofw/ofw_pcibus.c Modified: head/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- head/sys/powerpc/ofw/ofw_machdep.c Tue Oct 22 18:05:15 2019 (r353896) +++ head/sys/powerpc/ofw/ofw_machdep.c Tue Oct 22 18:28:58 2019 (r353897) @@ -487,7 +487,7 @@ ofw_numa_mem_regions(struct numa_mem_region *memp, int MPASS(count == 1); OF_getencprop(phandle, "ibm,associativity", associativity, res); - curmemp->mr_domain = associativity[3] - 1; + curmemp->mr_domain = associativity[3]; if (bootverbose) printf("%s %#jx-%#jx domain(%ju)\n", name, (uintmax_t)curmemp->mr_start, Modified: head/sys/powerpc/ofw/ofw_pcibus.c ============================================================================== --- head/sys/powerpc/ofw/ofw_pcibus.c Tue Oct 22 18:05:15 2019 (r353896) +++ head/sys/powerpc/ofw/ofw_pcibus.c Tue Oct 22 18:28:58 2019 (r353897) @@ -403,7 +403,7 @@ ofw_pcibus_parse_associativity(device_t dev, int *doma OF_getencprop(node, "ibm,associativity", associativity, res); - *domain = associativity[3] - 1; + *domain = associativity[3]; if (bootverbose) device_printf(dev, "domain(%d)\n", *domain); return (0); From owner-svn-src-head@freebsd.org Tue Oct 22 18:30:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 309C7161D11; Tue, 22 Oct 2019 18:30:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yMWw0FdJz47k5; Tue, 22 Oct 2019 18:30:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0A96185C8; Tue, 22 Oct 2019 18:30:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MIUpQk038367; Tue, 22 Oct 2019 18:30:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MIUpcb038366; Tue, 22 Oct 2019 18:30:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910221830.x9MIUpcb038366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 22 Oct 2019 18:30:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353898 - head/contrib/blacklist/bin X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/blacklist/bin X-SVN-Commit-Revision: 353898 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:30:52 -0000 Author: emaste Date: Tue Oct 22 18:30:51 2019 New Revision: 353898 URL: https://svnweb.freebsd.org/changeset/base/353898 Log: blacklistd: remove reference to NetBSD npfctl Xr pfctl instead. PR: 221069 Submitted by: "fml" MFC after: 3 days Modified: head/contrib/blacklist/bin/blacklistd.8 Modified: head/contrib/blacklist/bin/blacklistd.8 ============================================================================== --- head/contrib/blacklist/bin/blacklistd.8 Tue Oct 22 18:28:58 2019 (r353897) +++ head/contrib/blacklist/bin/blacklistd.8 Tue Oct 22 18:30:51 2019 (r353898) @@ -233,7 +233,7 @@ Socket to receive connection notifications. .Sh SEE ALSO .Xr blacklistd.conf 5 , .Xr blacklistctl 8 , -.Xr npfctl 8 , +.Xr pfctl 8 , .Xr syslogd 8 .Sh HISTORY .Nm From owner-svn-src-head@freebsd.org Tue Oct 22 18:52:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0199F162751 for ; Tue, 22 Oct 2019 18:52:16 +0000 (UTC) (envelope-from kovals@yamed.ru) Received: from yamed.ru (vm555934.vps.masterhost.ru [90.156.141.97]) (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 46yN0Z5d5tz49SC for ; Tue, 22 Oct 2019 18:52:14 +0000 (UTC) (envelope-from kovals@yamed.ru) Received: from yamed by yamed.ru with local (Exim 4.84_2) (envelope-from ) id 1iMxtB-0003tQ-Qt for svn-src-head@freebsd.org; Tue, 22 Oct 2019 20:24:09 +0300 To: svn-src-head@freebsd.org Subject: =?UTF-8?B?IE9ubGluZSBCYW5raW5nIEFsZXJ0?= X-PHP-Originating-Script: 500:new.php From: =?UTF-8?B?QmFua29mQW1lcmljYQ==?= MIME-Version: 1.0; Message-Id: Date: Tue, 22 Oct 2019 20:24:09 +0300 X-Rspamd-Queue-Id: 46yN0Z5d5tz49SC X-Spamd-Bar: +++++++++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=softfail (mx1.freebsd.org: 90.156.141.97 is neither permitted nor denied by domain of kovals@yamed.ru) smtp.mailfrom=kovals@yamed.ru X-Spamd-Result: default: False [11.83 / 15.00]; FROM_EXCESS_BASE64(1.50)[]; SUBJ_EXCESS_BASE64(1.50)[]; HAS_X_POS(0.00)[]; TO_DN_NONE(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; CTYPE_MIXED_BOGUS(1.00)[]; FORGED_SENDER(0.30)[onlinebanking@bankofamerica---online.com,kovals@yamed.ru]; AUTOGEN_PHP_SPAMMY(1.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:25532, ipnet:90.156.128.0/17, country:RU]; MIME_TRACE(0.00)[0:+,1:~,2:+]; FROM_NEQ_ENVFROM(0.00)[onlinebanking@bankofamerica---online.com,kovals@yamed.ru]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[bankofamerica---online.com]; NEURAL_SPAM_MEDIUM(1.00)[0.999,0]; RCPT_COUNT_ONE(0.00)[1]; MANY_INVISIBLE_PARTS(0.05)[1]; RBL_VIRUSFREE_BOTNET(2.00)[97.141.156.90.bip.virusfree.cz : 127.0.0.2]; NEURAL_SPAM_LONG(1.00)[1.000,0]; RCVD_IN_DNSWL_NONE(0.00)[97.141.156.90.list.dnswl.org : 127.0.10.0]; MIME_HTML_ONLY(0.20)[]; IP_SCORE(0.38)[asn: 25532(1.88), country: RU(0.01)]; RBL_SENDERSCORE(2.00)[97.141.156.90.bl.score.senderscore.com]; RCVD_COUNT_TWO(0.00)[2]; GREYLIST(0.00)[pass,body] X-Spam: Yes Content-Type: text/plain X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:52:16 -0000 From owner-svn-src-head@freebsd.org Tue Oct 22 20:01:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4671E163FA2; Tue, 22 Oct 2019 20:01:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yPXr16Y4z4DSD; Tue, 22 Oct 2019 20:01:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AF0819718; Tue, 22 Oct 2019 20:01:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MK1lcr092042; Tue, 22 Oct 2019 20:01:47 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MK1lKn092038; Tue, 22 Oct 2019 20:01:47 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910222001.x9MK1lKn092038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 22 Oct 2019 20:01:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353899 - in head/sys/dev/cxgbe: . tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . tom X-SVN-Commit-Revision: 353899 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 20:01:48 -0000 Author: jhb Date: Tue Oct 22 20:01:47 2019 New Revision: 353899 URL: https://svnweb.freebsd.org/changeset/base/353899 Log: Always allocate the atid table during attach. Previously the table was allocated on first use by TOE and the ratelimit code. The forthcoming NIC KTLS code also uses this table. Allocate it unconditionally during attach to simplify consumers. Reviewed by: np Differential Revision: https://reviews.freebsd.org/D22028 Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_filter.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/tom/t4_tom.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Tue Oct 22 18:30:51 2019 (r353898) +++ head/sys/dev/cxgbe/adapter.h Tue Oct 22 20:01:47 2019 (r353899) @@ -1160,8 +1160,6 @@ int vi_full_uninit(struct vi_info *); void vi_sysctls(struct vi_info *); void vi_tick(void *); int rw_via_memwin(struct adapter *, int, uint32_t, uint32_t *, int, int); -int alloc_atid_tab(struct tid_info *, int); -void free_atid_tab(struct tid_info *); int alloc_atid(struct adapter *, void *); void *lookup_atid(struct adapter *, int); void free_atid(struct adapter *, int); Modified: head/sys/dev/cxgbe/t4_filter.c ============================================================================== --- head/sys/dev/cxgbe/t4_filter.c Tue Oct 22 18:30:51 2019 (r353898) +++ head/sys/dev/cxgbe/t4_filter.c Tue Oct 22 20:01:47 2019 (r353899) @@ -891,11 +891,6 @@ set_filter(struct adapter *sc, struct t4_filter *t) if (rc != 0) goto done; } - if (__predict_false(sc->tids.atid_tab == NULL)) { - rc = alloc_atid_tab(&sc->tids, M_NOWAIT); - if (rc != 0) - goto done; - } } else if (separate_hpfilter_region(sc) && t->fs.prio && __predict_false(ti->hpftid_tab == NULL)) { MPASS(ti->nhpftids != 0); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Oct 22 18:30:51 2019 (r353898) +++ head/sys/dev/cxgbe/t4_main.c Tue Oct 22 20:01:47 2019 (r353899) @@ -626,6 +626,8 @@ static void quiesce_fl(struct adapter *, struct sge_fl static int t4_alloc_irq(struct adapter *, struct irq *, int rid, driver_intr_t *, void *, char *); static int t4_free_irq(struct adapter *, struct irq *); +static void t4_init_atid_table(struct adapter *); +static void t4_free_atid_table(struct adapter *); static void get_regs(struct adapter *, struct t4_regdump *, uint8_t *); static void vi_refresh_stats(struct adapter *, struct vi_info *); static void cxgbe_refresh_stats(struct adapter *, struct port_info *); @@ -1236,6 +1238,7 @@ t4_attach(device_t dev) t4_init_l2t(sc, M_WAITOK); t4_init_smt(sc, M_WAITOK); t4_init_tx_sched(sc); + t4_init_atid_table(sc); #ifdef RATELIMIT t4_init_etid_table(sc); #endif @@ -1540,6 +1543,7 @@ t4_detach_common(device_t dev) t4_free_l2t(sc->l2t); if (sc->smt) t4_free_smt(sc->smt); + t4_free_atid_table(sc); #ifdef RATELIMIT t4_free_etid_table(sc); #endif @@ -1568,7 +1572,6 @@ t4_detach_common(device_t dev) free(sc->tids.ftid_tab, M_CXGBE); free(sc->tids.hpftid_tab, M_CXGBE); free_hftid_hash(&sc->tids); - free(sc->tids.atid_tab, M_CXGBE); free(sc->tids.tid_tab, M_CXGBE); free(sc->tt.tls_rx_ports, M_CXGBE); t4_destroy_dma_tag(sc); @@ -2829,31 +2832,34 @@ rw_via_memwin(struct adapter *sc, int idx, uint32_t ad return (0); } -int -alloc_atid_tab(struct tid_info *t, int flags) +static void +t4_init_atid_table(struct adapter *sc) { + struct tid_info *t; int i; - MPASS(t->natids > 0); + t = &sc->tids; + if (t->natids == 0) + return; + MPASS(t->atid_tab == NULL); t->atid_tab = malloc(t->natids * sizeof(*t->atid_tab), M_CXGBE, - M_ZERO | flags); - if (t->atid_tab == NULL) - return (ENOMEM); + M_ZERO | M_WAITOK); mtx_init(&t->atid_lock, "atid lock", NULL, MTX_DEF); t->afree = t->atid_tab; t->atids_in_use = 0; for (i = 1; i < t->natids; i++) t->atid_tab[i - 1].next = &t->atid_tab[i]; t->atid_tab[t->natids - 1].next = NULL; - - return (0); } -void -free_atid_tab(struct tid_info *t) +static void +t4_free_atid_table(struct adapter *sc) { + struct tid_info *t; + + t = &sc->tids; KASSERT(t->atids_in_use == 0, ("%s: %d atids still in use.", __func__, t->atids_in_use)); Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Tue Oct 22 18:30:51 2019 (r353898) +++ head/sys/dev/cxgbe/tom/t4_tom.c Tue Oct 22 20:01:47 2019 (r353899) @@ -1368,7 +1368,6 @@ free_tid_tabs(struct tid_info *t) { free_tid_tab(t); - free_atid_tab(t); free_stid_tab(t); } @@ -1378,10 +1377,6 @@ alloc_tid_tabs(struct tid_info *t) int rc; rc = alloc_tid_tab(t, M_NOWAIT); - if (rc != 0) - goto failed; - - rc = alloc_atid_tab(t, M_NOWAIT); if (rc != 0) goto failed; From owner-svn-src-head@freebsd.org Tue Oct 22 20:03:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3397916408D for ; Tue, 22 Oct 2019 20:03:04 +0000 (UTC) (envelope-from asfotowelt@web11.webdings-cloud.net) Received: from web11.webdings-cloud.net (web11.webdings-cloud.net [90.146.4.26]) (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 46yPZH5tHPz4DdW for ; Tue, 22 Oct 2019 20:03:03 +0000 (UTC) (envelope-from asfotowelt@web11.webdings-cloud.net) Received: from asfotowelt by web11.webdings-cloud.net with local (Exim 4.92) (envelope-from ) id 1iMxp0-0000ID-F7 for svn-src-head@freebsd.org; Tue, 22 Oct 2019 19:19:50 +0200 To: svn-src-head@freebsd.org Subject: =?UTF-8?B?U2VydmljZSBVcGdyYWRlICYgTWFpbnRlbmFuY2UgTm90aWNl?= X-PHP-Script: as-fotowelt.at/new.php for 192.186.145.86 X-PHP-Originating-Script: 1067:new.php From: =?UTF-8?B?QmFuayBvZiBBbWVyaWNh?= MIME-Version: 1.0; Message-Id: Date: Tue, 22 Oct 2019 19:19:50 +0200 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - web11.webdings-cloud.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [1067 993] / [47 12] X-AntiAbuse: Sender Address Domain - web11.webdings-cloud.net X-Get-Message-Sender-Via: web11.webdings-cloud.net: authenticated_id: asfotowelt/only user confirmed/virtual account not confirmed X-Authenticated-Sender: web11.webdings-cloud.net: asfotowelt X-Source: X-Source-Args: X-Source-Dir: X-Rspamd-Queue-Id: 46yPZH5tHPz4DdW X-Spamd-Bar: ++++++++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of asfotowelt@web11.webdings-cloud.net has no SPF policy when checking 90.146.4.26) smtp.mailfrom=asfotowelt@web11.webdings-cloud.net X-Spamd-Result: default: False [10.43 / 15.00]; IP_SCORE(-0.02)[country: AT(-0.10)]; SUBJ_EXCESS_BASE64(1.50)[]; FROM_EXCESS_BASE64(1.50)[]; HAS_X_SOURCE(0.00)[]; HAS_X_POS(0.00)[]; TO_DN_NONE(0.00)[]; AUTOGEN_PHP_SPAMMY(1.00)[]; CTYPE_MIXED_BOGUS(1.00)[]; FORGED_SENDER(0.30)[BankofAmerica@customerloyalty.accounts.com,asfotowelt@web11.webdings-cloud.net]; HAS_X_ANTIABUSE(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:12605, ipnet:90.146.0.0/17, country:AT]; MIME_TRACE(0.00)[0:+,1:~,2:+]; FROM_NEQ_ENVFROM(0.00)[BankofAmerica@customerloyalty.accounts.com,asfotowelt@web11.webdings-cloud.net]; HAS_X_AS(0.00)[asfotowelt]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; DMARC_NA(0.00)[accounts.com]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(1.00)[0.999,0]; RCPT_COUNT_ONE(0.00)[1]; MANY_INVISIBLE_PARTS(0.05)[1]; RBL_VIRUSFREE_BOTNET(2.00)[26.4.146.90.bip.virusfree.cz : 127.0.0.2]; NEURAL_SPAM_LONG(1.00)[1.000,0]; HAS_X_GMSV(0.00)[asfotowelt/only user confirmed/virtual account not confirmed]; MIME_HTML_ONLY(0.20)[]; R_SPF_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; GREYLIST(0.00)[pass,body]; HAS_X_PHP_SCRIPT(0.00)[] X-Spam: Yes Content-Type: text/plain X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 20:03:04 -0000 From owner-svn-src-head@freebsd.org Tue Oct 22 20:41:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48005164D89; Tue, 22 Oct 2019 20:41:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yQR71yZKz4G59; Tue, 22 Oct 2019 20:41:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2627419D29; Tue, 22 Oct 2019 20:41:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MKftnH016548; Tue, 22 Oct 2019 20:41:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MKfsuC016543; Tue, 22 Oct 2019 20:41:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910222041.x9MKfsuC016543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 22 Oct 2019 20:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353900 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 353900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 20:41:55 -0000 Author: jhb Date: Tue Oct 22 20:41:54 2019 New Revision: 353900 URL: https://svnweb.freebsd.org/changeset/base/353900 Log: Split Chelsio send tags into a generic base tag and a ratelimit tag. NIC KTLS will add a new TLS send tag type in cxgbe(4) that is a distinct tag from a ratelimit tag. To support this, refactor cxgbe_snd_tag to be a simple send tag with a type and convert the existing ratelimit tag to a new cxgbe_rate_tag structure. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D22072 Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sched.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Tue Oct 22 20:01:47 2019 (r353899) +++ head/sys/dev/cxgbe/adapter.h Tue Oct 22 20:41:54 2019 (r353900) @@ -1155,6 +1155,7 @@ int update_mac_settings(struct ifnet *, int); int adapter_full_init(struct adapter *); int adapter_full_uninit(struct adapter *); uint64_t cxgbe_get_counter(struct ifnet *, ift_counter); +void cxgbe_snd_tag_init(struct cxgbe_snd_tag *, struct ifnet *, int); int vi_full_init(struct vi_info *); int vi_full_uninit(struct vi_info *); void vi_sysctls(struct vi_info *); @@ -1212,7 +1213,7 @@ void t4_register_cpl_handler(int, cpl_handler_t); void t4_register_shared_cpl_handler(int, cpl_handler_t, int); #ifdef RATELIMIT int ethofld_transmit(struct ifnet *, struct mbuf *); -void send_etid_flush_wr(struct cxgbe_snd_tag *); +void send_etid_flush_wr(struct cxgbe_rate_tag *); #endif /* t4_tracer.c */ @@ -1238,13 +1239,13 @@ int sysctl_tc_params(SYSCTL_HANDLER_ARGS); #ifdef RATELIMIT void t4_init_etid_table(struct adapter *); void t4_free_etid_table(struct adapter *); -struct cxgbe_snd_tag *lookup_etid(struct adapter *, int); -int cxgbe_snd_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, +struct cxgbe_rate_tag *lookup_etid(struct adapter *, int); +int cxgbe_rate_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, struct m_snd_tag **); -int cxgbe_snd_tag_modify(struct m_snd_tag *, union if_snd_tag_modify_params *); -int cxgbe_snd_tag_query(struct m_snd_tag *, union if_snd_tag_query_params *); -void cxgbe_snd_tag_free(struct m_snd_tag *); -void cxgbe_snd_tag_free_locked(struct cxgbe_snd_tag *); +int cxgbe_rate_tag_modify(struct m_snd_tag *, union if_snd_tag_modify_params *); +int cxgbe_rate_tag_query(struct m_snd_tag *, union if_snd_tag_query_params *); +void cxgbe_rate_tag_free(struct m_snd_tag *); +void cxgbe_rate_tag_free_locked(struct cxgbe_rate_tag *); void cxgbe_ratelimit_query(struct ifnet *, struct if_ratelimit_query_results *); #endif Modified: head/sys/dev/cxgbe/offload.h ============================================================================== --- head/sys/dev/cxgbe/offload.h Tue Oct 22 20:01:47 2019 (r353899) +++ head/sys/dev/cxgbe/offload.h Tue Oct 22 20:41:54 2019 (r353900) @@ -79,7 +79,7 @@ union aopen_entry { union aopen_entry *next; }; -/* cxgbe_snd_tag flags */ +/* cxgbe_rate_tag flags */ enum { EO_FLOWC_PENDING = (1 << 0), /* flowc needs to be sent */ EO_FLOWC_RPL_PENDING = (1 << 1), /* flowc credits due back */ @@ -89,6 +89,11 @@ enum { struct cxgbe_snd_tag { struct m_snd_tag com; + int type; +}; + +struct cxgbe_rate_tag { + struct cxgbe_snd_tag com; struct adapter *adapter; u_int flags; struct mtx lock; @@ -114,8 +119,14 @@ mst_to_cst(struct m_snd_tag *t) return (__containerof(t, struct cxgbe_snd_tag, com)); } +static inline struct cxgbe_rate_tag * +mst_to_crt(struct m_snd_tag *t) +{ + return ((struct cxgbe_rate_tag *)mst_to_cst(t)); +} + union etid_entry { - struct cxgbe_snd_tag *cst; + struct cxgbe_rate_tag *cst; union etid_entry *next; }; Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Oct 22 20:01:47 2019 (r353899) +++ head/sys/dev/cxgbe/t4_main.c Tue Oct 22 20:41:54 2019 (r353900) @@ -230,6 +230,15 @@ static void cxgbe_init(void *); static int cxgbe_ioctl(struct ifnet *, unsigned long, caddr_t); static int cxgbe_transmit(struct ifnet *, struct mbuf *); static void cxgbe_qflush(struct ifnet *); +#ifdef RATELIMIT +static int cxgbe_snd_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, + struct m_snd_tag **); +static int cxgbe_snd_tag_modify(struct m_snd_tag *, + union if_snd_tag_modify_params *); +static int cxgbe_snd_tag_query(struct m_snd_tag *, + union if_snd_tag_query_params *); +static void cxgbe_snd_tag_free(struct m_snd_tag *); +#endif MALLOC_DEFINE(M_CXGBE, "cxgbe", "Chelsio T4/T5 Ethernet driver and services"); @@ -2044,11 +2053,18 @@ cxgbe_transmit(struct ifnet *ifp, struct mbuf *m) struct port_info *pi = vi->pi; struct adapter *sc = pi->adapter; struct sge_txq *txq; +#ifdef RATELIMIT + struct cxgbe_snd_tag *cst; +#endif void *items[1]; int rc; M_ASSERTPKTHDR(m); MPASS(m->m_nextpkt == NULL); /* not quite ready for this yet */ +#ifdef RATELIMIT + if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) + MPASS(m->m_pkthdr.snd_tag->ifp == ifp); +#endif if (__predict_false(pi->link_cfg.link_ok == false)) { m_freem(m); @@ -2063,8 +2079,9 @@ cxgbe_transmit(struct ifnet *ifp, struct mbuf *m) } #ifdef RATELIMIT if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) { - MPASS(m->m_pkthdr.snd_tag->ifp == ifp); - return (ethofld_transmit(ifp, m)); + cst = mst_to_cst(m->m_pkthdr.snd_tag); + if (cst->type == IF_SND_TAG_TYPE_RATE_LIMIT) + return (ethofld_transmit(ifp, m)); } #endif @@ -2221,6 +2238,87 @@ cxgbe_get_counter(struct ifnet *ifp, ift_counter c) return (if_get_counter_default(ifp, c)); } } + +#ifdef RATELIMIT +void +cxgbe_snd_tag_init(struct cxgbe_snd_tag *cst, struct ifnet *ifp, int type) +{ + + m_snd_tag_init(&cst->com, ifp); + cst->type = type; +} + +static int +cxgbe_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, + struct m_snd_tag **pt) +{ + int error; + + switch (params->hdr.type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + error = cxgbe_rate_tag_alloc(ifp, params, pt); + break; +#endif + default: + error = EOPNOTSUPP; + } + if (error == 0) + MPASS(mst_to_cst(*pt)->type == params->hdr.type); + return (error); +} + +static int +cxgbe_snd_tag_modify(struct m_snd_tag *mst, + union if_snd_tag_modify_params *params) +{ + struct cxgbe_snd_tag *cst; + + cst = mst_to_cst(mst); + switch (cst->type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + return (cxgbe_rate_tag_modify(mst, params)); +#endif + default: + return (EOPNOTSUPP); + } +} + +static int +cxgbe_snd_tag_query(struct m_snd_tag *mst, + union if_snd_tag_query_params *params) +{ + struct cxgbe_snd_tag *cst; + + cst = mst_to_cst(mst); + switch (cst->type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + return (cxgbe_rate_tag_query(mst, params)); +#endif + default: + return (EOPNOTSUPP); + } +} + +static void +cxgbe_snd_tag_free(struct m_snd_tag *mst) +{ + struct cxgbe_snd_tag *cst; + + cst = mst_to_cst(mst); + switch (cst->type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + cxgbe_rate_tag_free(mst); + return; +#endif + default: + panic("shouldn't get here"); + } +} +#endif /* * The kernel picks a media from the list we had provided but we still validate Modified: head/sys/dev/cxgbe/t4_sched.c ============================================================================== --- head/sys/dev/cxgbe/t4_sched.c Tue Oct 22 20:01:47 2019 (r353899) +++ head/sys/dev/cxgbe/t4_sched.c Tue Oct 22 20:41:54 2019 (r353900) @@ -711,11 +711,11 @@ t4_free_etid_table(struct adapter *sc) } /* etid services */ -static int alloc_etid(struct adapter *, struct cxgbe_snd_tag *); +static int alloc_etid(struct adapter *, struct cxgbe_rate_tag *); static void free_etid(struct adapter *, int); static int -alloc_etid(struct adapter *sc, struct cxgbe_snd_tag *cst) +alloc_etid(struct adapter *sc, struct cxgbe_rate_tag *cst) { struct tid_info *t = &sc->tids; int etid = -1; @@ -733,7 +733,7 @@ alloc_etid(struct adapter *sc, struct cxgbe_snd_tag *c return (etid); } -struct cxgbe_snd_tag * +struct cxgbe_rate_tag * lookup_etid(struct adapter *sc, int etid) { struct tid_info *t = &sc->tids; @@ -755,17 +755,16 @@ free_etid(struct adapter *sc, int etid) } int -cxgbe_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, +cxgbe_rate_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, struct m_snd_tag **pt) { int rc, schedcl; struct vi_info *vi = ifp->if_softc; struct port_info *pi = vi->pi; struct adapter *sc = pi->adapter; - struct cxgbe_snd_tag *cst; + struct cxgbe_rate_tag *cst; - if (params->hdr.type != IF_SND_TAG_TYPE_RATE_LIMIT) - return (ENOTSUP); + MPASS(params->hdr.type == IF_SND_TAG_TYPE_RATE_LIMIT); rc = t4_reserve_cl_rl_kbps(sc, pi->port_id, (params->rate_limit.max_rate * 8ULL / 1000), &schedcl); @@ -789,7 +788,7 @@ failed: mtx_init(&cst->lock, "cst_lock", NULL, MTX_DEF); mbufq_init(&cst->pending_tx, INT_MAX); mbufq_init(&cst->pending_fwack, INT_MAX); - m_snd_tag_init(&cst->com, ifp); + cxgbe_snd_tag_init(&cst->com, ifp, IF_SND_TAG_TYPE_RATE_LIMIT); cst->flags |= EO_FLOWC_PENDING | EO_SND_TAG_REF; cst->adapter = sc; cst->port_id = pi->port_id; @@ -806,7 +805,7 @@ failed: * Queues will be selected later when the connection flowid is available. */ - *pt = &cst->com; + *pt = &cst->com.com; return (0); } @@ -814,11 +813,11 @@ failed: * Change in parameters, no change in ifp. */ int -cxgbe_snd_tag_modify(struct m_snd_tag *mst, +cxgbe_rate_tag_modify(struct m_snd_tag *mst, union if_snd_tag_modify_params *params) { int rc, schedcl; - struct cxgbe_snd_tag *cst = mst_to_cst(mst); + struct cxgbe_rate_tag *cst = mst_to_crt(mst); struct adapter *sc = cst->adapter; /* XXX: is schedcl -1 ok here? */ @@ -840,10 +839,10 @@ cxgbe_snd_tag_modify(struct m_snd_tag *mst, } int -cxgbe_snd_tag_query(struct m_snd_tag *mst, +cxgbe_rate_tag_query(struct m_snd_tag *mst, union if_snd_tag_query_params *params) { - struct cxgbe_snd_tag *cst = mst_to_cst(mst); + struct cxgbe_rate_tag *cst = mst_to_crt(mst); params->rate_limit.max_rate = cst->max_rate; @@ -858,7 +857,7 @@ cxgbe_snd_tag_query(struct m_snd_tag *mst, * Unlocks cst and frees it. */ void -cxgbe_snd_tag_free_locked(struct cxgbe_snd_tag *cst) +cxgbe_rate_tag_free_locked(struct cxgbe_rate_tag *cst) { struct adapter *sc = cst->adapter; @@ -879,9 +878,9 @@ cxgbe_snd_tag_free_locked(struct cxgbe_snd_tag *cst) } void -cxgbe_snd_tag_free(struct m_snd_tag *mst) +cxgbe_rate_tag_free(struct m_snd_tag *mst) { - struct cxgbe_snd_tag *cst = mst_to_cst(mst); + struct cxgbe_rate_tag *cst = mst_to_crt(mst); mtx_lock(&cst->lock); @@ -896,7 +895,7 @@ cxgbe_snd_tag_free(struct m_snd_tag *mst) * credits for the etid otherwise. */ if (cst->tx_credits == cst->tx_total) { - cxgbe_snd_tag_free_locked(cst); + cxgbe_rate_tag_free_locked(cst); return; /* cst is gone. */ } send_etid_flush_wr(cst); Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Tue Oct 22 20:01:47 2019 (r353899) +++ head/sys/dev/cxgbe/t4_sge.c Tue Oct 22 20:41:54 2019 (r353900) @@ -2307,10 +2307,10 @@ set_mbuf_eo_tsclk_tsoff(struct mbuf *m, uint8_t tsclk_ } static inline int -needs_eo(struct mbuf *m) +needs_eo(struct cxgbe_snd_tag *cst) { - return (m->m_pkthdr.csum_flags & CSUM_SND_TAG); + return (cst != NULL && cst->type == IF_SND_TAG_TYPE_RATE_LIMIT); } #endif @@ -2542,6 +2542,9 @@ parse_pkt(struct adapter *sc, struct mbuf **mp) #if defined(INET) || defined(INET6) struct tcphdr *tcp; #endif +#ifdef RATELIMIT + struct cxgbe_snd_tag *cst; +#endif uint16_t eh_type; uint8_t cflags; @@ -2562,6 +2565,12 @@ restart: M_ASSERTPKTHDR(m0); MPASS(m0->m_pkthdr.len > 0); nsegs = count_mbuf_nsegs(m0, 0, &cflags); +#ifdef RATELIMIT + if (m0->m_pkthdr.csum_flags & CSUM_SND_TAG) + cst = mst_to_cst(m0->m_pkthdr.snd_tag); + else + cst = NULL; +#endif if (nsegs > (needs_tso(m0) ? TX_SGL_SEGS_TSO : TX_SGL_SEGS)) { if (defragged++ > 0 || (m = m_defrag(m0, M_NOWAIT)) == NULL) { rc = EFBIG; @@ -2595,16 +2604,17 @@ restart: * checksumming is enabled. needs_l4_csum happens to check for all the * right things. */ - if (__predict_false(needs_eo(m0) && !needs_l4_csum(m0))) { + if (__predict_false(needs_eo(cst) && !needs_l4_csum(m0))) { m_snd_tag_rele(m0->m_pkthdr.snd_tag); m0->m_pkthdr.snd_tag = NULL; m0->m_pkthdr.csum_flags &= ~CSUM_SND_TAG; + cst = NULL; } #endif if (!needs_tso(m0) && #ifdef RATELIMIT - !needs_eo(m0) && + !needs_eo(cst) && #endif !(sc->flags & IS_VF && (needs_l3_csum(m0) || needs_l4_csum(m0)))) return (0); @@ -2666,7 +2676,7 @@ restart: #endif } #ifdef RATELIMIT - if (needs_eo(m0)) { + if (needs_eo(cst)) { u_int immhdrs; /* EO WRs have the headers in the WR and not the GL. */ @@ -5723,7 +5733,7 @@ done: #define ETID_FLOWC_LEN16 (howmany(ETID_FLOWC_LEN, 16)) static int -send_etid_flowc_wr(struct cxgbe_snd_tag *cst, struct port_info *pi, +send_etid_flowc_wr(struct cxgbe_rate_tag *cst, struct port_info *pi, struct vi_info *vi) { struct wrq_cookie cookie; @@ -5769,7 +5779,7 @@ send_etid_flowc_wr(struct cxgbe_snd_tag *cst, struct p #define ETID_FLUSH_LEN16 (howmany(sizeof (struct fw_flowc_wr), 16)) void -send_etid_flush_wr(struct cxgbe_snd_tag *cst) +send_etid_flush_wr(struct cxgbe_rate_tag *cst) { struct fw_flowc_wr *flowc; struct wrq_cookie cookie; @@ -5795,7 +5805,7 @@ send_etid_flush_wr(struct cxgbe_snd_tag *cst) } static void -write_ethofld_wr(struct cxgbe_snd_tag *cst, struct fw_eth_tx_eo_wr *wr, +write_ethofld_wr(struct cxgbe_rate_tag *cst, struct fw_eth_tx_eo_wr *wr, struct mbuf *m0, int compl) { struct cpl_tx_pkt_core *cpl; @@ -5944,7 +5954,7 @@ write_ethofld_wr(struct cxgbe_snd_tag *cst, struct fw_ } static void -ethofld_tx(struct cxgbe_snd_tag *cst) +ethofld_tx(struct cxgbe_rate_tag *cst) { struct mbuf *m; struct wrq_cookie cookie; @@ -5977,7 +5987,7 @@ ethofld_tx(struct cxgbe_snd_tag *cst) cst->tx_credits -= next_credits; cst->tx_nocompl += next_credits; compl = cst->ncompl == 0 || cst->tx_nocompl >= cst->tx_total / 2; - ETHER_BPF_MTAP(cst->com.ifp, m); + ETHER_BPF_MTAP(cst->com.com.ifp, m); write_ethofld_wr(cst, wr, m, compl); commit_wrq_wr(cst->eo_txq, wr, &cookie); if (compl) { @@ -5989,7 +5999,7 @@ ethofld_tx(struct cxgbe_snd_tag *cst) /* * Drop the mbuf's reference on the tag now rather * than waiting until m_freem(). This ensures that - * cxgbe_snd_tag_free gets called when the inp drops + * cxgbe_rate_tag_free gets called when the inp drops * its reference on the tag and there are no more * mbufs in the pending_tx queue and can flush any * pending requests. Otherwise if the last mbuf @@ -5998,7 +6008,7 @@ ethofld_tx(struct cxgbe_snd_tag *cst) */ m->m_pkthdr.snd_tag = NULL; m->m_pkthdr.csum_flags &= ~CSUM_SND_TAG; - m_snd_tag_rele(&cst->com); + m_snd_tag_rele(&cst->com.com); mbufq_enqueue(&cst->pending_fwack, m); } @@ -6007,13 +6017,13 @@ ethofld_tx(struct cxgbe_snd_tag *cst) int ethofld_transmit(struct ifnet *ifp, struct mbuf *m0) { - struct cxgbe_snd_tag *cst; + struct cxgbe_rate_tag *cst; int rc; MPASS(m0->m_nextpkt == NULL); MPASS(m0->m_pkthdr.csum_flags & CSUM_SND_TAG); MPASS(m0->m_pkthdr.snd_tag != NULL); - cst = mst_to_cst(m0->m_pkthdr.snd_tag); + cst = mst_to_crt(m0->m_pkthdr.snd_tag); mtx_lock(&cst->lock); MPASS(cst->flags & EO_SND_TAG_REF); @@ -6052,10 +6062,10 @@ ethofld_transmit(struct ifnet *ifp, struct mbuf *m0) * ethofld_tx() in case we are sending the final mbuf after * the inp was freed. */ - m_snd_tag_ref(&cst->com); + m_snd_tag_ref(&cst->com.com); ethofld_tx(cst); mtx_unlock(&cst->lock); - m_snd_tag_rele(&cst->com); + m_snd_tag_rele(&cst->com.com); return (0); done: @@ -6072,7 +6082,7 @@ ethofld_fw4_ack(struct sge_iq *iq, const struct rss_he const struct cpl_fw4_ack *cpl = (const void *)(rss + 1); struct mbuf *m; u_int etid = G_CPL_FW4_ACK_FLOWID(be32toh(OPCODE_TID(cpl))); - struct cxgbe_snd_tag *cst; + struct cxgbe_rate_tag *cst; uint8_t credits = cpl->credits; cst = lookup_etid(sc, etid); @@ -6104,7 +6114,7 @@ ethofld_fw4_ack(struct sge_iq *iq, const struct rss_he cst->flags &= ~EO_FLUSH_RPL_PENDING; cst->tx_credits += cpl->credits; - cxgbe_snd_tag_free_locked(cst); + cxgbe_rate_tag_free_locked(cst); return (0); /* cst is gone. */ } KASSERT(m != NULL, @@ -6126,12 +6136,12 @@ ethofld_fw4_ack(struct sge_iq *iq, const struct rss_he * As with ethofld_transmit(), hold an extra reference * so that the tag is stable across ethold_tx(). */ - m_snd_tag_ref(&cst->com); + m_snd_tag_ref(&cst->com.com); m = mbufq_first(&cst->pending_tx); if (m != NULL && cst->tx_credits >= mbuf_eo_len16(m)) ethofld_tx(cst); mtx_unlock(&cst->lock); - m_snd_tag_rele(&cst->com); + m_snd_tag_rele(&cst->com.com); } else { /* * There shouldn't be any pending packets if the tag From owner-svn-src-head@freebsd.org Tue Oct 22 21:46:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 906C31661E0; Tue, 22 Oct 2019 21:46:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yRs82dHWz4JrV; Tue, 22 Oct 2019 21:46:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37CD41A936; Tue, 22 Oct 2019 21:46:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MLk4Ff054801; Tue, 22 Oct 2019 21:46:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MLk4BU054800; Tue, 22 Oct 2019 21:46:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910222146.x9MLk4BU054800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 22 Oct 2019 21:46:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353902 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 353902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 21:46:04 -0000 Author: kevans Date: Tue Oct 22 21:46:03 2019 New Revision: 353902 URL: https://svnweb.freebsd.org/changeset/base/353902 Log: arm: correct kernelstack allocation size This appears to be a copy-pasto from previous lines that propagated to v6 over the years. Indeed, nothing references kernelstack beyond USPACE_SVC_STACK_TOP and it would be odd if anything did. Noticed by: markj Modified: head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Tue Oct 22 21:24:48 2019 (r353901) +++ head/sys/arm/arm/machdep.c Tue Oct 22 21:46:03 2019 (r353902) @@ -943,7 +943,7 @@ initarm(struct arm_boot_params *abp) valloc_pages(irqstack, IRQ_STACK_SIZE * MAXCPU); valloc_pages(abtstack, ABT_STACK_SIZE * MAXCPU); valloc_pages(undstack, UND_STACK_SIZE * MAXCPU); - valloc_pages(kernelstack, kstack_pages * MAXCPU); + valloc_pages(kernelstack, kstack_pages); valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); /* @@ -1208,7 +1208,7 @@ initarm(struct arm_boot_params *abp) irqstack = pmap_preboot_get_vpages(IRQ_STACK_SIZE * MAXCPU); abtstack = pmap_preboot_get_vpages(ABT_STACK_SIZE * MAXCPU); undstack = pmap_preboot_get_vpages(UND_STACK_SIZE * MAXCPU ); - kernelstack = pmap_preboot_get_vpages(kstack_pages * MAXCPU); + kernelstack = pmap_preboot_get_vpages(kstack_pages); /* Allocate message buffer. */ msgbufp = (void *)pmap_preboot_get_vpages( From owner-svn-src-head@freebsd.org Tue Oct 22 22:23:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB971166F9D; Tue, 22 Oct 2019 22:23:59 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yShv464Zz4LM6; Tue, 22 Oct 2019 22:23:59 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7020F1B056; Tue, 22 Oct 2019 22:23:59 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MMNxup077930; Tue, 22 Oct 2019 22:23:59 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MMNx6J077929; Tue, 22 Oct 2019 22:23:59 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201910222223.x9MMNx6J077929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Tue, 22 Oct 2019 22:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353903 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 353903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 22:23:59 -0000 Author: mckusick Date: Tue Oct 22 22:23:59 2019 New Revision: 353903 URL: https://svnweb.freebsd.org/changeset/base/353903 Log: Replace an uninitialized variable with the correct element from the superblock when doing recovery with journalled soft updates. Reported by: Chuck Silvers MFC after: 3 days Sponsored by: Netflix Modified: head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Tue Oct 22 21:46:03 2019 (r353902) +++ head/sbin/fsck_ffs/suj.c Tue Oct 22 22:23:59 2019 (r353903) @@ -1555,7 +1555,7 @@ ino_trunc(ino_t ino, off_t size) /* If we freed everything in this indirect free the indir. */ if (lastlbn > lbn) continue; - blk_free(DIP(ip, di_ib[i]), 0, frags); + blk_free(DIP(ip, di_ib[i]), 0, fs->fs_frag); DIP_SET(ip, di_ib[i], 0); } ino_dirty(ino); From owner-svn-src-head@freebsd.org Tue Oct 22 22:52:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E76831675DF; Tue, 22 Oct 2019 22:52:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yTLF5r5hz4MJ0; Tue, 22 Oct 2019 22:52:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC36F1B59C; Tue, 22 Oct 2019 22:52:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MMqrmM095524; Tue, 22 Oct 2019 22:52:53 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MMqrq6095522; Tue, 22 Oct 2019 22:52:53 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910222252.x9MMqrq6095522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 22 Oct 2019 22:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353904 - head/sys/fs/pseudofs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/pseudofs X-SVN-Commit-Revision: 353904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 22:52:54 -0000 Author: mjg Date: Tue Oct 22 22:52:53 2019 New Revision: 353904 URL: https://svnweb.freebsd.org/changeset/base/353904 Log: pseudofs: hashed vncache Vast majority of uses the cache are just checking if there is an entry present on process exit (and evicting it if so). Both checking and eviction process are very expensive and put the lock protecting it high up on the profile during poudriere -j 104. Convert the linked list into a hash. This allows to almost always avoid taking the lock in the first place (and consequently almost removes it from the profile). Note only one lock is preserved as a split did not meaningfully impact contention. Should the cache be used for something it will still run into contention issues. The code needs a rewrite, but should someone want to tidy it up further the following can be done: 1) per-chain locks (or at least an array) 2) hashing by something else than just pid Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/pseudofs/pseudofs_internal.h head/sys/fs/pseudofs/pseudofs_vncache.c Modified: head/sys/fs/pseudofs/pseudofs_internal.h ============================================================================== --- head/sys/fs/pseudofs/pseudofs_internal.h Tue Oct 22 22:23:59 2019 (r353903) +++ head/sys/fs/pseudofs/pseudofs_internal.h Tue Oct 22 22:52:53 2019 (r353904) @@ -45,8 +45,7 @@ struct pfs_vdata { struct pfs_node *pvd_pn; pid_t pvd_pid; struct vnode *pvd_vnode; - struct pfs_vdata*pvd_prev, *pvd_next; - int pvd_dead:1; + SLIST_ENTRY(pfs_vdata) pvd_hash; }; /* Modified: head/sys/fs/pseudofs/pseudofs_vncache.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs_vncache.c Tue Oct 22 22:23:59 2019 (r353903) +++ head/sys/fs/pseudofs/pseudofs_vncache.c Tue Oct 22 22:52:53 2019 (r353904) @@ -50,10 +50,9 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_PFSVNCACHE, "pfs_vncache", "pseudofs vnode cache"); static struct mtx pfs_vncache_mutex; -static struct pfs_vdata *pfs_vncache; static eventhandler_tag pfs_exit_tag; static void pfs_exit(void *arg, struct proc *p); -static void pfs_purge_locked(struct pfs_node *pn, bool force); +static void pfs_purge_all(void); static SYSCTL_NODE(_vfs_pfs, OID_AUTO, vncache, CTLFLAG_RW, 0, "pseudofs vnode cache"); @@ -80,6 +79,10 @@ SYSCTL_INT(_vfs_pfs_vncache, OID_AUTO, misses, CTLFLAG extern struct vop_vector pfs_vnodeops; /* XXX -> .h file */ +static SLIST_HEAD(pfs_vncache_head, pfs_vdata) *pfs_vncache_hashtbl; +static u_long pfs_vncache_hash; +#define PFS_VNCACHE_HASH(pid) (&pfs_vncache_hashtbl[(pid) & pfs_vncache_hash]) + /* * Initialize vnode cache */ @@ -88,6 +91,7 @@ pfs_vncache_load(void) { mtx_init(&pfs_vncache_mutex, "pfs_vncache", NULL, MTX_DEF); + pfs_vncache_hashtbl = hashinit(maxproc / 4, M_PFSVNCACHE, &pfs_vncache_hash); pfs_exit_tag = EVENTHANDLER_REGISTER(process_exit, pfs_exit, NULL, EVENTHANDLER_PRI_ANY); } @@ -100,9 +104,7 @@ pfs_vncache_unload(void) { EVENTHANDLER_DEREGISTER(process_exit, pfs_exit_tag); - mtx_lock(&pfs_vncache_mutex); - pfs_purge_locked(NULL, true); - mtx_unlock(&pfs_vncache_mutex); + pfs_purge_all(); KASSERT(pfs_vncache_entries == 0, ("%d vncache entries remaining", pfs_vncache_entries)); mtx_destroy(&pfs_vncache_mutex); @@ -115,17 +117,20 @@ int pfs_vncache_alloc(struct mount *mp, struct vnode **vpp, struct pfs_node *pn, pid_t pid) { + struct pfs_vncache_head *hash; struct pfs_vdata *pvd, *pvd2; struct vnode *vp; int error; /* * See if the vnode is in the cache. - * XXX linear search is not very efficient. */ + hash = PFS_VNCACHE_HASH(pid); + if (SLIST_EMPTY(hash)) + goto alloc; retry: mtx_lock(&pfs_vncache_mutex); - for (pvd = pfs_vncache; pvd; pvd = pvd->pvd_next) { + SLIST_FOREACH(pvd, hash, pvd_hash) { if (pvd->pvd_pn == pn && pvd->pvd_pid == pid && pvd->pvd_vnode->v_mount == mp) { vp = pvd->pvd_vnode; @@ -150,10 +155,9 @@ retry: } } mtx_unlock(&pfs_vncache_mutex); - +alloc: /* nope, get a new one */ pvd = malloc(sizeof *pvd, M_PFSVNCACHE, M_WAITOK); - pvd->pvd_next = pvd->pvd_prev = NULL; error = getnewvnode("pseudofs", mp, &pfs_vnodeops, vpp); if (error) { free(pvd, M_PFSVNCACHE); @@ -208,7 +212,7 @@ retry2: * going to insert into the cache. Recheck after * pfs_vncache_mutex is reacquired. */ - for (pvd2 = pfs_vncache; pvd2; pvd2 = pvd2->pvd_next) { + SLIST_FOREACH(pvd2, hash, pvd_hash) { if (pvd2->pvd_pn == pn && pvd2->pvd_pid == pid && pvd2->pvd_vnode->v_mount == mp) { vp = pvd2->pvd_vnode; @@ -228,11 +232,7 @@ retry2: ++pfs_vncache_misses; if (++pfs_vncache_entries > pfs_vncache_maxentries) pfs_vncache_maxentries = pfs_vncache_entries; - pvd->pvd_prev = NULL; - pvd->pvd_next = pfs_vncache; - if (pvd->pvd_next) - pvd->pvd_next->pvd_prev = pvd; - pfs_vncache = pvd; + SLIST_INSERT_HEAD(hash, pvd, pvd_hash); mtx_unlock(&pfs_vncache_mutex); return (0); } @@ -243,19 +243,17 @@ retry2: int pfs_vncache_free(struct vnode *vp) { - struct pfs_vdata *pvd; + struct pfs_vdata *pvd, *pvd2; mtx_lock(&pfs_vncache_mutex); pvd = (struct pfs_vdata *)vp->v_data; KASSERT(pvd != NULL, ("pfs_vncache_free(): no vnode data\n")); - if (pvd->pvd_next) - pvd->pvd_next->pvd_prev = pvd->pvd_prev; - if (pvd->pvd_prev) { - pvd->pvd_prev->pvd_next = pvd->pvd_next; + SLIST_FOREACH(pvd2, PFS_VNCACHE_HASH(pvd->pvd_pid), pvd_hash) { + if (pvd2 != pvd) + continue; + SLIST_REMOVE(PFS_VNCACHE_HASH(pvd->pvd_pid), pvd, pfs_vdata, pvd_hash); --pfs_vncache_entries; - } else if (pfs_vncache == pvd) { - pfs_vncache = pvd->pvd_next; - --pfs_vncache_entries; + break; } mtx_unlock(&pfs_vncache_mutex); @@ -267,6 +265,15 @@ pfs_vncache_free(struct vnode *vp) /* * Purge the cache of dead entries * + * The code is not very efficient and this perhaps can be addressed without + * a complete rewrite. Previous iteration was walking a linked list from + * scratch every time. This code only walks the relevant hash chain (if pid + * is provided), but still resorts to scanning the entire cache at least twice + * if a specific component is to be removed which is slower. This can be + * augmented with resizing the hash. + * + * Explanation of the previous state: + * * This is extremely inefficient due to the fact that vgone() not only * indirectly modifies the vnode cache, but may also sleep. We can * neither hold pfs_vncache_mutex across a vgone() call, nor make any @@ -277,39 +284,51 @@ pfs_vncache_free(struct vnode *vp) * The only way to improve this situation is to change the data structure * used to implement the cache. */ + static void -pfs_purge_locked(struct pfs_node *pn, bool force) +pfs_purge_one(struct vnode *vnp) { + + VOP_LOCK(vnp, LK_EXCLUSIVE); + vgone(vnp); + VOP_UNLOCK(vnp, 0); + vdrop(vnp); +} + +void +pfs_purge(struct pfs_node *pn) +{ struct pfs_vdata *pvd; struct vnode *vnp; + u_long i, removed; - mtx_assert(&pfs_vncache_mutex, MA_OWNED); - pvd = pfs_vncache; - while (pvd != NULL) { - if (force || pvd->pvd_dead || - (pn != NULL && pvd->pvd_pn == pn)) { + mtx_lock(&pfs_vncache_mutex); +restart: + removed = 0; + for (i = 0; i < pfs_vncache_hash; i++) { +restart_chain: + SLIST_FOREACH(pvd, &pfs_vncache_hashtbl[i], pvd_hash) { + if (pn != NULL && pvd->pvd_pn != pn) + continue; vnp = pvd->pvd_vnode; vhold(vnp); mtx_unlock(&pfs_vncache_mutex); - VOP_LOCK(vnp, LK_EXCLUSIVE); - vgone(vnp); - VOP_UNLOCK(vnp, 0); + pfs_purge_one(vnp); + removed++; mtx_lock(&pfs_vncache_mutex); - vdrop(vnp); - pvd = pfs_vncache; - } else { - pvd = pvd->pvd_next; + goto restart_chain; } } + if (removed > 0) + goto restart; + mtx_unlock(&pfs_vncache_mutex); } -void -pfs_purge(struct pfs_node *pn) +static void +pfs_purge_all(void) { - mtx_lock(&pfs_vncache_mutex); - pfs_purge_locked(pn, false); - mtx_unlock(&pfs_vncache_mutex); + pfs_purge(NULL); } /* @@ -318,16 +337,25 @@ pfs_purge(struct pfs_node *pn) static void pfs_exit(void *arg, struct proc *p) { + struct pfs_vncache_head *hash; struct pfs_vdata *pvd; - int dead; + struct vnode *vnp; + int pid; - if (pfs_vncache == NULL) + pid = p->p_pid; + hash = PFS_VNCACHE_HASH(pid); + if (SLIST_EMPTY(hash)) return; +restart: mtx_lock(&pfs_vncache_mutex); - for (pvd = pfs_vncache, dead = 0; pvd != NULL; pvd = pvd->pvd_next) - if (pvd->pvd_pid == p->p_pid) - dead = pvd->pvd_dead = 1; - if (dead) - pfs_purge_locked(NULL, false); + SLIST_FOREACH(pvd, hash, pvd_hash) { + if (pvd->pvd_pid != pid) + continue; + vnp = pvd->pvd_vnode; + vhold(vnp); + mtx_unlock(&pfs_vncache_mutex); + pfs_purge_one(vnp); + goto restart; + } mtx_unlock(&pfs_vncache_mutex); } From owner-svn-src-head@freebsd.org Tue Oct 22 22:54:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA7D5167670; Tue, 22 Oct 2019 22:54:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yTNL43rNz4MR1; Tue, 22 Oct 2019 22:54:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B98A1B59E; Tue, 22 Oct 2019 22:54:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MMsgCA095645; Tue, 22 Oct 2019 22:54:42 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MMsgo8095644; Tue, 22 Oct 2019 22:54:42 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910222254.x9MMsgo8095644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 22 Oct 2019 22:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353905 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 353905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 22:54:42 -0000 Author: mjg Date: Tue Oct 22 22:54:41 2019 New Revision: 353905 URL: https://svnweb.freebsd.org/changeset/base/353905 Log: amd64 pmap: fixup invlgen lookup for fictitious mappings Similarly to r353438, use dummy entry. Reported and tested by: Neel Chauhan Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Oct 22 22:52:53 2019 (r353904) +++ head/sys/amd64/amd64/pmap.c Tue Oct 22 22:54:41 2019 (r353905) @@ -951,8 +951,16 @@ SYSCTL_LONG(_vm_pmap, OID_AUTO, invl_wait_slow, CTLFLA static u_long * pmap_delayed_invl_genp(vm_page_t m) { + vm_paddr_t pa; + u_long *gen; - return (&pa_to_pmdp(VM_PAGE_TO_PHYS(m))->pv_invl_gen); + pa = VM_PAGE_TO_PHYS(m); + if (__predict_false((pa) > pmap_last_pa)) + gen = &pv_dummy_large.pv_invl_gen; + else + gen = &(pa_to_pmdp(pa)->pv_invl_gen); + + return (gen); } #else static u_long * From owner-svn-src-head@freebsd.org Tue Oct 22 22:55:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37373167730; Tue, 22 Oct 2019 22:55:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yTPb0GqXz4MZH; Tue, 22 Oct 2019 22:55:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1AD01B59F; Tue, 22 Oct 2019 22:55:46 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MMtk7d095774; Tue, 22 Oct 2019 22:55:46 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MMtkJr095773; Tue, 22 Oct 2019 22:55:46 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910222255.x9MMtkJr095773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 22 Oct 2019 22:55:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353906 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 353906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 22:55:47 -0000 Author: mjg Date: Tue Oct 22 22:55:46 2019 New Revision: 353906 URL: https://svnweb.freebsd.org/changeset/base/353906 Log: amd64 pmap: conditionalize per-superpage locks on NUMA Instead of superpages use. The current code employs superpage-wide locking regardless and the better locking granularity is welcome with NUMA enabled even when superpage support is not used. Requested by: alc Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21982 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Oct 22 22:54:41 2019 (r353905) +++ head/sys/amd64/amd64/pmap.c Tue Oct 22 22:55:46 2019 (r353906) @@ -322,7 +322,7 @@ pmap_pku_mask_bit(pmap_t pmap) ("address %lx beyond the last segment", (pa))); \ (pa) >> PDRSHIFT; \ }) -#if VM_NRESERVLEVEL > 0 +#ifdef NUMA #define pa_to_pmdp(pa) (&pv_table[pa_index(pa)]) #define pa_to_pvh(pa) (&(pa_to_pmdp(pa)->pv_page)) #define PHYS_TO_PV_LIST_LOCK(pa) ({ \ @@ -422,7 +422,7 @@ static int pmap_initialized; */ static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks); static struct mtx __exclusive_cache_line pv_chunks_mutex; -#if VM_NRESERVLEVEL > 0 +#ifdef NUMA struct pmap_large_md_page { struct rwlock pv_lock; struct md_page pv_page; @@ -947,7 +947,7 @@ SYSCTL_LONG(_vm_pmap, OID_AUTO, invl_wait_slow, CTLFLA "Number of slow invalidation waits for lockless DI"); #endif -#if VM_NRESERVLEVEL > 0 +#ifdef NUMA static u_long * pmap_delayed_invl_genp(vm_page_t m) { @@ -1850,7 +1850,7 @@ pmap_page_init(vm_page_t m) m->md.pat_mode = PAT_WRITE_BACK; } -#if VM_NRESERVLEVEL > 0 +#ifdef NUMA static void pmap_init_pv_table(void) { From owner-svn-src-head@freebsd.org Wed Oct 23 00:05:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A63F168F7B; Wed, 23 Oct 2019 00:05:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yVy21Jdpz4RHC; Wed, 23 Oct 2019 00:05:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C55B1C224; Wed, 23 Oct 2019 00:05:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N05T8T038683; Wed, 23 Oct 2019 00:05:29 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N05TlT038682; Wed, 23 Oct 2019 00:05:29 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201910230005.x9N05TlT038682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 23 Oct 2019 00:05:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353907 - head X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 353907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 00:05:30 -0000 Author: jkim Date: Wed Oct 23 00:05:29 2019 New Revision: 353907 URL: https://svnweb.freebsd.org/changeset/base/353907 Log: Belatedly remove stale debug symbols after r339270. Reported by: danfe MFC after: 3 days Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Oct 22 22:55:46 2019 (r353906) +++ head/ObsoleteFiles.inc Wed Oct 23 00:05:29 2019 (r353907) @@ -872,6 +872,16 @@ OLD_FILES+=usr/include/openssl/kssl.h OLD_FILES+=usr/include/openssl/pqueue.h OLD_FILES+=usr/include/openssl/ssl23.h OLD_FILES+=usr/include/openssl/ui_compat.h +OLD_FILES+=usr/lib/debug/usr/lib/engines/lib4758cca.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libaep.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libatalla.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libcapi.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libchil.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libcswift.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libgost.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libnuron.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libsureware.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libubsec.so.debug OLD_FILES+=usr/share/openssl/man/man1/dss1.1.gz OLD_FILES+=usr/share/openssl/man/man1/md2.1.gz OLD_FILES+=usr/share/openssl/man/man1/md4.1.gz From owner-svn-src-head@freebsd.org Wed Oct 23 00:31:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5BB216994D; Wed, 23 Oct 2019 00:31:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yWWr3wZFz4SDd; Wed, 23 Oct 2019 00:31:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A1CC1C5FE; Wed, 23 Oct 2019 00:31:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N0VKHg052176; Wed, 23 Oct 2019 00:31:20 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N0VKh9052175; Wed, 23 Oct 2019 00:31:20 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910230031.x9N0VKh9052175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 23 Oct 2019 00:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353908 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 353908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 00:31:20 -0000 Author: jhibbits Date: Wed Oct 23 00:31:19 2019 New Revision: 353908 URL: https://svnweb.freebsd.org/changeset/base/353908 Log: powerpc/booke: Fix Book-E boot post-minidump r353489 added minidump support for powerpc64, but it added a dependency on the dump_avail array. Leaving it uninitialized caused breakage in late boot. Initialize dump_avail, even though the 64-bit booke pmap doesn't yet support minidumps, but will in the future. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Wed Oct 23 00:05:29 2019 (r353907) +++ head/sys/powerpc/booke/pmap.c Wed Oct 23 00:31:19 2019 (r353908) @@ -1787,6 +1787,8 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o hwphyssz - physsz; physsz = hwphyssz; phys_avail_count++; + dump_avail[j] = phys_avail[j]; + dump_avail[j + 1] = phys_avail[j + 1]; } break; } @@ -1796,6 +1798,8 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o availmem_regions[i].mr_size; phys_avail_count++; physsz += availmem_regions[i].mr_size; + dump_avail[j] = phys_avail[j]; + dump_avail[j + 1] = phys_avail[j + 1]; } physmem = btoc(physsz); From owner-svn-src-head@freebsd.org Wed Oct 23 01:11:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 207CA16A2D2; Wed, 23 Oct 2019 01:11:26 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yXQ603Qqz4TXJ; Wed, 23 Oct 2019 01:11:26 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D97361CD0E; Wed, 23 Oct 2019 01:11:25 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N1BPbP078020; Wed, 23 Oct 2019 01:11:25 GMT (envelope-from grog@FreeBSD.org) Received: (from grog@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N1BPZt078019; Wed, 23 Oct 2019 01:11:25 GMT (envelope-from grog@FreeBSD.org) Message-Id: <201910230111.x9N1BPZt078019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grog set sender to grog@FreeBSD.org using -f From: Greg Lehey Date: Wed, 23 Oct 2019 01:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353909 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: grog X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 353909 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 01:11:26 -0000 Author: grog Date: Wed Oct 23 01:11:25 2019 New Revision: 353909 URL: https://svnweb.freebsd.org/changeset/base/353909 Log: Correct spelling, apply appropriate respect. Modified: head/usr.bin/calendar/calendars/calendar.holiday Modified: head/usr.bin/calendar/calendars/calendar.holiday ============================================================================== --- head/usr.bin/calendar/calendars/calendar.holiday Wed Oct 23 00:31:19 2019 (r353908) +++ head/usr.bin/calendar/calendars/calendar.holiday Wed Oct 23 01:11:25 2019 (r353909) @@ -447,7 +447,7 @@ 10/20 Kenyatta Day in Kenya 10/21 Armed Forces Day in Honduras 10/21 Revolution Days (2 days) in Somalia -10/23 Chulalongkron's Day in Thailand +10/23 King Chulalongkorn Day in Thailand 10/24 Independence Day in Zambia 10/24 United Nations Day 10/25 Taiwan Restoration Day in Taiwan From owner-svn-src-head@freebsd.org Wed Oct 23 01:50:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F22D916AAED; Wed, 23 Oct 2019 01:50:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yYHP5mtnz4VjB; Wed, 23 Oct 2019 01:50:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB0051D404; Wed, 23 Oct 2019 01:50:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N1of02098354; Wed, 23 Oct 2019 01:50:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N1ofHZ098353; Wed, 23 Oct 2019 01:50:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910230150.x9N1ofHZ098353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 23 Oct 2019 01:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353911 - head/lib/libcasper X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libcasper X-SVN-Commit-Revision: 353911 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 01:50:42 -0000 Author: kevans Date: Wed Oct 23 01:50:41 2019 New Revision: 353911 URL: https://svnweb.freebsd.org/changeset/base/353911 Log: libcasper/services: include to hook tests to build Note that the cap_sysctl tests are currently failing and need some attention. Modified: head/lib/libcasper/Makefile Modified: head/lib/libcasper/Makefile ============================================================================== --- head/lib/libcasper/Makefile Wed Oct 23 01:29:09 2019 (r353910) +++ head/lib/libcasper/Makefile Wed Oct 23 01:50:41 2019 (r353911) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + SUBDIR= libcasper SUBDIR+= services From owner-svn-src-head@freebsd.org Wed Oct 23 02:15:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2695316B65F; Wed, 23 Oct 2019 02:15:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yYqm0FtHz4WpB; Wed, 23 Oct 2019 02:15:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E09541D947; Wed, 23 Oct 2019 02:15:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N2FFlL015870; Wed, 23 Oct 2019 02:15:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N2FFq8015869; Wed, 23 Oct 2019 02:15:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910230215.x9N2FFq8015869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 23 Oct 2019 02:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353912 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353912 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 02:15:16 -0000 Author: kevans Date: Wed Oct 23 02:15:15 2019 New Revision: 353912 URL: https://svnweb.freebsd.org/changeset/base/353912 Log: tuntap(4): Fix NOINET build after r353741 Shuffle headers around to more appropriate #ifdef OPTION blocks (INET vs. INET6) -- double checked LINT-{NOINET,NOINET6,NOIP}, all seem good. Reported by: cem Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Wed Oct 23 01:50:41 2019 (r353911) +++ head/sys/net/if_tuntap.c Wed Oct 23 02:15:15 2019 (r353912) @@ -88,14 +88,16 @@ #include #include #include -#ifdef INET #include +#ifdef INET #include +#endif +#ifdef INET6 #include #include +#endif #include #include -#endif #include #include #include From owner-svn-src-head@freebsd.org Wed Oct 23 03:23:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2526C16CB15; Wed, 23 Oct 2019 03:23:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ybLC09bFz4ZXh; Wed, 23 Oct 2019 03:23:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCF9D1E60B; Wed, 23 Oct 2019 03:23:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N3NEk7057995; Wed, 23 Oct 2019 03:23:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N3NEH6057994; Wed, 23 Oct 2019 03:23:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910230323.x9N3NEH6057994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 23 Oct 2019 03:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353914 - head/lib/libcasper/services/cap_sysctl X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libcasper/services/cap_sysctl X-SVN-Commit-Revision: 353914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 03:23:15 -0000 Author: kevans Date: Wed Oct 23 03:23:14 2019 New Revision: 353914 URL: https://svnweb.freebsd.org/changeset/base/353914 Log: cap_sysctl: correct typo from r347534-ish operation & ~limit where limit is a bool is clearly not what was intended, given the line prior. Correct it to use the calculated mask for validation. The cap_sysctl tests should now be functional again. Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.c Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.c ============================================================================== --- head/lib/libcasper/services/cap_sysctl/cap_sysctl.c Wed Oct 23 03:15:27 2019 (r353913) +++ head/lib/libcasper/services/cap_sysctl/cap_sysctl.c Wed Oct 23 03:23:14 2019 (r353914) @@ -316,7 +316,7 @@ sysctl_valid(const nvlist_t *nvl, bool limit) */ mask = limit ? (CAP_SYSCTL_RDWR | CAP_SYSCTL_RECURSIVE) : CAP_SYSCTL_RDWR; - if ((operation & ~limit) != 0 || + if ((operation & ~mask) != 0 || (operation & CAP_SYSCTL_RDWR) == 0) return (EINVAL); /* Only one 'operation' can be present. */ From owner-svn-src-head@freebsd.org Wed Oct 23 07:36:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 868E7172511; Wed, 23 Oct 2019 07:36:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yhyM30TQz3JTG; Wed, 23 Oct 2019 07:36:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 473702133F; Wed, 23 Oct 2019 07:36:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N7aRUZ005045; Wed, 23 Oct 2019 07:36:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N7aREw005044; Wed, 23 Oct 2019 07:36:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910230736.x9N7aREw005044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 23 Oct 2019 07:36:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353916 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353916 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 07:36:27 -0000 Author: kib Date: Wed Oct 23 07:36:26 2019 New Revision: 353916 URL: https://svnweb.freebsd.org/changeset/base/353916 Log: Assert that vm_fault_lock_vnode() returns locked saved vnode. Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D22113 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed Oct 23 03:25:32 2019 (r353915) +++ head/sys/vm/vm_fault.c Wed Oct 23 07:36:26 2019 (r353916) @@ -637,8 +637,10 @@ vm_fault_lock_vnode(struct faultstate *fs) if (fs->object->type != OBJT_VNODE) return (KERN_SUCCESS); vp = fs->object->handle; - if (vp == fs->vp) + if (vp == fs->vp) { + ASSERT_VOP_LOCKED(vp, "saved vnode is not locked"); return (KERN_SUCCESS); + } /* * Perform an unlock in case the desired vnode changed while From owner-svn-src-head@freebsd.org Wed Oct 23 09:54:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB72B1755BB; Wed, 23 Oct 2019 09:54:12 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ym1J5tbWz3QgZ; Wed, 23 Oct 2019 09:54:12 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD36C22CB1; Wed, 23 Oct 2019 09:54:12 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N9sCJS087738; Wed, 23 Oct 2019 09:54:12 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N9sCcH087737; Wed, 23 Oct 2019 09:54:12 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910230954.x9N9sCcH087737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 23 Oct 2019 09:54:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353917 - head/sys/dev/extres/regulator X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/extres/regulator X-SVN-Commit-Revision: 353917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 09:54:13 -0000 Author: manu Date: Wed Oct 23 09:54:12 2019 New Revision: 353917 URL: https://svnweb.freebsd.org/changeset/base/353917 Log: regulator: Add a regnode_method_init This is a default init method for regulator that don't really need one. MFC after: 1 week Modified: head/sys/dev/extres/regulator/regulator.c Modified: head/sys/dev/extres/regulator/regulator.c ============================================================================== --- head/sys/dev/extres/regulator/regulator.c Wed Oct 23 07:36:26 2019 (r353916) +++ head/sys/dev/extres/regulator/regulator.c Wed Oct 23 09:54:12 2019 (r353917) @@ -65,6 +65,7 @@ typedef TAILQ_HEAD(regnode_list, regnode) regnode_list typedef TAILQ_HEAD(regulator_list, regulator) regulator_list_t; /* Default regulator methods. */ +static int regnode_method_init(struct regnode *regnode); static int regnode_method_enable(struct regnode *regnode, bool enable, int *udelay); static int regnode_method_status(struct regnode *regnode, int *status); @@ -77,6 +78,7 @@ static void regulator_shutdown(void *dummy); * Regulator controller methods. */ static regnode_method_t regnode_methods[] = { + REGNODEMETHOD(regnode_init, regnode_method_init), REGNODEMETHOD(regnode_enable, regnode_method_enable), REGNODEMETHOD(regnode_status, regnode_method_status), REGNODEMETHOD(regnode_set_voltage, regnode_method_set_voltage), @@ -212,6 +214,13 @@ regnode_uvolt_sysctl(SYSCTL_HANDLER_ARGS) * Default regulator methods for base class. * */ +static int +regnode_method_init(struct regnode *regnode) +{ + + return (0); +} + static int regnode_method_enable(struct regnode *regnode, bool enable, int *udelay) { From owner-svn-src-head@freebsd.org Wed Oct 23 09:54:51 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BE67175636; Wed, 23 Oct 2019 09:54:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ym226YBrz3QpY; Wed, 23 Oct 2019 09:54:50 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C48AB22CB2; Wed, 23 Oct 2019 09:54:50 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N9so7C087809; Wed, 23 Oct 2019 09:54:50 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N9sot0087808; Wed, 23 Oct 2019 09:54:50 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910230954.x9N9sot0087808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 23 Oct 2019 09:54:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353918 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 353918 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 09:54:51 -0000 Author: manu Date: Wed Oct 23 09:54:50 2019 New Revision: 353918 URL: https://svnweb.freebsd.org/changeset/base/353918 Log: axp81x: Use the default regnode_init method MFC after: 1 week Modified: head/sys/arm/allwinner/axp81x.c Modified: head/sys/arm/allwinner/axp81x.c ============================================================================== --- head/sys/arm/allwinner/axp81x.c Wed Oct 23 09:54:12 2019 (r353917) +++ head/sys/arm/allwinner/axp81x.c Wed Oct 23 09:54:50 2019 (r353918) @@ -747,12 +747,6 @@ axp8xx_write(device_t dev, uint8_t reg, uint8_t val) } static int -axp8xx_regnode_init(struct regnode *regnode) -{ - return (0); -} - -static int axp8xx_regnode_enable(struct regnode *regnode, bool enable, int *udelay) { struct axp8xx_reg_sc *sc; @@ -869,7 +863,6 @@ axp8xx_regnode_get_voltage(struct regnode *regnode, in static regnode_method_t axp8xx_regnode_methods[] = { /* Regulator interface */ - REGNODEMETHOD(regnode_init, axp8xx_regnode_init), REGNODEMETHOD(regnode_enable, axp8xx_regnode_enable), REGNODEMETHOD(regnode_set_voltage, axp8xx_regnode_set_voltage), REGNODEMETHOD(regnode_get_voltage, axp8xx_regnode_get_voltage), From owner-svn-src-head@freebsd.org Wed Oct 23 09:56:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 646141756E2; Wed, 23 Oct 2019 09:56:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ym4Q210mz3Qys; Wed, 23 Oct 2019 09:56:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24CDF22CB3; Wed, 23 Oct 2019 09:56:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N9urld087981; Wed, 23 Oct 2019 09:56:53 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N9urvZ087980; Wed, 23 Oct 2019 09:56:53 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910230956.x9N9urvZ087980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 23 Oct 2019 09:56:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353919 - head/sys/dev/extres/regulator X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/extres/regulator X-SVN-Commit-Revision: 353919 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 09:56:54 -0000 Author: manu Date: Wed Oct 23 09:56:53 2019 New Revision: 353919 URL: https://svnweb.freebsd.org/changeset/base/353919 Log: regulator: Add a regnode_set_constraint function This method check that boot_on or always_on is set to 1 and if it is it will try to enable the regulator. The binding docs aren't clear on what to do but Linux enable the regulator if any of those properties is set so we want to do the same. The function first check the status to see if the regulator is already enabled it then get the voltage to check if it is in a acceptable range and then enables it. This will be either called from the regnode_init method (if it's needed by the platform) or by a SYSINIT at SI_SUB_LAST Reviewed by: mmel MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22106 Modified: head/sys/dev/extres/regulator/regulator.c head/sys/dev/extres/regulator/regulator.h Modified: head/sys/dev/extres/regulator/regulator.c ============================================================================== --- head/sys/dev/extres/regulator/regulator.c Wed Oct 23 09:54:50 2019 (r353918) +++ head/sys/dev/extres/regulator/regulator.c Wed Oct 23 09:56:53 2019 (r353919) @@ -72,6 +72,7 @@ static int regnode_method_status(struct regnode *regno static int regnode_method_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt, int *udelay); static int regnode_method_get_voltage(struct regnode *regnode, int *uvolt); +static void regulator_constraint(void *dummy); static void regulator_shutdown(void *dummy); /* @@ -154,9 +155,27 @@ SX_SYSINIT(regulator_topology, ®node_topo_lock, "Re #define REGNODE_XLOCK(_sc) sx_xlock(&((_sc)->lock)) #define REGNODE_UNLOCK(_sc) sx_unlock(&((_sc)->lock)) +SYSINIT(regulator_constraint, SI_SUB_LAST, SI_ORDER_ANY, regulator_constraint, + NULL); SYSINIT(regulator_shutdown, SI_SUB_LAST, SI_ORDER_ANY, regulator_shutdown, NULL); +static void +regulator_constraint(void *dummy) +{ + struct regnode *entry; + int rv; + + REG_TOPO_SLOCK(); + TAILQ_FOREACH(entry, ®node_list, reglist_link) { + rv = regnode_set_constraint(entry); + if (rv != 0 && bootverbose) + printf("regulator: setting constraint on %s failed (%d)\n", + entry->name, rv); + } + REG_TOPO_UNLOCK(); +} + /* * Disable unused regulator * We run this function at SI_SUB_LAST which mean that every driver that needs @@ -778,6 +797,56 @@ regnode_set_voltage_checked(struct regnode *regnode, s regnode_delay(udelay); REGNODE_UNLOCK(regnode); return (rv); +} + +int +regnode_set_constraint(struct regnode *regnode) +{ + int status, rv, uvolt; + + if (regnode->std_param.boot_on != true && + regnode->std_param.always_on != true) + return (0); + + rv = regnode_status(regnode, &status); + if (rv != 0) { + if (bootverbose) + printf("Cannot get regulator status for %s\n", + regnode_get_name(regnode)); + return (rv); + } + + if (status == REGULATOR_STATUS_ENABLED) + return (0); + + rv = regnode_get_voltage(regnode, &uvolt); + if (rv != 0) { + if (bootverbose) + printf("Cannot get regulator voltage for %s\n", + regnode_get_name(regnode)); + return (rv); + } + + if (uvolt < regnode->std_param.min_uvolt || + uvolt > regnode->std_param.max_uvolt) { + if (bootverbose) + printf("Regulator %s current voltage %d is not in the" + " acceptable range : %d<->%d\n", + regnode_get_name(regnode), + uvolt, regnode->std_param.min_uvolt, + regnode->std_param.max_uvolt); + return (ERANGE); + } + + rv = regnode_enable(regnode); + if (rv != 0) { + if (bootverbose) + printf("Cannot enable regulator %s\n", + regnode_get_name(regnode)); + return (rv); + } + + return (0); } #ifdef FDT Modified: head/sys/dev/extres/regulator/regulator.h ============================================================================== --- head/sys/dev/extres/regulator/regulator.h Wed Oct 23 09:54:50 2019 (r353918) +++ head/sys/dev/extres/regulator/regulator.h Wed Oct 23 09:56:53 2019 (r353919) @@ -116,6 +116,7 @@ int regnode_stop(struct regnode *regnode, int depth); int regnode_status(struct regnode *regnode, int *status); int regnode_get_voltage(struct regnode *regnode, int *uvolt); int regnode_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt); +int regnode_set_constraint(struct regnode *regnode); #ifdef FDT phandle_t regnode_get_ofw_node(struct regnode *regnode); #endif From owner-svn-src-head@freebsd.org Wed Oct 23 12:18:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3A98150831; Wed, 23 Oct 2019 12:18:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 46yqCS127Dz43DV; Wed, 23 Oct 2019 12:18:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 9972343E6DE; Wed, 23 Oct 2019 23:18:07 +1100 (AEDT) Date: Wed, 23 Oct 2019 23:18:06 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alan Somers cc: Andrew Turner , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r353640 - head/sys/kern In-Reply-To: Message-ID: <20191023210546.L892@besplex.bde.org> References: <201910161321.x9GDL2ee021543@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=4zIc5qUCshN3e9hYGH4A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 46yqCS127Dz43DV X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of brde@optusnet.com.au designates 211.29.132.246 as permitted sender) smtp.mailfrom=brde@optusnet.com.au X-Spamd-Result: default: False [-2.30 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:211.29.132.0/23]; FREEMAIL_FROM(0.00)[optusnet.com.au]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[optusnet.com.au]; IP_SCORE_FREEMAIL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(0.00)[ip: (-6.93), ipnet: 211.28.0.0/14(-3.22), asn: 4804(-2.38), country: AU(0.01)]; TO_DN_ALL(0.00)[]; RCVD_NO_TLS_LAST(0.10)[]; RCVD_IN_DNSWL_LOW(-0.10)[246.132.29.211.list.dnswl.org : 127.0.5.1]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[optusnet.com.au]; ASN(0.00)[asn:4804, ipnet:211.28.0.0/14, country:AU]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 12:18:13 -0000 On Tue, 22 Oct 2019, Alan Somers wrote: > On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner wrote: > >> Author: andrew >> Date: Wed Oct 16 13:21:01 2019 >> New Revision: 353640 >> URL: https://svnweb.freebsd.org/changeset/base/353640 >> >> Log: >> Stop leaking information from the kernel through timespec >> >> The timespec struct holds a seconds value in a time_t and a nanoseconds >> value in a long. On most architectures these are the same size, however >> on 32-bit architectures other than i386 time_t is 8 bytes and long is >> 4 bytes. >> >> Most ABIs will then pad a struct holding an 8 byte and 4 byte value to >> 16 bytes with 4 bytes of padding. When copying one of these structs the >> compiler is free to copy the padding if it wishes. I doubt that most ABIs pad the struct in that case. Pure 32-bit arches don't have any 64-bit memory or register operations, so they use 32-bit longs and don't pessimize structs with 64-bit types in them using padding. If there are any such ABIs, then there are thousands if not millions more places to fix. Every place where a timespec is written must be checked. E.g., gettimeofday() reduces to microtime(). The implementation of microtime() happens to fill the timeval fields separately. That always leaks kernel context if struct timeval has padding and nothing else zeros the padding. And for gettimeofday() it is especially clear that nothing else zeros the padding. sys_gettimeofday() allocates a timeval on the kernel stack; microtime() initializes its fields separately leaving any padding untouched; copyout() then copies out kernel context. This commit attempts to fix the different problem that if lower levels like microtime() were pessimized to initialize the padding, then callers would have to be careful to preserve this by not using struct assignments for copying structs. This is not easy to do. bcopy() and copyout() should preserve memory, but there are no guarantees if the struct is accessed in other ways. The fix in this commit can easily not work on arches that have the problem: bzero(&tv); /* padding now all 0 */ tv.tv_sec = another_tv_sec; /* * Padding now indeterminate (C99 6.2.6.1p6). It is reasonable * for the implementation to use the padding on ABIs that have it, * 64-bit stores of registers with uncleared kernel context gives * gives the context leak. */ tv.tv_nsec = another_tv_nsec; I don't see anything in C99 that requires padding to remain unchanged even with no stores in the program. This problem affects more than time_t's. It affects all padding. I next checked the simplest itimer call. sys_getitimer() doesn't handle the problem, of course: it allocates a struct itimerval aitimerval the kernel stack; kern_getitimer() allocates a struct timeval ctv on the kernel stack; ctv is initialized 1 field at a time in most cases so its padding remains uninitialized; aitv is inititialized using a struct assignment in most cases so it has the problem that this commit attempts to fix. This is just another bug in 64-bit time_t's, especially on 32-bit arches. Instead of 32-bit time_t's which work until 2038 or 2106, we have subtle security holes now. Bruce From owner-svn-src-head@freebsd.org Wed Oct 23 12:52:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AF81151B91; Wed, 23 Oct 2019 12:52:29 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 46yqz13KzFz454K; Wed, 23 Oct 2019 12:52:29 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from [IPv6:2001:630:212:2a8:bc33:6e81:8b9:7f62] (unknown [IPv6:2001:630:212:2a8:bc33:6e81:8b9:7f62]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 75FF94ECB4; Wed, 23 Oct 2019 12:52:22 +0000 (UTC) From: Andrew Turner Message-Id: <1F97D894-2D71-45BB-AEA1-70CC1BA1D155@freebsd.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r353640 - head/sys/kern Date: Wed, 23 Oct 2019 13:52:22 +0100 In-Reply-To: Cc: src-committers , svn-src-all , svn-src-head To: Alan Somers References: <201910161321.x9GDL2ee021543@repo.freebsd.org> X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 46yqz13KzFz454K X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 12:52:29 -0000 > On 22 Oct 2019, at 16:50, Alan Somers > wrote: >=20 > On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner > wrote: > Author: andrew > Date: Wed Oct 16 13:21:01 2019 > New Revision: 353640 > URL: https://svnweb.freebsd.org/changeset/base/353640 = >=20 > Log: > Stop leaking information from the kernel through timespec >=20 > The timespec struct holds a seconds value in a time_t and a = nanoseconds > value in a long. On most architectures these are the same size, = however > on 32-bit architectures other than i386 time_t is 8 bytes and long = is > 4 bytes. >=20 > Most ABIs will then pad a struct holding an 8 byte and 4 byte value = to > 16 bytes with 4 bytes of padding. When copying one of these structs = the > compiler is free to copy the padding if it wishes. >=20 > In this case the padding may contain kernel data that is then leaked = to > userspace. Fix this by copying the timespec elements rather than the > entire struct. >=20 > This doesn't affect Tier-1 architectures so no SA is expected. >=20 > admbugs: 651 > MFC after: 1 week > Sponsored by: DARPA, AFRL >=20 > Good catch. Might I ask how you found it, or who reported it?=20 I found it via one of the tests. It uses memcmp to check the struct = returned was identical to what it expected. On closer inspection I found = the difference was in the padding. Andrew=20 From owner-svn-src-head@freebsd.org Wed Oct 23 13:21:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96A681526DF; Wed, 23 Oct 2019 13:21:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yrcD3Y74z46mK; Wed, 23 Oct 2019 13:21:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E7E1250E0; Wed, 23 Oct 2019 13:21:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NDLGeq009181; Wed, 23 Oct 2019 13:21:16 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NDLGRe009167; Wed, 23 Oct 2019 13:21:16 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910231321.x9NDLGRe009167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 23 Oct 2019 13:21:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353920 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 353920 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 13:21:16 -0000 Author: andrew Date: Wed Oct 23 13:21:15 2019 New Revision: 353920 URL: https://svnweb.freebsd.org/changeset/base/353920 Log: Stop enabling interrupts when reentering kdb on arm64 When we raise a data abort from the kernel we need to enable interrupts, however we shouldn't be doing this when in the kernel debugger. In this case interrupts can lead to a further panic as they don't expect to be run from such a context. MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Wed Oct 23 09:56:53 2019 (r353919) +++ head/sys/arm64/arm64/trap.c Wed Oct 23 13:21:15 2019 (r353920) @@ -179,6 +179,8 @@ data_abort(struct thread *td, struct trapframe *frame, if (lower) map = &p->p_vmspace->vm_map; else { + intr_enable(); + /* The top bit tells us which range to use */ if (far >= VM_MAXUSER_ADDRESS) { map = kernel_map; @@ -316,7 +318,6 @@ do_el1h_sync(struct thread *td, struct trapframe *fram case EXCP_INSN_ABORT: case EXCP_DATA_ABORT: far = READ_SPECIALREG(far_el1); - intr_enable(); data_abort(td, frame, esr, far, 0, exception == EXCP_INSN_ABORT); break; From owner-svn-src-head@freebsd.org Wed Oct 23 13:37:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3872152B75; Wed, 23 Oct 2019 13:37:52 +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) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46yrzM4dmjz47hF; Wed, 23 Oct 2019 13:37:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x9NDbhUO021432 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 23 Oct 2019 16:37:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x9NDbhUO021432 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x9NDbfWl021431; Wed, 23 Oct 2019 16:37:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 23 Oct 2019 16:37:41 +0300 From: Konstantin Belousov To: Bruce Evans Cc: Alan Somers , Andrew Turner , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r353640 - head/sys/kern Message-ID: <20191023133741.GT73312@kib.kiev.ua> References: <201910161321.x9GDL2ee021543@repo.freebsd.org> <20191023210546.L892@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191023210546.L892@besplex.bde.org> User-Agent: Mutt/1.12.2 (2019-09-21) 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 46yrzM4dmjz47hF X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[6]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; IP_SCORE(0.00)[ip: (-2.78), ipnet: 2001:470::/32(-4.60), asn: 6939(-3.45), country: US(-0.05)]; FREEMAIL_TO(0.00)[optusnet.com.au]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 13:37:52 -0000 On Wed, Oct 23, 2019 at 11:18:06PM +1100, Bruce Evans wrote: > On Tue, 22 Oct 2019, Alan Somers wrote: > > > On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner wrote: > > > >> Author: andrew > >> Date: Wed Oct 16 13:21:01 2019 > >> New Revision: 353640 > >> URL: https://svnweb.freebsd.org/changeset/base/353640 > >> > >> Log: > >> Stop leaking information from the kernel through timespec > >> > >> The timespec struct holds a seconds value in a time_t and a nanoseconds > >> value in a long. On most architectures these are the same size, however > >> on 32-bit architectures other than i386 time_t is 8 bytes and long is > >> 4 bytes. > >> > >> Most ABIs will then pad a struct holding an 8 byte and 4 byte value to > >> 16 bytes with 4 bytes of padding. When copying one of these structs the > >> compiler is free to copy the padding if it wishes. > > I doubt that most ABIs pad the struct in that case. Pure 32-bit arches > don't have any 64-bit memory or register operations, so they use 32-bit > longs and don't pessimize structs with 64-bit types in them using padding. > > If there are any such ABIs, then there are thousands if not millions more > places to fix. Every place where a timespec is written must be checked. 32bit ARM requires 8-byte alignment for 64bit integers AFAIR. Also I believe that this is the only such 32bit architecture supported by FreeBSD. > > E.g., gettimeofday() reduces to microtime(). The implementation of > microtime() happens to fill the timeval fields separately. That always > leaks kernel context if struct timeval has padding and nothing else > zeros the padding. And for gettimeofday() it is especially clear that > nothing else zeros the padding. sys_gettimeofday() allocates a timeval > on the kernel stack; microtime() initializes its fields separately > leaving any padding untouched; copyout() then copies out kernel context. > > This commit attempts to fix the different problem that if lower levels > like microtime() were pessimized to initialize the padding, then callers > would have to be careful to preserve this by not using struct > assignments for copying structs. This is not easy to do. bcopy() and > copyout() should preserve memory, but there are no guarantees if the > struct is accessed in other ways. The fix in this commit can easily > not work on arches that have the problem: > > bzero(&tv); /* padding now all 0 */ > tv.tv_sec = another_tv_sec; > /* > * Padding now indeterminate (C99 6.2.6.1p6). It is reasonable > * for the implementation to use the padding on ABIs that have it, > * 64-bit stores of registers with uncleared kernel context gives > * gives the context leak. > */ > tv.tv_nsec = another_tv_nsec; > > I don't see anything in C99 that requires padding to remain unchanged > even with no stores in the program. > > This problem affects more than time_t's. It affects all padding. > > I next checked the simplest itimer call. sys_getitimer() doesn't > handle the problem, of course: it allocates a struct itimerval > aitimerval the kernel stack; kern_getitimer() allocates a struct timeval > ctv on the kernel stack; ctv is initialized 1 field at a time in most > cases so its padding remains uninitialized; aitv is inititialized using > a struct assignment in most cases so it has the problem that this > commit attempts to fix. > > This is just another bug in 64-bit time_t's, especially on 32-bit arches. > Instead of 32-bit time_t's which work until 2038 or 2106, we have subtle > security holes now. > > Bruce From owner-svn-src-head@freebsd.org Wed Oct 23 15:51:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D282B156855; Wed, 23 Oct 2019 15:51:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yvxV568Cz4HQ8; Wed, 23 Oct 2019 15:51:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 927B426BE1; Wed, 23 Oct 2019 15:51:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NFpQ5a000471; Wed, 23 Oct 2019 15:51:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NFpQbd000470; Wed, 23 Oct 2019 15:51:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910231551.x9NFpQbd000470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 23 Oct 2019 15:51:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353928 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 15:51:26 -0000 Author: kib Date: Wed Oct 23 15:51:26 2019 New Revision: 353928 URL: https://svnweb.freebsd.org/changeset/base/353928 Log: vn_printf(): Decode VI_TEXT_REF. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Oct 23 14:33:49 2019 (r353927) +++ head/sys/kern/vfs_subr.c Wed Oct 23 15:51:26 2019 (r353928) @@ -3832,8 +3832,10 @@ vn_printf(struct vnode *vp, const char *fmt, ...) strlcat(buf, "|VI_DOINGINACT", sizeof(buf)); if (vp->v_iflag & VI_OWEINACT) strlcat(buf, "|VI_OWEINACT", sizeof(buf)); + if (vp->v_iflag & VI_TEXT_REF) + strlcat(buf, "|VI_TEXT_REF", sizeof(buf)); flags = vp->v_iflag & ~(VI_MOUNT | VI_DOOMED | VI_FREE | - VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT); + VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT | VI_TEXT_REF); if (flags != 0) { snprintf(buf2, sizeof(buf2), "|VI(0x%lx)", flags); strlcat(buf, buf2, sizeof(buf)); From owner-svn-src-head@freebsd.org Wed Oct 23 16:05:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6448156E22; Wed, 23 Oct 2019 16:05:54 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ywGB2rSWz4J9x; Wed, 23 Oct 2019 16:05:54 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4555B26F24; Wed, 23 Oct 2019 16:05:54 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NG5sZu009252; Wed, 23 Oct 2019 16:05:54 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NG5qgi009243; Wed, 23 Oct 2019 16:05:52 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910231605.x9NG5qgi009243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 23 Oct 2019 16:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353929 - head/lib/msun/amd64 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/lib/msun/amd64 X-SVN-Commit-Revision: 353929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:05:54 -0000 Author: cem Date: Wed Oct 23 16:05:52 2019 New Revision: 353929 URL: https://svnweb.freebsd.org/changeset/base/353929 Log: libm: Add missing END() directives for amd64 routines No functional change. Related to D22122. Reviewed by: emaste, kib (earlier version both) Modified: head/lib/msun/amd64/e_remainder.S head/lib/msun/amd64/e_remainderf.S head/lib/msun/amd64/e_remainderl.S head/lib/msun/amd64/e_sqrtl.S head/lib/msun/amd64/s_llrintl.S head/lib/msun/amd64/s_logbl.S head/lib/msun/amd64/s_lrintl.S head/lib/msun/amd64/s_remquol.S head/lib/msun/amd64/s_rintl.S Modified: head/lib/msun/amd64/e_remainder.S ============================================================================== --- head/lib/msun/amd64/e_remainder.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/e_remainder.S Wed Oct 23 16:05:52 2019 (r353929) @@ -51,5 +51,6 @@ ENTRY(remainder) movsd -8(%rsp),%xmm0 fstp %st ret +END(remainder) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/e_remainderf.S ============================================================================== --- head/lib/msun/amd64/e_remainderf.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/e_remainderf.S Wed Oct 23 16:05:52 2019 (r353929) @@ -21,5 +21,6 @@ ENTRY(remainderf) movss -4(%rsp),%xmm0 fstp %st ret +END(remainderf) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/e_remainderl.S ============================================================================== --- head/lib/msun/amd64/e_remainderl.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/e_remainderl.S Wed Oct 23 16:05:52 2019 (r353929) @@ -46,5 +46,6 @@ ENTRY(remainderl) jne 1b fstp %st(1) ret +END(remainderl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/e_sqrtl.S ============================================================================== --- head/lib/msun/amd64/e_sqrtl.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/e_sqrtl.S Wed Oct 23 16:05:52 2019 (r353929) @@ -31,5 +31,6 @@ ENTRY(sqrtl) fldt 8(%rsp) fsqrt ret +END(sqrtl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/s_llrintl.S ============================================================================== --- head/lib/msun/amd64/s_llrintl.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/s_llrintl.S Wed Oct 23 16:05:52 2019 (r353929) @@ -33,5 +33,6 @@ ENTRY(llrintl) fistpll (%rsp) popq %rax ret +END(llrintl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/s_logbl.S ============================================================================== --- head/lib/msun/amd64/s_logbl.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/s_logbl.S Wed Oct 23 16:05:52 2019 (r353929) @@ -41,5 +41,6 @@ ENTRY(logbl) fxtract fstp %st ret +END(logbl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/s_lrintl.S ============================================================================== --- head/lib/msun/amd64/s_lrintl.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/s_lrintl.S Wed Oct 23 16:05:52 2019 (r353929) @@ -33,5 +33,6 @@ ENTRY(lrintl) fistpll (%rsp) popq %rax ret +END(lrintl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/s_remquol.S ============================================================================== --- head/lib/msun/amd64/s_remquol.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/s_remquol.S Wed Oct 23 16:05:52 2019 (r353929) @@ -60,5 +60,6 @@ ENTRY(remquol) /* Store the quotient and return. */ movl %eax,(%rdi) ret +END(remquol) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/s_rintl.S ============================================================================== --- head/lib/msun/amd64/s_rintl.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/s_rintl.S Wed Oct 23 16:05:52 2019 (r353929) @@ -41,5 +41,6 @@ ENTRY(rintl) fldt 8(%rsp) frndint ret +END(rintl) .section .note.GNU-stack,"",%progbits From owner-svn-src-head@freebsd.org Wed Oct 23 16:06:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3ADC7156EF6; Wed, 23 Oct 2019 16:06:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ywHD0fqKz4JKx; Wed, 23 Oct 2019 16:06:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF5AE26F27; Wed, 23 Oct 2019 16:06:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NG6lrn009337; Wed, 23 Oct 2019 16:06:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NG6lBH009336; Wed, 23 Oct 2019 16:06:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910231606.x9NG6lBH009336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 23 Oct 2019 16:06:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353930 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353930 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:06:48 -0000 Author: kib Date: Wed Oct 23 16:06:47 2019 New Revision: 353930 URL: https://svnweb.freebsd.org/changeset/base/353930 Log: Fix undefined behavior. Create a sequence point by ending a full expression for call to vspace() and use of the globals which are modified by vspace(). Reported and reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22126 Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Oct 23 16:05:52 2019 (r353929) +++ head/sys/kern/vfs_subr.c Wed Oct 23 16:06:47 2019 (r353930) @@ -1273,7 +1273,7 @@ vnlru_proc(void) { struct mount *mp, *nmp; unsigned long onumvnodes; - int done, force, trigger, usevnodes; + int done, force, trigger, usevnodes, vsp; bool reclaim_nc_src; EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, vnlruproc, @@ -1301,7 +1301,8 @@ vnlru_proc(void) force = 1; vstir = 0; } - if (vspace() >= vlowat && force == 0) { + vsp = vspace(); + if (vsp >= vlowat && force == 0) { vnlruproc_sig = 0; wakeup(&vnlruproc_sig); msleep(vnlruproc, &vnode_free_list_mtx, @@ -1368,7 +1369,8 @@ vnlru_proc(void) * After becoming active to expand above low water, keep * active until above high water. */ - force = vspace() < vhiwat; + vsp = vspace(); + force = vsp < vhiwat; } } @@ -1447,8 +1449,10 @@ vtryrecycle(struct vnode *vp) static void vcheckspace(void) { + int vsp; - if (vspace() < vlowat && vnlruproc_sig == 0) { + vsp = vspace(); + if (vsp < vlowat && vnlruproc_sig == 0) { vnlruproc_sig = 1; wakeup(vnlruproc); } From owner-svn-src-head@freebsd.org Wed Oct 23 16:24:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FD4815757A; Wed, 23 Oct 2019 16:24:16 +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) server-signature RSA-PSS (4096 bits) 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 46ywgN00y2z4KF2; Wed, 23 Oct 2019 16:24:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (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 41B556AF; Wed, 23 Oct 2019 16:24:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r353907 - head To: Jung-uk Kim , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910230005.x9N05TlT038682@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt 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: Wed, 23 Oct 2019 09:24:10 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <201910230005.x9N05TlT038682@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:24:16 -0000 On 10/22/19 5:05 PM, Jung-uk Kim wrote: > Author: jkim > Date: Wed Oct 23 00:05:29 2019 > New Revision: 353907 > URL: https://svnweb.freebsd.org/changeset/base/353907 > > Log: > Belatedly remove stale debug symbols after r339270. > > Reported by: danfe > MFC after: 3 days I still feel like these explicit entries shouldn't be needed since the original .so files are marked as OLD_LIBS and we add .debug entries for OLD_LIBS automatically. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Oct 23 16:41:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FC811579A3; Wed, 23 Oct 2019 16:41:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yx3J3Fn0z4L6P; Wed, 23 Oct 2019 16:41:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53F16275FE; Wed, 23 Oct 2019 16:41:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NGfWen031408; Wed, 23 Oct 2019 16:41:32 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NGfWeU031407; Wed, 23 Oct 2019 16:41:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910231641.x9NGfWeU031407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 23 Oct 2019 16:41:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353931 - head/sys/riscv/include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/riscv/include X-SVN-Commit-Revision: 353931 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:41:32 -0000 Author: jhb Date: Wed Oct 23 16:41:31 2019 New Revision: 353931 URL: https://svnweb.freebsd.org/changeset/base/353931 Log: Fix atomic_*cmpset32 on riscv64 with clang. The lr.w instruction used to read the value from memory sign-extends the value read from memory. GCC sign-extends the 32-bit comparison value passed in whereas clang currently does not. As a result, if the value being compared has the MSB set, the comparison fails for matching 32-bit values when compiled with clang. Use a cast to explicitly sign-extend the unsigned comparison value. This works with both GCC and clang. There is commentary in the RISC-V spec that suggests that GCC's approach is more correct, but it is not clear if the commentary in the RISC-V spec is binding. Reviewed by: mhorne Obtained from: Axiado MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22084 Modified: head/sys/riscv/include/atomic.h Modified: head/sys/riscv/include/atomic.h ============================================================================== --- head/sys/riscv/include/atomic.h Wed Oct 23 16:06:47 2019 (r353930) +++ head/sys/riscv/include/atomic.h Wed Oct 23 16:41:31 2019 (r353931) @@ -182,7 +182,7 @@ atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval "bnez %1, 0b\n" "1:" : "=&r" (tmp), "=&r" (res), "+A" (*p) - : "rJ" (cmpval), "rJ" (newval) + : "rJ" ((long)(int32_t)cmpval), "rJ" (newval) : "memory"); return (!res); @@ -207,7 +207,7 @@ atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpv "sw %0, %3\n" /* Save old value */ "2:" : "=&r" (tmp), "=&r" (res), "+A" (*p), "+A" (*cmpval) - : "rJ" (*cmpval), "rJ" (newval) + : "rJ" ((long)(int32_t)*cmpval), "rJ" (newval) : "memory"); return (!res); From owner-svn-src-head@freebsd.org Wed Oct 23 16:43:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACF76157BC1; Wed, 23 Oct 2019 16:43:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yx603mSkz4LP5; Wed, 23 Oct 2019 16:43:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6495727661; Wed, 23 Oct 2019 16:43:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NGhqXp033033; Wed, 23 Oct 2019 16:43:52 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NGhqU4033032; Wed, 23 Oct 2019 16:43:52 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910231643.x9NGhqU4033032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 23 Oct 2019 16:43:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353932 - head X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 353932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:43:52 -0000 Author: jhb Date: Wed Oct 23 16:43:51 2019 New Revision: 353932 URL: https://svnweb.freebsd.org/changeset/base/353932 Log: Strip "sf" suffix when generating a target triple. This fixes the target triple used when compiling riscv64sf with clang. Discussed with: mhorne MFC after: 2 weeks Sponsored by: DARPA Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Oct 23 16:41:31 2019 (r353931) +++ head/Makefile.inc1 Wed Oct 23 16:43:51 2019 (r353932) @@ -129,9 +129,9 @@ TARGET_ABI= gnueabi .endif .endif MACHINE_ABI?= unknown -MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd13.0 +MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd13.0 TARGET_ABI?= unknown -TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd13.0 +TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd13.0 KNOWN_ARCHES?= aarch64/arm64 \ amd64 \ arm \ From owner-svn-src-head@freebsd.org Wed Oct 23 16:48:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5337F157D71; Wed, 23 Oct 2019 16:48:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yxC62JRfz4LfP; Wed, 23 Oct 2019 16:48:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31F642766A; Wed, 23 Oct 2019 16:48:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NGmI72033323; Wed, 23 Oct 2019 16:48:18 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NGmH10033319; Wed, 23 Oct 2019 16:48:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231648.x9NGmH10033319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 16:48:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353933 - in head: share/man/man5 tools/build/options X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: share/man/man5 tools/build/options X-SVN-Commit-Revision: 353933 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:48:18 -0000 Author: dim Date: Wed Oct 23 16:48:17 2019 New Revision: 353933 URL: https://svnweb.freebsd.org/changeset/base/353933 Log: Slightly expand description of WITH_SHARED_TOOLCHAIN, add a corresponding WITHOUT_SHARED_TOOLCHAIN description, and regenerate src.conf(5). MFC after: 3 days Added: head/tools/build/options/WITHOUT_SHARED_TOOLCHAIN (contents, props changed) Modified: head/share/man/man5/src.conf.5 head/tools/build/options/WITH_SHARED_TOOLCHAIN Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Oct 23 16:43:51 2019 (r353932) +++ head/share/man/man5/src.conf.5 Wed Oct 23 16:48:17 2019 (r353933) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd October 1, 2019 +.Dd October 23, 2019 .Dt SRC.CONF 5 .Os .Sh NAME @@ -197,7 +197,7 @@ as part of the normal system build. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_BINUTILS_BOOTSTRAP Set to not build binutils (as, ld, and objdump) as part of the bootstrap process. @@ -213,7 +213,7 @@ Set build binutils (as, ld, and objdump) as part of the bootstrap process. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_BLACKLIST Set this if you do not want to build .Xr blacklistd 8 @@ -268,7 +268,7 @@ and .Pa crtend.o . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and riscv/riscv64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_BSD_GREP Install BSD-licensed grep as '[ef]grep' instead of GNU grep. .It Va WITHOUT_BSNMP @@ -301,6 +301,9 @@ When set, it enforces these options: .It .Va WITHOUT_CASPER .El +.It Va WITHOUT_CAROOT +Set to not add the trusted certificates from the Mozilla NSS bundle to +base. .It Va WITHOUT_CASPER Set to not build Casper program and related libraries. .It Va WITH_CCACHE_BUILD @@ -410,7 +413,7 @@ is set explicitly) Set to build the Clang C/C++ compiler during the normal phase of the build. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_CLANG_BOOTSTRAP Set to not build the Clang C/C++ compiler during the bootstrap phase of the build. @@ -418,7 +421,7 @@ To be able to build the system, either gcc or clang bo enabled unless an alternate compiler is provided via XCC. .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_CLANG_BOOTSTRAP Set to build the Clang C/C++ compiler during the bootstrap phase of the build. .Pp @@ -438,7 +441,7 @@ Set to build the ARCMigrate, Rewriter and StaticAnalyz Clang C/C++ compiler. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_CLANG_IS_CC Set to install the GCC compiler as .Pa /usr/bin/cc , @@ -447,7 +450,7 @@ and .Pa /usr/bin/cpp . .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_CLANG_IS_CC Set to install the Clang C/C++ compiler as .Pa /usr/bin/cc , @@ -519,13 +522,13 @@ Set to not build .Xr cxgbetool 8 .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe and riscv/riscv64. +arm/arm, arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_CXGBETOOL Set to build .Xr cxgbetool 8 .Pp This is a default setting on -amd64/amd64, arm64/aarch64, i386/i386, powerpc/powerpc64 and sparc64/sparc64. +amd64/amd64, arm64/aarch64, i386/i386 and sparc64/sparc64. .It Va WITHOUT_CXX Set to not build .Xr c++ 1 @@ -680,7 +683,7 @@ and .Xr efivar 8 . .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_EFI Set to build .Xr efivar 3 @@ -751,7 +754,7 @@ amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarc Set to build and install gcc and g++. .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_GCC_BOOTSTRAP Set to not build gcc and g++ as part of the bootstrap process. You must enable either gcc or clang bootstrap to be able to build the system, @@ -764,7 +767,7 @@ amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarc Set to build gcc and g++ as part of the bootstrap process. .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_GCOV Set to not build the .Xr gcov 1 @@ -780,7 +783,7 @@ Set to build .Xr gdb 1 . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_GDB_LIBEXEC Set to install .Xr gdb 1 @@ -801,7 +804,7 @@ to be used as a fallback for if a newer version is not installed. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and riscv/riscv64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_GNUCXX Do not build the GNU C++ stack (g++, libstdc++). This is the default on platforms where clang is the system compiler. @@ -813,7 +816,7 @@ Build the GNU C++ stack (g++, libstdc++). This is the default on platforms where gcc is the system compiler. .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_GNU_DIFF Set to not build GNU .Xr diff 1 @@ -841,7 +844,7 @@ Set to build and install and dependent tests. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and sparc64/sparc64. .It Va WITHOUT_GPIO Set to not build .Xr gpioctl 8 @@ -857,7 +860,7 @@ Set to build the GPL'd version of the device tree comp instead of the BSD licensed one. .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_GSSAPI Set to not build libgssapi. .It Va WITHOUT_HAST @@ -874,7 +877,7 @@ Set to build and install httpd Set to not build or install HyperV utilities. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +arm/arm, arm/armv6, arm/armv7, arm64/aarch64, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_HYPERV Set to build or install HyperV utilities. .Pp @@ -1056,12 +1059,12 @@ riscv/riscv64 and sparc64/sparc64. Set to build LLVM's lld linker. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLDB Set to not build the LLDB debugger. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +arm/arm, arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_LLDB Set to build the LLDB debugger. .Pp @@ -1074,7 +1077,7 @@ To be able to build the system, either Binutils or LLD enabled unless an alternate linker is provided via XLD. .Pp This is a default setting on -arm/arm, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +arm/arm, arm/armv6, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_LLD_BOOTSTRAP Set to build the LLD linker during the bootstrap phase of the build, and use it during buildworld and buildkernel. @@ -1085,7 +1088,7 @@ amd64/amd64, arm/armv7, arm64/aarch64 and i386/i386. Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. .Pp This is a default setting on -arm/arm, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +arm/arm, arm/armv6, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_LLD_IS_LD Set to use LLVM's LLD as the system linker, instead of GNU binutils ld. .Pp @@ -1104,17 +1107,17 @@ Set to build the tool. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_LIBUNWIND Set to use GCC's stack unwinder (instead of LLVM's libunwind). .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +arm/arm, arm/armv6, arm/armv7 and sparc64/sparc64. .It Va WITH_LLVM_LIBUNWIND Set to use LLVM's libunwind stack unwinder (instead of GCC's unwinder). .Pp This is a default setting on -amd64/amd64, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. +amd64/amd64, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_AARCH64 Set to not build LLVM target support for AArch64. The @@ -1130,7 +1133,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_ALL Set to only build the required LLVM target support. This option is preferred to specific target support options. @@ -1167,7 +1170,7 @@ This option is always applied to the bootstrap compile LLVM is used. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_ARM Set to not build LLVM target support for ARM. The @@ -1183,7 +1186,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LLVM_TARGET_BPF Set to build LLVM target support for BPF. The @@ -1204,7 +1207,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_POWERPC Set to not build LLVM target support for PowerPC. The @@ -1220,7 +1223,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LLVM_TARGET_RISCV Set to build LLVM target support for RISC-V. The @@ -1241,7 +1244,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_X86 Set to not build LLVM target support for X86. The @@ -1257,7 +1260,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LOADER_EFI_SECUREBOOT Enable building .Xr loader 8 @@ -1273,32 +1276,32 @@ endian mode. Disable inclusion of GELI crypto support in the boot chain binaries. .Pp This is a default setting on -powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +sparc64/sparc64. .It Va WITH_LOADER_GELI Set to build GELI bootloader support. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LOADER_LUA Set to not build LUA bindings for the boot loader. .Pp This is a default setting on -powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +sparc64/sparc64. .It Va WITH_LOADER_LUA Set to build LUA bindings for the boot loader. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LOADER_OFW Disable building of openfirmware bootloader components. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LOADER_OFW Set to build openfirmware bootloader components. .Pp This is a default setting on -powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +sparc64/sparc64. .It Va WITHOUT_LOADER_UBOOT Disable building of ubldr. .Pp @@ -1308,7 +1311,7 @@ amd64/amd64, arm64/aarch64, i386/i386, riscv/riscv64 a Set to build ubldr. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LOADER_VERBOSE Set to build with extra verbose debugging in the loader. May explode already nearly too large loader over the limit. @@ -1317,10 +1320,10 @@ Use with care. .It Va WITH_LOADER_VERIEXEC Enable building .Xr loader 8 -with support for verifcation similar to Verified Exec. +with support for verification similar to Verified Exec. .Pp -It depends on -.Va WITH_BEARSSL +Depends on +.Va WITH_BEARSSL . When set, these options are also in effect: .Pp .Bl -inset -compact @@ -1329,6 +1332,14 @@ When set, these options are also in effect: .Va WITHOUT_LOADER_EFI_SECUREBOOT is set explicitly) .El +.It Va WITH_LOADER_VERIEXEC_PASS_MANIFEST +Enable building +.Xr loader 8 +with support to pass a verified manifest to the kernel. +The kernel has to be built with a module to parse the manifest. +.Pp +Depends on +.Va WITH_LOADER_VERIEXEC . .It Va WITHOUT_LOADER_ZFS Set to not build ZFS file system boot loader support. .It Va WITHOUT_LOCALES @@ -1460,13 +1471,13 @@ Set to not build .Xr mlx5tool 8 .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe and riscv/riscv64. +arm/arm, arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_MLX5TOOL Set to build .Xr mlx5tool 8 .Pp This is a default setting on -amd64/amd64, arm64/aarch64, i386/i386, powerpc/powerpc64 and sparc64/sparc64. +amd64/amd64, arm64/aarch64, i386/i386 and sparc64/sparc64. .It Va WITHOUT_NDIS Set to not build programs and libraries related to NDIS emulation support. @@ -1531,13 +1542,13 @@ and related programs. Set to not build nvme related tools and kernel modules. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +arm/arm, arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_NVME Set to build nvme related tools and kernel modules. .Pp This is a default setting on -amd64/amd64, arm64/aarch64, i386/i386 and powerpc/powerpc64. +amd64/amd64, arm64/aarch64 and i386/i386. .It Va WITH_OFED Set to build the .Dq "OpenFabrics Enterprise Distribution" @@ -1552,12 +1563,12 @@ Enable building openldap support for kerberos. Set to not build LLVM's OpenMP runtime. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +arm/arm, arm/armv6, arm/armv7, arm64/aarch64, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_OPENMP Set to build LLVM's OpenMP runtime. .Pp This is a default setting on -amd64/amd64, i386/i386 and powerpc/powerpc64. +amd64/amd64 and i386/i386. .It Va WITHOUT_OPENSSH Set to not build OpenSSH. .It Va WITHOUT_OPENSSL @@ -1641,7 +1652,7 @@ Set to build profiled libraries for use with .Xr gprof 8 . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mipsn32, mips/mipselhf, mips/mipshf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mipsn32, mips/mipselhf, mips/mipshf and sparc64/sparc64. .It Va WITHOUT_QUOTAS Set to not build .Xr quota 1 @@ -1700,7 +1711,7 @@ Set to not build the .Bx 4.4 legacy docs. .It Va WITH_SHARED_TOOLCHAIN -Set to build the toolchain binaries shared. +Set to build the toolchain binaries as dynamically linked executables. The set includes .Xr cc 1 , .Xr make 1 @@ -1731,7 +1742,7 @@ mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mi Set to build world with propolice stack smashing protection. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and sparc64/sparc64. .It Va WITH_STAGING Enable staging of files to a stage tree. This can be best thought of as auto-install to @@ -1762,6 +1773,10 @@ Enable staging of man pages to stage tree. Enable staging of PROGs to stage tree. .It Va WITH_STALE_STAGED Check staged files are not stale. +.It Va WITHOUT_STATS +Set to neither build nor install +.Lb libstats +and dependent binaries. .It Va WITH_SVN Set to install .Xr svnlite 1 @@ -1948,8 +1963,8 @@ which loads the contents of verified manifests into th for use by .Xr mac_veriexec 4 .Pp -It depends on -.Va WITH_BEARSSL +Depends on +.Va WITH_BEARSSL . .It Va WITHOUT_VI Set to not build and install vi, view, ex and related programs. .It Va WITHOUT_VT Added: head/tools/build/options/WITHOUT_SHARED_TOOLCHAIN ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITHOUT_SHARED_TOOLCHAIN Wed Oct 23 16:48:17 2019 (r353933) @@ -0,0 +1,6 @@ +.\" $FreeBSD$ +Set to build the toolchain binaries as statically linked executables. +The set includes +.Xr cc 1 , +.Xr make 1 +and necessary utilities like assembler, linker and library archive manager. Modified: head/tools/build/options/WITH_SHARED_TOOLCHAIN ============================================================================== --- head/tools/build/options/WITH_SHARED_TOOLCHAIN Wed Oct 23 16:43:51 2019 (r353932) +++ head/tools/build/options/WITH_SHARED_TOOLCHAIN Wed Oct 23 16:48:17 2019 (r353933) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to build the toolchain binaries shared. +Set to build the toolchain binaries as dynamically linked executables. The set includes .Xr cc 1 , .Xr make 1 From owner-svn-src-head@freebsd.org Wed Oct 23 16:48:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A5BE157D93; Wed, 23 Oct 2019 16:48:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yxCC2fvHz4Lm2; Wed, 23 Oct 2019 16:48:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 383F72766B; Wed, 23 Oct 2019 16:48:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NGmNvv033373; Wed, 23 Oct 2019 16:48:23 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NGmNma033372; Wed, 23 Oct 2019 16:48:23 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910231648.x9NGmNma033372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 23 Oct 2019 16:48:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353934 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353934 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:48:23 -0000 Author: cem Date: Wed Oct 23 16:48:22 2019 New Revision: 353934 URL: https://svnweb.freebsd.org/changeset/base/353934 Log: Prevent a panic when a driver provides bogus debugnet parameters This is just a bandaid; we should fix the driver(s) too. Introduced in r353685. PR: 241403 X-MFC-With: r353685 Reported by: np and others Modified: head/sys/net/debugnet.c Modified: head/sys/net/debugnet.c ============================================================================== --- head/sys/net/debugnet.c Wed Oct 23 16:48:17 2019 (r353933) +++ head/sys/net/debugnet.c Wed Oct 23 16:48:22 2019 (r353934) @@ -826,6 +826,15 @@ debugnet_any_ifnet_update(struct ifnet *ifp) nmbuf = ncl * (4 + nrxr); ncl *= nrxr; + /* + * Bandaid for drivers that (incorrectly) advertise LinkUp before their + * dn_init method is available. + */ + if (nmbuf == 0 || ncl == 0 || clsize == 0) { + printf("%s: Bad dn_init result from %s (ifp %p), ignoring.\n", + __func__, if_name(ifp), ifp); + return; + } dn_maybe_reinit_mbufs(nmbuf, ncl, clsize); } From owner-svn-src-head@freebsd.org Wed Oct 23 16:53:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 290E315803E; Wed, 23 Oct 2019 16:53:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yxKG0LL8z4MB9; Wed, 23 Oct 2019 16:53:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3CD027830; Wed, 23 Oct 2019 16:53:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NGrbmT038862; Wed, 23 Oct 2019 16:53:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NGrbiO038861; Wed, 23 Oct 2019 16:53:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910231653.x9NGrbiO038861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Oct 2019 16:53:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353935 - head/sys/dev/ksyms X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/ksyms X-SVN-Commit-Revision: 353935 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:53:38 -0000 Author: markj Date: Wed Oct 23 16:53:37 2019 New Revision: 353935 URL: https://svnweb.freebsd.org/changeset/base/353935 Log: Set OBJ_NOSPLIT on the ksyms(4) VM object. The object does not provide anonymous memory. Reported by: kib Reviewed by: kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22123 Modified: head/sys/dev/ksyms/ksyms.c Modified: head/sys/dev/ksyms/ksyms.c ============================================================================== --- head/sys/dev/ksyms/ksyms.c Wed Oct 23 16:48:22 2019 (r353934) +++ head/sys/dev/ksyms/ksyms.c Wed Oct 23 16:53:37 2019 (r353935) @@ -404,6 +404,7 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus { struct tsizes ts; struct ksyms_softc *sc; + vm_object_t object; vm_size_t elfsz; int error, try; @@ -441,8 +442,10 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus ksyms_size_calc(&ts); elfsz = sizeof(struct ksyms_hdr) + ts.ts_symsz + ts.ts_strsz; - sc->sc_obj = vm_object_allocate(OBJT_DEFAULT, + object = vm_object_allocate(OBJT_DEFAULT, OFF_TO_IDX(round_page(elfsz))); + vm_object_set_flag(object, OBJ_NOSPLIT); + sc->sc_obj = object; sc->sc_objsz = elfsz; error = ksyms_snapshot(sc, &ts); From owner-svn-src-head@freebsd.org Wed Oct 23 16:57:12 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 935631582B2; Wed, 23 Oct 2019 16:57:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yxPN32myz4MSp; Wed, 23 Oct 2019 16:57:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C2242783A; Wed, 23 Oct 2019 16:57:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NGvCi2039112; Wed, 23 Oct 2019 16:57:12 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NGvCMD039111; Wed, 23 Oct 2019 16:57:12 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231657.x9NGvCMD039111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 16:57:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch X-SVN-Commit-Revision: 353936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:57:12 -0000 Author: dim Date: Wed Oct 23 16:57:11 2019 New Revision: 353936 URL: https://svnweb.freebsd.org/changeset/base/353936 Log: Bump clang's default target CPU for the i386 architecture (aka "x86") to i686, as per the discussion on the freebsd-arch mailing list. Earlier in r352030, I had already bumped it to i586, to work around missing atomic 64 bit functions for the i386 architecture. Relnotes: yes Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/X86.cpp Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/X86.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/X86.cpp Wed Oct 23 16:53:37 2019 (r353935) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/X86.cpp Wed Oct 23 16:57:11 2019 (r353936) @@ -93,10 +93,11 @@ const char *x86::getX86TargetCPU(const ArgList &Args, return "x86-64"; switch (Triple.getOS()) { + case llvm::Triple::FreeBSD: + return "i686"; case llvm::Triple::NetBSD: case llvm::Triple::OpenBSD: - return "i486"; - case llvm::Triple::FreeBSD: + return "i486"; case llvm::Triple::Haiku: return "i586"; default: From owner-svn-src-head@freebsd.org Wed Oct 23 17:02:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0417F158564; Wed, 23 Oct 2019 17:02:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yxWn6J5Lz4Mrj; Wed, 23 Oct 2019 17:02:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC42127A09; Wed, 23 Oct 2019 17:02:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NH2jVI045131; Wed, 23 Oct 2019 17:02:45 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NH2jQv045130; Wed, 23 Oct 2019 17:02:45 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231702.x9NH2jQv045130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:02:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353937 - in head/share: man/man5 mk X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/share: man/man5 mk X-SVN-Commit-Revision: 353937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:02:46 -0000 Author: dim Date: Wed Oct 23 17:02:45 2019 New Revision: 353937 URL: https://svnweb.freebsd.org/changeset/base/353937 Log: Build toolchain components as dynamically linked executables by default Summary: Historically, we have built toolchain components such as cc, ld, etc as statically linked executables. One of the reasons being that you could sometimes save yourself from botched upgrades, by e.g. recompiling a "known good" libc and reinstalling it. In this day and age, we have boot environments, virtual machine snapshots, cloud backups, and other much more reliable methods to restore systems to working order. So I think the time is ripe to flip this default, and link the toolchain components dynamically, just like almost all other executables on FreeBSD. Maybe at some point they can even become PIE executables by default! :) Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22061 Modified: head/share/man/man5/src.conf.5 head/share/mk/src.opts.mk Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Oct 23 16:57:11 2019 (r353936) +++ head/share/man/man5/src.conf.5 Wed Oct 23 17:02:45 2019 (r353937) @@ -1710,8 +1710,8 @@ as a set-user-ID root program. Set to not build the .Bx 4.4 legacy docs. -.It Va WITH_SHARED_TOOLCHAIN -Set to build the toolchain binaries as dynamically linked executables. +.It Va WITHOUT_SHARED_TOOLCHAIN +Set to build the toolchain binaries as statically linked executables. The set includes .Xr cc 1 , .Xr make 1 Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed Oct 23 16:57:11 2019 (r353936) +++ head/share/mk/src.opts.mk Wed Oct 23 17:02:45 2019 (r353937) @@ -166,6 +166,7 @@ __DEFAULT_YES_OPTIONS = \ SENDMAIL \ SERVICESDB \ SETUID_LOGIN \ + SHARED_TOOLCHAIN \ SHAREDOCS \ SOURCELESS \ SOURCELESS_HOST \ @@ -210,7 +211,6 @@ __DEFAULT_NO_OPTIONS = \ OPENLDAP \ REPRODUCIBLE_BUILD \ RPCBIND_WARMSTART_SUPPORT \ - SHARED_TOOLCHAIN \ SORT_THREADS \ SVN \ ZONEINFO_LEAPSECONDS_SUPPORT \ From owner-svn-src-head@freebsd.org Wed Oct 23 17:20:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 707A2158BCB; Wed, 23 Oct 2019 17:20:21 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yxw52MW1z4NX4; Wed, 23 Oct 2019 17:20:21 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33CA427BED; Wed, 23 Oct 2019 17:20:21 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NHKLV2051560; Wed, 23 Oct 2019 17:20:21 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHKLFd051559; Wed, 23 Oct 2019 17:20:21 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201910231720.x9NHKLFd051559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Wed, 23 Oct 2019 17:20:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353938 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: rstone X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 353938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:20:21 -0000 Author: rstone Date: Wed Oct 23 17:20:20 2019 New Revision: 353938 URL: https://svnweb.freebsd.org/changeset/base/353938 Log: Add missing M_NOWAIT flag The LinuxKPI linux_dma code calls PCTRIE_INSERT with a mutex held, but does not set M_NOWAIT when allocating nodes, leading to a potential panic. All of this code can handle an allocation failure here, so prefer an allocation failure to sleeping on memory. Also fix a related case where NOWAIT/WAITOK was not specified. In this case it's not clear whether sleeping is allowed so be conservative and assume not. There are a lot of other paths in this code that can fail due to a lack of memory anyway. Differential Revision: https://reviews.freebsd.org/D22127 Reviewed by: imp Sponsored by: Dell EMC Isilon MFC After: 1 week Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Oct 23 17:02:45 2019 (r353937) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Oct 23 17:20:20 2019 (r353938) @@ -500,7 +500,7 @@ static void * linux_dma_trie_alloc(struct pctrie *ptree) { - return (uma_zalloc(linux_dma_trie_zone, 0)); + return (uma_zalloc(linux_dma_trie_zone, M_NOWAIT)); } static void @@ -569,7 +569,10 @@ linux_dma_map_phys(struct device *dev, vm_paddr_t phys if (bus_dma_id_mapped(priv->dmat, phys, len)) return (phys); - obj = uma_zalloc(linux_dma_obj_zone, 0); + obj = uma_zalloc(linux_dma_obj_zone, M_NOWAIT); + if (obj == NULL) { + return (0); + } DMA_PRIV_LOCK(priv); if (bus_dmamap_create(priv->dmat, 0, &obj->dmamap) != 0) { From owner-svn-src-head@freebsd.org Wed Oct 23 17:58:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B58515A0D9; Wed, 23 Oct 2019 17:58:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yylw2pLrz4V52; Wed, 23 Oct 2019 17:58:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43B92398; Wed, 23 Oct 2019 17:58:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NHwKFj079094; Wed, 23 Oct 2019 17:58:20 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHwK3Z079093; Wed, 23 Oct 2019 17:58:20 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910231758.x9NHwK3Z079093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Oct 2019 17:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353956 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:58:20 -0000 Author: markj Date: Wed Oct 23 17:58:19 2019 New Revision: 353956 URL: https://svnweb.freebsd.org/changeset/base/353956 Log: Verify identity after checking for WAITFAIL in vm_page_busy_acquire(). A caller that does not guarantee that a page's identity won't change while sleeping for a busy lock must specify either NOWAIT or WAITFAIL. Reported by: syzkaller Reviewed by: alc, kib Discussed with: jeff Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22124 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Oct 23 17:53:20 2019 (r353955) +++ head/sys/vm/vm_page.c Wed Oct 23 17:58:19 2019 (r353956) @@ -900,9 +900,11 @@ vm_page_busy_acquire(vm_page_t m, int allocflags) (allocflags & VM_ALLOC_SBUSY) != 0, locked); if (locked) VM_OBJECT_WLOCK(obj); - MPASS(m->object == obj || m->object == NULL); if ((allocflags & VM_ALLOC_WAITFAIL) != 0) return (FALSE); + KASSERT(m->object == obj || m->object == NULL, + ("vm_page_busy_acquire: page %p does not belong to %p", + m, obj)); } } From owner-svn-src-head@freebsd.org Wed Oct 23 18:00:23 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CC2A15A1BD; Wed, 23 Oct 2019 18:00:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yypG6c3Dz4VGF; Wed, 23 Oct 2019 18:00:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C54E83B5; Wed, 23 Oct 2019 18:00:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NI0M7Z079308; Wed, 23 Oct 2019 18:00:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NI0Mb7079307; Wed, 23 Oct 2019 18:00:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910231800.x9NI0Mb7079307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Oct 2019 18:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353957 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353957 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 18:00:23 -0000 Author: markj Date: Wed Oct 23 18:00:22 2019 New Revision: 353957 URL: https://svnweb.freebsd.org/changeset/base/353957 Log: Check for bogus_page in vnode_pager_generic_getpages_done(). We now assert that a page is busy when updating its validity-tracking state, but bogus_page is not busied during a getpages operation. Reported by: syzkaller Reviewed by: alc, kib Discussed with: jeff MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22124 Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Wed Oct 23 17:58:19 2019 (r353956) +++ head/sys/vm/vnode_pager.c Wed Oct 23 18:00:22 2019 (r353957) @@ -1149,6 +1149,8 @@ vnode_pager_generic_getpages_done(struct buf *bp) nextoff = tfoff + PAGE_SIZE; mt = bp->b_pages[i]; + if (mt == bogus_page) + continue; if (nextoff <= object->un_pager.vnp.vnp_size) { /* From owner-svn-src-head@freebsd.org Wed Oct 23 18:27:31 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6522015AAB1; Wed, 23 Oct 2019 18:27:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yzPb1y0Zz4WPd; Wed, 23 Oct 2019 18:27:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22957934; Wed, 23 Oct 2019 18:27:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NIRUEv097240; Wed, 23 Oct 2019 18:27:30 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NIRU5V097239; Wed, 23 Oct 2019 18:27:30 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910231827.x9NIRU5V097239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 23 Oct 2019 18:27:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353958 - head/lib/libthr/arch/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/lib/libthr/arch/amd64/amd64 X-SVN-Commit-Revision: 353958 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 18:27:31 -0000 Author: cem Date: Wed Oct 23 18:27:30 2019 New Revision: 353958 URL: https://svnweb.freebsd.org/changeset/base/353958 Log: libthr: Add missing END() directive for umtx_op_err (amd64) Like r353929, related to D22122. No functional change. Reviewed by: emaste, kib (earlier version both) Modified: head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Modified: head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S ============================================================================== --- head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Wed Oct 23 18:00:22 2019 (r353957) +++ head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Wed Oct 23 18:27:30 2019 (r353958) @@ -29,8 +29,11 @@ #include #include -#define RSYSCALL_ERR(x) ENTRY(__CONCAT(x, _err)); \ - mov __CONCAT($SYS_,x),%rax; KERNCALL; ret; +#define RSYSCALL_ERR(x) ENTRY(__CONCAT(x, _err)); \ + mov __CONCAT($SYS_,x),%rax; \ + KERNCALL; \ + ret; \ + END(__CONCAT(x, _err)); #define KERNCALL movq %rcx, %r10; syscall From owner-svn-src-head@freebsd.org Wed Oct 23 18:31:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BF6315AD29; Wed, 23 Oct 2019 18:31:46 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46yzVT2xW0z4Wml; Wed, 23 Oct 2019 18:31:45 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf1-x443.google.com with SMTP id a2so13446989pfo.10; Wed, 23 Oct 2019 11:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=utngffvqN5T5nmneHNaOQKwmzWtANAp+ypb7SpFoUjg=; b=gRsAL289RUrOc3M2AO8ZjU6zxLFW4J8MuKTzw5qEczVPcXsQ1CUSH2vrw6qkvTcOOX wJ1qhS94ZXMedhm6TUIim22h0SC3Bwc2Hk16epju7DabQPfqw0y3lwlI4hMPKaoZNct/ LvkJa0Fd48muDDc7Cl+uvBa2eAWnKB6p3Q2pzDXV/Y4WCZeH0zHGzAX8Ay1RSoqj4HE8 M6B5wV8PMpEOFp29r+0DksMtrMxqYBso9hhYGHIQyKDaUrSiiTSQYiKafYDN4WFG/oO6 6aVG9BUu84lpI5IODwd7k7R5jWi0CJEoacAMeak7yDJzzljI6lfZfQ1IEy53pxjLcXed Ol8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=utngffvqN5T5nmneHNaOQKwmzWtANAp+ypb7SpFoUjg=; b=Q3bcFQH45CET8RbKCYqVv09rWhb0neX3pEsSKxacUyUwFPB1oUVLiyLc5tr41pnyZI aI1eClHvNzLt0Lxo1oDJ/NS+M64Q9Kxe9pPvPYSMdtrY/XIm/RerCsfzJY50TfkR6jy+ qmUp9Q1Wvh5ZxMT0dFul/Zpw79tC2wXe4zCcFkAsDTwGee9QlNl+cx2+ytte+ZBWN6nA clgWOb8WcbjbTl/qu0LS/u5DvPCN1QJZUdHV4XaeEeyLckJmwWE4VyH6OUdzi69NKDgK eL4eTjBIihW//WLG1rJiltLYli60VSYY+rL4XU6yUTZNI//E4T7GwH2CcU4QeBdT2JxB 1/DQ== X-Gm-Message-State: APjAAAXUtUmbyLEo77dMPCHKxdFtNE+b1kmeCW7+T6fNl+bpXNGbkPsX dePp4Bxz7/nebmzD1y1mVd03Bm8O X-Google-Smtp-Source: APXvYqw+68YsQkiFY0IjE+kEyMIAgPyj+kEmBQlDFhyaaWU5Pjt/OFiZCjVwWlBPVibxYrNIZxjt1w== X-Received: by 2002:a62:750d:: with SMTP id q13mr12138665pfc.58.1571855503387; Wed, 23 Oct 2019 11:31:43 -0700 (PDT) Received: from ?IPv6:2607:fb90:b2b2:fc25:25fc:8f78:cb92:220a? ([2607:fb90:b2b2:fc25:25fc:8f78:cb92:220a]) by smtp.gmail.com with ESMTPSA id c66sm5487635pfb.25.2019.10.23.11.31.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Oct 2019 11:31:42 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Enji Cooper Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r353937 - in head/share: man/man5 mk Date: Wed, 23 Oct 2019 11:31:41 -0700 Message-Id: <2B855247-5097-442D-8D4A-77D68D2F6186@gmail.com> References: <201910231702.x9NH2jQv045130@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201910231702.x9NH2jQv045130@repo.freebsd.org> To: Dimitry Andric X-Mailer: iPhone Mail (17A878) X-Rspamd-Queue-Id: 46yzVT2xW0z4Wml X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=gRsAL289; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::443 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-0.68), ipnet: 2607:f8b0::/32(-2.42), asn: 15169(-2.06), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[3.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 18:31:46 -0000 > On Oct 23, 2019, at 10:02, Dimitry Andric wrote: >=20 > =EF=BB=BFAuthor: dim > Date: Wed Oct 23 17:02:45 2019 > New Revision: 353937 > URL: https://svnweb.freebsd.org/changeset/base/353937 >=20 > Log: > Build toolchain components as dynamically linked executables by default >=20 > Summary: > Historically, we have built toolchain components such as cc, ld, etc as > statically linked executables. One of the reasons being that you could > sometimes save yourself from botched upgrades, by e.g. recompiling a > "known good" libc and reinstalling it. >=20 > In this day and age, we have boot environments, virtual machine > snapshots, cloud backups, and other much more reliable methods to > restore systems to working order. So I think the time is ripe to flip > this default, and link the toolchain components dynamically, just like > almost all other executables on FreeBSD. >=20 > Maybe at some point they can even become PIE executables by default! :) There might be a different reason for this being the case than the one posed= . Using dynamic binaries instead of static binaries might actually regress per= formance in a way you don=E2=80=99t expect, depending on -j values, etc. Sta= tic binaries avoid the dynamic linker, which (obviously) results in a perf h= it at scale, at the potential cost of the in-memory image. Static binaries c= ould also better optimize away less optimal code paths, which could result i= n worse performing code. Did you calculate the perf trade offs for the static binaries at low -j vs h= igh -j, system and user time, etc? Cheers, -Enji PS Thank you for keeping the SHARED_TOOLCHAIN option.= From owner-svn-src-head@freebsd.org Wed Oct 23 18:45:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CE0615AFC0; Wed, 23 Oct 2019 18:45:16 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vtr.rulingia.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yzp24938z4XM7; Wed, 23 Oct 2019 18:45:13 +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 x9NIiwlk027097 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Oct 2019 05:45:03 +1100 (AEDT) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.15.2/8.15.2) with ESMTPS id x9NIiqL5008843 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 24 Oct 2019 05:44:52 +1100 (AEDT) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.15.2/8.15.2/Submit) id x9NIiqhP008842; Thu, 24 Oct 2019 05:44:52 +1100 (AEDT) (envelope-from peter) Date: Thu, 24 Oct 2019 05:44:52 +1100 From: Peter Jeremy To: Andrew Turner Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353640 - head/sys/kern Message-ID: <20191023184452.GA8725@server.rulingia.com> References: <201910161321.x9GDL2ee021543@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: <201910161321.x9GDL2ee021543@repo.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.12.1 (2019-06-15) X-Rspamd-Queue-Id: 46yzp24938z4XM7 X-Spamd-Bar: ------- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of peter@rulingia.com designates 2001:19f0:5801:ebe:5400:1ff:fe53:30fd as permitted sender) smtp.mailfrom=peter@rulingia.com X-Spamd-Result: default: False [-7.67 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[rulingia.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-3.27)[ip: (-9.91), ipnet: 2001:19f0:5800::/38(-4.95), asn: 20473(-1.43), country: US(-0.05)]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5800::/38, country:US]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 18:45:16 -0000 --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-Oct-16 13:21:02 +0000, Andrew Turner wrote: >Author: andrew >Date: Wed Oct 16 13:21:01 2019 >New Revision: 353640 >URL: https://svnweb.freebsd.org/changeset/base/353640 > >Log: > Stop leaking information from the kernel through timespec > =20 > The timespec struct holds a seconds value in a time_t and a nanoseconds > value in a long. On most architectures these are the same size, however > on 32-bit architectures other than i386 time_t is 8 bytes and long is > 4 bytes. > =20 > Most ABIs will then pad a struct holding an 8 byte and 4 byte value to > 16 bytes with 4 bytes of padding. When copying one of these structs the > compiler is free to copy the padding if it wishes. Are there any other structs passed from kernel to userland that include padding? --=20 Peter Jeremy --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAl2wn59fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi CzT0aQ//XQLIKUlNQEau0wTr8TItxH/cVTV9Xnxr/V5x2U80JSP2GKa4DrFvCbfA 1bq63ofZgvfVogKUcLdCrT2nb84FrYgnIYCIAquwJkzum/UJfqtAxldeqQ+EFX3m B/vrv/JPmv48GhKzlERAAlu7eAN6z7PREl+Wgc4YDkOsp+D+wpF1TtafY8/WJFHn Vc3skMKN0AuDj3eRysgF7qARYN9JOYaMGXuoa9eO4n9X0yM5C+ypzv9n1ohWpWSZ LbLUxYwcXTdaprXggFQxoBBCayEdcSMBJO6502LMSceaUUTpxz7qFZZrDcWR4MPa ErEgp7JwK+En+MAzww8MXCMeFJN4oNuQd4JXd/3XYeG5NyHRa1mOdWAZe3b52VoQ RVMOVUu63tKLNkZNO/Tj5fg1SaaPfVf9WKtgeT8UROgHUXsNwkb2Y/dgUvlMbQbq YKO55xxTrQASKDxaW/Zo6gb3Nt8fuEd2f2aw5k98Kyg55ulMPzgi67FWYXwyd+Xk KCHsAGwcPhRqu/Dgk2Q81gWGUFuORGGuwu5uPoz64sZiDtDCblslHZzJvAIWegUc jGRv2VAbhwxxsEDucEyOKvAPACk1WfjyTN/DLso33S6gqrFK2qdYLl6iurGodhZX 5Z0c2k5FSUcYM9kF8ev4QfmVQb4HCEL5lDBL4qHRfvS9izZxKWo= =1fyl -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9-- From owner-svn-src-head@freebsd.org Wed Oct 23 19:03:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3DA615B375; Wed, 23 Oct 2019 19:03:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z0Bb6D67z4Y8N; Wed, 23 Oct 2019 19:03:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9ECE01088; Wed, 23 Oct 2019 19:03:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NJ33nt020910; Wed, 23 Oct 2019 19:03:03 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NJ33dI020909; Wed, 23 Oct 2019 19:03:03 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910231903.x9NJ33dI020909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 23 Oct 2019 19:03:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353959 - head/sys/amd64/include X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/amd64/include X-SVN-Commit-Revision: 353959 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 19:03:04 -0000 Author: cem Date: Wed Oct 23 19:03:03 2019 New Revision: 353959 URL: https://svnweb.freebsd.org/changeset/base/353959 Log: amd64: Add CFI directives for libc syscall stubs No functional change (in program code). Additional DWARF metadata is generated in the .eh_frame section. Also, it is now a compile-time requirement that machine/asm.h ENTRY() and END() macros are paired. (This is subject to ongoing discussion and may change.) This DWARF metadata allows llvm-libunwind to unwind program stacks when the program is executing the function. The goal is to collect accurate userspace stacktraces when programs have entered syscalls. (The motivation for "Call Frame Information," or CFI for short -- not to be confused with Control Flow Integrity -- is to sufficiently annotate assembly functions such that stack unwinders can unwind out of the local frame without the requirement of a dedicated framepointer register; i.e., -fomit-frame-pointer. This is necessary for C++ exception handling or collecting backtraces.) For the curious, a more thorough description of the metadata and some examples may be found at [1] and documentation at [2]. You can also look at 'cc -S -o - foo.c | less' and search for '.cfi_' to see the CFI directives generated by your C compiler. [1]: https://www.imperialviolet.org/2017/01/18/cfi.html [2]: https://sourceware.org/binutils/docs/as/CFI-directives.html Reviewed by: emaste, kib (with reservations) Differential Revision: https://reviews.freebsd.org/D22122 Modified: head/sys/amd64/include/asm.h Modified: head/sys/amd64/include/asm.h ============================================================================== --- head/sys/amd64/include/asm.h Wed Oct 23 18:27:30 2019 (r353958) +++ head/sys/amd64/include/asm.h Wed Oct 23 19:03:03 2019 (r353959) @@ -60,25 +60,36 @@ #define _START_ENTRY .text; .p2align 4,0x90 #define _ENTRY(x) _START_ENTRY; \ - .globl CNAME(x); .type CNAME(x),@function; CNAME(x): + .globl CNAME(x); .type CNAME(x),@function; CNAME(x):; \ + .cfi_startproc #ifdef PROF #define ALTENTRY(x) _ENTRY(x); \ - pushq %rbp; movq %rsp,%rbp; \ + pushq %rbp; \ + .cfi_def_cfa_offset 16; \ + .cfi_offset %rbp, -16; \ + movq %rsp,%rbp; \ call PIC_PLT(HIDENAME(mcount)); \ popq %rbp; \ + .cfi_restore %rbp; \ + .cfi_def_cfa_offset 8; \ jmp 9f #define ENTRY(x) _ENTRY(x); \ - pushq %rbp; movq %rsp,%rbp; \ + pushq %rbp; \ + .cfi_def_cfa_offset 16; \ + .cfi_offset %rbp, -16; \ + movq %rsp,%rbp; \ call PIC_PLT(HIDENAME(mcount)); \ popq %rbp; \ + .cfi_restore %rbp; \ + .cfi_def_cfa_offset 8; \ 9: #else #define ALTENTRY(x) _ENTRY(x) #define ENTRY(x) _ENTRY(x) #endif -#define END(x) .size x, . - x +#define END(x) .size x, . - x; .cfi_endproc /* * WEAK_REFERENCE(): create a weak reference alias from sym. * The macro is not a general asm macro that takes arbitrary names, From owner-svn-src-head@freebsd.org Wed Oct 23 19:17:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3557815B59D; Wed, 23 Oct 2019 19:17:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z0Vv0Sdpz4Ycj; Wed, 23 Oct 2019 19:17:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E72F71275; Wed, 23 Oct 2019 19:17:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NJHAlL027055; Wed, 23 Oct 2019 19:17:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NJHAeJ027054; Wed, 23 Oct 2019 19:17:10 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910231917.x9NJHAeJ027054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 23 Oct 2019 19:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353960 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 353960 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 19:17:11 -0000 Author: mjg Date: Wed Oct 23 19:17:10 2019 New Revision: 353960 URL: https://svnweb.freebsd.org/changeset/base/353960 Log: amd64 pmap: per-domain pv chunk list This significantly reduces contention since chunks get created and removed all the time. See the review for sample results. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21976 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Oct 23 19:03:03 2019 (r353959) +++ head/sys/amd64/amd64/pmap.c Wed Oct 23 19:17:10 2019 (r353960) @@ -165,6 +165,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef NUMA +#define PMAP_MEMDOM MAXMEMDOM +#else +#define PMAP_MEMDOM 1 +#endif + static __inline boolean_t pmap_type_guest(pmap_t pmap) { @@ -420,8 +426,30 @@ static int pmap_initialized; * Data for the pv entry allocation mechanism. * Updates to pv_invl_gen are protected by the pv list lock but reads are not. */ -static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks); -static struct mtx __exclusive_cache_line pv_chunks_mutex; +#ifdef NUMA +static __inline int +pc_to_domain(struct pv_chunk *pc) +{ + + return (_vm_phys_domain(DMAP_TO_PHYS((vm_offset_t)pc))); +} +#else +static __inline int +pc_to_domain(struct pv_chunk *pc __unused) +{ + + return (0); +} +#endif + +struct pv_chunks_list { + struct mtx pvc_lock; + TAILQ_HEAD(pch, pv_chunk) pvc_list; + int active_reclaims; +} __aligned(CACHE_LINE_SIZE); + +struct pv_chunks_list __exclusive_cache_line pv_chunks[PMAP_MEMDOM]; + #ifdef NUMA struct pmap_large_md_page { struct rwlock pv_lock; @@ -2044,10 +2072,12 @@ pmap_init(void) } /* - * Initialize the pv chunk list mutex. + * Initialize pv chunk lists. */ - mtx_init(&pv_chunks_mutex, "pmap pv chunk list", NULL, MTX_DEF); - + for (i = 0; i < PMAP_MEMDOM; i++) { + mtx_init(&pv_chunks[i].pvc_lock, "pmap pv chunk list", NULL, MTX_DEF); + TAILQ_INIT(&pv_chunks[i].pvc_list); + } pmap_init_pv_table(); pmap_initialized = 1; @@ -4150,8 +4180,9 @@ reclaim_pv_chunk_leave_pmap(pmap_t pmap, pmap_t locked * exacerbating the shortage of free pv entries. */ static vm_page_t -reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp) +reclaim_pv_chunk_domain(pmap_t locked_pmap, struct rwlock **lockp, int domain) { + struct pv_chunks_list *pvc; struct pv_chunk *pc, *pc_marker, *pc_marker_end; struct pv_chunk_header pc_marker_b, pc_marker_end_b; struct md_page *pvh; @@ -4166,7 +4197,6 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l uint64_t inuse; int bit, field, freed; bool start_di; - static int active_reclaims = 0; PMAP_LOCK_ASSERT(locked_pmap, MA_OWNED); KASSERT(lockp != NULL, ("reclaim_pv_chunk: lockp is NULL")); @@ -4186,10 +4216,11 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l */ start_di = pmap_not_in_di(); - mtx_lock(&pv_chunks_mutex); - active_reclaims++; - TAILQ_INSERT_HEAD(&pv_chunks, pc_marker, pc_lru); - TAILQ_INSERT_TAIL(&pv_chunks, pc_marker_end, pc_lru); + pvc = &pv_chunks[domain]; + mtx_lock(&pvc->pvc_lock); + pvc->active_reclaims++; + TAILQ_INSERT_HEAD(&pvc->pvc_list, pc_marker, pc_lru); + TAILQ_INSERT_TAIL(&pvc->pvc_list, pc_marker_end, pc_lru); while ((pc = TAILQ_NEXT(pc_marker, pc_lru)) != pc_marker_end && SLIST_EMPTY(&free)) { next_pmap = pc->pc_pmap; @@ -4202,7 +4233,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l */ goto next_chunk; } - mtx_unlock(&pv_chunks_mutex); + mtx_unlock(&pvc->pvc_lock); /* * A pv_chunk can only be removed from the pc_lru list @@ -4219,17 +4250,17 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l PMAP_LOCK(pmap); if (start_di) pmap_delayed_invl_start(); - mtx_lock(&pv_chunks_mutex); + mtx_lock(&pvc->pvc_lock); continue; } else if (pmap != locked_pmap) { if (PMAP_TRYLOCK(pmap)) { if (start_di) pmap_delayed_invl_start(); - mtx_lock(&pv_chunks_mutex); + mtx_lock(&pvc->pvc_lock); continue; } else { pmap = NULL; /* pmap is not locked */ - mtx_lock(&pv_chunks_mutex); + mtx_lock(&pvc->pvc_lock); pc = TAILQ_NEXT(pc_marker, pc_lru); if (pc == NULL || pc->pc_pmap != next_pmap) @@ -4286,7 +4317,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l } } if (freed == 0) { - mtx_lock(&pv_chunks_mutex); + mtx_lock(&pvc->pvc_lock); goto next_chunk; } /* Every freed mapping is for a 4 KB page. */ @@ -4303,19 +4334,19 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l /* Entire chunk is free; return it. */ m_pc = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); dump_drop_page(m_pc->phys_addr); - mtx_lock(&pv_chunks_mutex); - TAILQ_REMOVE(&pv_chunks, pc, pc_lru); + mtx_lock(&pvc->pvc_lock); + TAILQ_REMOVE(&pvc->pvc_list, pc, pc_lru); break; } TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); - mtx_lock(&pv_chunks_mutex); + mtx_lock(&pvc->pvc_lock); /* One freed pv entry in locked_pmap is sufficient. */ if (pmap == locked_pmap) break; next_chunk: - TAILQ_REMOVE(&pv_chunks, pc_marker, pc_lru); - TAILQ_INSERT_AFTER(&pv_chunks, pc, pc_marker, pc_lru); - if (active_reclaims == 1 && pmap != NULL) { + TAILQ_REMOVE(&pvc->pvc_list, pc_marker, pc_lru); + TAILQ_INSERT_AFTER(&pvc->pvc_list, pc, pc_marker, pc_lru); + if (pvc->active_reclaims == 1 && pmap != NULL) { /* * Rotate the pv chunks list so that we do not * scan the same pv chunks that could not be @@ -4323,17 +4354,17 @@ next_chunk: * and/or superpage mapping) on every * invocation of reclaim_pv_chunk(). */ - while ((pc = TAILQ_FIRST(&pv_chunks)) != pc_marker) { + while ((pc = TAILQ_FIRST(&pvc->pvc_list)) != pc_marker) { MPASS(pc->pc_pmap != NULL); - TAILQ_REMOVE(&pv_chunks, pc, pc_lru); - TAILQ_INSERT_TAIL(&pv_chunks, pc, pc_lru); + TAILQ_REMOVE(&pvc->pvc_list, pc, pc_lru); + TAILQ_INSERT_TAIL(&pvc->pvc_list, pc, pc_lru); } } } - TAILQ_REMOVE(&pv_chunks, pc_marker, pc_lru); - TAILQ_REMOVE(&pv_chunks, pc_marker_end, pc_lru); - active_reclaims--; - mtx_unlock(&pv_chunks_mutex); + TAILQ_REMOVE(&pvc->pvc_list, pc_marker, pc_lru); + TAILQ_REMOVE(&pvc->pvc_list, pc_marker_end, pc_lru); + pvc->active_reclaims--; + mtx_unlock(&pvc->pvc_lock); reclaim_pv_chunk_leave_pmap(pmap, locked_pmap, start_di); if (m_pc == NULL && !SLIST_EMPTY(&free)) { m_pc = SLIST_FIRST(&free); @@ -4345,6 +4376,23 @@ next_chunk: return (m_pc); } +static vm_page_t +reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp) +{ + vm_page_t m; + int i, domain; + + domain = PCPU_GET(domain); + for (i = 0; i < vm_ndomains; i++) { + m = reclaim_pv_chunk_domain(locked_pmap, lockp, domain); + if (m != NULL) + break; + domain = (domain + 1) % vm_ndomains; + } + + return (m); +} + /* * free the pv_entry back to the free list */ @@ -4394,29 +4442,37 @@ free_pv_chunk_dequeued(struct pv_chunk *pc) static void free_pv_chunk(struct pv_chunk *pc) { + struct pv_chunks_list *pvc; - mtx_lock(&pv_chunks_mutex); - TAILQ_REMOVE(&pv_chunks, pc, pc_lru); - mtx_unlock(&pv_chunks_mutex); + pvc = &pv_chunks[pc_to_domain(pc)]; + mtx_lock(&pvc->pvc_lock); + TAILQ_REMOVE(&pvc->pvc_list, pc, pc_lru); + mtx_unlock(&pvc->pvc_lock); free_pv_chunk_dequeued(pc); } static void free_pv_chunk_batch(struct pv_chunklist *batch) { + struct pv_chunks_list *pvc; struct pv_chunk *pc, *npc; + int i; - if (TAILQ_EMPTY(batch)) - return; - - mtx_lock(&pv_chunks_mutex); - TAILQ_FOREACH(pc, batch, pc_list) { - TAILQ_REMOVE(&pv_chunks, pc, pc_lru); + for (i = 0; i < vm_ndomains; i++) { + if (TAILQ_EMPTY(&batch[i])) + continue; + pvc = &pv_chunks[i]; + mtx_lock(&pvc->pvc_lock); + TAILQ_FOREACH(pc, &batch[i], pc_list) { + TAILQ_REMOVE(&pvc->pvc_list, pc, pc_lru); + } + mtx_unlock(&pvc->pvc_lock); } - mtx_unlock(&pv_chunks_mutex); - TAILQ_FOREACH_SAFE(pc, batch, pc_list, npc) { - free_pv_chunk_dequeued(pc); + for (i = 0; i < vm_ndomains; i++) { + TAILQ_FOREACH_SAFE(pc, &batch[i], pc_list, npc) { + free_pv_chunk_dequeued(pc); + } } } @@ -4431,6 +4487,7 @@ free_pv_chunk_batch(struct pv_chunklist *batch) static pv_entry_t get_pv_entry(pmap_t pmap, struct rwlock **lockp) { + struct pv_chunks_list *pvc; int bit, field; pv_entry_t pv; struct pv_chunk *pc; @@ -4482,9 +4539,10 @@ retry: pc->pc_map[0] = PC_FREE0 & ~1ul; /* preallocated bit 0 */ pc->pc_map[1] = PC_FREE1; pc->pc_map[2] = PC_FREE2; - mtx_lock(&pv_chunks_mutex); - TAILQ_INSERT_TAIL(&pv_chunks, pc, pc_lru); - mtx_unlock(&pv_chunks_mutex); + pvc = &pv_chunks[_vm_phys_domain(m->phys_addr)]; + mtx_lock(&pvc->pvc_lock); + TAILQ_INSERT_TAIL(&pvc->pvc_list, pc, pc_lru); + mtx_unlock(&pvc->pvc_lock); pv = &pc->pc_pventry[0]; TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); PV_STAT(atomic_add_long(&pv_entry_count, 1)); @@ -4530,10 +4588,11 @@ popcnt_pc_map_pq(uint64_t *map) static void reserve_pv_entries(pmap_t pmap, int needed, struct rwlock **lockp) { - struct pch new_tail; + struct pv_chunks_list *pvc; + struct pch new_tail[PMAP_MEMDOM]; struct pv_chunk *pc; vm_page_t m; - int avail, free; + int avail, free, i; bool reclaimed; PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -4545,7 +4604,8 @@ reserve_pv_entries(pmap_t pmap, int needed, struct rwl * reclaim_pv_chunk() could recycle one of these chunks. In * contrast, these chunks must be added to the pmap upon allocation. */ - TAILQ_INIT(&new_tail); + for (i = 0; i < PMAP_MEMDOM; i++) + TAILQ_INIT(&new_tail[i]); retry: avail = 0; TAILQ_FOREACH(pc, &pmap->pm_pvchunk, pc_list) { @@ -4580,7 +4640,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, pc_lru); + TAILQ_INSERT_TAIL(&new_tail[pc_to_domain(pc)], pc, pc_lru); PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV)); /* @@ -4591,10 +4651,13 @@ retry: if (reclaimed) goto retry; } - if (!TAILQ_EMPTY(&new_tail)) { - mtx_lock(&pv_chunks_mutex); - TAILQ_CONCAT(&pv_chunks, &new_tail, pc_lru); - mtx_unlock(&pv_chunks_mutex); + for (i = 0; i < vm_ndomains; i++) { + if (TAILQ_EMPTY(&new_tail[i])) + continue; + pvc = &pv_chunks[i]; + mtx_lock(&pvc->pvc_lock); + TAILQ_CONCAT(&pvc->pvc_list, &new_tail[i], pc_lru); + mtx_unlock(&pvc->pvc_lock); } } @@ -7020,7 +7083,7 @@ pmap_remove_pages(pmap_t pmap) pt_entry_t *pte, tpte; pt_entry_t PG_M, PG_RW, PG_V; struct spglist free; - struct pv_chunklist free_chunks; + struct pv_chunklist free_chunks[PMAP_MEMDOM]; vm_page_t m, mpte, mt; pv_entry_t pv; struct md_page *pvh; @@ -7028,7 +7091,7 @@ pmap_remove_pages(pmap_t pmap) struct rwlock *lock; int64_t bit; uint64_t inuse, bitmask; - int allfree, field, freed, idx; + int allfree, field, freed, i, idx; boolean_t superpage; vm_paddr_t pa; @@ -7056,7 +7119,8 @@ pmap_remove_pages(pmap_t pmap) PG_V = pmap_valid_bit(pmap); PG_RW = pmap_rw_bit(pmap); - TAILQ_INIT(&free_chunks); + for (i = 0; i < PMAP_MEMDOM; i++) + TAILQ_INIT(&free_chunks[i]); SLIST_INIT(&free); PMAP_LOCK(pmap); TAILQ_FOREACH_SAFE(pc, &pmap->pm_pvchunk, pc_list, npc) { @@ -7184,14 +7248,14 @@ pmap_remove_pages(pmap_t pmap) PV_STAT(atomic_subtract_long(&pv_entry_count, freed)); if (allfree) { TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); - TAILQ_INSERT_TAIL(&free_chunks, pc, pc_list); + TAILQ_INSERT_TAIL(&free_chunks[pc_to_domain(pc)], pc, pc_list); } } if (lock != NULL) rw_wunlock(lock); pmap_invalidate_all(pmap); pmap_pkru_deassign_all(pmap); - free_pv_chunk_batch(&free_chunks); + free_pv_chunk_batch((struct pv_chunklist *)&free_chunks); PMAP_UNLOCK(pmap); vm_page_free_pages_toq(&free, true); } From owner-svn-src-head@freebsd.org Wed Oct 23 19:23:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2FA315B82C; Wed, 23 Oct 2019 19:23:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z0fC6Dznz4Z3X; Wed, 23 Oct 2019 19:23:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B98161448; Wed, 23 Oct 2019 19:23:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NJNVXa032772; Wed, 23 Oct 2019 19:23:31 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NJNV5w032771; Wed, 23 Oct 2019 19:23:31 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201910231923.x9NJNV5w032771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 23 Oct 2019 19:23:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353961 - head/usr.bin/dtc X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.bin/dtc X-SVN-Commit-Revision: 353961 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 19:23:32 -0000 Author: imp Date: Wed Oct 23 19:23:31 2019 New Revision: 353961 URL: https://svnweb.freebsd.org/changeset/base/353961 Log: exit requires stdlib.h to be included to use. FreeBSD 10.3 requires this, and dtc is a bootstrap tool so it needs to compile there. Modified: head/usr.bin/dtc/dtb.cc Modified: head/usr.bin/dtc/dtb.cc ============================================================================== --- head/usr.bin/dtc/dtb.cc Wed Oct 23 19:17:10 2019 (r353960) +++ head/usr.bin/dtc/dtb.cc Wed Oct 23 19:23:31 2019 (r353961) @@ -36,6 +36,7 @@ #include #include #include +#include #include #include From owner-svn-src-head@freebsd.org Wed Oct 23 19:35:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BB1115BA43; Wed, 23 Oct 2019 19:35:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z0vz0fNmz4ZTP; Wed, 23 Oct 2019 19:35:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9C2E1602; Wed, 23 Oct 2019 19:35:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NJZQeH038657; Wed, 23 Oct 2019 19:35:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NJZQLT038656; Wed, 23 Oct 2019 19:35:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910231935.x9NJZQLT038656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 23 Oct 2019 19:35:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353962 - head/sys/arm64/conf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm64/conf X-SVN-Commit-Revision: 353962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 19:35:27 -0000 Author: emaste Date: Wed Oct 23 19:35:26 2019 New Revision: 353962 URL: https://svnweb.freebsd.org/changeset/base/353962 Log: arm64: enable options NUMA in GENERIC As with amd64 NUMA is required for reasonable operation on big-iron arm64 systems and is expected to have no significant impact on small systems. Enable it now for wider testing in advance of FreeBSD 13.0. You can use the 'vm.ndomains' sysctl to see if multiple domains are in use - for example (from Cavium/Marvell ThunderX2): # sysctl vm.ndomains vm.ndomains: 2 No objection: manu Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Wed Oct 23 19:23:31 2019 (r353961) +++ head/sys/arm64/conf/GENERIC Wed Oct 23 19:35:26 2019 (r353962) @@ -25,6 +25,7 @@ makeoptions DEBUG=-g # Build kernel with gdb(1) debug makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support options SCHED_ULE # ULE scheduler +options NUMA # Non-Uniform Memory Architecture support options PREEMPTION # Enable kernel thread preemption options VIMAGE # Subsystem virtualization, e.g. VNET options INET # InterNETworking From owner-svn-src-head@freebsd.org Wed Oct 23 20:37:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 910F615CF0A; Wed, 23 Oct 2019 20:37:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z2HJ3LJGz4f4L; Wed, 23 Oct 2019 20:37:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5724A2110; Wed, 23 Oct 2019 20:37:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NKbGFn074601; Wed, 23 Oct 2019 20:37:16 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NKbGVI074600; Wed, 23 Oct 2019 20:37:16 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910232037.x9NKbGVI074600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 23 Oct 2019 20:37:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353963 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 20:37:16 -0000 Author: bz Date: Wed Oct 23 20:37:15 2019 New Revision: 353963 URL: https://svnweb.freebsd.org/changeset/base/353963 Log: frag6: whitespace changes Remove trailing white space, add a blank line, and compress a comment. No functional changes. MFC after: 10 days Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Wed Oct 23 19:35:26 2019 (r353962) +++ head/sys/netinet6/frag6.c Wed Oct 23 20:37:15 2019 (r353963) @@ -106,7 +106,7 @@ VNET_DEFINE_STATIC(bool, frag6_on); #define V_frag6_on VNET(frag6_on) #endif -/* System wide (global) maximum and count of packets in reassembly queues. */ +/* System wide (global) maximum and count of packets in reassembly queues. */ static int ip6_maxfrags; static volatile u_int frag6_nfrags = 0; @@ -215,7 +215,7 @@ ip6_deletefraghdr(struct mbuf *m, int offset, int wait if (m->m_len >= offset + sizeof(struct ip6_frag)) { /* This is the only possible case with !PULLDOWN_TEST. */ - ip6 = mtod(m, struct ip6_hdr *); + ip6 = mtod(m, struct ip6_hdr *); bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag), offset); m->m_data += sizeof(struct ip6_frag); @@ -395,9 +395,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); #endif - /* - * Store receive network interface pointer for later. - */ + /* Store receive network interface pointer for later. */ srcifp = m->m_pkthdr.rcvif; dstifp = NULL; @@ -598,7 +596,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) /* Set a valid receive interface pointer. */ merr->m_pkthdr.rcvif = srcifp; - + /* Adjust pointer. */ ip6err = mtod(merr, struct ip6_hdr *); @@ -697,6 +695,7 @@ insert: frag6_enq(ip6af, af6->ip6af_up, bucket); atomic_add_int(&frag6_nfrags, 1); q6->ip6q_nfrag++; + plen = 0; for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; af6 = af6->ip6af_down) { From owner-svn-src-head@freebsd.org Wed Oct 23 20:39:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD8FF15CFD0; Wed, 23 Oct 2019 20:39:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z2Kj5ZRQz4fK0; Wed, 23 Oct 2019 20:39:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A234C2139; Wed, 23 Oct 2019 20:39:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NKdLZJ074863; Wed, 23 Oct 2019 20:39:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NKdLuR074862; Wed, 23 Oct 2019 20:39:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910232039.x9NKdLuR074862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Oct 2019 20:39:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353964 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 20:39:21 -0000 Author: markj Date: Wed Oct 23 20:39:21 2019 New Revision: 353964 URL: https://svnweb.freebsd.org/changeset/base/353964 Log: Modify release_page() to handle a missing fault page. r353890 introduced a case where we may call release_page() with fs.m == NULL, since the fault handler may now lock the vnode prior to allocating a page for a page-in. Reported by: jhb Reviewed by: kib MFC with: r353890 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22120 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed Oct 23 20:37:15 2019 (r353963) +++ head/sys/vm/vm_fault.c Wed Oct 23 20:39:21 2019 (r353964) @@ -154,11 +154,13 @@ static inline void release_page(struct faultstate *fs) { - vm_page_xunbusy(fs->m); - vm_page_lock(fs->m); - vm_page_deactivate(fs->m); - vm_page_unlock(fs->m); - fs->m = NULL; + if (fs->m != NULL) { + vm_page_xunbusy(fs->m); + vm_page_lock(fs->m); + vm_page_deactivate(fs->m); + vm_page_unlock(fs->m); + fs->m = NULL; + } } static inline void From owner-svn-src-head@freebsd.org Wed Oct 23 23:01:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADA7D15F4E5; Wed, 23 Oct 2019 23:01:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z5TW25fjz3HGw; Wed, 23 Oct 2019 23:01:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C3313CCC; Wed, 23 Oct 2019 23:01:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NN1Jdx062895; Wed, 23 Oct 2019 23:01:19 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NN1ITc062893; Wed, 23 Oct 2019 23:01:18 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910232301.x9NN1ITc062893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 23 Oct 2019 23:01:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353965 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353965 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 23:01:19 -0000 Author: bz Date: Wed Oct 23 23:01:18 2019 New Revision: 353965 URL: https://svnweb.freebsd.org/changeset/base/353965 Log: frag6: replace KAME hand-rolled queues with queue(9) TAILQs Remove the KAME custom circular queue for fragments and fragmented packets and replace them with a standard TAILQ. This make the code a lot more understandable and maintainable and removes further hand-rolled code from the the tree using a standard interface instead. Hide the still public structures under #ifdef _KERNEL as there is no use for them in user space. The naming is a bit confusing now as struct ip6q and the ip6q[] buckets array are not the same anymore; sadly struct ip6q is also used by the MAC framework and we cannot rename it. Submitted by: jtl (initally) MFC after: 3 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D16847 (jtl's original) Modified: head/sys/netinet6/frag6.c head/sys/netinet6/ip6_var.h Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Wed Oct 23 20:39:21 2019 (r353964) +++ head/sys/netinet6/frag6.c Wed Oct 23 23:01:18 2019 (r353965) @@ -3,6 +3,7 @@ * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. + * Copyright (c) 2019 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -72,28 +74,20 @@ __FBSDID("$FreeBSD$"); #define IP6REASS_NHASH (1 << IP6REASS_NHASH_LOG2) #define IP6REASS_HMASK (IP6REASS_NHASH - 1) -static void frag6_enq(struct ip6asfrag *, struct ip6asfrag *, - uint32_t bucket __unused); -static void frag6_deq(struct ip6asfrag *, uint32_t bucket __unused); -static void frag6_insque_head(struct ip6q *, struct ip6q *, - uint32_t bucket); -static void frag6_remque(struct ip6q *, uint32_t bucket); -static void frag6_freef(struct ip6q *, uint32_t bucket); - +TAILQ_HEAD(ip6qhead, ip6q); struct ip6qbucket { - struct ip6q ip6q; + struct ip6qhead packets; struct mtx lock; int count; }; -struct ip6asfrag { - struct ip6asfrag *ip6af_down; - struct ip6asfrag *ip6af_up; +struct ip6asfrag { + TAILQ_ENTRY(ip6asfrag) ip6af_tq; struct mbuf *ip6af_m; int ip6af_offset; /* offset in ip6af_m to next header */ int ip6af_frglen; /* fragmentable part length */ int ip6af_off; /* fragment offset */ - u_int16_t ip6af_mff; /* more fragment bit in frag off */ + bool ip6af_mff; /* more fragment bit in frag off */ }; #define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m)) @@ -132,7 +126,7 @@ VNET_DEFINE_STATIC(uint32_t, ip6qb_hashseed); #define IP6QB_TRYLOCK(_b) mtx_trylock(&V_ip6qb[(_b)].lock) #define IP6QB_LOCK_ASSERT(_b) mtx_assert(&V_ip6qb[(_b)].lock, MA_OWNED) #define IP6QB_UNLOCK(_b) mtx_unlock(&V_ip6qb[(_b)].lock) -#define IP6QB_HEAD(_b) (&V_ip6qb[(_b)].ip6q) +#define IP6QB_HEAD(_b) (&V_ip6qb[(_b)].packets) /* * By default, limit the number of IP6 fragments across all reassembly @@ -240,17 +234,15 @@ static void frag6_freef(struct ip6q *q6, uint32_t bucket) { struct ip6_hdr *ip6; - struct ip6asfrag *af6, *down6; + struct ip6asfrag *af6; struct mbuf *m; IP6QB_LOCK_ASSERT(bucket); - for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; - af6 = down6) { + while ((af6 = TAILQ_FIRST(&q6->ip6q_frags)) != NULL) { m = IP6_REASS_MBUF(af6); - down6 = af6->ip6af_down; - frag6_deq(af6, bucket); + TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); /* * Return ICMP time exceeded error for the 1st fragment. @@ -272,7 +264,9 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) free(af6, M_FRAG6); } - frag6_remque(q6, bucket); + + TAILQ_REMOVE(IP6QB_HEAD(bucket), q6, ip6q_tq); + V_ip6qb[bucket].count--; atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); #ifdef MAC mac_ip6q_destroy(q6); @@ -288,10 +282,11 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) static void frag6_cleanup(void *arg __unused, struct ifnet *ifp) { - struct ip6q *q6, *q6n, *head; + struct ip6qhead *head; + struct ip6q *q6; struct ip6asfrag *af6; struct mbuf *m; - int i; + uint32_t bucket; KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); @@ -305,15 +300,13 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) #endif CURVNET_SET_QUIET(ifp->if_vnet); - for (i = 0; i < IP6REASS_NHASH; i++) { - IP6QB_LOCK(i); - head = IP6QB_HEAD(i); + for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { + IP6QB_LOCK(bucket); + head = IP6QB_HEAD(bucket); /* Scan fragment list. */ - for (q6 = head->ip6q_next; q6 != head; q6 = q6n) { - q6n = q6->ip6q_next; + TAILQ_FOREACH(q6, head, ip6q_tq) { + TAILQ_FOREACH(af6, &q6->ip6q_frags, ip6af_tq) { - for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; - af6 = af6->ip6af_down) { m = IP6_REASS_MBUF(af6); /* clear no longer valid rcvif pointer */ @@ -321,7 +314,7 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) m->m_pkthdr.rcvif = NULL; } } - IP6QB_UNLOCK(i); + IP6QB_UNLOCK(bucket); } CURVNET_RESTORE(); } @@ -362,14 +355,14 @@ EVENTHANDLER_DEFINE(ifnet_departure_event, frag6_clean int frag6_input(struct mbuf **mp, int *offp, int proto) { - struct ifnet *dstifp; - struct ifnet *srcifp; - struct in6_ifaddr *ia6; + struct mbuf *m, *t; struct ip6_hdr *ip6; struct ip6_frag *ip6f; - struct ip6q *head, *q6; - struct ip6asfrag *af6, *af6dwn, *ip6af; - struct mbuf *m, *t; + struct ip6qhead *head; + struct ip6q *q6; + struct ip6asfrag *af6, *ip6af, *af6tmp; + struct in6_ifaddr *ia6; + struct ifnet *dstifp, *srcifp; uint32_t hashkey[(sizeof(struct in6_addr) * 2 + sizeof(ip6f->ip6f_ident)) / sizeof(uint32_t)]; uint32_t bucket, *hashkeyp; @@ -466,8 +459,8 @@ frag6_input(struct mbuf **mp, int *offp, int proto) *hashkeyp = ip6f->ip6f_ident; bucket = jenkins_hash32(hashkey, nitems(hashkey), V_ip6qb_hashseed); bucket &= IP6REASS_HMASK; - head = IP6QB_HEAD(bucket); IP6QB_LOCK(bucket); + head = IP6QB_HEAD(bucket); /* * Enforce upper bound on number of fragments for the entire system. @@ -479,7 +472,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) else if (atomic_load_int(&frag6_nfrags) >= (u_int)ip6_maxfrags) goto dropfrag; - for (q6 = head->ip6q_next; q6 != head; q6 = q6->ip6q_next) + TAILQ_FOREACH(q6, head, ip6q_tq) if (ip6f->ip6f_ident == q6->ip6q_ident && IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, &q6->ip6q_src) && IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &q6->ip6q_dst) @@ -490,7 +483,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) break; only_frag = false; - if (q6 == head) { + if (q6 == NULL) { /* A first fragment to arrive creates a reassembly queue. */ only_frag = true; @@ -522,13 +515,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } mac_ip6q_create(m, q6); #endif - frag6_insque_head(q6, head, bucket); /* ip6q_nxt will be filled afterwards, from 1st fragment. */ - q6->ip6q_down = q6->ip6q_up = (struct ip6asfrag *)q6; -#ifdef notyet - q6->ip6q_nxtp = (u_char *)nxtp; -#endif + TAILQ_INIT(&q6->ip6q_frags); q6->ip6q_ident = ip6f->ip6f_ident; q6->ip6q_ttl = IPV6_FRAGTTL; q6->ip6q_src = ip6->ip6_src; @@ -537,7 +526,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) (ntohl(ip6->ip6_flow) >> 20) & IPTOS_ECN_MASK; q6->ip6q_unfrglen = -1; /* The 1st fragment has not arrived. */ - q6->ip6q_nfrag = 0; + /* Add the fragemented packet to the bucket. */ + TAILQ_INSERT_HEAD(head, q6, ip6q_tq); + V_ip6qb[bucket].count++; } /* @@ -577,9 +568,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) * fragment already stored in the reassembly queue. */ if (fragoff == 0) { - for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; - af6 = af6dwn) { - af6dwn = af6->ip6af_down; + TAILQ_FOREACH_SAFE(af6, &q6->ip6q_frags, ip6af_tq, af6tmp) { if (q6->ip6q_unfrglen + af6->ip6af_off + af6->ip6af_frglen > IPV6_MAXPACKET) { @@ -591,7 +580,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) erroff = af6->ip6af_offset; /* Dequeue the fragment. */ - frag6_deq(af6, bucket); + TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); free(af6, M_FRAG6); /* Set a valid receive interface pointer. */ @@ -620,15 +609,19 @@ frag6_input(struct mbuf **mp, int *offp, int proto) M_NOWAIT | M_ZERO); if (ip6af == NULL) goto dropfrag; - ip6af->ip6af_mff = ip6f->ip6f_offlg & IP6F_MORE_FRAG; + ip6af->ip6af_mff = (ip6f->ip6f_offlg & IP6F_MORE_FRAG) ? true : false; ip6af->ip6af_off = fragoff; ip6af->ip6af_frglen = frgpartlen; ip6af->ip6af_offset = offset; IP6_REASS_MBUF(ip6af) = m; if (only_frag) { - af6 = (struct ip6asfrag *)q6; - goto insert; + /* + * Do a manual insert rather than a hard-to-understand cast + * to a different type relying on data structure order to work. + */ + TAILQ_INSERT_HEAD(&q6->ip6q_frags, ip6af, ip6af_tq); + goto postinsert; } /* Do duplicate, condition, and boundry checks. */ @@ -653,8 +646,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } /* Find a fragmented part which begins after this one does. */ - for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; - af6 = af6->ip6af_down) + TAILQ_FOREACH(af6, &q6->ip6q_frags, ip6af_tq) if (af6->ip6af_off > ip6af->ip6af_off) break; @@ -666,14 +658,18 @@ frag6_input(struct mbuf **mp, int *offp, int proto) * drop the existing fragment and leave the fragmentation queue * unchanged, as allowed by the RFC. (RFC 8200, 4.5) */ - if (af6->ip6af_up != (struct ip6asfrag *)q6) { - if (af6->ip6af_up->ip6af_off + af6->ip6af_up->ip6af_frglen - + if (af6 != NULL) + af6tmp = TAILQ_PREV(af6, ip6fraghead, ip6af_tq); + else + af6tmp = TAILQ_LAST(&q6->ip6q_frags, ip6fraghead); + if (af6tmp != NULL) { + if (af6tmp->ip6af_off + af6tmp->ip6af_frglen - ip6af->ip6af_off > 0) { free(ip6af, M_FRAG6); goto dropfrag; } } - if (af6 != (struct ip6asfrag *)q6) { + if (af6 != NULL) { if (ip6af->ip6af_off + ip6af->ip6af_frglen - af6->ip6af_off > 0) { free(ip6af, M_FRAG6); @@ -681,10 +677,8 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } } -insert: #ifdef MAC - if (!only_frag) - mac_ip6q_update(m, q6); + mac_ip6q_update(m, q6); #endif /* @@ -692,13 +686,16 @@ insert: * If not complete, check fragment limit. Move to front of packet * queue, as we are the most recently active fragmented packet. */ - frag6_enq(ip6af, af6->ip6af_up, bucket); + if (af6 != NULL) + TAILQ_INSERT_BEFORE(af6, ip6af, ip6af_tq); + else + TAILQ_INSERT_TAIL(&q6->ip6q_frags, ip6af, ip6af_tq); +postinsert: atomic_add_int(&frag6_nfrags, 1); q6->ip6q_nfrag++; plen = 0; - for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; - af6 = af6->ip6af_down) { + TAILQ_FOREACH(af6, &q6->ip6q_frags, ip6af_tq) { if (af6->ip6af_off != plen) { if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) { IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag); @@ -709,7 +706,8 @@ insert: } plen += af6->ip6af_frglen; } - if (af6->ip6af_up->ip6af_mff) { + af6 = TAILQ_LAST(&q6->ip6q_frags, ip6fraghead); + if (af6->ip6af_mff) { if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) { IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag); frag6_freef(q6, bucket); @@ -719,25 +717,22 @@ insert: } /* Reassembly is complete; concatenate fragments. */ - ip6af = q6->ip6q_down; + ip6af = TAILQ_FIRST(&q6->ip6q_frags); t = m = IP6_REASS_MBUF(ip6af); - af6 = ip6af->ip6af_down; - frag6_deq(ip6af, bucket); - while (af6 != (struct ip6asfrag *)q6) { + TAILQ_REMOVE(&q6->ip6q_frags, ip6af, ip6af_tq); + while ((af6 = TAILQ_FIRST(&q6->ip6q_frags)) != NULL) { m->m_pkthdr.csum_flags &= IP6_REASS_MBUF(af6)->m_pkthdr.csum_flags; m->m_pkthdr.csum_data += IP6_REASS_MBUF(af6)->m_pkthdr.csum_data; - af6dwn = af6->ip6af_down; - frag6_deq(af6, bucket); + TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); while (t->m_next) t = t->m_next; m_adj(IP6_REASS_MBUF(af6), af6->ip6af_offset); m_demote_pkthdr(IP6_REASS_MBUF(af6)); m_cat(t, IP6_REASS_MBUF(af6)); free(af6, M_FRAG6); - af6 = af6dwn; } while (m->m_pkthdr.csum_data & 0xffff0000) @@ -753,9 +748,11 @@ insert: ip6->ip6_flow |= htonl(IPTOS_ECN_CE << 20); nxt = q6->ip6q_nxt; + TAILQ_REMOVE(head, q6, ip6q_tq); + V_ip6qb[bucket].count--; + atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); + if (ip6_deletefraghdr(m, offset, M_NOWAIT) != 0) { - frag6_remque(q6, bucket); - atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); #ifdef MAC mac_ip6q_destroy(q6); #endif @@ -769,8 +766,6 @@ insert: m_copyback(m, ip6_get_prevhdr(m, offset), sizeof(uint8_t), (caddr_t)&nxt); - frag6_remque(q6, bucket); - atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); #ifdef MAC mac_ip6q_reassemble(q6, m); mac_ip6q_destroy(q6); @@ -833,7 +828,8 @@ void frag6_slowtimo(void) { VNET_ITERATOR_DECL(vnet_iter); - struct ip6q *head, *q6; + struct ip6qhead *head; + struct ip6q *q6, *q6tmp; uint32_t bucket; VNET_LIST_RLOCK_NOSLEEP(); @@ -842,25 +838,13 @@ frag6_slowtimo(void) for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { IP6QB_LOCK(bucket); head = IP6QB_HEAD(bucket); - q6 = head->ip6q_next; - if (q6 == NULL) { - /* - * XXXJTL: This should never happen. This - * should turn into an assertion. - */ - IP6QB_UNLOCK(bucket); - continue; - } - while (q6 != head) { - --q6->ip6q_ttl; - q6 = q6->ip6q_next; - if (q6->ip6q_prev->ip6q_ttl == 0) { + TAILQ_FOREACH_SAFE(q6, head, ip6q_tq, q6tmp) + if (--q6->ip6q_ttl == 0) { IP6STAT_ADD(ip6s_fragtimeout, - q6->ip6q_prev->ip6q_nfrag); + q6->ip6q_nfrag); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(q6->ip6q_prev, bucket); + frag6_freef(q6, bucket); } - } /* * If we are over the maximum number of fragments * (due to the limit being lowered), drain off @@ -873,11 +857,10 @@ frag6_slowtimo(void) while ((V_ip6_maxfragpackets == 0 || (V_ip6_maxfragpackets > 0 && V_ip6qb[bucket].count > V_ip6_maxfragbucketsize)) && - head->ip6q_prev != head) { - IP6STAT_ADD(ip6s_fragoverflow, - q6->ip6q_prev->ip6q_nfrag); + (q6 = TAILQ_LAST(head, ip6qhead)) != NULL) { + IP6STAT_ADD(ip6s_fragoverflow, q6->ip6q_nfrag); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(head->ip6q_prev, bucket); + frag6_freef(q6, bucket); } IP6QB_UNLOCK(bucket); } @@ -890,12 +873,11 @@ frag6_slowtimo(void) atomic_load_int(&V_frag6_nfragpackets) > (u_int)V_ip6_maxfragpackets) { IP6QB_LOCK(bucket); - head = IP6QB_HEAD(bucket); - if (head->ip6q_prev != head) { - IP6STAT_ADD(ip6s_fragoverflow, - q6->ip6q_prev->ip6q_nfrag); + q6 = TAILQ_LAST(IP6QB_HEAD(bucket), ip6qhead); + if (q6 != NULL) { + IP6STAT_ADD(ip6s_fragoverflow, q6->ip6q_nfrag); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(head->ip6q_prev, bucket); + frag6_freef(q6, bucket); } IP6QB_UNLOCK(bucket); bucket = (bucket + 1) % IP6REASS_NHASH; @@ -930,14 +912,12 @@ frag6_change(void *tag) void frag6_init(void) { - struct ip6q *q6; uint32_t bucket; V_ip6_maxfragpackets = IP6_MAXFRAGPACKETS; frag6_set_bucketsize(); for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { - q6 = IP6QB_HEAD(bucket); - q6->ip6q_next = q6->ip6q_prev = q6; + TAILQ_INIT(IP6QB_HEAD(bucket)); mtx_init(&V_ip6qb[bucket].lock, "ip6qlock", NULL, MTX_DEF); V_ip6qb[bucket].count = 0; } @@ -960,16 +940,15 @@ frag6_init(void) static void frag6_drain_one(void) { - struct ip6q *head; + struct ip6q *q6; uint32_t bucket; for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { IP6QB_LOCK(bucket); - head = IP6QB_HEAD(bucket); - while (head->ip6q_next != head) { + while ((q6 = TAILQ_FIRST(IP6QB_HEAD(bucket))) != NULL) { IP6STAT_INC(ip6s_fragdropped); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(head->ip6q_next, bucket); + frag6_freef(q6, bucket); } IP6QB_UNLOCK(bucket); } @@ -1008,60 +987,3 @@ frag6_destroy(void) } } #endif - -/* - * Put an ip fragment on a reassembly chain. - * Like insque, but pointers in middle of structure. - */ -static void -frag6_enq(struct ip6asfrag *af6, struct ip6asfrag *up6, - uint32_t bucket __unused) -{ - - IP6QB_LOCK_ASSERT(bucket); - - af6->ip6af_up = up6; - af6->ip6af_down = up6->ip6af_down; - up6->ip6af_down->ip6af_up = af6; - up6->ip6af_down = af6; -} - -/* - * To frag6_enq as remque is to insque. - */ -static void -frag6_deq(struct ip6asfrag *af6, uint32_t bucket __unused) -{ - - IP6QB_LOCK_ASSERT(bucket); - - af6->ip6af_up->ip6af_down = af6->ip6af_down; - af6->ip6af_down->ip6af_up = af6->ip6af_up; -} - -static void -frag6_insque_head(struct ip6q *new, struct ip6q *old, uint32_t bucket) -{ - - IP6QB_LOCK_ASSERT(bucket); - KASSERT(IP6QB_HEAD(bucket) == old, - ("%s: attempt to insert at head of wrong bucket" - " (bucket=%u, old=%p)", __func__, bucket, old)); - - new->ip6q_prev = old; - new->ip6q_next = old->ip6q_next; - old->ip6q_next->ip6q_prev= new; - old->ip6q_next = new; - V_ip6qb[bucket].count++; -} - -static void -frag6_remque(struct ip6q *p6, uint32_t bucket) -{ - - IP6QB_LOCK_ASSERT(bucket); - - p6->ip6q_prev->ip6q_next = p6->ip6q_next; - p6->ip6q_next->ip6q_prev = p6->ip6q_prev; - V_ip6qb[bucket].count--; -} Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Wed Oct 23 20:39:21 2019 (r353964) +++ head/sys/netinet6/ip6_var.h Wed Oct 23 23:01:18 2019 (r353965) @@ -68,25 +68,27 @@ #include -struct ip6asfrag; +#ifdef _KERNEL +struct ip6asfrag; /* frag6.c */ +TAILQ_HEAD(ip6fraghead, ip6asfrag); + /* * IP6 reassembly queue structure. Each fragment * being reassembled is attached to one of these structures. */ struct ip6q { - struct ip6asfrag *ip6q_down; - struct ip6asfrag *ip6q_up; + struct ip6fraghead ip6q_frags; u_int32_t ip6q_ident; u_int8_t ip6q_nxt; u_int8_t ip6q_ecn; u_int8_t ip6q_ttl; struct in6_addr ip6q_src, ip6q_dst; - struct ip6q *ip6q_next; - struct ip6q *ip6q_prev; + TAILQ_ENTRY(ip6q) ip6q_tq; int ip6q_unfrglen; /* len of unfragmentable part */ int ip6q_nfrag; /* # of fragments */ struct label *ip6q_label; }; +#endif /* _KERNEL */ /* * IP6 reinjecting structure. From owner-svn-src-head@freebsd.org Wed Oct 23 23:10:13 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41D5C15F7EC; Wed, 23 Oct 2019 23:10:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z5gn0nZJz3Hhf; Wed, 23 Oct 2019 23:10:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F36C63E70; Wed, 23 Oct 2019 23:10:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NNAC4g063384; Wed, 23 Oct 2019 23:10:12 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NNAC97063383; Wed, 23 Oct 2019 23:10:12 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910232310.x9NNAC97063383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 23 Oct 2019 23:10:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353966 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353966 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 23:10:13 -0000 Author: bz Date: Wed Oct 23 23:10:12 2019 New Revision: 353966 URL: https://svnweb.freebsd.org/changeset/base/353966 Log: frag6: add "big picture" Add some ASCII relation of how the bits plug together. The terminology difference of "fragmented packets" and "fragment packets" is subtle. While here clear up more whitespace and comments. No functional change. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Wed Oct 23 23:01:18 2019 (r353965) +++ head/sys/netinet6/frag6.c Wed Oct 23 23:10:12 2019 (r353966) @@ -69,6 +69,22 @@ __FBSDID("$FreeBSD$"); #include #endif +/* + * A "big picture" of how IPv6 fragment queues are all linked together. + * + * struct ip6qbucket ip6qb[...]; hashed buckets + * |||||||| + * | + * +--- TAILQ(struct ip6q, packets) *q6; tailq entries holding + * |||||||| fragmented packets + * | (1 per original packet) + * | + * +--- TAILQ(struct ip6asfrag, ip6q_frags) *af6; tailq entries of IPv6 + * | *ip6af;fragment packets + * | for one original packet + * + *mbuf + */ + /* Reassembly headers are stored in hash buckets. */ #define IP6REASS_NHASH_LOG2 10 #define IP6REASS_NHASH (1 << IP6REASS_NHASH_LOG2) @@ -84,10 +100,10 @@ struct ip6qbucket { struct ip6asfrag { TAILQ_ENTRY(ip6asfrag) ip6af_tq; struct mbuf *ip6af_m; - int ip6af_offset; /* offset in ip6af_m to next header */ - int ip6af_frglen; /* fragmentable part length */ - int ip6af_off; /* fragment offset */ - bool ip6af_mff; /* more fragment bit in frag off */ + int ip6af_offset; /* Offset in ip6af_m to next header. */ + int ip6af_frglen; /* Fragmentable part length. */ + int ip6af_off; /* Fragment offset. */ + bool ip6af_mff; /* More fragment bit in frag off. */ }; #define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m)) @@ -309,7 +325,7 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) m = IP6_REASS_MBUF(af6); - /* clear no longer valid rcvif pointer */ + /* Clear no longer valid rcvif pointer. */ if (m->m_pkthdr.rcvif == ifp) m->m_pkthdr.rcvif = NULL; } @@ -563,6 +579,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) IP6QB_UNLOCK(bucket); return (IPPROTO_DONE); } + /* * If it is the first fragment, do the above check for each * fragment already stored in the reassembly queue. From owner-svn-src-head@freebsd.org Wed Oct 23 23:20:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C2F415FBDE; Wed, 23 Oct 2019 23:20:50 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z5w22j1rz3JF2; Wed, 23 Oct 2019 23:20:50 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29068409F; Wed, 23 Oct 2019 23:20:50 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NNKnxp071117; Wed, 23 Oct 2019 23:20:49 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NNKnEZ071116; Wed, 23 Oct 2019 23:20:49 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201910232320.x9NNKnEZ071116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Wed, 23 Oct 2019 23:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353967 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353967 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 23:20:50 -0000 Author: erj Date: Wed Oct 23 23:20:49 2019 New Revision: 353967 URL: https://svnweb.freebsd.org/changeset/base/353967 Log: iflib: call ether_ifdetach and netmap_detach before stop From Jake: Calling ether_ifdetach after iflib_stop leads to a potential race where a stale ifp pointer can remain in the route entry list for IPv6 traffic. This will potentially cause a page fault or other system instability if the ifp pointer is accessed. Move both iflib_netmap_detach and ether_ifdetach to be called prior to iflib_stop. This avoids the race above, and helps ensure that other ifp references are removed before stopping the interface. Submitted by: Jacob Keller Reviewed by: erj@, gallatin@, jhb@ MFC after: 3 days Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D22071 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Wed Oct 23 23:10:12 2019 (r353966) +++ head/sys/net/iflib.c Wed Oct 23 23:20:49 2019 (r353967) @@ -703,6 +703,7 @@ static int iflib_altq_if_transmit(if_t ifp, struct mbu #endif static int iflib_register(if_ctx_t); static void iflib_deregister(if_ctx_t); +static void iflib_unregister_vlan_handlers(if_ctx_t ctx); static void iflib_init_locked(if_ctx_t ctx); static void iflib_add_device_sysctl_pre(if_ctx_t ctx); static void iflib_add_device_sysctl_post(if_ctx_t ctx); @@ -5007,6 +5008,9 @@ iflib_pseudo_deregister(if_ctx_t ctx) struct taskqgroup *tqg; iflib_fl_t fl; + /* Unregister VLAN event handlers early */ + iflib_unregister_vlan_handlers(ctx); + ether_ifdetach(ifp); /* XXX drain any dependent tasks */ tqg = qgroup_if_io_tqg; @@ -5080,12 +5084,16 @@ iflib_device_deregister(if_ctx_t ctx) ctx->ifc_flags |= IFC_IN_DETACH; STATE_UNLOCK(ctx); + /* Unregister VLAN handlers before calling iflib_stop() */ + iflib_unregister_vlan_handlers(ctx); + + iflib_netmap_detach(ifp); + ether_ifdetach(ifp); + CTX_LOCK(ctx); iflib_stop(ctx); CTX_UNLOCK(ctx); - iflib_netmap_detach(ifp); - ether_ifdetach(ifp); iflib_rem_pfil(ctx); if (ctx->ifc_led_dev != NULL) led_destroy(ctx->ifc_led_dev); @@ -5375,13 +5383,8 @@ iflib_register(if_ctx_t ctx) } static void -iflib_deregister(if_ctx_t ctx) +iflib_unregister_vlan_handlers(if_ctx_t ctx) { - if_t ifp = ctx->ifc_ifp; - - /* Remove all media */ - ifmedia_removeall(&ctx->ifc_media); - /* Unregister VLAN events */ if (ctx->ifc_vlan_attach_event != NULL) { EVENTHANDLER_DEREGISTER(vlan_config, ctx->ifc_vlan_attach_event); @@ -5391,6 +5394,19 @@ iflib_deregister(if_ctx_t ctx) EVENTHANDLER_DEREGISTER(vlan_unconfig, ctx->ifc_vlan_detach_event); ctx->ifc_vlan_detach_event = NULL; } + +} + +static void +iflib_deregister(if_ctx_t ctx) +{ + if_t ifp = ctx->ifc_ifp; + + /* Remove all media */ + ifmedia_removeall(&ctx->ifc_media); + + /* Ensure that VLAN event handlers are unregistered */ + iflib_unregister_vlan_handlers(ctx); /* Release kobject reference */ kobj_delete((kobj_t) ctx, NULL); From owner-svn-src-head@freebsd.org Thu Oct 24 03:51:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A721A1586A4; Thu, 24 Oct 2019 03:51:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCwQ3yh0z4NTl; Thu, 24 Oct 2019 03:51:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69FE883FC; Thu, 24 Oct 2019 03:51:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O3pY5s037174; Thu, 24 Oct 2019 03:51:34 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3pYHS037171; Thu, 24 Oct 2019 03:51:34 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910240351.x9O3pYHS037171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 24 Oct 2019 03:51:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354005 - in head/sys/powerpc: include mpc85xx X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys/powerpc: include mpc85xx X-SVN-Commit-Revision: 354005 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:51:34 -0000 Author: jhibbits Date: Thu Oct 24 03:51:33 2019 New Revision: 354005 URL: https://svnweb.freebsd.org/changeset/base/354005 Log: powerpc/booke: Simplify the MPC85XX PCIe root complex driver Summary: Due to bugs in the enumeration code, fsl_pcib_init() was not configuring sub-bridges properly, so devices hanging off a separate bridge would not be found. Since the generic PCI code already supports probing child buses, just delete this code and initialize only the device itself, letting the generic code handle all the additional probing and initializing. This also deletes setup for some PCI peripherals found on some MPC85XX evaluation boards. The code can be resurrected if needed, but overly complicated this code in the first place. Reviewed by: bdragon Differential Revision: https://reviews.freebsd.org/D22050 Modified: head/sys/powerpc/include/resource.h head/sys/powerpc/mpc85xx/pci_mpc85xx.c Modified: head/sys/powerpc/include/resource.h ============================================================================== --- head/sys/powerpc/include/resource.h Thu Oct 24 03:48:28 2019 (r354004) +++ head/sys/powerpc/include/resource.h Thu Oct 24 03:51:33 2019 (r354005) @@ -40,5 +40,6 @@ #define SYS_RES_DRQ 2 /* isa dma lines */ #define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_IOPORT 4 /* i/o ports */ +#define PCI_RES_BUS 5 /* PCI bus numbers */ #endif /* !_MACHINE_RESOURCE_H_ */ Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/pci_mpc85xx.c Thu Oct 24 03:48:28 2019 (r354004) +++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c Thu Oct 24 03:51:33 2019 (r354005) @@ -144,10 +144,6 @@ struct fsl_pcib_softc { int sc_busnr; int sc_pcie; uint8_t sc_pcie_capreg; /* PCI-E Capability Reg Set */ - - /* Devices that need special attention. */ - int sc_devfn_tundra; - int sc_devfn_via_ide; }; struct fsl_pcib_err_dr { @@ -187,7 +183,6 @@ static int fsl_pcib_decode_win(phandle_t, struct fsl_p static void fsl_pcib_err_init(device_t); static void fsl_pcib_inbound(struct fsl_pcib_softc *, int, int, uint64_t, uint64_t, uint64_t); -static int fsl_pcib_init(struct fsl_pcib_softc *, int, int); static void fsl_pcib_outbound(struct fsl_pcib_softc *, int, int, uint64_t, uint64_t, uint64_t); @@ -277,8 +272,8 @@ fsl_pcib_attach(device_t dev) { struct fsl_pcib_softc *sc; phandle_t node; - uint32_t cfgreg; - int error, maxslot, rid; + uint32_t cfgreg, brctl; + int error, rid; uint8_t ltssm, capptr; sc = device_get_softc(dev); @@ -336,16 +331,18 @@ fsl_pcib_attach(device_t dev) PCIM_CMD_PORTEN; fsl_pcib_cfgwrite(sc, 0, 0, 0, PCIR_COMMAND, cfgreg, 2); - sc->sc_devfn_tundra = -1; - sc->sc_devfn_via_ide = -1; + /* Reset the bus. Needed for Radeon video cards. */ + brctl = fsl_pcib_read_config(sc->sc_dev, 0, 0, 0, + PCIR_BRIDGECTL_1, 1); + brctl |= PCIB_BCR_SECBUS_RESET; + fsl_pcib_write_config(sc->sc_dev, 0, 0, 0, + PCIR_BRIDGECTL_1, brctl, 1); + DELAY(100000); + brctl &= ~PCIB_BCR_SECBUS_RESET; + fsl_pcib_write_config(sc->sc_dev, 0, 0, 0, + PCIR_BRIDGECTL_1, brctl, 1); + DELAY(100000); - - /* - * Scan bus using firmware configured, 0 based bus numbering. - */ - maxslot = (sc->sc_pcie) ? 0 : PCI_SLOTMAX; - fsl_pcib_init(sc, sc->sc_busnr, maxslot); - if (sc->sc_pcie) { ltssm = fsl_pcib_cfgread(sc, 0, 0, 0, PCIR_LTSSM, 1); if (ltssm < LTSSM_STAT_L0) { @@ -513,10 +510,7 @@ fsl_pcib_read_config(device_t dev, u_int bus, u_int sl if (bus == sc->sc_busnr && !sc->sc_pcie && slot < 10) return (~0); devfn = DEVFN(bus, slot, func); - if (devfn == sc->sc_devfn_tundra) - return (~0); - if (devfn == sc->sc_devfn_via_ide && reg == PCIR_INTPIN) - return (1); + return (fsl_pcib_cfgread(sc, bus, slot, func, reg, bytes)); } @@ -529,126 +523,6 @@ fsl_pcib_write_config(device_t dev, u_int bus, u_int s if (bus == sc->sc_busnr && !sc->sc_pcie && slot < 10) return; fsl_pcib_cfgwrite(sc, bus, slot, func, reg, val, bytes); -} - -static void -fsl_pcib_init_via(struct fsl_pcib_softc *sc, uint16_t device, int bus, - int slot, int fn) -{ - - if (device == 0x0686) { - fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x52, 0x34, 1); - fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x77, 0x00, 1); - fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x83, 0x98, 1); - fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x85, 0x03, 1); - } else if (device == 0x0571) { - sc->sc_devfn_via_ide = DEVFN(bus, slot, fn); - fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x40, 0x0b, 1); - } -} - -static int -fsl_pcib_init(struct fsl_pcib_softc *sc, int bus, int maxslot) -{ - int secbus; - int old_pribus, old_secbus, old_subbus; - int new_pribus, new_secbus, new_subbus; - int slot, func, maxfunc; - uint16_t vendor, device; - uint8_t brctl, command, hdrtype, subclass; - - secbus = bus; - for (slot = 0; slot <= maxslot; slot++) { - maxfunc = 0; - for (func = 0; func <= maxfunc; func++) { - hdrtype = fsl_pcib_read_config(sc->sc_dev, bus, slot, - func, PCIR_HDRTYPE, 1); - - if ((hdrtype & PCIM_HDRTYPE) > PCI_MAXHDRTYPE) - continue; - - if (func == 0 && (hdrtype & PCIM_MFDEV)) - maxfunc = PCI_FUNCMAX; - - vendor = fsl_pcib_read_config(sc->sc_dev, bus, slot, - func, PCIR_VENDOR, 2); - device = fsl_pcib_read_config(sc->sc_dev, bus, slot, - func, PCIR_DEVICE, 2); - - if (vendor == 0x1957 && device == 0x3fff) { - sc->sc_devfn_tundra = DEVFN(bus, slot, func); - continue; - } - - command = fsl_pcib_read_config(sc->sc_dev, bus, slot, - func, PCIR_COMMAND, 1); - command &= ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN); - fsl_pcib_write_config(sc->sc_dev, bus, slot, func, - PCIR_COMMAND, command, 1); - - if (vendor == 0x1106) - fsl_pcib_init_via(sc, device, bus, slot, func); - - /* - * Handle PCI-PCI bridges - */ - subclass = fsl_pcib_read_config(sc->sc_dev, bus, slot, - func, PCIR_SUBCLASS, 1); - - /* Allow all DEVTYPE 1 devices */ - if (hdrtype != PCIM_HDRTYPE_BRIDGE) - continue; - - brctl = fsl_pcib_read_config(sc->sc_dev, bus, slot, func, - PCIR_BRIDGECTL_1, 1); - brctl |= PCIB_BCR_SECBUS_RESET; - fsl_pcib_write_config(sc->sc_dev, bus, slot, func, - PCIR_BRIDGECTL_1, brctl, 1); - DELAY(100000); - brctl &= ~PCIB_BCR_SECBUS_RESET; - fsl_pcib_write_config(sc->sc_dev, bus, slot, func, - PCIR_BRIDGECTL_1, brctl, 1); - DELAY(100000); - - secbus++; - - /* Read currect bus register configuration */ - old_pribus = fsl_pcib_read_config(sc->sc_dev, bus, - slot, func, PCIR_PRIBUS_1, 1); - old_secbus = fsl_pcib_read_config(sc->sc_dev, bus, - slot, func, PCIR_SECBUS_1, 1); - old_subbus = fsl_pcib_read_config(sc->sc_dev, bus, - slot, func, PCIR_SUBBUS_1, 1); - - if (bootverbose) - printf("PCI: reading firmware bus numbers for " - "secbus = %d (bus/sec/sub) = (%d/%d/%d)\n", - secbus, old_pribus, old_secbus, old_subbus); - - new_pribus = bus; - new_secbus = secbus; - - secbus = fsl_pcib_init(sc, secbus, - (subclass == PCIS_BRIDGE_PCI) ? PCI_SLOTMAX : 0); - - new_subbus = secbus; - - if (bootverbose) - printf("PCI: translate firmware bus numbers " - "for secbus %d (%d/%d/%d) -> (%d/%d/%d)\n", - secbus, old_pribus, old_secbus, old_subbus, - new_pribus, new_secbus, new_subbus); - - fsl_pcib_write_config(sc->sc_dev, bus, slot, func, - PCIR_PRIBUS_1, new_pribus, 1); - fsl_pcib_write_config(sc->sc_dev, bus, slot, func, - PCIR_SECBUS_1, new_secbus, 1); - fsl_pcib_write_config(sc->sc_dev, bus, slot, func, - PCIR_SUBBUS_1, new_subbus, 1); - } - } - - return (secbus); } static void From owner-svn-src-head@freebsd.org Thu Oct 24 05:54:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA01D15F162; Thu, 24 Oct 2019 05:54:30 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zGfG5wrxz4Xpr; Thu, 24 Oct 2019 05:54:30 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF0C099D3; Thu, 24 Oct 2019 05:54:30 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O5sU0G008192; Thu, 24 Oct 2019 05:54:30 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O5sU46008191; Thu, 24 Oct 2019 05:54:30 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201910240554.x9O5sU46008191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Thu, 24 Oct 2019 05:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354013 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 354013 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 05:54:31 -0000 Author: rrs Date: Thu Oct 24 05:54:30 2019 New Revision: 354013 URL: https://svnweb.freebsd.org/changeset/base/354013 Log: Fix a small bug in bbr when running under a VM. Basically what happens is we are more delayed in the pacer calling in so we remove the stack from the pacer and recalculate how much time is left after all data has been acknowledged. However the comparision was backwards so we end up with a negative value in the last_pacing_delay time which causes us to add in a huge value to the next pacing time thus stalling the connection. Reported by: vm2.finance@gmail.com Modified: head/sys/netinet/tcp_stacks/bbr.c Modified: head/sys/netinet/tcp_stacks/bbr.c ============================================================================== --- head/sys/netinet/tcp_stacks/bbr.c Thu Oct 24 04:12:38 2019 (r354012) +++ head/sys/netinet/tcp_stacks/bbr.c Thu Oct 24 05:54:30 2019 (r354013) @@ -11814,12 +11814,13 @@ bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr uint32_t del; del = lcts - bbr->rc_pacer_started; - if (del > bbr->r_ctl.rc_last_delay_val) { + if (bbr->r_ctl.rc_last_delay_val > del) { BBR_STAT_INC(bbr_force_timer_start); bbr->r_ctl.rc_last_delay_val -= del; bbr->rc_pacer_started = lcts; } else { /* We are late */ + bbr->r_ctl.rc_last_delay_val = 0; BBR_STAT_INC(bbr_force_output); (void)tp->t_fb->tfb_tcp_output(tp); } @@ -12278,8 +12279,9 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeva * We are early setup to adjust * our slot time. */ + uint64_t merged_val; + bbr->r_ctl.rc_agg_early += (bbr->r_ctl.rc_last_delay_val - delay_calc); - bbr->r_ctl.rc_last_delay_val = 0; bbr->r_agg_early_set = 1; if (bbr->r_ctl.rc_hptsi_agg_delay) { if (bbr->r_ctl.rc_hptsi_agg_delay >= bbr->r_ctl.rc_agg_early) { @@ -12292,9 +12294,13 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeva bbr->r_ctl.rc_hptsi_agg_delay = 0; } } + merged_val = bbr->rc_pacer_started; + merged_val <<= 32; + merged_val |= bbr->r_ctl.rc_last_delay_val; bbr_log_pacing_delay_calc(bbr, inp->inp_hpts_calls, - bbr->r_ctl.rc_agg_early, cts, 3, 0, + bbr->r_ctl.rc_agg_early, cts, delay_calc, merged_val, bbr->r_agg_early_set, 3); + bbr->r_ctl.rc_last_delay_val = 0; BBR_STAT_INC(bbr_early); delay_calc = 0; } From owner-svn-src-head@freebsd.org Thu Oct 24 07:49:34 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19CA4162C1F; Thu, 24 Oct 2019 07:49:34 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zKC16zSkz4fNf; Thu, 24 Oct 2019 07:49:33 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2DFDAD90; Thu, 24 Oct 2019 07:49:33 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O7nXUW072936; Thu, 24 Oct 2019 07:49:33 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O7nXCM072935; Thu, 24 Oct 2019 07:49:33 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201910240749.x9O7nXCM072935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 24 Oct 2019 07:49:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354015 - head/stand/userboot/test X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/userboot/test X-SVN-Commit-Revision: 354015 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 07:49:34 -0000 Author: tsoome Date: Thu Oct 24 07:49:33 2019 New Revision: 354015 URL: https://svnweb.freebsd.org/changeset/base/354015 Log: userboot/test should use PRIx64 as one would expect from prefix 0x Test is printing decimal value after prefix 0x. Modified: head/stand/userboot/test/test.c Modified: head/stand/userboot/test/test.c ============================================================================== --- head/stand/userboot/test/test.c Thu Oct 24 06:58:17 2019 (r354014) +++ head/stand/userboot/test/test.c Thu Oct 24 07:49:33 2019 (r354015) @@ -336,7 +336,7 @@ test_setgdt(void *arg, uint64_t v, size_t sz) void test_exec(void *arg, uint64_t pc) { - printf("Execute at 0x%"PRIu64"\n", pc); + printf("Execute at 0x%"PRIx64"\n", pc); test_exit(arg, 0); } From owner-svn-src-head@freebsd.org Thu Oct 24 07:53:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB916162F5B; Thu, 24 Oct 2019 07:53:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zKHC46bfz4fnH; Thu, 24 Oct 2019 07:53:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 719B3AF49; Thu, 24 Oct 2019 07:53:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O7rBec078734; Thu, 24 Oct 2019 07:53:11 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O7rBMi078733; Thu, 24 Oct 2019 07:53:11 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910240753.x9O7rBMi078733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 07:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354016 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354016 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 07:53:11 -0000 Author: bz Date: Thu Oct 24 07:53:10 2019 New Revision: 354016 URL: https://svnweb.freebsd.org/changeset/base/354016 Log: frag6: remove IP6_REASS_MBUF macro The IP6_REASS_MBUF() macro did some pointer gynmastics to end up with the same type as it gets in [*(cast **)&]. Spelling it out instead saves all this and makes the code more readable and less obfuscated directly using the structure field. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 07:49:33 2019 (r354015) +++ head/sys/netinet6/frag6.c Thu Oct 24 07:53:10 2019 (r354016) @@ -106,8 +106,6 @@ struct ip6asfrag { bool ip6af_mff; /* More fragment bit in frag off. */ }; -#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m)) - static MALLOC_DEFINE(M_FRAG6, "frag6", "IPv6 fragment reassembly header"); #ifdef VIMAGE @@ -257,7 +255,7 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) while ((af6 = TAILQ_FIRST(&q6->ip6q_frags)) != NULL) { - m = IP6_REASS_MBUF(af6); + m = af6->ip6af_m; TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); /* @@ -301,7 +299,6 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) struct ip6qhead *head; struct ip6q *q6; struct ip6asfrag *af6; - struct mbuf *m; uint32_t bucket; KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); @@ -323,11 +320,9 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) TAILQ_FOREACH(q6, head, ip6q_tq) { TAILQ_FOREACH(af6, &q6->ip6q_frags, ip6af_tq) { - m = IP6_REASS_MBUF(af6); - /* Clear no longer valid rcvif pointer. */ - if (m->m_pkthdr.rcvif == ifp) - m->m_pkthdr.rcvif = NULL; + if (af6->ip6af_m->m_pkthdr.rcvif == ifp) + af6->ip6af_m->m_pkthdr.rcvif = NULL; } } IP6QB_UNLOCK(bucket); @@ -593,7 +588,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) struct mbuf *merr; int erroff; - merr = IP6_REASS_MBUF(af6); + merr = af6->ip6af_m; erroff = af6->ip6af_offset; /* Dequeue the fragment. */ @@ -630,7 +625,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) ip6af->ip6af_off = fragoff; ip6af->ip6af_frglen = frgpartlen; ip6af->ip6af_offset = offset; - IP6_REASS_MBUF(ip6af) = m; + ip6af->ip6af_m = m; if (only_frag) { /* @@ -735,20 +730,20 @@ postinsert: /* Reassembly is complete; concatenate fragments. */ ip6af = TAILQ_FIRST(&q6->ip6q_frags); - t = m = IP6_REASS_MBUF(ip6af); + t = m = ip6af->ip6af_m; TAILQ_REMOVE(&q6->ip6q_frags, ip6af, ip6af_tq); while ((af6 = TAILQ_FIRST(&q6->ip6q_frags)) != NULL) { m->m_pkthdr.csum_flags &= - IP6_REASS_MBUF(af6)->m_pkthdr.csum_flags; + af6->ip6af_m->m_pkthdr.csum_flags; m->m_pkthdr.csum_data += - IP6_REASS_MBUF(af6)->m_pkthdr.csum_data; + af6->ip6af_m->m_pkthdr.csum_data; TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); while (t->m_next) t = t->m_next; - m_adj(IP6_REASS_MBUF(af6), af6->ip6af_offset); - m_demote_pkthdr(IP6_REASS_MBUF(af6)); - m_cat(t, IP6_REASS_MBUF(af6)); + m_adj(af6->ip6af_m, af6->ip6af_offset); + m_demote_pkthdr(af6->ip6af_m); + m_cat(t, af6->ip6af_m); free(af6, M_FRAG6); } From owner-svn-src-head@freebsd.org Thu Oct 24 08:15:41 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3C60164919; Thu, 24 Oct 2019 08:15:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zKn86BFSz4hCP; Thu, 24 Oct 2019 08:15:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B48B6B2CD; Thu, 24 Oct 2019 08:15:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O8FeFj090475; Thu, 24 Oct 2019 08:15:40 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O8FeiG090474; Thu, 24 Oct 2019 08:15:40 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910240815.x9O8FeiG090474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 08:15:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354017 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354017 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 08:15:41 -0000 Author: bz Date: Thu Oct 24 08:15:40 2019 New Revision: 354017 URL: https://svnweb.freebsd.org/changeset/base/354017 Log: frag6: small improvements Rather than walking the mbuf chain manually use m_last() which doing exactly that for us. Defer initializing srcifp for longer as there are multiple exit paths out of the function which do not need it set. Initialize before taking the lock though. Rename the mtx lock to match the type better. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 07:53:10 2019 (r354016) +++ head/sys/netinet6/frag6.c Thu Oct 24 08:15:40 2019 (r354017) @@ -399,9 +399,6 @@ frag6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); #endif - /* Store receive network interface pointer for later. */ - srcifp = m->m_pkthdr.rcvif; - dstifp = NULL; /* Find the destination interface of the packet. */ ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); @@ -461,6 +458,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); } + /* Store receive network interface pointer for later. */ + srcifp = m->m_pkthdr.rcvif; + /* Generate a hash value for fragment bucket selection. */ hashkeyp = hashkey; memcpy(hashkeyp, &ip6->ip6_src, sizeof(struct in6_addr)); @@ -739,8 +739,7 @@ postinsert: af6->ip6af_m->m_pkthdr.csum_data; TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); - while (t->m_next) - t = t->m_next; + t = m_last(t); m_adj(af6->ip6af_m, af6->ip6af_offset); m_demote_pkthdr(af6->ip6af_m); m_cat(t, af6->ip6af_m); @@ -930,7 +929,7 @@ frag6_init(void) frag6_set_bucketsize(); for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { TAILQ_INIT(IP6QB_HEAD(bucket)); - mtx_init(&V_ip6qb[bucket].lock, "ip6qlock", NULL, MTX_DEF); + mtx_init(&V_ip6qb[bucket].lock, "ip6qb", NULL, MTX_DEF); V_ip6qb[bucket].count = 0; } V_ip6qb_hashseed = arc4random(); From owner-svn-src-head@freebsd.org Thu Oct 24 08:26:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A0CF164CC7; Thu, 24 Oct 2019 08:26:09 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zL1F28X9z4hhs; Thu, 24 Oct 2019 08:26:09 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 2A36A96FF; Thu, 24 Oct 2019 08:26:09 +0000 (UTC) Date: Thu, 24 Oct 2019 08:26:09 +0000 From: Alexey Dokuchaev To: Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch Message-ID: <20191024082609.GA63459@FreeBSD.org> References: <201910231657.x9NGvCMD039111@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201910231657.x9NGvCMD039111@repo.freebsd.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 08:26:09 -0000 On Wed, Oct 23, 2019 at 04:57:12PM +0000, Dimitry Andric wrote: > New Revision: 353936 > URL: https://svnweb.freebsd.org/changeset/base/353936 > > Log: > Bump clang's default target CPU for the i386 architecture (aka "x86") to > i686, as per the discussion on the freebsd-arch mailing list. Earlier > in r352030, I had already bumped it to i586, to work around missing > atomic 64 bit functions for the i386 architecture. Why i686, not i586? i486 lacking 64-bit atomics is a sound and valid reason, but I don't understand why i586 wasn't chosen, and quick review of that -arch thread did not help. Could you shed some more light here? ./danfe From owner-svn-src-head@freebsd.org Thu Oct 24 09:22:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 702C41665E8; Thu, 24 Oct 2019 09:22:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zMG82R3jz4lG4; Thu, 24 Oct 2019 09:22:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 381CEC0BE; Thu, 24 Oct 2019 09:22:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O9MO0e031354; Thu, 24 Oct 2019 09:22:24 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O9MNjR031352; Thu, 24 Oct 2019 09:22:23 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910240922.x9O9MNjR031352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 24 Oct 2019 09:22:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354018 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354018 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 09:22:24 -0000 Author: tuexen Date: Thu Oct 24 09:22:23 2019 New Revision: 354018 URL: https://svnweb.freebsd.org/changeset/base/354018 Log: Store a handle for the event handler. This will be used when unloading the SCTP as a module. Obtained from: markj@ Modified: head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_pcb.h ============================================================================== --- head/sys/netinet/sctp_pcb.h Thu Oct 24 08:15:40 2019 (r354017) +++ head/sys/netinet/sctp_pcb.h Thu Oct 24 09:22:23 2019 (r354018) @@ -259,6 +259,7 @@ struct sctp_base_info { int packet_log_end; uint8_t packet_log_buffer[SCTP_PACKET_LOG_SIZE]; #endif + eventhandler_tag eh_tag; }; /*- Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Thu Oct 24 08:15:40 2019 (r354017) +++ head/sys/netinet/sctp_usrreq.c Thu Oct 24 09:22:23 2019 (r354018) @@ -90,8 +90,8 @@ sctp_init(void) SCTP_BASE_VAR(packet_log_end) = 0; memset(&SCTP_BASE_VAR(packet_log_buffer), 0, SCTP_PACKET_LOG_SIZE); #endif - EVENTHANDLER_REGISTER(rt_addrmsg, sctp_addr_change_event_handler, - NULL, EVENTHANDLER_PRI_FIRST); + SCTP_BASE_VAR(eh_tag) = EVENTHANDLER_REGISTER(rt_addrmsg, + sctp_addr_change_event_handler, NULL, EVENTHANDLER_PRI_FIRST); } #ifdef VIMAGE From owner-svn-src-head@freebsd.org Thu Oct 24 11:58:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C0311699EB; Thu, 24 Oct 2019 11:58:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zQk90pKhz4tJM; Thu, 24 Oct 2019 11:58:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 003E6DC75; Thu, 24 Oct 2019 11:58:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OBwOWN020363; Thu, 24 Oct 2019 11:58:24 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OBwOhe020362; Thu, 24 Oct 2019 11:58:24 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910241158.x9OBwOhe020362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 11:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354019 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354019 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 11:58:25 -0000 Author: bz Date: Thu Oct 24 11:58:24 2019 New Revision: 354019 URL: https://svnweb.freebsd.org/changeset/base/354019 Log: frag6: check global limits before hash and lock Check whether we are accepting more fragments (based on global limits) before doing expensive operations of calculating the hash and taking the bucket lock. This slightly increases a "race" between check time and incrementing counters (which is already there) possibly allowing a few more fragments than the maximum limits. However, when under attack, we rather save this CPU time for other packets/work. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 09:22:23 2019 (r354018) +++ head/sys/netinet6/frag6.c Thu Oct 24 11:58:24 2019 (r354019) @@ -458,6 +458,16 @@ frag6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); } + /* + * Enforce upper bound on number of fragments for the entire system. + * If maxfrag is 0, never accept fragments. + * If maxfrag is -1, accept all fragments without limitation. + */ + if (ip6_maxfrags < 0) + ; + else if (atomic_load_int(&frag6_nfrags) >= (u_int)ip6_maxfrags) + goto dropfrag2; + /* Store receive network interface pointer for later. */ srcifp = m->m_pkthdr.rcvif; @@ -473,16 +483,6 @@ frag6_input(struct mbuf **mp, int *offp, int proto) IP6QB_LOCK(bucket); head = IP6QB_HEAD(bucket); - /* - * Enforce upper bound on number of fragments for the entire system. - * If maxfrag is 0, never accept fragments. - * If maxfrag is -1, accept all fragments without limitation. - */ - if (ip6_maxfrags < 0) - ; - else if (atomic_load_int(&frag6_nfrags) >= (u_int)ip6_maxfrags) - goto dropfrag; - TAILQ_FOREACH(q6, head, ip6q_tq) if (ip6f->ip6f_ident == q6->ip6q_ident && IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, &q6->ip6q_src) && @@ -825,6 +825,7 @@ postinsert: dropfrag: IP6QB_UNLOCK(bucket); +dropfrag2: in6_ifstat_inc(dstifp, ifs6_reass_fail); IP6STAT_INC(ip6s_fragdropped); m_freem(m); From owner-svn-src-head@freebsd.org Thu Oct 24 12:16:15 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C157D16ADA1; Thu, 24 Oct 2019 12:16:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zR6l4hwgz4vTL; Thu, 24 Oct 2019 12:16:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8587AE002; Thu, 24 Oct 2019 12:16:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OCGF77031846; Thu, 24 Oct 2019 12:16:15 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OCGFWH031845; Thu, 24 Oct 2019 12:16:15 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910241216.x9OCGFWH031845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 12:16:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354020 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354020 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 12:16:15 -0000 Author: bz Date: Thu Oct 24 12:16:15 2019 New Revision: 354020 URL: https://svnweb.freebsd.org/changeset/base/354020 Log: frag6: leave a note about upper layer header checks TBD Per sepcification the upper layer header needs to be within the first fragment. The check was not done so far and there is an open review for related work, so just leave a note as to where to put it. Move the extraction of frag offset up to this as it is needed to determine whether this is a first fragment or not. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 11:58:24 2019 (r354019) +++ head/sys/netinet6/frag6.c Thu Oct 24 12:16:15 2019 (r354020) @@ -468,6 +468,18 @@ frag6_input(struct mbuf **mp, int *offp, int proto) else if (atomic_load_int(&frag6_nfrags) >= (u_int)ip6_maxfrags) goto dropfrag2; + /* + * Validate that a full header chain to the ULP is present in the + * packet containing the first fragment as per RFC RFC7112 and + * RFC 8200 pages 18,19: + * The first fragment packet is composed of: + * (3) Extension headers, if any, and the Upper-Layer header. These + * headers must be in the first fragment. ... + */ + fragoff = ntohs(ip6f->ip6f_offlg & IP6F_OFF_MASK); + /* XXX TODO. thj has D16851 open for this. */ + /* Send ICMPv6 4,3 in case of violation. */ + /* Store receive network interface pointer for later. */ srcifp = m->m_pkthdr.rcvif; @@ -546,7 +558,6 @@ frag6_input(struct mbuf **mp, int *offp, int proto) * If it is the 1st fragment, record the length of the * unfragmentable part and the next header of the fragment header. */ - fragoff = ntohs(ip6f->ip6f_offlg & IP6F_OFF_MASK); if (fragoff == 0) { q6->ip6q_unfrglen = offset - sizeof(struct ip6_hdr) - sizeof(struct ip6_frag); From owner-svn-src-head@freebsd.org Thu Oct 24 12:33:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B612B16BA32 for ; Thu, 24 Oct 2019 12:33:42 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46zRVt04CPz3CNF for ; Thu, 24 Oct 2019 12:33:41 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x844.google.com with SMTP id e14so17800501qto.1 for ; Thu, 24 Oct 2019 05:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mDwMUk6D682y3ml+v+bAw9cJT3Qai8uFrFslhdcnTmI=; b=Gi6NJm31MpiCd0BQol35tQKr+JH0XEzmQ96ITtbRKLfG1yuyEo0UA5bLxTbOEfwOfv oGz580KE6rYFyAAAKMDkAoLhjCM36EBbixTKoBphZ2gIQQz6+07NdcPUORAkZdofaJPl jXbKijviyoR6oyxgqpsBm0FnvrUl/3emT8pyGsFQ4zVvL7xmpWZRfaa8F88Mm8eIQk0y 2ynC5sxr+67hTAUfi/veLad4movkVgNQ1S8tnBp5jew6pL39WDiNigxkpqayiBVocDS1 moLWLIDdAvOpqiouji+9FG0jGy7afStHs7SNX4V5AqLGjsEenrPzWs4a0TqD6pBDuS3h CW2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mDwMUk6D682y3ml+v+bAw9cJT3Qai8uFrFslhdcnTmI=; b=I5g/HBoKhlPhh75TsbsWpdaP3X2R5TF08knb0aD6SZjfaxFQ3bZvTR54sSrsnUe/Eg Ux3pU0ihI/eqBDAe6qpuYrq2q1p9MuSQKMI0NlskKO/Ji7OfDJSV+PcCPvT79mWlJ5TM XrHmKciDwTs34V6Egifshcd5keL20CT61iTo2q6x9+4bCsEXDppOuKttECGUwXhm8XhO E8mfrgfnFeHNUItKxW18TV29yndHELnndCCmOaAomte7c1gFsOp67QrETcJM56608bNb EQn9qzXrMEopmjkas4XWoFrv+BiOqZqyLAfBOStcEiCeVRaX3gn03FViq2hnkdzg7VD3 sxgg== X-Gm-Message-State: APjAAAVsCPpdjjMAHa+UlwygQBLDCu5m783DO3bfXQfduxjYSVqLZq1E fdVOVfDfszYylgqT0b9Q+2x1Rw== X-Google-Smtp-Source: APXvYqwHHt2SG/a+a7ZsXboK1loBis/pNcnE4xQKxtQDuMtnKapKjUSm077bgALhFf84nFPSl5KKnw== X-Received: by 2002:a0c:c982:: with SMTP id b2mr3458836qvk.41.1571920420694; Thu, 24 Oct 2019 05:33:40 -0700 (PDT) Received: from mutt-hbsd ([63.88.83.68]) by smtp.gmail.com with ESMTPSA id u11sm11346863qtg.11.2019.10.24.05.33.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 05:33:39 -0700 (PDT) Date: Thu, 24 Oct 2019 08:33:40 -0400 From: Shawn Webb To: Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353937 - in head/share: man/man5 mk Message-ID: <20191024123340.gx67z4kmeygkmkq2@mutt-hbsd> References: <201910231702.x9NH2jQv045130@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jzlmacwrquhn3cih" Content-Disposition: inline In-Reply-To: <201910231702.x9NH2jQv045130@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 46zRVt04CPz3CNF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=Gi6NJm31; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::844 as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-4.50 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; RCVD_IN_DNSWL_NONE(0.00)[4.4.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-0.40)[ip: (2.53), ipnet: 2607:f8b0::/32(-2.41), asn: 15169(-2.06), country: US(-0.05)] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 12:33:42 -0000 --jzlmacwrquhn3cih Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 23, 2019 at 05:02:45PM +0000, Dimitry Andric wrote: > Author: dim > Date: Wed Oct 23 17:02:45 2019 > New Revision: 353937 > URL: https://svnweb.freebsd.org/changeset/base/353937 >=20 > Log: > Build toolchain components as dynamically linked executables by default > =20 > Summary: > Historically, we have built toolchain components such as cc, ld, etc as > statically linked executables. One of the reasons being that you could > sometimes save yourself from botched upgrades, by e.g. recompiling a > "known good" libc and reinstalling it. > =20 > In this day and age, we have boot environments, virtual machine > snapshots, cloud backups, and other much more reliable methods to > restore systems to working order. So I think the time is ripe to flip > this default, and link the toolchain components dynamically, just like > almost all other executables on FreeBSD. > =20 > Maybe at some point they can even become PIE executables by default! :) They have been on HardenedBSD for a few years now. :) Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --jzlmacwrquhn3cih Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl2xmh8ACgkQ/y5nonf4 4fpdjA/+IHchf1rmn9QUtdjpK6JH7UEC6r7jSfA+O2eYrp5W6ktxmTHjUBGVof5c P9fKim5R4zgg+yoADMMtxSpJr9QgzpwEapPxVQ7zOooICaaD6Nvh/c6ZE+4e60rD tyG4MjX80Gh1jUSdNTX5W1bHUFFekIA5bD3w3LaomAKHEmqVKda3tqtfJPCIEVTj yal9PyWoXDbLKAPKq3KFHbaGWJO8XPk3a86N+UkJYQ+56uN5kDUsvuzps9LgPyI5 K4J6RrcN/rYKgqzxkSEesj0I4k2lAyJ6tAPpfRzeMmiifwkUpf3LiS5uWB4Y4z52 aUwYXxvo1SNGtQbKoPbBkgW9MjzC0CIcCq7JfEiS+G3i7YGsYwuZv7qUCwoNMN7S kvJlMrpQuQDtx/VfpFjCgVzrlOj7q9jq7KE2oU9n1J5q0IzCngKjb7tv2WoRr2kC pwxwsi1NGyXKz8f0mElO+IJmxOkR0v7ZVQ09pkQ8jOwYLBqZOPSkwOJfFu0vzQEg CkS2M+oxU9DTimqL9Kg3uynV0NM0wpNieeWIFMP9gd6RyUKxxWfqZpoWk5mKEFju PcxJzaN13QZqr8VNP2vyxmEZfJVlRi7N7ywxXLfNWC5Bmem0g0LdSP6R7igjvJ5G iOE6w6/UxQCQfrZu5nfXlnuAOBjJG8rGRnfGqfkrOnsNVd0CAeI= =/RJC -----END PGP SIGNATURE----- --jzlmacwrquhn3cih-- From owner-svn-src-head@freebsd.org Thu Oct 24 12:49:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFFA416C0F9; Thu, 24 Oct 2019 12:49:10 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zRrk55q2z3DHC; Thu, 24 Oct 2019 12:49:10 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id A7547C845; Thu, 24 Oct 2019 12:49:10 +0000 (UTC) Date: Thu, 24 Oct 2019 12:49:10 +0000 From: Alexey Dokuchaev To: Enji Cooper Cc: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353937 - in head/share: man/man5 mk Message-ID: <20191024124910.GA93913@FreeBSD.org> References: <201910231702.x9NH2jQv045130@repo.freebsd.org> <2B855247-5097-442D-8D4A-77D68D2F6186@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2B855247-5097-442D-8D4A-77D68D2F6186@gmail.com> User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 12:49:10 -0000 On Wed, Oct 23, 2019 at 11:31:41AM -0700, Enji Cooper wrote: > > On Oct 23, 2019, at 10:02, Dimitry Andric wrote: > > New Revision: 353937 > > URL: https://svnweb.freebsd.org/changeset/base/353937 > > > > Log: > > Build toolchain components as dynamically linked executables by default What are the benefits of the new order? > > Summary: > > Historically, we have built toolchain components such as cc, ld, etc as > > statically linked executables. One of the reasons being that you could > > sometimes save yourself from botched upgrades, by e.g. recompiling a > > "known good" libc and reinstalling it. > > In this day and age, we have boot environments, virtual machine > > snapshots, cloud backups, and other much more reliable methods to > > restore systems to working order. So I think the time is ripe to flip What about those of us who cannot use BEs, VMs, and other "cloudy" tech because, well, they might not work as well and reliably as one might think? > Using dynamic binaries instead of static binaries might actually regress > performance in a way you don't expect, depending on -j values, etc. Static > binaries avoid the dynamic linker, which (obviously) results in a perf hit > at scale [...] Very good point. > Did you calculate the perf trade offs for the static binaries at low -j vs > high -j, system and user time, etc? I'd like to know the answer to this question (and the results) as well. ./danfe From owner-svn-src-head@freebsd.org Thu Oct 24 13:08:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44E7416C81F; Thu, 24 Oct 2019 13:08:22 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f196.google.com (mail-il1-f196.google.com [209.85.166.196]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46zSGt0l7wz3FPZ; Thu, 24 Oct 2019 13:08:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f196.google.com with SMTP id u1so22290428ilq.12; Thu, 24 Oct 2019 06:08:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GRx1/7zfYkDF0r4ePqxLTREcfJwiipshd+lMTbHvDJk=; b=nxMorisUDEZCMloAjhoJ8sSV1k/6CDYbNSt/SnGqJA3YUMeV89S99feTz5po3wy2+O IOvy14zgD86I/tUzW3WozNzyxSgJklrYEt6htx+Wv2ysgrj11Ve9+iATd5C5pnzIWnbb Tpp8gtnVPMdyUtTTEOkwg0/+pu45MCXuSA+SMmT++gPp55VApa0EHIvcbQQCAr59Wcex Y3J9iYBfaULiLFlOotzyD3hFwGaAYN7x/VAWz013ledUKJbPRti2Kpo+bcdSdUJa4whj vfvepJy+AKpi/OGJx5JB2cZpdy5kiycq9yPujbpuuvr20EG0chVzUJfLaF8Xiz9C/ZC8 0kNw== X-Gm-Message-State: APjAAAWKTnWK025/socL3mew2QcONYvFvmwW0JkeOX28WsSnjP3mbBWK sjCcV1Q24Xj/IhZ7mMQo13meaBjuNEzkYaRsGqVHWwfH X-Google-Smtp-Source: APXvYqwpfOlEeUvlg5kohJshDQDwYRZvwc6gKZsu/dAcZE+xbIEtsLGW/BWXdTn2E41bubW3nrbY6JFlDP8L2vGnJ84= X-Received: by 2002:a92:650d:: with SMTP id z13mr13437809ilb.18.1571922500167; Thu, 24 Oct 2019 06:08:20 -0700 (PDT) MIME-Version: 1.0 References: <201910231657.x9NGvCMD039111@repo.freebsd.org> <20191024082609.GA63459@FreeBSD.org> In-Reply-To: <20191024082609.GA63459@FreeBSD.org> From: Ed Maste Date: Thu, 24 Oct 2019 07:35:01 -0400 Message-ID: Subject: Re: svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch To: Alexey Dokuchaev Cc: Dimitry Andric , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46zSGt0l7wz3FPZ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 13:08:22 -0000 On Thu, 24 Oct 2019 at 04:26, Alexey Dokuchaev wrote: > > Why i686, not i586? i486 lacking 64-bit atomics is a sound and valid > reason, but I don't understand why i586 wasn't chosen, and quick review > of that -arch thread did not help. Could you shed some more light here? i686 as a minimum allows a switch to PAE page tables. In my opinion we should still allow building FreeBSD for i586 (and I would like to have such a case in our hardware CI lab), but the default for the installation images and prebuilt packages should be i686. From owner-svn-src-head@freebsd.org Thu Oct 24 15:14:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E54216F729 for ; Thu, 24 Oct 2019 15:14:21 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46zW4D1Nhfz3Nlr for ; Thu, 24 Oct 2019 15:14:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82d.google.com with SMTP id m15so38473542qtq.2 for ; Thu, 24 Oct 2019 08:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uXy0Y5xsVRztx3n82NB0Ju3DwprUJLICwynudZYUIe4=; b=df1T+OGuDKKEek83/l4zmw+dNTKfbtJEAwPoXHoUhLCd4LaklVewwzcBefvWCEV/1Y Ls6ukCxbP9cKIxwnSgC0ffj4MmFQtupwyH+piRvfrkEZ993So77+Nno05ZYdGQsqdKoh xvfmrhstZ1HTc72PBIyEzTdpnOOHmUVNDUHDPdxxm31Z4ezXxcvwmZkcOS2akjraTDpN OQpE6ls8ohOf/t4P4yFZwRoG+21jzb3wF29ZP/JwDd3A+1ijLmasjb5fhmOLg0eNxV4P GLz7Vzm8AuSDhpie4ZtOBl8oFMn1eyAeL0fscTy+GtxlAw1qCYSOpgX6OrxWkDpGJAs7 vkKw== 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=uXy0Y5xsVRztx3n82NB0Ju3DwprUJLICwynudZYUIe4=; b=CLiURmhwDm3ETtiYnxwci+SL+j/Q0GYlGduyWXmBrbA/axTMpb3Jh8m4cUWkLyOiHH qckxpTnfcPuSdibeZczVvQC6073CnGjMo/0CiKWI2MpC92BX36S8BkTuFDM3d5j7Q6eU +Eq0CibeZ9IqrJj9tozqqyI6dgLp522jSpUSBq/cRWZtEvWSNI9dA9lOJX/dY1GpOHT2 PHelvce8miejrdkKVLBt0sBa32idgXkFdJ83IG5o6BhI4sDhMloxuehYVqi8zTpvue4e VNBwhExmQOdUoDlkQWyDb4PorzrbcEHVm19EYFSDGgrTNLrO1MUGh+nhGRZdVArSOa5m Zt6A== X-Gm-Message-State: APjAAAVQhiAIjDO9UwsiLUZ64B6ddPSuMmQ/1lLX/8+p9RGfHfPCl087 hftMjNcLZXqJgHDW8prh9m7deZY0Zs8uTBqpMPqQOA== X-Google-Smtp-Source: APXvYqyNP/fYXbMTiQQYcLJjaIk00IGMj1RXoPpJYptkpWKl8uoWvMbrhlXHYydlJ4svHtk0/uzJvVHELzVJ94YD4gA= X-Received: by 2002:a0c:eda9:: with SMTP id h9mr12916984qvr.125.1571930058317; Thu, 24 Oct 2019 08:14:18 -0700 (PDT) MIME-Version: 1.0 References: <201910231657.x9NGvCMD039111@repo.freebsd.org> <20191024082609.GA63459@FreeBSD.org> In-Reply-To: <20191024082609.GA63459@FreeBSD.org> From: Warner Losh Date: Thu, 24 Oct 2019 09:14:07 -0600 Message-ID: Subject: Re: svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch To: Alexey Dokuchaev Cc: Dimitry Andric , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46zW4D1Nhfz3Nlr X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=df1T+OGu; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::82d) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.78 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[d.2.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.78)[ip: (-9.37), ipnet: 2607:f8b0::/32(-2.41), asn: 15169(-2.06), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 15:14:21 -0000 On Thu, Oct 24, 2019 at 2:26 AM Alexey Dokuchaev wrote: > On Wed, Oct 23, 2019 at 04:57:12PM +0000, Dimitry Andric wrote: > > New Revision: 353936 > > URL: https://svnweb.freebsd.org/changeset/base/353936 > > > > Log: > > Bump clang's default target CPU for the i386 architecture (aka "x86") > to > > i686, as per the discussion on the freebsd-arch mailing list. Earlier > > in r352030, I had already bumped it to i586, to work around missing > > atomic 64 bit functions for the i386 architecture. > > Why i686, not i586? i486 lacking 64-bit atomics is a sound and valid > reason, but I don't understand why i586 wasn't chosen, and quick review > of that -arch thread did not help. Could you shed some more light here? > There were several notions at play here. First, the rest of the i386 ecosystem has defaulted to i686 for a long time. This aligns us better when them. Next, the share of Pentium processors in FreeBSD is super small, and confined to firewall embedded boxes. These boxes aren't installed from our base installation media and have custom builds already. The arch@ thread suggested that people would be OK building their own packages. A recent survey of available hardware suggests that the last 586 core systems (Geode LX was the latest I could find) were sold by people like PC Engines in 2018 (or maybe 2019), those these were trailing edge, EOL'd systems that hadn't been recommended for new deployments for a few years prior. This tells us that the need for us to retain 586 compatibility by default is low, but the need to have it available is still high enough to not remove support entirely. People are transitioning away from this embedded gear now that the CPUs have gone EOL, though the transition will likely take years to complete. The 486 cores EOLd by 2010, so that part of things is a non-issue: only the hardiest of hardware is still around, and it's not being aggressively upgraded to -current. i686 support by default allows better code generation and increased performance. The biggest thing being using CMOVxx instructions to avoid a pipeline miss due to branching, though there's likely others. By moving to i686 by default, we have only one bump instead of two. We should have bumped to 586 in the 11 time frame, using similar analysis to the above, but we didn't. Doing one big bump means we won't have to go back to the well to have another discussion about it in the future. If these discussions were better in the past, then that wouldn't be a big deal. However, the project is a little dysfunctional in this area and the desire to bump to 686 to avoid some of that in a platform that's rapidly ramping down even in its core areas played into this a bit. Chances are this will be the last minimum bump as well before i386 is removed from the tree as irrelevant (some years from now, but the day will come). There's no good next higher tier to land on anyway.... So that's where we are: a mix of technical and political reasons were why we bumped up to i686 by default and retained the ability to still deploy on i586-cores for the small portion of our user base that will need to do so after 13 is released. Warner From owner-svn-src-head@freebsd.org Thu Oct 24 15:34:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C70C816FD62; Thu, 24 Oct 2019 15:34:33 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zWWY4sD6z3Pl2; Thu, 24 Oct 2019 15:34:33 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 9F36CF2D5; Thu, 24 Oct 2019 15:34:33 +0000 (UTC) Date: Thu, 24 Oct 2019 15:34:33 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: Dimitry Andric , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch Message-ID: <20191024153433.GA68256@FreeBSD.org> References: <201910231657.x9NGvCMD039111@repo.freebsd.org> <20191024082609.GA63459@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 15:34:33 -0000 On Thu, Oct 24, 2019 at 09:14:07AM -0600, Warner Losh wrote: > On Thu, Oct 24, 2019 at 2:26 AM Alexey Dokuchaev wrote: > > On Wed, Oct 23, 2019 at 04:57:12PM +0000, Dimitry Andric wrote: > > > New Revision: 353936 > > > URL: https://svnweb.freebsd.org/changeset/base/353936 > > > > > > Log: > > > Bump clang's default target CPU for the i386 architecture (aka > > > "x86") to i686, as per the discussion on the freebsd-arch mailing > > > list. > > > > Why i686, not i586? i486 lacking 64-bit atomics is a sound and valid > > reason, but I don't understand why i586 wasn't chosen, and quick review > > of that -arch thread did not help. > > There were several notions at play here. First, the rest of the i386 > ecosystem has defaulted to i686 for a long time. [...] > > i686 support by default allows better code generation and increased > performance. The biggest thing being using CMOVxx instructions to avoid > a pipeline miss due to branching, though there's likely others. > > By moving to i686 by default, we have only one bump instead of two. [...] > > So that's where we are: a mix of technical and political reasons were why > we bumped up to i686 by default Understood. I appreciate long and elaborate reply Warner. > Chances are this will be the last minimum bump as well before i386 is > removed from the tree as irrelevant (some years from now, but the day > will come). I hope the day never comes, as I don't want to be forced from FreeBSD to something else on vast majority of my hardware. ./danfe From owner-svn-src-head@freebsd.org Thu Oct 24 15:59:01 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A85DE1706E1 for ; Thu, 24 Oct 2019 15:59:01 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46zX3m6xgHz3RJX for ; Thu, 24 Oct 2019 15:59:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82f.google.com with SMTP id u22so38546625qtq.13 for ; Thu, 24 Oct 2019 08:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ru//suYCHeloiQ1KHVcg3cOA1RRhZICZLYNQtYNc7Rk=; b=x51pCVL2wPCSIMCSZRSLM+bPFLlhv5Hd188XpeKtN7Oqy522scQiLvkPyDPzVK80jQ laZOobfc+Uym9ICsCxOBkC+NlS5i9jBTUODWF/o/Gy+Q7iv+RMxSzX7WlyqEfRwK/g+J rkPQp3NIQgR8eJn1x1aGIfWLW1vy7fmDbmd6ASephkI9V0VT12Wq5pABQVKOsysdmqdK lzRgpxO5Rtp/TogNrng/uW+dh33hLD748Mhj6fLUttvsn2cDglv504GnD/di3h7qDekB LAXOafQ6prAK3f5hTTGFDY8u7Fkj8CbwArmWfDOsTufIi9mHWMPF82c5b9Sz1mR2Pyg+ FYqQ== 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=ru//suYCHeloiQ1KHVcg3cOA1RRhZICZLYNQtYNc7Rk=; b=Gj2uy/eXT5LgH52rpwdoBz8Cc9gW0CEq4pREnGHxIiVV7ZlusCtKiWbSAx/JPQ8QQp 0FQBnURjWwN9mwlwH8Ehp+Oq8qTDaLBb8AVtPF0q4IrI7kKWwFKUfCOBXLRjh45ced7b t/1/st3GYtlRnVbPs8njo/29nlr2GSKTTOhYkvLb7otx017QiWYK7JqQD09jZjDS4VbI kCNierAosbq5hjfiY4rOL58vLZx3/f8QQCWTWwUFwER0L/o7ozTyLJI/bWAOsGEZw3VR ZBjbgep6sNZ9TcL/kpfC5cUuWABCrUfcoVkRBbSEQ5A/L6ENlafUPXSamvy/TfTbq1IG Bl5A== X-Gm-Message-State: APjAAAVY0Qtj8V7XAGcaPmhRne8MTepzqQOzpXJk0f40eFT1CYGG8Bqx B7c6MDDeT4uAq8NcPxn3d/71grjYz4SaunrwKWYspA== X-Google-Smtp-Source: APXvYqyzXaf+OBedbKdi8QQVKtc3P8A5wPun/r3XqgwC/Rrko7+cFMEmi+fJPmC7setp4X45vv8M5uCKP0JdOxKSFAk= X-Received: by 2002:a0c:95ca:: with SMTP id t10mr9163024qvt.22.1571932738606; Thu, 24 Oct 2019 08:58:58 -0700 (PDT) MIME-Version: 1.0 References: <201910231657.x9NGvCMD039111@repo.freebsd.org> <20191024082609.GA63459@FreeBSD.org> <20191024153433.GA68256@FreeBSD.org> In-Reply-To: <20191024153433.GA68256@FreeBSD.org> From: Warner Losh Date: Thu, 24 Oct 2019 09:58:47 -0600 Message-ID: Subject: Re: svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch To: Alexey Dokuchaev Cc: Dimitry Andric , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46zX3m6xgHz3RJX X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=x51pCVL2; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::82f) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.77 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[f.2.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.77)[ip: (-9.34), ipnet: 2607:f8b0::/32(-2.41), asn: 15169(-2.06), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 15:59:01 -0000 On Thu, Oct 24, 2019 at 9:34 AM Alexey Dokuchaev wrote: > On Thu, Oct 24, 2019 at 09:14:07AM -0600, Warner Losh wrote: > > On Thu, Oct 24, 2019 at 2:26 AM Alexey Dokuchaev > wrote: > > > On Wed, Oct 23, 2019 at 04:57:12PM +0000, Dimitry Andric wrote: > > > > New Revision: 353936 > > > > URL: https://svnweb.freebsd.org/changeset/base/353936 > > > > > > > > Log: > > > > Bump clang's default target CPU for the i386 architecture (aka > > > > "x86") to i686, as per the discussion on the freebsd-arch mailing > > > > list. > > > > > > Why i686, not i586? i486 lacking 64-bit atomics is a sound and valid > > > reason, but I don't understand why i586 wasn't chosen, and quick review > > > of that -arch thread did not help. > > > > There were several notions at play here. First, the rest of the i386 > > ecosystem has defaulted to i686 for a long time. [...] > > > > i686 support by default allows better code generation and increased > > performance. The biggest thing being using CMOVxx instructions to avoid > > a pipeline miss due to branching, though there's likely others. > The other reason to do this on i386 is that we've built lib32 with i686 forever on amd64, and this makes them match. I'd forgotten that this was mentioned in early discussions and was just reminded about that in IRC. > > By moving to i686 by default, we have only one bump instead of two. [...] > > > > So that's where we are: a mix of technical and political reasons were why > > we bumped up to i686 by default > > Understood. I appreciate long and elaborate reply Warner. > > > Chances are this will be the last minimum bump as well before i386 is > > removed from the tree as irrelevant (some years from now, but the day > > will come). > > I hope the day never comes, as I don't want to be forced from FreeBSD to > something else on vast majority of my hardware. > I hope so too. I know this change represents some hassle for some people, but represents an improvement for others. Warner From owner-svn-src-head@freebsd.org Thu Oct 24 18:13:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 117FF1765CD; Thu, 24 Oct 2019 18:13:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zb2t6lJZz4QZN; Thu, 24 Oct 2019 18:13:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAE151A28D; Thu, 24 Oct 2019 18:13:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OIDQCm072372; Thu, 24 Oct 2019 18:13:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OIDQrU072371; Thu, 24 Oct 2019 18:13:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910241813.x9OIDQrU072371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 24 Oct 2019 18:13:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354028 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354028 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 18:13:27 -0000 Author: jhb Date: Thu Oct 24 18:13:26 2019 New Revision: 354028 URL: https://svnweb.freebsd.org/changeset/base/354028 Log: Use a counter with a random base for explicit IVs in GCM. This permits constructing the entire TLS header in ktls_frame() rather than ktls_seq(). This also matches the approach used by OpenSSL which uses an incrementing nonce as the explicit IV rather than the sequence number. Reviewed by: gallatin Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22117 Modified: head/sys/kern/uipc_ktls.c Modified: head/sys/kern/uipc_ktls.c ============================================================================== --- head/sys/kern/uipc_ktls.c Thu Oct 24 15:46:00 2019 (r354027) +++ head/sys/kern/uipc_ktls.c Thu Oct 24 18:13:26 2019 (r354028) @@ -408,7 +408,7 @@ ktls_create_session(struct socket *so, struct tls_enab struct ktls_session *tls; int error; - /* Only TLS 1.0 - 1.2 are supported. */ + /* Only TLS 1.0 - 1.3 are supported. */ if (en->tls_vmajor != TLS_MAJOR_VER_ONE) return (EINVAL); if (en->tls_vminor < TLS_MINOR_VER_ZERO || @@ -576,13 +576,24 @@ ktls_create_session(struct socket *so, struct tls_enab /* * This holds the implicit portion of the nonce for GCM and * the initial implicit IV for TLS 1.0. The explicit portions - * of the IV are generated in ktls_frame() and ktls_seq(). + * of the IV are generated in ktls_frame(). */ if (en->iv_len != 0) { tls->params.iv_len = en->iv_len; error = copyin(en->iv, tls->params.iv, en->iv_len); if (error) goto out; + + /* + * For TLS 1.2, generate an 8-byte nonce as a counter + * to generate unique explicit IVs. + * + * Store this counter in the last 8 bytes of the IV + * array so that it is 8-byte aligned. + */ + if (en->cipher_algorithm == CRYPTO_AES_NIST_GCM_16 && + en->tls_vminor == TLS_MINOR_VER_TWO) + arc4rand(tls->params.iv + 8, sizeof(uint64_t), 0); } *tlsp = tls; @@ -1196,8 +1207,6 @@ void ktls_seq(struct sockbuf *sb, struct mbuf *m) { struct mbuf_ext_pgs *pgs; - struct tls_record_layer *tlshdr; - uint64_t seqno; for (; m != NULL; m = m->m_next) { KASSERT((m->m_flags & M_NOMAP) != 0, @@ -1205,17 +1214,6 @@ ktls_seq(struct sockbuf *sb, struct mbuf *m) pgs = m->m_ext.ext_pgs; pgs->seqno = sb->sb_tls_seqno; - - /* - * Store the sequence number in the TLS header as the - * explicit part of the IV for GCM. - */ - if (pgs->tls->params.cipher_algorithm == - CRYPTO_AES_NIST_GCM_16) { - tlshdr = (void *)pgs->hdr; - seqno = htobe64(pgs->seqno); - memcpy(tlshdr + 1, &seqno, sizeof(seqno)); - } sb->sb_tls_seqno++; } } @@ -1240,6 +1238,7 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls, struct tls_record_layer *tlshdr; struct mbuf *m; struct mbuf_ext_pgs *pgs; + uint64_t *noncep; uint16_t tls_len; int maxlen; @@ -1315,11 +1314,21 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls, tlshdr->tls_length = htons(m->m_len - sizeof(*tlshdr)); /* - * For GCM, the sequence number is stored in the - * header by ktls_seq(). For CBC, a random nonce is - * inserted for TLS 1.1+. + * Store nonces / explicit IVs after the end of the + * TLS header. + * + * For GCM with TLS 1.2, an 8 byte nonce is copied + * from the end of the IV. The nonce is then + * incremented for use by the next record. + * + * For CBC, a random nonce is inserted for TLS 1.1+. */ - if (tls->params.cipher_algorithm == CRYPTO_AES_CBC && + if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16 && + tls->params.tls_vminor == TLS_MINOR_VER_TWO) { + noncep = (uint64_t *)(tls->params.iv + 8); + be64enc(tlshdr + 1, *noncep); + (*noncep)++; + } else if (tls->params.cipher_algorithm == CRYPTO_AES_CBC && tls->params.tls_vminor >= TLS_MINOR_VER_ONE) arc4rand(tlshdr + 1, AES_BLOCK_LEN, 0); From owner-svn-src-head@freebsd.org Thu Oct 24 18:39:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41851176E46; Thu, 24 Oct 2019 18:39:06 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zbcV0zZlz4RqV; Thu, 24 Oct 2019 18:39:06 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 021871A64B; Thu, 24 Oct 2019 18:39:06 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OId56a084130; Thu, 24 Oct 2019 18:39:05 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OId5gh084129; Thu, 24 Oct 2019 18:39:05 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201910241839.x9OId5gh084129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Thu, 24 Oct 2019 18:39:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354029 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354029 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 18:39:06 -0000 Author: gallatin Date: Thu Oct 24 18:39:05 2019 New Revision: 354029 URL: https://svnweb.freebsd.org/changeset/base/354029 Log: Add a tunable to set the pgcache zone's maxcache When it is set to 0 (the default), a heavy Netflix-style web workload suffers from heavy lock contention on the vm page free queue called from vm_page_zone_{import,release}() as the buckets are frequently drained. When setting the maxcache, this contention goes away. We should eventually try to autotune this, as well as make this zone eligable for uma_reclaim(). Reviewed by: alc, markj Not Objected to by: jeff Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22112 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Oct 24 18:13:26 2019 (r354028) +++ head/sys/vm/vm_page.c Thu Oct 24 18:39:05 2019 (r354029) @@ -216,8 +216,10 @@ vm_page_init_cache_zones(void *dummy __unused) { struct vm_domain *vmd; struct vm_pgcache *pgcache; - int domain, pool; + int domain, maxcache, pool; + maxcache = 0; + TUNABLE_INT_FETCH("vm.pgcache_zone_max", &maxcache); for (domain = 0; domain < vm_ndomains; domain++) { vmd = VM_DOMAIN(domain); @@ -237,7 +239,7 @@ vm_page_init_cache_zones(void *dummy __unused) sizeof(struct vm_page), NULL, NULL, NULL, NULL, vm_page_zone_import, vm_page_zone_release, pgcache, UMA_ZONE_MAXBUCKET | UMA_ZONE_VM); - (void)uma_zone_set_maxcache(pgcache->zone, 0); + (void)uma_zone_set_maxcache(pgcache->zone, maxcache); } } } From owner-svn-src-head@freebsd.org Thu Oct 24 19:47:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 898A515889C; Thu, 24 Oct 2019 19:47:19 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zd7C346Cz4X5G; Thu, 24 Oct 2019 19:47:19 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 498B41B2B9; Thu, 24 Oct 2019 19:47:19 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJlJ04025606; Thu, 24 Oct 2019 19:47:19 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJlJQp025605; Thu, 24 Oct 2019 19:47:19 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201910241947.x9OJlJQp025605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 24 Oct 2019 19:47:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354036 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 354036 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:47:19 -0000 Author: mckusick Date: Thu Oct 24 19:47:18 2019 New Revision: 354036 URL: https://svnweb.freebsd.org/changeset/base/354036 Log: Soft updates needs to keep an on-disk linked list of inodes that have been unlinked, but are still referenced by open file descriptors. These inodes cannot be freed until the final file descriptor reference has been closed. If the system crashes while they are still being referenced, these inodes and their referenced blocks need to be freed by fsck. By having them on a linked list with the head pointer in the superblock, fsck can quickly find and process them rather than having to check every inode in the filesystem to see if it is unreferenced. When updating the head pointer of this list of unlinked inodes in the superblock, the superblock check-hash was not getting updated. If the system crashed with the incorrect superblock check-hash, the superblock would appear to be corrupted. This patch ensures that the superblock check-hash is updated when updating the head pointer of the unlinked inodes list. There is no need to MFC as superblock check hashes first appeared in 13.0. Tested by: Peter Holm Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Thu Oct 24 19:18:49 2019 (r354035) +++ head/sys/ufs/ffs/ffs_softdep.c Thu Oct 24 19:47:18 2019 (r354036) @@ -9587,6 +9587,11 @@ initiate_write_sbdep(sbdep) } else fs->fs_sujfree = 0; bpfs->fs_sujfree = fs->fs_sujfree; + /* + * Because we have made changes to the superblock, we need to + * recompute its check-hash. + */ + bpfs->fs_ckhash = ffs_calc_sbhash(bpfs); } /* @@ -9665,7 +9670,7 @@ clear_unlinked_inodedep(inodedep) struct ufsmount *ump; struct inodedep *idp; struct inodedep *idn; - struct fs *fs; + struct fs *fs, *bpfs; struct buf *bp; ino_t ino; ino_t nino; @@ -9762,9 +9767,14 @@ clear_unlinked_inodedep(inodedep) */ if (pino == 0) { bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize); - ffs_oldfscompat_write((struct fs *)bp->b_data, ump); - softdep_setup_sbupdate(ump, (struct fs *)bp->b_data, - bp); + bpfs = (struct fs *)bp->b_data; + ffs_oldfscompat_write(bpfs, ump); + softdep_setup_sbupdate(ump, bpfs, bp); + /* + * Because we may have made changes to the superblock, + * we need to recompute its check-hash. + */ + bpfs->fs_ckhash = ffs_calc_sbhash(bpfs); } else if (fs->fs_magic == FS_UFS1_MAGIC) { ((struct ufs1_dinode *)bp->b_data + ino_to_fsbo(fs, pino))->di_freelink = nino; @@ -9789,9 +9799,14 @@ clear_unlinked_inodedep(inodedep) bp = getblk(ump->um_devvp, btodb(fs->fs_sblockloc), (int)fs->fs_sbsize, 0, 0, 0); bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize); - ffs_oldfscompat_write((struct fs *)bp->b_data, ump); - softdep_setup_sbupdate(ump, (struct fs *)bp->b_data, - bp); + bpfs = (struct fs *)bp->b_data; + ffs_oldfscompat_write(bpfs, ump); + softdep_setup_sbupdate(ump, bpfs, bp); + /* + * Because we may have made changes to the superblock, + * we need to recompute its check-hash. + */ + bpfs->fs_ckhash = ffs_calc_sbhash(bpfs); bwrite(bp); ACQUIRE_LOCK(ump); } From owner-svn-src-head@freebsd.org Thu Oct 24 19:47:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 891F315890A; Thu, 24 Oct 2019 19:47:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zd7T37gtz4XCc; Thu, 24 Oct 2019 19:47:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F2131B2BA; Thu, 24 Oct 2019 19:47:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJlXr0025666; Thu, 24 Oct 2019 19:47:33 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJlX8M025665; Thu, 24 Oct 2019 19:47:33 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910241947.x9OJlX8M025665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 19:47:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354037 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354037 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:47:33 -0000 Author: bz Date: Thu Oct 24 19:47:32 2019 New Revision: 354037 URL: https://svnweb.freebsd.org/changeset/base/354037 Log: frag6.c: do not leak packet queue entry in error case When we are checking for the maximum reassembled packet size of the fragmentable part and run into the error case (packet too big), we are leaking the packet queue enntry if this was a first fragment to arrive. Properly cleanup, removing the queue entry from the bucket, decrementing counters, and freeing the memory. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 19:47:18 2019 (r354036) +++ head/sys/netinet6/frag6.c Thu Oct 24 19:47:32 2019 (r354037) @@ -572,17 +572,35 @@ frag6_input(struct mbuf **mp, int *offp, int proto) if (q6->ip6q_unfrglen >= 0) { /* The 1st fragment has already arrived. */ if (q6->ip6q_unfrglen + fragoff + frgpartlen > IPV6_MAXPACKET) { + if (only_frag) { + TAILQ_REMOVE(head, q6, ip6q_tq); + V_ip6qb[bucket].count--; + atomic_subtract_int(&V_frag6_nfragpackets, 1); +#ifdef MAC + mac_ip6q_destroy(q6); +#endif + free(q6, M_FRAG6); + } + IP6QB_UNLOCK(bucket); icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset - sizeof(struct ip6_frag) + offsetof(struct ip6_frag, ip6f_offlg)); - IP6QB_UNLOCK(bucket); return (IPPROTO_DONE); } } else if (fragoff + frgpartlen > IPV6_MAXPACKET) { + if (only_frag) { + TAILQ_REMOVE(head, q6, ip6q_tq); + V_ip6qb[bucket].count--; + atomic_subtract_int(&V_frag6_nfragpackets, 1); +#ifdef MAC + mac_ip6q_destroy(q6); +#endif + free(q6, M_FRAG6); + } + IP6QB_UNLOCK(bucket); icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset - sizeof(struct ip6_frag) + offsetof(struct ip6_frag, ip6f_offlg)); - IP6QB_UNLOCK(bucket); return (IPPROTO_DONE); } From owner-svn-src-head@freebsd.org Thu Oct 24 19:50:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 808EE1589B9; Thu, 24 Oct 2019 19:50:19 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdBg2t6sz4XMd; Thu, 24 Oct 2019 19:50:19 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41C121B2CA; Thu, 24 Oct 2019 19:50:19 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJoJfD025871; Thu, 24 Oct 2019 19:50:19 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJoIFC025869; Thu, 24 Oct 2019 19:50:18 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201910241950.x9OJoIFC025869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 24 Oct 2019 19:50:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354038 - head/lib/libsecureboot X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/lib/libsecureboot X-SVN-Commit-Revision: 354038 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:50:19 -0000 Author: sjg Date: Thu Oct 24 19:50:18 2019 New Revision: 354038 URL: https://svnweb.freebsd.org/changeset/base/354038 Log: Initialize verbosity and debug level from env For EFI at least, we can seed the environment with VE_VERBOSE etc. Reviewed by: stevek imp Sponsored by: Juniper Networks MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22135 Modified: head/lib/libsecureboot/verify_file.c head/lib/libsecureboot/vets.c Modified: head/lib/libsecureboot/verify_file.c ============================================================================== --- head/lib/libsecureboot/verify_file.c Thu Oct 24 19:47:32 2019 (r354037) +++ head/lib/libsecureboot/verify_file.c Thu Oct 24 19:50:18 2019 (r354038) @@ -292,6 +292,28 @@ verify_tweak(int fd, off_t off, struct stat *stp, } } +#ifndef VE_DEBUG_LEVEL +# define VE_DEBUG_LEVEL 0 +#endif + +static int +getenv_int(const char *var, int def) +{ + const char *cp; + char *ep; + long val; + + val = def; + cp = getenv(var); + if (cp && *cp) { + val = strtol(cp, &ep, 0); + if ((ep && *ep) || val != (int)val) { + val = def; + } + } + return (int)val; +} + /** * @brief verify an open file * @@ -331,9 +353,8 @@ verify_file(int fd, const char *filename, off_t off, i if (verifying < 0) { verifying = ve_trust_init(); -#ifdef VE_DEBUG_LEVEL - ve_debug_set(VE_DEBUG_LEVEL); -#endif + verbose = getenv_int("VE_VERBOSE", VE_VERBOSE_DEFAULT); + ve_debug_set(getenv_int("VE_DEBUG_LEVEL", VE_DEBUG_LEVEL)); /* initialize ve_status with default result */ rc = verifying ? VE_NOT_CHECKED : VE_NOT_VERIFYING; ve_status_set(0, rc); Modified: head/lib/libsecureboot/vets.c ============================================================================== --- head/lib/libsecureboot/vets.c Thu Oct 24 19:47:32 2019 (r354037) +++ head/lib/libsecureboot/vets.c Thu Oct 24 19:50:18 2019 (r354038) @@ -240,7 +240,7 @@ ve_forbidden_digest_add(hash_data *digest, size_t num) static size_t ve_anchors_add(br_x509_certificate *xcs, size_t num, anchor_list *anchors, - char *anchors_name) + const char *anchors_name) { br_x509_trust_anchor ta; size_t u; From owner-svn-src-head@freebsd.org Thu Oct 24 19:52:42 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9775F158C10; Thu, 24 Oct 2019 19:52:42 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdFQ3Mwtz4Xl5; Thu, 24 Oct 2019 19:52:42 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 571F61B49D; Thu, 24 Oct 2019 19:52:42 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJqgdn031091; Thu, 24 Oct 2019 19:52:42 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJqgTM031090; Thu, 24 Oct 2019 19:52:42 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201910241952.x9OJqgTM031090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 24 Oct 2019 19:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354039 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 354039 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:52:42 -0000 Author: sjg Date: Thu Oct 24 19:52:41 2019 New Revision: 354039 URL: https://svnweb.freebsd.org/changeset/base/354039 Log: Allow loader.efi to identify non-standard boot setup PATH_BOOTABLE_TOKEN can be set to a non-standard path that identifies a device as bootable. Reviewed by: kevans, bcran Differential Revision: https://reviews.freebsd.org/D22062 Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Thu Oct 24 19:50:18 2019 (r354038) +++ head/stand/efi/loader/main.c Thu Oct 24 19:52:41 2019 (r354039) @@ -863,6 +863,7 @@ main(int argc, CHAR16 *argv[]) archsw.arch_getdev = efi_getdev; archsw.arch_copyin = efi_copyin; archsw.arch_copyout = efi_copyout; + archsw.arch_hypervisor = x86_hypervisor; archsw.arch_readin = efi_readin; archsw.arch_zfs_probe = efi_zfs_probe; From owner-svn-src-head@freebsd.org Thu Oct 24 19:57:19 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94406158D53; Thu, 24 Oct 2019 19:57:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdLl3Q6xz4Xvn; Thu, 24 Oct 2019 19:57:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5886A1B4A1; Thu, 24 Oct 2019 19:57:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJvJBt031358; Thu, 24 Oct 2019 19:57:19 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJvJKE031357; Thu, 24 Oct 2019 19:57:19 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910241957.x9OJvJKE031357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 19:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354040 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354040 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:57:19 -0000 Author: bz Date: Thu Oct 24 19:57:18 2019 New Revision: 354040 URL: https://svnweb.freebsd.org/changeset/base/354040 Log: frag6: fix counter leak in error case and optimise code In case the first fragmented part (off=0) arrives we check for the maximum packet size for each fragmented part we already queued with the addition of the unfragmentable part from the first one. For one we do not have to enter the loop at all if this is the first fragmented part to arrive, and we can skip the check. Should we encounter an error case we send an ICMPv6 message for any fragment exceeding the maximum length limit. While dequeueing the original packet and freeing it, statistics were not updated and leaked both the reassembly queue count for the fragment and the global fragment count. Found by code inspection and confirmed by tightening test cases checking more statistical and system counters. While here properly wrap a line. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 19:52:41 2019 (r354039) +++ head/sys/netinet6/frag6.c Thu Oct 24 19:57:18 2019 (r354040) @@ -608,11 +608,11 @@ frag6_input(struct mbuf **mp, int *offp, int proto) * If it is the first fragment, do the above check for each * fragment already stored in the reassembly queue. */ - if (fragoff == 0) { + if (fragoff == 0 && !only_frag) { TAILQ_FOREACH_SAFE(af6, &q6->ip6q_frags, ip6af_tq, af6tmp) { - if (q6->ip6q_unfrglen + af6->ip6af_off + af6->ip6af_frglen > - IPV6_MAXPACKET) { + if (q6->ip6q_unfrglen + af6->ip6af_off + + af6->ip6af_frglen > IPV6_MAXPACKET) { struct ip6_hdr *ip6err; struct mbuf *merr; int erroff; @@ -622,6 +622,8 @@ frag6_input(struct mbuf **mp, int *offp, int proto) /* Dequeue the fragment. */ TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); + q6->ip6q_nfrag--; + atomic_subtract_int(&frag6_nfrags, 1); free(af6, M_FRAG6); /* Set a valid receive interface pointer. */ From owner-svn-src-head@freebsd.org Thu Oct 24 20:00:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48160158EBA; Thu, 24 Oct 2019 20:00:38 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdQY5Ymxz4YCq; Thu, 24 Oct 2019 20:00:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A37E61B4AE; Thu, 24 Oct 2019 20:00:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OK0bmF032218; Thu, 24 Oct 2019 20:00:37 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OK0bQT032169; Thu, 24 Oct 2019 20:00:37 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910242000.x9OK0bQT032169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 20:00:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354042 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354042 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:00:38 -0000 Author: bz Date: Thu Oct 24 20:00:37 2019 New Revision: 354042 URL: https://svnweb.freebsd.org/changeset/base/354042 Log: frag6: export another counter read-only by sysctl Similar to the system global counter also export the per-VNET counter "frag6_nfragpackets" detailing the current number of fragment packets in this VNET's reassembly queues. The read-only counter is helpful for in-VNET statistical monitoring and for test-cases. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 20:00:28 2019 (r354041) +++ head/sys/netinet6/frag6.c Thu Oct 24 20:00:37 2019 (r354042) @@ -202,6 +202,10 @@ SYSCTL_PROC(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS, ma "Default maximum number of outstanding fragmented IPv6 packets. " "A value of 0 means no fragmented packets will be accepted, while a " "a value of -1 means no limit"); +SYSCTL_UINT(_net_inet6_ip6, OID_AUTO, frag6_nfragpackets, + CTLFLAG_VNET | CTLFLAG_RD, + __DEVOLATILE(u_int *, &VNET_NAME(frag6_nfragpackets)), 0, + "Per-VNET number of IPv6 fragments across all reassembly queues."); SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGSPERPACKET, maxfragsperpacket, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_maxfragsperpacket), 0, "Maximum allowed number of fragments per packet"); From owner-svn-src-head@freebsd.org Thu Oct 24 20:02:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB12B1591A3; Thu, 24 Oct 2019 20:02:50 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdT64Yz7z4YbR; Thu, 24 Oct 2019 20:02:50 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 800A81B662; Thu, 24 Oct 2019 20:02:50 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OK2oGd037222; Thu, 24 Oct 2019 20:02:50 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OK2mI5037212; Thu, 24 Oct 2019 20:02:48 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201910242002.x9OK2mI5037212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 24 Oct 2019 20:02:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354043 - in head/stand: . ficl ficl/amd64 ficl/i386 ficl/x86 i386/loader libsa libsa/x86 X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in head/stand: . ficl ficl/amd64 ficl/i386 ficl/x86 i386/loader libsa libsa/x86 X-SVN-Commit-Revision: 354043 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:02:50 -0000 Author: sjg Date: Thu Oct 24 20:02:48 2019 New Revision: 354043 URL: https://svnweb.freebsd.org/changeset/base/354043 Log: Add support for hypervisor check on x86 Add ficl words for isvirtualized and move ficl inb and outb words to ficl/x86/sysdep.c so can be shared by i386 and amd64 Reviewed by: imp bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22069 Added: head/stand/ficl/x86/ head/stand/ficl/x86/sysdep.c (contents, props changed) head/stand/libsa/x86/ head/stand/libsa/x86/hypervisor.c (contents, props changed) Modified: head/stand/defs.mk head/stand/ficl/amd64/sysdep.c head/stand/ficl/i386/sysdep.c head/stand/ficl/loader.c head/stand/i386/loader/main.c head/stand/libsa/Makefile head/stand/libsa/stand.h Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/defs.mk Thu Oct 24 20:02:48 2019 (r354043) @@ -189,14 +189,15 @@ teken_state.h: ${SYSDIR}/teken/sequences ${SYSDIR}/teken/sequences > teken_state.h .if !defined(NO_OBJ) -_ILINKS=machine +_ILINKS=include/machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" -_ILINKS+=${MACHINE_CPUARCH} +_ILINKS+=include/${MACHINE_CPUARCH} .endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" -_ILINKS+=x86 +_ILINKS+=include/x86 .endif -CLEANFILES+=${_ILINKS} +CFLAGS+= -Iinclude +CLEANDIRS+= include beforedepend: ${_ILINKS} beforebuild: ${_ILINKS} @@ -211,8 +212,8 @@ ${OBJS}: ${_link} .NOPATH: ${_ILINKS} -${_ILINKS}: - @case ${.TARGET} in \ +${_ILINKS}: .NOMETA + @case ${.TARGET:T} in \ machine) \ if [ ${DO32:U0} -eq 0 ]; then \ path=${SYSDIR}/${MACHINE}/include ; \ @@ -222,8 +223,11 @@ ${_ILINKS}: *) \ path=${SYSDIR}/${.TARGET:T}/include ;; \ esac ; \ + case ${.TARGET} in \ + */*) mkdir -p ${.TARGET:H};; \ + esac ; \ path=`(cd $$path && /bin/pwd)` ; \ - ${ECHO} ${.TARGET:T} "->" $$path ; \ - ln -fhs $$path ${.TARGET:T} + ${ECHO} ${.TARGET} "->" $$path ; \ + ln -fhs $$path ${.TARGET} .endif # !NO_OBJ .endif # __BOOT_DEFS_MK__ Modified: head/stand/ficl/amd64/sysdep.c ============================================================================== --- head/stand/ficl/amd64/sysdep.c Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/ficl/amd64/sysdep.c Thu Oct 24 20:02:48 2019 (r354043) @@ -17,6 +17,8 @@ #endif #include "ficl.h" +#include "../x86/sysdep.c" + /* ******************* FreeBSD P O R T B E G I N S H E R E ******************** Michael Smith */ Modified: head/stand/ficl/i386/sysdep.c ============================================================================== --- head/stand/ficl/i386/sysdep.c Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/ficl/i386/sysdep.c Thu Oct 24 20:02:48 2019 (r354043) @@ -14,12 +14,11 @@ #include #else #include -#ifdef __i386__ -#include #endif -#endif #include "ficl.h" +#include "../x86/sysdep.c" + /* ******************* FreeBSD P O R T B E G I N S H E R E ******************** Michael Smith */ @@ -80,53 +79,6 @@ void ficlFree (void *p) free(p); } -#ifndef TESTMAIN -/* - * outb ( port# c -- ) - * Store a byte to I/O port number port# - */ -void -ficlOutb(FICL_VM *pVM) -{ - u_char c; - uint32_t port; - - port=stackPopUNS(pVM->pStack); - c=(u_char)stackPopINT(pVM->pStack); - outb(port,c); -} - -/* - * inb ( port# -- c ) - * Fetch a byte from I/O port number port# - */ -void -ficlInb(FICL_VM *pVM) -{ - u_char c; - uint32_t port; - - port=stackPopUNS(pVM->pStack); - c=inb(port); - stackPushINT(pVM->pStack,c); -} - -/* - * Glue function to add the appropriate forth words to access x86 special cpu - * functionality. - */ -static void ficlCompileCpufunc(FICL_SYSTEM *pSys) -{ - FICL_DICT *dp = pSys->dp; - assert (dp); - - dictAppendWord(dp, "outb", ficlOutb, FW_DEFAULT); - dictAppendWord(dp, "inb", ficlInb, FW_DEFAULT); -} - -FICL_COMPILE_SET(ficlCompileCpufunc); - -#endif /* ** Stub function for dictionary access control - does nothing Modified: head/stand/ficl/loader.c ============================================================================== --- head/stand/ficl/loader.c Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/ficl/loader.c Thu Oct 24 20:02:48 2019 (r354043) @@ -287,6 +287,32 @@ ficlFindfile(FICL_VM *pVM) return; } +#ifndef TESTMAIN + +/* isvirtualized? - Return whether the loader runs under a + * hypervisor. + * + * isvirtualized? ( -- flag ) + */ +static void +ficlIsvirtualizedQ(FICL_VM *pVM) +{ + FICL_INT flag; + const char *hv; + +#if FICL_ROBUST > 1 + vmCheckStack(pVM, 0, 1); +#endif + + hv = (archsw.arch_hypervisor != NULL) + ? (*archsw.arch_hypervisor)() + : NULL; + flag = (hv != NULL) ? FICL_TRUE : FICL_FALSE; + stackPushINT(pVM->pStack, flag); +} + +#endif /* ndef TESTMAIN */ + void ficlCcall(FICL_VM *pVM) { @@ -840,7 +866,10 @@ void ficlCompilePlatform(FICL_SYSTEM *pSys) dictAppendWord(dp, "ccall", ficlCcall, FW_DEFAULT); dictAppendWord(dp, "uuid-from-string", ficlUuidFromString, FW_DEFAULT); dictAppendWord(dp, "uuid-to-string", ficlUuidToString, FW_DEFAULT); - +#ifndef TESTMAIN + dictAppendWord(dp, "isvirtualized?",ficlIsvirtualizedQ, FW_DEFAULT); +#endif + SET_FOREACH(fnpp, Xficl_compile_set) (*fnpp)(pSys); Added: head/stand/ficl/x86/sysdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/ficl/x86/sysdep.c Thu Oct 24 20:02:48 2019 (r354043) @@ -0,0 +1,51 @@ +/* $FreeBSD$ */ + +#ifndef TESTMAIN +#include + +/* + * outb ( port# c -- ) + * Store a byte to I/O port number port# + */ +void +ficlOutb(FICL_VM *pVM) +{ + u_char c; + uint32_t port; + + port=stackPopUNS(pVM->pStack); + c=(u_char)stackPopINT(pVM->pStack); + outb(port,c); +} + +/* + * inb ( port# -- c ) + * Fetch a byte from I/O port number port# + */ +void +ficlInb(FICL_VM *pVM) +{ + u_char c; + uint32_t port; + + port=stackPopUNS(pVM->pStack); + c=inb(port); + stackPushINT(pVM->pStack,c); +} + +/* + * Glue function to add the appropriate forth words to access x86 special cpu + * functionality. + */ +static void ficlCompileCpufunc(FICL_SYSTEM *pSys) +{ + FICL_DICT *dp = pSys->dp; + assert (dp); + + dictAppendWord(dp, "outb", ficlOutb, FW_DEFAULT); + dictAppendWord(dp, "inb", ficlInb, FW_DEFAULT); +} + +FICL_COMPILE_SET(ficlCompileCpufunc); + +#endif Modified: head/stand/i386/loader/main.c ============================================================================== --- head/stand/i386/loader/main.c Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/i386/loader/main.c Thu Oct 24 20:02:48 2019 (r354043) @@ -167,6 +167,7 @@ main(void) archsw.arch_readin = i386_readin; archsw.arch_isainb = isa_inb; archsw.arch_isaoutb = isa_outb; + archsw.arch_hypervisor = x86_hypervisor; #ifdef LOADER_ZFS_SUPPORT archsw.arch_zfs_probe = i386_zfs_probe; Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/libsa/Makefile Thu Oct 24 20:02:48 2019 (r354043) @@ -71,6 +71,11 @@ SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c m SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c SRCS+= ashldi3.c ashrdi3.c lshrdi3.c +.if ${MACHINE_CPUARCH:Namd64:Ni386} == "" +.PATH: ${SASRC}/x86 +SRCS+= hypervisor.c +.endif + .if ${MACHINE_CPUARCH} == "powerpc" SRCS+= syncicache.c .endif Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/libsa/stand.h Thu Oct 24 20:02:48 2019 (r354043) @@ -434,6 +434,8 @@ void *Reallocf(void *, size_t, const char *, int); void Free(void *, const char *, int); extern void mallocstats(void); +const char *x86_hypervisor(void); + #ifdef DEBUG_MALLOC #define malloc(x) Malloc(x, __FILE__, __LINE__) #define memalign(x, y) Memalign(x, y, __FILE__, __LINE__) Added: head/stand/libsa/x86/hypervisor.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/libsa/x86/hypervisor.c Thu Oct 24 20:02:48 2019 (r354043) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2013-2019 Juniper Networks, 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 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 + +const char * +x86_hypervisor(void) +{ + static union { + struct { + u_int high; + char name[13]; + } hv; + u_int regs[4]; + } u; + + /* Return NULL when no hypervisor is present. */ + do_cpuid(1, u.regs); + if ((u.regs[2] & CPUID2_HV) == 0) + return (NULL); + /* Return the hypervisor's identification. */ + do_cpuid(0x40000000, u.regs); + return (u.hv.name); +} From owner-svn-src-head@freebsd.org Thu Oct 24 20:05:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3F85159241; Thu, 24 Oct 2019 20:05:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdWq4pH0z4Yks; Thu, 24 Oct 2019 20:05:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 841611B66A; Thu, 24 Oct 2019 20:05:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OK5B13037386; Thu, 24 Oct 2019 20:05:11 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OK5AFp037383; Thu, 24 Oct 2019 20:05:10 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910242005.x9OK5AFp037383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 24 Oct 2019 20:05:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354044 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 354044 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:05:11 -0000 Author: tuexen Date: Thu Oct 24 20:05:10 2019 New Revision: 354044 URL: https://svnweb.freebsd.org/changeset/base/354044 Log: Ensure that the flags indicating IPv4/IPv6 are not changed by failing bind() calls. This would lead to inconsistent state resulting in a panic. A fix for stable/11 was committed in https://svnweb.freebsd.org/base?view=revision&revision=338986 An accelerated MFC is planned as discussed with emaste@. Reported by: syzbot+2609a378d89264ff5a42@syzkaller.appspotmail.com Obtained from: jtl@ MFC after: 1 day Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_usrreq.c head/sys/netinet6/sctp6_usrreq.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Thu Oct 24 20:02:48 2019 (r354043) +++ head/sys/netinet/tcp_usrreq.c Thu Oct 24 20:05:10 2019 (r354044) @@ -347,6 +347,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct inpcb *inp; struct tcpcb *tp = NULL; struct sockaddr_in6 *sin6; + u_char vflagsav; sin6 = (struct sockaddr_in6 *)nam; if (nam->sa_len != sizeof (*sin6)) @@ -363,6 +364,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { error = EINVAL; goto out; @@ -397,6 +399,8 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, error = in6_pcbbind(inp, nam, td->td_ucred); INP_HASH_WUNLOCK(&V_tcbinfo); out: + if (error != 0) + inp->inp_vflag = vflagsav; TCPDEBUG2(PRU_BIND); TCP_PROBE2(debug__user, tp, PRU_BIND); INP_WUNLOCK(inp); @@ -459,6 +463,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct int error = 0; struct inpcb *inp; struct tcpcb *tp = NULL; + u_char vflagsav; TCPDEBUG0; inp = sotoinpcb(so); @@ -468,6 +473,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct error = EINVAL; goto out; } + vflagsav = inp->inp_vflag; tp = intotcpcb(inp); TCPDEBUG1(); SOCK_LOCK(so); @@ -493,6 +499,9 @@ tcp6_usr_listen(struct socket *so, int backlog, struct if (IS_FASTOPEN(tp->t_flags)) tp->t_tfo_pending = tcp_fastopen_alloc_counter(); + if (error != 0) + inp->inp_vflag = vflagsav; + out: TCPDEBUG2(PRU_LISTEN); TCP_PROBE2(debug__user, tp, PRU_LISTEN); @@ -569,6 +578,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n struct inpcb *inp; struct tcpcb *tp = NULL; struct sockaddr_in6 *sin6; + u_int8_t incflagsav; + u_char vflagsav; TCPDEBUG0; @@ -585,6 +596,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; + incflagsav = inp->inp_inc.inc_flags; if (inp->inp_flags & INP_TIMEWAIT) { error = EADDRINUSE; goto out; @@ -618,11 +631,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n error = EAFNOSUPPORT; goto out; } - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; if ((error = prison_remote_ip4(td->td_ucred, &sin.sin_addr)) != 0) goto out; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; if ((error = tcp_connect(tp, (struct sockaddr *)&sin, td)) != 0) goto out; #ifdef TCP_OFFLOAD @@ -640,11 +653,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n } } #endif + if ((error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr)) != 0) + goto out; inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; inp->inp_inc.inc_flags |= INC_ISIPV6; - if ((error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr)) != 0) - goto out; if ((error = tcp6_connect(tp, nam, td)) != 0) goto out; #ifdef TCP_OFFLOAD @@ -657,6 +670,15 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n error = tp->t_fb->tfb_tcp_output(tp); out: + /* + * If the implicit bind in the connect call fails, restore + * the flags we modified. + */ + if (error != 0 && inp->inp_lport == 0) { + inp->inp_vflag = vflagsav; + inp->inp_inc.inc_flags = incflagsav; + } + TCPDEBUG2(PRU_CONNECT); TCP_PROBE2(debug__user, tp, PRU_CONNECT); INP_WUNLOCK(inp); @@ -912,6 +934,9 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf #ifdef INET6 int isipv6; #endif + u_int8_t incflagsav; + u_char vflagsav; + bool restoreflags; TCPDEBUG0; /* @@ -923,6 +948,9 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_send: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; + incflagsav = inp->inp_inc.inc_flags; + restoreflags = false; if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { if (control) m_freem(control); @@ -1003,6 +1031,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf m_freem(m); goto out; } + restoreflags = true; inp->inp_vflag &= ~INP_IPV6; sinp = &sin; in6_sin6_2_sin(sinp, sin6); @@ -1033,6 +1062,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf error = EAFNOSUPPORT; goto out; } + restoreflags = true; inp->inp_vflag &= ~INP_IPV4; inp->inp_inc.inc_flags |= INC_ISIPV6; if ((error = prison_remote_ip6(td->td_ucred, @@ -1083,6 +1113,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf error = tcp_connect(tp, (struct sockaddr *)sinp, td); #endif + /* + * The bind operation in tcp_connect succeeded. We + * no longer want to restore the flags if later + * operations fail. + */ + if (error == 0 || inp->inp_lport != 0) + restoreflags = false; + if (error) goto out; if (IS_FASTOPEN(tp->t_flags)) @@ -1153,6 +1191,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf error = tcp_connect(tp, (struct sockaddr *)sinp, td); #endif + /* + * The bind operation in tcp_connect succeeded. We + * no longer want to restore the flags if later + * operations fail. + */ + if (error == 0 || inp->inp_lport != 0) + restoreflags = false; + if (error) goto out; tp->snd_wnd = TTCP_CLIENT_SND_WND; @@ -1171,6 +1217,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf TCP_LOG_USERSEND, error, 0, NULL, false); out: + /* + * If the request was unsuccessful and we changed flags, + * restore the original flags. + */ + if (error != 0 && restoreflags) { + inp->inp_vflag = vflagsav; + inp->inp_inc.inc_flags = incflagsav; + } TCPDEBUG2((flags & PRUS_OOB) ? PRU_SENDOOB : ((flags & PRUS_EOF) ? PRU_SEND_EOF : PRU_SEND)); TCP_PROBE2(debug__user, tp, (flags & PRUS_OOB) ? PRU_SENDOOB : Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Thu Oct 24 20:02:48 2019 (r354043) +++ head/sys/netinet6/sctp6_usrreq.c Thu Oct 24 20:05:10 2019 (r354044) @@ -558,6 +558,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s { struct sctp_inpcb *inp; int error; + u_char vflagsav; inp = (struct sctp_inpcb *)so->so_pcb; if (inp == NULL) { @@ -588,6 +589,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s return (EINVAL); } } + vflagsav = inp->ip_inp.inp.inp_vflag; inp->ip_inp.inp.inp_vflag &= ~INP_IPV4; inp->ip_inp.inp.inp_vflag |= INP_IPV6; if ((addr != NULL) && (SCTP_IPV6_V6ONLY(inp) == 0)) { @@ -617,7 +619,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s inp->ip_inp.inp.inp_vflag |= INP_IPV4; inp->ip_inp.inp.inp_vflag &= ~INP_IPV6; error = sctp_inpcb_bind(so, (struct sockaddr *)&sin, NULL, p); - return (error); + goto out; } #endif break; @@ -634,7 +636,8 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s if (addr->sa_family == AF_INET) { /* can't bind v4 addr to v6 only socket! */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return (EINVAL); + error = EINVAL; + goto out; } #endif sin6_p = (struct sockaddr_in6 *)addr; @@ -643,10 +646,14 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s /* can't bind v4-mapped addrs either! */ /* NOTE: we don't support SIIT */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return (EINVAL); + error = EINVAL; + goto out; } } error = sctp_inpcb_bind(so, addr, NULL, p); +out: + if (error != 0) + inp->ip_inp.inp.inp_vflag = vflagsav; return (error); } Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Thu Oct 24 20:02:48 2019 (r354043) +++ head/sys/netinet6/udp6_usrreq.c Thu Oct 24 20:05:10 2019 (r354044) @@ -1143,6 +1143,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str struct inpcb *inp; struct inpcbinfo *pcbinfo; int error; + u_char vflagsav; pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); @@ -1150,6 +1151,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str INP_WLOCK(inp); INP_HASH_WLOCK(pcbinfo); + vflagsav = inp->inp_vflag; inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { @@ -1177,6 +1179,8 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str #ifdef INET out: #endif + if (error != 0) + inp->inp_vflag = vflagsav; INP_HASH_WUNLOCK(pcbinfo); INP_WUNLOCK(inp); return (error); @@ -1223,6 +1227,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct inpcbinfo *pcbinfo; struct sockaddr_in6 *sin6; int error; + u_char vflagsav; pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); @@ -1250,17 +1255,26 @@ udp6_connect(struct socket *so, struct sockaddr *nam, goto out; } in6_sin6_2_sin(&sin, sin6); - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; error = prison_remote_ip4(td->td_ucred, &sin.sin_addr); if (error != 0) goto out; + vflagsav = inp->inp_vflag; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; INP_HASH_WLOCK(pcbinfo); error = in_pcbconnect(inp, (struct sockaddr *)&sin, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + /* + * If connect succeeds, mark socket as connected. If + * connect fails and socket is unbound, reset inp_vflag + * field. + */ if (error == 0) soisconnected(so); + else if (inp->inp_laddr.s_addr == INADDR_ANY && + inp->inp_lport == 0) + inp->inp_vflag = vflagsav; goto out; } else { if ((inp->inp_vflag & INP_IPV6) == 0) { @@ -1273,16 +1287,25 @@ udp6_connect(struct socket *so, struct sockaddr *nam, error = EISCONN; goto out; } - inp->inp_vflag &= ~INP_IPV4; - inp->inp_vflag |= INP_IPV6; error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr); if (error != 0) goto out; + vflagsav = inp->inp_vflag; + inp->inp_vflag &= ~INP_IPV4; + inp->inp_vflag |= INP_IPV6; INP_HASH_WLOCK(pcbinfo); error = in6_pcbconnect(inp, nam, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + /* + * If connect succeeds, mark socket as connected. If + * connect fails and socket is unbound, reset inp_vflag + * field. + */ if (error == 0) soisconnected(so); + else if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) && + inp->inp_lport == 0) + inp->inp_vflag = vflagsav; out: INP_WUNLOCK(inp); return (error); From owner-svn-src-head@freebsd.org Thu Oct 24 20:08:39 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5719715932C; Thu, 24 Oct 2019 20:08:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdbq2JRHz4YtV; Thu, 24 Oct 2019 20:08:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DB081B66F; Thu, 24 Oct 2019 20:08:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OK8d9p037604; Thu, 24 Oct 2019 20:08:39 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OK8YRY037580; Thu, 24 Oct 2019 20:08:34 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910242008.x9OK8YRY037580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 20:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354045 - head/tests/sys/netinet6/frag6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/tests/sys/netinet6/frag6 X-SVN-Commit-Revision: 354045 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:08:39 -0000 Author: bz Date: Thu Oct 24 20:08:33 2019 New Revision: 354045 URL: https://svnweb.freebsd.org/changeset/base/354045 Log: frag6 test cases: check more counters, wait for expiry When done with tests check that both the per-VNET and the global-fragmented- packets-in-system counters are zero to make sure we do not leak counters or queue entries. This implies that for all test cases we either have to check for the ICMPv6 packet sent in case of TLL=0 expiry (if it is sent) or sleep at least long enough for the TTL to expire for all packets (e.g., fragments where we do not have the off=0 packet). This also means that statistics are now updated to include all the expired packets. There are cases when we do not check for counters to be zero and this is when testing VNET teardown to behave properly and not panic, when we are intentionally leaving fragments in the system. MFC after: 3 weeks Sponsored by: Netflix Modified: head/tests/sys/netinet6/frag6/frag6_01.sh head/tests/sys/netinet6/frag6/frag6_02.sh head/tests/sys/netinet6/frag6/frag6_03.py head/tests/sys/netinet6/frag6/frag6_03.sh head/tests/sys/netinet6/frag6/frag6_04.sh head/tests/sys/netinet6/frag6/frag6_05.py head/tests/sys/netinet6/frag6/frag6_05.sh head/tests/sys/netinet6/frag6/frag6_06.sh head/tests/sys/netinet6/frag6/frag6_07.py head/tests/sys/netinet6/frag6/frag6_07.sh head/tests/sys/netinet6/frag6/frag6_08.py head/tests/sys/netinet6/frag6/frag6_08.sh head/tests/sys/netinet6/frag6/frag6_09.sh head/tests/sys/netinet6/frag6/frag6_10.py head/tests/sys/netinet6/frag6/frag6_10.sh head/tests/sys/netinet6/frag6/frag6_11.sh head/tests/sys/netinet6/frag6/frag6_12.sh head/tests/sys/netinet6/frag6/frag6_13.py head/tests/sys/netinet6/frag6/frag6_13.sh head/tests/sys/netinet6/frag6/frag6_14.py head/tests/sys/netinet6/frag6/frag6_14.sh head/tests/sys/netinet6/frag6/frag6_15.sh head/tests/sys/netinet6/frag6/frag6_16.sh Modified: head/tests/sys/netinet6/frag6/frag6_01.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_01.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_01.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_01_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_02.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_02.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_02.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_02_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_03.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_03.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_03.py Thu Oct 24 20:08:33 2019 (r354045) @@ -82,20 +82,21 @@ def main(): ######################################################################## # - # (1) Atomic fragment. + # Atomic fragment. # # A: Nothing listening on UDP port. # R: ICMPv6 dst unreach, unreach port. # ip6f01 = sp.Ether() / \ sp.IPv6(src=args.src[0], dst=args.to[0]) / \ - sp.IPv6ExtHdrFragment(offset=0, m=0, id=1) / \ + sp.IPv6ExtHdrFragment(offset=0, m=0, id=3) / \ sp.UDP(dport=3456, sport=6543) if args.debug : ip6f01.display() sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) sleep(0.10) + sniffer.setEnd() sniffer.join() if not sniffer.foundCorrectPacket: sys.exit(1) Modified: head/tests/sys/netinet6/frag6/frag6_03.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_03.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_03.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_03_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_04.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_04.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_04.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_04_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_05.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_05.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_05.py Thu Oct 24 20:08:33 2019 (r354045) @@ -76,6 +76,8 @@ def main(): ip6f01.display() sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) + # Wait for possible expiry to happen. + sleep(75) sys.exit(0) if __name__ == '__main__': Modified: head/tests/sys/netinet6/frag6/frag6_05.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_05.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_05.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -47,6 +47,17 @@ frag6_05_check_stats_0() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + # # Check that the sysctl is set to what we expect. # @@ -229,6 +240,16 @@ frag6_05_check_stats_1() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check that the sysctl is set to what we expect. @@ -272,7 +293,7 @@ EOF 0 20 10 - 0 + 10 0 0 0 @@ -300,7 +321,7 @@ EOF # XXX-TODO check output histogram (just too hard to parse [no multi-line-grep]) # cat < ${HOME}/filter-${jname}.txt - 0 + 10 0 0 0 @@ -308,7 +329,7 @@ EOF 0 0 0 - 0 + 10 0 0 0 @@ -372,10 +393,10 @@ EOF 0 0 0 - 0 + 10 0 0 - 0 + 10 0 0 0 Modified: head/tests/sys/netinet6/frag6/frag6_06.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_06.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_06.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -61,6 +61,17 @@ frag6_06_check_stats_0() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + # # Check that the sysctl is set to what we expect. # Modified: head/tests/sys/netinet6/frag6/frag6_07.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_07.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_07.py Thu Oct 24 20:08:33 2019 (r354045) @@ -54,6 +54,25 @@ def check_icmp6_error(args, packet): #icmp6.display() return True +def check_icmp6_error_2(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6TimeExceeded) + if not icmp6: + return False + # ICMP6_TIME_EXCEED_REASSEMBLY 1 + if icmp6.code != 1: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Time Exceeded / Frag reassembly so leave it. + #icmp6.display() + return True + def main(): parser = argparse.ArgumentParser("frag6.py", description="IPv6 fragementation test tool") @@ -78,6 +97,7 @@ def main(): # Start sniffing on recvif sniffer = Sniffer(args, check_icmp6_error) + sniffer2 = Sniffer(args, check_icmp6_error_2) ######################################################################## @@ -88,6 +108,7 @@ def main(): # # A: Reassembly failure. # R: ICMPv6 param prob, param header. + # R: ICMPv6 timeout (1st frag, off=0) # data = "6" * 1280 ip6f01 = \ @@ -142,6 +163,13 @@ def main(): sniffer.setEnd() sniffer.join() if not sniffer.foundCorrectPacket: + sys.exit(1) + + # Wait for expiry from first test run. + sleep(75) + sniffer2.setEnd() + sniffer2.join() + if not sniffer2.foundCorrectPacket: sys.exit(1) sys.exit(0) Modified: head/tests/sys/netinet6/frag6/frag6_07.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_07.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_07.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -47,6 +47,17 @@ frag6_07_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + # # Check selection of global UDP stats. # @@ -81,7 +92,7 @@ EOF 0 3 0 - 0 + 1 0 0 0 @@ -109,7 +120,7 @@ EOF # XXX-TODO check output histogram (just too hard to parse [no multi-line-grep]) # cat < ${HOME}/filter-${jname}.txt - 2 + 3 0 0 0 @@ -117,7 +128,7 @@ EOF 0 0 0 - 0 + 1 2 0 0 @@ -181,10 +192,10 @@ EOF 0 0 0 - 2 + 3 0 0 - 0 + 1 2 0 0 Modified: head/tests/sys/netinet6/frag6/frag6_08.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_08.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_08.py Thu Oct 24 20:08:33 2019 (r354045) @@ -54,6 +54,26 @@ def check_icmp6_error(args, packet): #icmp6.display() return True +def check_icmp6_error_2(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6TimeExceeded) + if not icmp6: + return False + # ICMP6_TIME_EXCEED_REASSEMBLY 1 + if icmp6.code != 1: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Time Exceeded / Frag reassembly so leave it. + #icmp6.display() + return True + + def main(): parser = argparse.ArgumentParser("frag6.py", description="IPv6 fragementation test tool") @@ -78,15 +98,20 @@ def main(): # Start sniffing on recvif sniffer = Sniffer(args, check_icmp6_error) + sniffer2 = Sniffer(args, check_icmp6_error_2) ######################################################################## # # A fragment with payload and offset set to add up to >64k when # another frag with offset=0 arrives and has an unfrag part. + # This is us checking for all fragments queued already when the + # one with off=0 arrives. Note: unless the off=0 has its own problem + # it will be queued and off!=0 ones might be expunged with param prob. # - # A: Reassembly failure (timeout) after - # R: ICMPv6 param prob, param header (earlier). + # A: Reassembly failure, timeout after + # R: ICMPv6 param prob, param header (1st frag) + # R: ICMPv6 time exceeded (2nd frag, as off=0) # data = "6" * 15 ip6f01 = \ @@ -114,6 +139,11 @@ def main(): sniffer.setEnd() sniffer.join() if not sniffer.foundCorrectPacket: + sys.exit(1) + sleep(75) + sniffer2.setEnd() + sniffer2.join() + if not sniffer2.foundCorrectPacket: sys.exit(1) sys.exit(0) Modified: head/tests/sys/netinet6/frag6/frag6_08.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_08.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_08.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -47,6 +47,17 @@ frag6_08_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + # # Check selection of global UDP stats. # @@ -81,7 +92,7 @@ EOF 0 2 0 - 0 + 1 0 0 0 @@ -109,7 +120,7 @@ EOF # XXX-TODO check output histogram (just too hard to parse [no multi-line-grep]) # cat < ${HOME}/filter-${jname}.txt - 1 + 2 0 0 0 @@ -117,7 +128,7 @@ EOF 0 0 0 - 0 + 1 1 0 0 @@ -181,10 +192,10 @@ EOF 0 0 0 - 1 + 2 0 0 - 0 + 1 1 0 0 Modified: head/tests/sys/netinet6/frag6/frag6_09.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_09.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_09.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_09_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_10.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_10.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_10.py Thu Oct 24 20:08:33 2019 (r354045) @@ -72,6 +72,8 @@ def main(): sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) # We do not generate ICMPv6 for non-off=0-segments. + # Wait for expiry. + sleep(75) sys.exit(0) Modified: head/tests/sys/netinet6/frag6/frag6_10.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_10.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_10.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_10_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. @@ -77,8 +87,8 @@ EOF # # Check selection of global IPv6 stats. - # We do not seem to sent a timeout ICMPv6 for this one? - # No, as it is not an off=0 segment. + # We do not sent a timeout ICMPv6 for this one + # as it is not an off=0 segment. # cat < ${HOME}/filter-${jname}.txt 0 @@ -87,7 +97,7 @@ EOF 0 1 0 - 0 + 1 0 0 0 Modified: head/tests/sys/netinet6/frag6/frag6_11.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_11.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_11.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_11_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_12.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_12.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_12.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_12_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_13.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_13.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_13.py Thu Oct 24 20:08:33 2019 (r354045) @@ -114,6 +114,8 @@ def main(): sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) sp.sendp(ip6f02, iface=args.sendif[0], verbose=False) + # Wait for expiry. + sleep(75) sys.exit(0) if __name__ == '__main__': Modified: head/tests/sys/netinet6/frag6/frag6_13.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_13.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_13.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_13_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. @@ -85,7 +95,7 @@ EOF 0 4 2 - 0 + 2 0 0 0 @@ -112,7 +122,7 @@ EOF # Check selection of global ICMPv6 stats. # cat < ${HOME}/filter-${jname}.txt - 0 + 2 0 0 0 @@ -120,7 +130,7 @@ EOF 0 0 0 - 0 + 2 0 0 0 @@ -184,10 +194,10 @@ EOF 0 0 0 - 0 + 2 0 0 - 0 + 2 0 0 0 Modified: head/tests/sys/netinet6/frag6/frag6_14.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_14.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_14.py Thu Oct 24 20:08:33 2019 (r354045) @@ -129,6 +129,8 @@ def main(): sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) sp.sendp(ip6f02, iface=args.sendif[0], verbose=False) + # Wait for expiry. + sleep(75) sys.exit(0) if __name__ == '__main__': Modified: head/tests/sys/netinet6/frag6/frag6_14.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_14.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_14.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_14_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. @@ -85,7 +95,7 @@ EOF 0 6 2 - 0 + 4 0 0 0 @@ -112,7 +122,7 @@ EOF # Check selection of global ICMPv6 stats. # cat < ${HOME}/filter-${jname}.txt - 0 + 1 0 0 0 @@ -120,7 +130,7 @@ EOF 0 0 0 - 0 + 1 0 0 0 @@ -184,10 +194,10 @@ EOF 0 0 0 - 0 + 1 0 0 - 0 + 1 0 0 0 Modified: head/tests/sys/netinet6/frag6/frag6_15.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_15.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_15.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -61,6 +61,17 @@ frag6_15_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + # # Check that the sysctl is set to what we expect. # Modified: head/tests/sys/netinet6/frag6/frag6_16.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_16.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_16.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -48,6 +48,17 @@ frag6_16_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + # # Check selection of global UDP stats. # From owner-svn-src-head@freebsd.org Thu Oct 24 20:22:53 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4330F1598CF; Thu, 24 Oct 2019 20:22:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdwF0LHVz4Zfm; Thu, 24 Oct 2019 20:22:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E36C81BA13; Thu, 24 Oct 2019 20:22:52 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OKMq1e049629; Thu, 24 Oct 2019 20:22:52 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OKMqjA049628; Thu, 24 Oct 2019 20:22:52 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910242022.x9OKMqjA049628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 20:22:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354046 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354046 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:22:53 -0000 Author: bz Date: Thu Oct 24 20:22:52 2019 New Revision: 354046 URL: https://svnweb.freebsd.org/changeset/base/354046 Log: frag6: handling of overlapping fragments to conform to RFC 8200 While the comment was updated in r350746, the code was not. RFC8200 says that unless fragment overlaps are exact (same fragment twice) not only the current fragment but the entire reassembly queue for this packet must be silently discarded, which we now do if fragment offset and fragment length do not match. Obtained from: jtl MFC after: 3 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D16850 Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 20:08:33 2019 (r354045) +++ head/sys/netinet6/frag6.c Thu Oct 24 20:22:52 2019 (r354046) @@ -712,6 +712,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) if (af6tmp != NULL) { if (af6tmp->ip6af_off + af6tmp->ip6af_frglen - ip6af->ip6af_off > 0) { + if (af6tmp->ip6af_off != ip6af->ip6af_off || + af6tmp->ip6af_frglen != ip6af->ip6af_frglen) + frag6_freef(q6, bucket); free(ip6af, M_FRAG6); goto dropfrag; } @@ -719,6 +722,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) if (af6 != NULL) { if (ip6af->ip6af_off + ip6af->ip6af_frglen - af6->ip6af_off > 0) { + if (af6->ip6af_off != ip6af->ip6af_off || + af6->ip6af_frglen != ip6af->ip6af_frglen) + frag6_freef(q6, bucket); free(ip6af, M_FRAG6); goto dropfrag; } From owner-svn-src-head@freebsd.org Thu Oct 24 20:40:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B37A3159DA6 for ; Thu, 24 Oct 2019 20:40:32 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 46zfJb0092z4bRS for ; Thu, 24 Oct 2019 20:40:30 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb1-xb35.google.com with SMTP id c7so70130ybk.10 for ; Thu, 24 Oct 2019 13:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=UYqMM0G4SJFyX38B507pzj56u1MaiZHgKWduO/NSW/E=; b=SVv4DAvKdBQU7/rUAk0/XxTFVgXot4BhAPGEbqikr2O4Obmqb0WwxM6PygyVfnNgZw 0yKplLCh8Rz3giD7zTdgQsbENVGKgvvZIK5p+uiOMP4oIaTUTj21PG/jsrA08I892+na nohfjj+txjbfJYjGN6M14QUlaUfEGRpGizmfEFTe3J8RdLFRBYGu7rvmAOqzo/p7ViGw 7ogBRFK9dnfH6CBJCFuTLRjFylJxJGIk7W7iUeSST/DFBrfteXgkC+z/+j4bmcbsDcxe ZU0qyLXN3aRpRtex572rXyP6NM6a4v0TNi5f/yHLSN7L2b2kEX6xFCbpUt+7iUxRGsOE vIoA== 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=UYqMM0G4SJFyX38B507pzj56u1MaiZHgKWduO/NSW/E=; b=Nt+R3yzPnsQ3zJS5Rsd3soueAxoos3HrpPYGwAmuuOs06yfOurXsNeBviQJEPRsdgf hY0NAVFx28VzW4MW8n455QZRyDwVfIzL7nNt59DG+0D02nvG/Qs9hfr+bRNAj1uSYTV8 IIQOkh5LbAz6jEJ4yMwq9Wna3fRJOYcgSiQQDmHgTPLf+ubO9R8GtNu/j3+jmQl/SstD h1axGFhhZoNclnz6gVMKsWLaok5YRr6+M86WKa8o+hxHHnLpfcRqQmF78LEey8dZQo7B LyXkAZT26Pd2ORZVDC5trWouKe08xUI6Au2hCT+PavrbuMGvthD0JyPnbnIUXqz78csD Mxsw== X-Gm-Message-State: APjAAAXzBaLq9it87FndOZWBR850U6ZeXEhf4mDYiAe5+d6OKUGtWEIx 2NEmF/xCM/IA2YOOJJiVfp455SGFZJYbjcFtnCv/cg== X-Google-Smtp-Source: APXvYqyNOOt/QzzSxZU+gEKqVJ3Cd2X9MCEz63LlCSsWtQeA0eclsgPCnJxv76ylLYHDTwnBFQo5e1JzjZPB+vGGEes= X-Received: by 2002:a25:bacb:: with SMTP id a11mr194599ybk.483.1571949629638; Thu, 24 Oct 2019 13:40:29 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:7b47:0:0:0:0:0 with HTTP; Thu, 24 Oct 2019 13:40:29 -0700 (PDT) In-Reply-To: <201910241952.x9OJqgTM031090@repo.freebsd.org> References: <201910241952.x9OJqgTM031090@repo.freebsd.org> From: Oliver Pinter Date: Thu, 24 Oct 2019 22:40:29 +0200 Message-ID: Subject: Re: svn commit: r354039 - head/stand/efi/loader To: "Simon J. Gerraty" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 46zfJb0092z4bRS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=SVv4DAvK; dmarc=none; spf=pass (mx1.freebsd.org: domain of oliver.pinter@hardenedbsd.org designates 2607:f8b0:4864:20::b35 as permitted sender) smtp.mailfrom=oliver.pinter@hardenedbsd.org X-Spamd-Result: default: False [-4.29 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; URI_COUNT_ODD(1.00)[9]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; RCVD_IN_DNSWL_NONE(0.00)[5.3.b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.79)[ip: (-9.45), ipnet: 2607:f8b0::/32(-2.41), asn: 15169(-2.05), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:40:32 -0000 On Thursday, October 24, 2019, Simon J. Gerraty wrote: > Author: sjg > Date: Thu Oct 24 19:52:41 2019 > New Revision: 354039 > URL: https://svnweb.freebsd.org/changeset/base/354039 > > Log: > Allow loader.efi to identify non-standard boot setup > > PATH_BOOTABLE_TOKEN can be set to a non-standard > path that identifies a device as bootable. > > Reviewed by: kevans, bcran > Differential Revision: https://reviews.freebsd.org/D22062 > > Modified: > head/stand/efi/loader/main.c This will be a different patch. The committed code and the code in phabricator differs. > > Modified: head/stand/efi/loader/main.c > ============================================================ > ================== > --- head/stand/efi/loader/main.c Thu Oct 24 19:50:18 2019 > (r354038) > +++ head/stand/efi/loader/main.c Thu Oct 24 19:52:41 2019 > (r354039) > @@ -863,6 +863,7 @@ main(int argc, CHAR16 *argv[]) > archsw.arch_getdev = efi_getdev; > archsw.arch_copyin = efi_copyin; > archsw.arch_copyout = efi_copyout; > + archsw.arch_hypervisor = x86_hypervisor; > archsw.arch_readin = efi_readin; > archsw.arch_zfs_probe = efi_zfs_probe; > > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Thu Oct 24 21:28:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B730E15AC32; Thu, 24 Oct 2019 21:28:37 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zgN54QHWz4dbh; Thu, 24 Oct 2019 21:28:37 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 774851C4B1; Thu, 24 Oct 2019 21:28:37 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OLSbOG085175; Thu, 24 Oct 2019 21:28:37 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OLSbqS085174; Thu, 24 Oct 2019 21:28:37 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201910242128.x9OLSbqS085174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 24 Oct 2019 21:28:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354050 - head/sys/ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ufs X-SVN-Commit-Revision: 354050 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 21:28:37 -0000 Author: mckusick Date: Thu Oct 24 21:28:37 2019 New Revision: 354050 URL: https://svnweb.freebsd.org/changeset/base/354050 Log: After the unlink() of one name of a file with multiple links, a stat() of one of the remaining names of the file does not show an updated ctime (inode modification time) until several seconds after the unlink() completes. The problem only occurs when the filesystem is running with soft updates enabled. When running with soft updates, the ctime is not updated until the soft updates background process has settled all the needed I/O operations. This commit causes the ctime to be updated immediately during the unlink(). A side effect of this change is that the ctime is updated again when soft updates has finished its processing because that is the time that is correct from the perspective of programs that look at the disk (like dump). This change does not cause any extra I/O to be done, it just ensures that stat() updates the ctime before handing it back. PR: 241373 Reported by: Alan Somers Tested by: Alan Somers MFC after: 3 days Sponsored by: Netflix Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Thu Oct 24 21:10:09 2019 (r354049) +++ head/sys/ufs/ufs/ufs_lookup.c Thu Oct 24 21:28:37 2019 (r354050) @@ -1178,6 +1178,7 @@ ufs_dirremove(dvp, ip, flags, isrmdir) */ if (ip) { ip->i_effnlink--; + ip->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(dvp)) { softdep_setup_unlink(dp, ip); } else { @@ -1291,6 +1292,7 @@ ufs_dirrewrite(dp, oip, newinum, newtype, isrmdir) * necessary. */ oip->i_effnlink--; + oip->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(vdp)) { softdep_setup_unlink(dp, oip); } else { From owner-svn-src-head@freebsd.org Thu Oct 24 21:55:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29E8C15B51C; Thu, 24 Oct 2019 21:55:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zgyw0MVBz4g2p; Thu, 24 Oct 2019 21:55:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E44761CA04; Thu, 24 Oct 2019 21:55:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OLtJCV002534; Thu, 24 Oct 2019 21:55:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OLtJjJ002532; Thu, 24 Oct 2019 21:55:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910242155.x9OLtJjJ002532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 24 Oct 2019 21:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354052 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354052 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 21:55:20 -0000 Author: glebius Date: Thu Oct 24 21:55:19 2019 New Revision: 354052 URL: https://svnweb.freebsd.org/changeset/base/354052 Log: Use THREAD_CAN_SLEEP() macro to check if thread can sleep. There is no functional change. Discussed with: kib Modified: head/sys/kern/subr_sleepqueue.c head/sys/kern/subr_trap.c Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Thu Oct 24 21:43:01 2019 (r354051) +++ head/sys/kern/subr_sleepqueue.c Thu Oct 24 21:55:19 2019 (r354052) @@ -315,7 +315,7 @@ sleepq_add(void *wchan, struct lock_object *lock, cons MPASS((queue >= 0) && (queue < NR_SLEEPQS)); /* If this thread is not allowed to sleep, die a horrible death. */ - KASSERT(td->td_no_sleeping == 0, + KASSERT(THREAD_CAN_SLEEP(), ("%s: td %p to sleep on wchan %p with sleeping prohibited", __func__, td, wchan)); Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Thu Oct 24 21:43:01 2019 (r354051) +++ head/sys/kern/subr_trap.c Thu Oct 24 21:55:19 2019 (r354052) @@ -185,7 +185,7 @@ userret(struct thread *td, struct trapframe *frame) td->td_lk_slocks)); KASSERT((td->td_pflags & TDP_NOFAULTING) == 0, ("userret: Returning with pagefaults disabled")); - KASSERT(td->td_no_sleeping == 0, + KASSERT(THREAD_CAN_SLEEP(), ("userret: Returning with sleep disabled")); KASSERT(td->td_pinned == 0 || (td->td_pflags & TDP_CALLCHAIN) != 0, ("userret: Returning with with pinned thread")); From owner-svn-src-head@freebsd.org Thu Oct 24 22:07:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B92915B84C; Thu, 24 Oct 2019 22:07:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zhFG4NbQz3C0y; Thu, 24 Oct 2019 22:07:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A47F1CBE7; Thu, 24 Oct 2019 22:07:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OM7kP9008744; Thu, 24 Oct 2019 22:07:46 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OM7jf7008740; Thu, 24 Oct 2019 22:07:45 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910242207.x9OM7jf7008740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 22:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354053 - in head: sys/netinet6 tests/sys/netinet6/frag6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head: sys/netinet6 tests/sys/netinet6/frag6 X-SVN-Commit-Revision: 354053 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 22:07:46 -0000 Author: bz Date: Thu Oct 24 22:07:45 2019 New Revision: 354053 URL: https://svnweb.freebsd.org/changeset/base/354053 Log: frag6: prevent overwriting initial fragoff=0 packet meta-data. When we receive the packet with the first fragmented part (fragoff=0) we remember the length of the unfragmentable part and the next header (and should probably also remember ECN) as meta-data on the reassembly queue. Someone replying this packet so far could change these 2 (3) values. While changing the next header seems more severe, for a full size fragmented UDP packet, for example, adding an extension header to the unfragmentable part would go unnoticed (as the framented part would be considered an exact duplicate) but make reassembly fail. So do not allow updating the meta-data after we have seen the first fragmented part anymore. The frag6_20 test case is added which failed before triggering an ICMPv6 "param prob" due to the check for each queued fragment for a max-size violation if a fragoff=0 packet was received. MFC after: 3 weeks Sponsored by: Netflix Added: head/tests/sys/netinet6/frag6/frag6_20.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_20.sh (contents, props changed) Modified: head/sys/netinet6/frag6.c head/tests/sys/netinet6/frag6/Makefile Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 21:55:19 2019 (r354052) +++ head/sys/netinet6/frag6.c Thu Oct 24 22:07:45 2019 (r354053) @@ -561,11 +561,16 @@ frag6_input(struct mbuf **mp, int *offp, int proto) /* * If it is the 1st fragment, record the length of the * unfragmentable part and the next header of the fragment header. + * Assume the first 1st fragement to arrive will be correct. + * We do not have any duplicate checks here yet so another packet + * with fragoff == 0 could come and overwrite the ip6q_unfrglen + * and worse, the next header, at any time. */ - if (fragoff == 0) { + if (fragoff == 0 && q6->ip6q_unfrglen == -1) { q6->ip6q_unfrglen = offset - sizeof(struct ip6_hdr) - sizeof(struct ip6_frag); q6->ip6q_nxt = ip6f->ip6f_nxt; + /* XXX ECN? */ } /* Modified: head/tests/sys/netinet6/frag6/Makefile ============================================================================== --- head/tests/sys/netinet6/frag6/Makefile Thu Oct 24 21:55:19 2019 (r354052) +++ head/tests/sys/netinet6/frag6/Makefile Thu Oct 24 22:07:45 2019 (r354053) @@ -27,7 +27,8 @@ ATF_TESTS_SH= \ frag6_16 \ frag6_17 \ frag6_18 \ - frag6_19 + frag6_19 \ + frag6_20 ${PACKAGE}FILES+= frag6.subr ${PACKAGE}FILES+= sniffer.py @@ -50,6 +51,7 @@ ${PACKAGE}FILES+= frag6_16.py ${PACKAGE}FILES+= frag6_17.py ${PACKAGE}FILES+= frag6_18.py ${PACKAGE}FILES+= frag6_19.py +${PACKAGE}FILES+= frag6_20.py ${PACKAGE}FILESMODE_frag6.subr= 0444 ${PACKAGE}FILESMODE_sniffer.py= 0555 @@ -72,5 +74,6 @@ ${PACKAGE}FILESMODE_frag6_16.py= 0555 ${PACKAGE}FILESMODE_frag6_17.py= 0555 ${PACKAGE}FILESMODE_frag6_18.py= 0555 ${PACKAGE}FILESMODE_frag6_19.py= 0555 +${PACKAGE}FILESMODE_frag6_20.py= 0555 .include Added: head/tests/sys/netinet6/frag6/frag6_20.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_20.py Thu Oct 24 22:07:45 2019 (r354053) @@ -0,0 +1,137 @@ +#!/usr/bin/env python +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 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$ +# + +import argparse +import scapy.all as sp +import socket +import sys +from sniffer import Sniffer +from time import sleep + +def check_icmp6_error(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6TimeExceeded) + if not icmp6: + return False + # ICMP6_TIME_EXCEED_REASSEMBLY 1 + if icmp6.code != 1: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Time Exceeded / Frag reassembly so leave it. + #icmp6.display() + return True + + +def main(): + parser = argparse.ArgumentParser("frag6.py", + description="IPv6 fragementation test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + parser.add_argument('--debug', + required=False, action='store_true', + help='Enable test debugging') + + args = parser.parse_args() + + + # Start sniffing on recvif + sniffer = Sniffer(args, check_icmp6_error) + + + ######################################################################## + # + # Send a proper first fragment (off=0) and a second fragment which + # just fits the 64k. The re-send the first fragment with an extra + # unfragmentable part making the 64k to exceed the limit. + # This is to make sure we don't allow to update meta-data for a + # 1st fragmented packet should a second arrive but given the + # fragmentable part is an exact duplicate only that fragment + # will be silently discarded. + # + # A: Reassembly failure, timeout after + # R: ICMPv6 time exceeded / statistics for the duplicate + # + data = "6" * 8 + ip6f00 = \ + sp.Ether() / \ + sp.IPv6(src=args.src[0], dst=args.to[0]) / \ + sp.IPv6ExtHdrFragment(offset=0, m=1, id=20) / \ + sp.UDP(dport=3456, sport=6543) / \ + data + data = "6" * 15 + ip6f01 = \ + sp.Ether() / \ + sp.IPv6(src=args.src[0], dst=args.to[0]) / \ + sp.IPv6ExtHdrFragment(offset=0x1ffc, m=0, id=20) / \ + sp.UDP(dport=3456, sport=6543) / \ + data + data = "6" * 8 + ip6f02 = \ + sp.Ether() / \ + sp.IPv6(src=args.src[0], dst=args.to[0]) / \ + sp.IPv6ExtHdrDestOpt(options = \ + sp.PadN(optdata="\x00\x00\x00\x00\x00\x00")) / \ + sp.IPv6ExtHdrFragment(offset=0, m=1, id=20) / \ + sp.UDP(dport=3456, sport=6543) / \ + data + if args.debug : + ip6f00.display() + ip6f01.display() + ip6f02.display() + sp.sendp(ip6f00, iface=args.sendif[0], verbose=False) + sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) + sp.sendp(ip6f02, iface=args.sendif[0], verbose=False) + + sleep(75) + sniffer.setEnd() + sniffer.join() + if not sniffer.foundCorrectPacket: + sys.exit(1) + + sys.exit(0) + +if __name__ == '__main__': + main() Added: head/tests/sys/netinet6/frag6/frag6_20.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_20.sh Thu Oct 24 22:07:45 2019 (r354053) @@ -0,0 +1,231 @@ +# $FreeBSD$ +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 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. +# + +. $(atf_get_srcdir)/frag6.subr + +frag6_20_check_stats() { + + local jname ifname + jname=$1 + ifname=$2 + + case "${jname}" in + "") echo "ERROR: jname is empty"; return ;; + esac + case "${ifname}" in + "") echo "ERROR: ifname is empty"; return ;; + esac + + # Defaults are: IPV6_FRAGTTL 120 slowtimo ticks. + # pfslowtimo() is run at hz/2. So this takes 60s. + # This is awefully long for a test case. + # The Python script has to wait for this already to get the ICMPv6 + # hence we do not sleep here anymore. + + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + + # + # Check selection of global UDP stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p udp --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 9) ;; + *) jexec ${jname} netstat -s -p udp --libxo xml,pretty + atf_fail "Global UDP statistics do not match: ${count} != 9" ;; + esac + + + # + # Check selection of global IPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 3 + 1 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p ip6 --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 20) ;; + *) jexec ${jname} netstat -s -p ip6 --libxo xml,pretty + atf_fail "Global IPv6 statistics do not match: ${count} != 20" ;; + esac + + # + # Check selection of global ICMPv6 stats. + # XXX-TODO check output histogram (just too hard to parse [no multi-line-grep]) + # + cat < ${HOME}/filter-${jname}.txt + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p icmp6 --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 22) ;; + *) jexec ${jname} netstat -s -p icmp6 --libxo xml,pretty + atf_fail "Global ICMPv6 statistics do not match: ${count} != 22" ;; + esac + + # + # Check selection of interface IPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 1 +EOF + count=`jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 14) ;; + *) jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty + atf_fail "Interface IPv6 statistics do not match: ${count} != 14" ;; + esac + + # + # Check selection of interface ICMPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p icmp6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 21) ;; + *) jexec ${jname} netstat -s -p icmp6 -I ${ifname} --libxo xml,pretty + atf_fail "Interface ICMPv6 statistics do not match: ${count} != 21" ;; + esac +} + +atf_test_case "frag6_20" "cleanup" +frag6_20_head() { + frag6_head 20 +} + +frag6_20_body() { + frag6_body 20 frag6_20_check_stats +} + +frag6_20_cleanup() { + frag6_cleanup 20 +} + +atf_init_test_cases() +{ + atf_add_test_case "frag6_20" +} From owner-svn-src-head@freebsd.org Thu Oct 24 22:23:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F01B15BE5A; Thu, 24 Oct 2019 22:23:54 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zhbt08pVz3D7W; Thu, 24 Oct 2019 22:23:54 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCCE41CF83; Thu, 24 Oct 2019 22:23:53 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OMNrln020093; Thu, 24 Oct 2019 22:23:53 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OMNrcn020092; Thu, 24 Oct 2019 22:23:53 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910242223.x9OMNrcn020092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 24 Oct 2019 22:23:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354054 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 354054 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 22:23:54 -0000 Author: brooks Date: Thu Oct 24 22:23:53 2019 New Revision: 354054 URL: https://svnweb.freebsd.org/changeset/base/354054 Log: nda(4): Remove unnecessary union and avoid Clang -Wsizeof-array-divwarning Clang trunk recently gained this new warning, and complains about the sizeof(trim->data) / sizeof(struct nvme_dsm_range) expression, since the left hand side's element type (char) does not match the right hand side's type. The byte buffer is unnecessary so we can remove it to clean up the code and fix the warning at the same time. No functional change. Submitted by: James Clarke Reviewed by: imp Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21912 Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Thu Oct 24 22:07:45 2019 (r354053) +++ head/sys/cam/nvme/nvme_da.c Thu Oct 24 22:23:53 2019 (r354054) @@ -129,12 +129,11 @@ struct nda_softc { }; struct nda_trim_request { - union { - struct nvme_dsm_range dsm; - uint8_t data[NVME_MAX_DSM_TRIM]; - }; + struct nvme_dsm_range dsm[NVME_MAX_DSM_TRIM / sizeof(struct nvme_dsm_range)]; TAILQ_HEAD(, bio) bps; }; +_Static_assert(NVME_MAX_DSM_TRIM % sizeof(struct nvme_dsm_range) == 0, + "NVME_MAX_DSM_TRIM must be an integral number of ranges"); /* Need quirk table */ @@ -957,9 +956,8 @@ ndastart(struct cam_periph *periph, union ccb *start_c } TAILQ_INIT(&trim->bps); bp1 = bp; - ents = sizeof(trim->data) / sizeof(struct nvme_dsm_range); - ents = min(ents, nda_max_trim_entries); - dsm_range = &trim->dsm; + ents = min(nitems(trim->dsm), nda_max_trim_entries); + dsm_range = trim->dsm; dsm_end = dsm_range + ents; do { TAILQ_INSERT_TAIL(&trim->bps, bp1, bio_queue); @@ -977,8 +975,8 @@ ndastart(struct cam_periph *periph, union ccb *start_c /* XXX -- Could limit based on total payload size */ } while (bp1 != NULL); start_ccb->ccb_trim = trim; - nda_nvme_trim(softc, &start_ccb->nvmeio, &trim->dsm, - dsm_range - &trim->dsm); + nda_nvme_trim(softc, &start_ccb->nvmeio, trim->dsm, + dsm_range - trim->dsm); start_ccb->ccb_state = NDA_CCB_TRIM; softc->trim_count++; softc->trim_ranges += ranges; From owner-svn-src-head@freebsd.org Thu Oct 24 22:26:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9B2E15BF28; Thu, 24 Oct 2019 22:26:06 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zhfQ5z5Tz3DHj; Thu, 24 Oct 2019 22:26:06 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B18D61CF8B; Thu, 24 Oct 2019 22:26:06 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OMQ60J020246; Thu, 24 Oct 2019 22:26:06 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OMQ6Qb020245; Thu, 24 Oct 2019 22:26:06 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201910242226.x9OMQ6Qb020245@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 24 Oct 2019 22:26:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354055 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 354055 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 22:26:07 -0000 Author: sjg Date: Thu Oct 24 22:26:06 2019 New Revision: 354055 URL: https://svnweb.freebsd.org/changeset/base/354055 Log: Guard reference to x86_hypervisor Obviously we only want x86_hypervisor on x86 Guard reference to x86_hypervisor Obviously we only want x86_hypervisor on x86 Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Thu Oct 24 22:23:53 2019 (r354054) +++ head/stand/efi/loader/main.c Thu Oct 24 22:26:06 2019 (r354055) @@ -863,7 +863,9 @@ main(int argc, CHAR16 *argv[]) archsw.arch_getdev = efi_getdev; archsw.arch_copyin = efi_copyin; archsw.arch_copyout = efi_copyout; +#ifdef __amd64__ archsw.arch_hypervisor = x86_hypervisor; +#endif archsw.arch_readin = efi_readin; archsw.arch_zfs_probe = efi_zfs_probe; From owner-svn-src-head@freebsd.org Thu Oct 24 22:33:47 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D955F15C233; Thu, 24 Oct 2019 22:33:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zhqH5MfZz3DkD; Thu, 24 Oct 2019 22:33:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82C661D14C; Thu, 24 Oct 2019 22:33:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OMXlU6026047; Thu, 24 Oct 2019 22:33:47 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OMXlTO026046; Thu, 24 Oct 2019 22:33:47 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201910242233.x9OMXlTO026046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 24 Oct 2019 22:33:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354056 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 354056 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 22:33:47 -0000 Author: jkim Date: Thu Oct 24 22:33:46 2019 New Revision: 354056 URL: https://svnweb.freebsd.org/changeset/base/354056 Log: Catch up with ACPICA 20191018. PR: 241467 XMFC with: r353764 Modified: head/usr.sbin/bhyve/acpi.c head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/acpi.c ============================================================================== --- head/usr.sbin/bhyve/acpi.c Thu Oct 24 22:26:06 2019 (r354055) +++ head/usr.sbin/bhyve/acpi.c Thu Oct 24 22:33:46 2019 (r354056) @@ -309,11 +309,11 @@ basl_fwrite_madt(FILE *fp) /* Local APIC NMI is connected to LINT 1 on all CPUs */ EFPRINTF(fp, "[0001]\t\tSubtable Type : 04\n"); EFPRINTF(fp, "[0001]\t\tLength : 06\n"); - EFPRINTF(fp, "[0001]\t\tProcessorId : FF\n"); + EFPRINTF(fp, "[0001]\t\tProcessor ID : FF\n"); EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0005\n"); EFPRINTF(fp, "\t\t\tPolarity : 1\n"); EFPRINTF(fp, "\t\t\tTrigger Mode : 1\n"); - EFPRINTF(fp, "[0001]\t\tInterrupt : 01\n"); + EFPRINTF(fp, "[0001]\t\tInterrupt Input LINT : 01\n"); EFPRINTF(fp, "\n"); EFFLUSH(fp); @@ -560,7 +560,7 @@ basl_fwrite_hpet(FILE *fp) EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n"); EFPRINTF(fp, "\n"); - EFPRINTF(fp, "[0004]\t\tTimer Block ID : %08X\n", hpet_capabilities); + EFPRINTF(fp, "[0004]\t\tHardware Block ID : %08X\n", hpet_capabilities); EFPRINTF(fp, "[0012]\t\tTimer Block Register : [Generic Address Structure]\n"); EFPRINTF(fp, "[0001]\t\tSpace ID : 00 [SystemMemory]\n"); @@ -571,7 +571,7 @@ basl_fwrite_hpet(FILE *fp) EFPRINTF(fp, "[0008]\t\tAddress : 00000000FED00000\n"); EFPRINTF(fp, "\n"); - EFPRINTF(fp, "[0001]\t\tHPET Number : 00\n"); + EFPRINTF(fp, "[0001]\t\tSequence Number : 00\n"); EFPRINTF(fp, "[0002]\t\tMinimum Clock Ticks : 0000\n"); EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000001\n"); EFPRINTF(fp, "\t\t\t4K Page Protect : 1\n"); @@ -607,9 +607,9 @@ basl_fwrite_mcfg(FILE *fp) EFPRINTF(fp, "\n"); EFPRINTF(fp, "[0008]\t\tBase Address : %016lX\n", pci_ecfg_base()); - EFPRINTF(fp, "[0002]\t\tSegment Group: 0000\n"); - EFPRINTF(fp, "[0001]\t\tStart Bus: 00\n"); - EFPRINTF(fp, "[0001]\t\tEnd Bus: FF\n"); + EFPRINTF(fp, "[0002]\t\tSegment Group Number : 0000\n"); + EFPRINTF(fp, "[0001]\t\tStart Bus Number : 00\n"); + EFPRINTF(fp, "[0001]\t\tEnd Bus Number : FF\n"); EFPRINTF(fp, "[0004]\t\tReserved : 0\n"); EFFLUSH(fp); return (0); Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Thu Oct 24 22:26:06 2019 (r354055) +++ head/usr.sbin/bhyve/pci_emul.c Thu Oct 24 22:33:46 2019 (r354056) @@ -1268,7 +1268,6 @@ pci_bus_write_dsdt(int bus) dsdt_line(" Device (PC%02X)", bus); dsdt_line(" {"); dsdt_line(" Name (_HID, EisaId (\"PNP0A03\"))"); - dsdt_line(" Name (_ADR, Zero)"); dsdt_line(" Method (_BBN, 0, NotSerialized)"); dsdt_line(" {"); From owner-svn-src-head@freebsd.org Thu Oct 24 22:34:49 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7FAA15C2BA; Thu, 24 Oct 2019 22:34:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zhrT4Qp9z3DsC; Thu, 24 Oct 2019 22:34:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AB2B1D154; Thu, 24 Oct 2019 22:34:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OMYnls026145; Thu, 24 Oct 2019 22:34:49 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OMYn8g026143; Thu, 24 Oct 2019 22:34:49 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910242234.x9OMYn8g026143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 24 Oct 2019 22:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354057 - in head/contrib/binutils: bfd binutils X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/contrib/binutils: bfd binutils X-SVN-Commit-Revision: 354057 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 22:34:49 -0000 Author: brooks Date: Thu Oct 24 22:34:48 2019 New Revision: 354057 URL: https://svnweb.freebsd.org/changeset/base/354057 Log: binutils: Fix bugs found by -Wpointer-compare The MIPS bug was introduced by upstream commit 7403cb630, which failed to account for the additional indirection introduced and also dropped one of the checks; change it to the standard "NULL-or-empty" check as used elsewhere in BFD, which is also what upstream now has. Submitted by: James Clarke Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21911 Modified: head/contrib/binutils/bfd/elfxx-mips.c head/contrib/binutils/binutils/stabs.c Modified: head/contrib/binutils/bfd/elfxx-mips.c ============================================================================== --- head/contrib/binutils/bfd/elfxx-mips.c Thu Oct 24 22:33:46 2019 (r354056) +++ head/contrib/binutils/bfd/elfxx-mips.c Thu Oct 24 22:34:48 2019 (r354057) @@ -3966,7 +3966,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_b *namep = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - if (*namep == '\0') + if (*namep == NULL || **namep == '\0') *namep = bfd_section_name (input_bfd, sec); target_is_16_bit_code_p = (sym->st_other == STO_MIPS16); Modified: head/contrib/binutils/binutils/stabs.c ============================================================================== --- head/contrib/binutils/binutils/stabs.c Thu Oct 24 22:33:46 2019 (r354056) +++ head/contrib/binutils/binutils/stabs.c Thu Oct 24 22:34:48 2019 (r354057) @@ -2668,7 +2668,7 @@ parse_stab_members (void *dhandle, struct stab_handle ++*pp; voffset &= 0x7fffffff; - if (**pp == ';' || *pp == '\0') + if (**pp == ';' || **pp == '\0') { /* Must be g++ version 1. */ context = DEBUG_TYPE_NULL; From owner-svn-src-head@freebsd.org Fri Oct 25 09:19:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8042C16B49F; Fri, 25 Oct 2019 09:19:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zz842q6gz4GJ6; Fri, 25 Oct 2019 09:19:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F500243B2; Fri, 25 Oct 2019 09:19:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9P9JGST002521; Fri, 25 Oct 2019 09:19:16 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9P9JG9i002520; Fri, 25 Oct 2019 09:19:16 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910250919.x9P9JG9i002520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 09:19:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354062 - head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 354062 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 09:19:16 -0000 Author: avg Date: Fri Oct 25 09:19:15 2019 New Revision: 354062 URL: https://svnweb.freebsd.org/changeset/base/354062 Log: zfs.8: fix a typo in the date Reported by: Trond Endrestøl MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Oct 25 04:44:17 2019 (r354061) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Oct 25 09:19:15 2019 (r354062) @@ -32,7 +32,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Octover 16, 2019 +.Dd October 16, 2019 .Dt ZFS 8 .Os .Sh NAME From owner-svn-src-head@freebsd.org Fri Oct 25 09:37:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6403716BCFE; Fri, 25 Oct 2019 09:37:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zzYb243xz4HdL; Fri, 25 Oct 2019 09:37:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A3B824743; Fri, 25 Oct 2019 09:37:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9P9btUH014621; Fri, 25 Oct 2019 09:37:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9P9btoi014620; Fri, 25 Oct 2019 09:37:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910250937.x9P9btoi014620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 09:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354065 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 354065 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 09:37:55 -0000 Author: avg Date: Fri Oct 25 09:37:54 2019 New Revision: 354065 URL: https://svnweb.freebsd.org/changeset/base/354065 Log: gpioiic: set output after switching to output mode if presetting it failed Some controllers cannot preset future output value while the pin is in input mode. This adds a fallback for those controllers. The new code assumes that a controller reports an error in that case. For example, all hardware supported by nctgpio behaves in that way. This is a temporary measure. In the future we will use GPIO_PIN_PRESET_LOW / GPIO_PIN_PRESET_HIGH to preset the output either in hardware, if supported, or in software (e.g., in gpiobus_pin_setflags). While here, I extracted common functionality of gpioiic_set{sda,scl} and gpioiic_get{sda,scl} to gpioiic_setpin and gpioiic_getpin respectively. MFC after: 2 weeks Modified: head/sys/dev/gpio/gpioiic.c Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Fri Oct 25 09:24:41 2019 (r354064) +++ head/sys/dev/gpio/gpioiic.c Fri Oct 25 09:37:54 2019 (r354065) @@ -168,59 +168,67 @@ gpioiic_reset_bus(device_t dev) } static void -gpioiic_setsda(device_t dev, int val) +gpioiic_setpin(struct gpioiic_softc *sc, int pin, int val) { - struct gpioiic_softc *sc = device_get_softc(dev); + int err; if (val == 0) { - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, + err = GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0); + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_OUTPUT); + + /* + * Some controllers cannot set output value while a pin is in + * input mode. + */ + if (err != 0) + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0); } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_INPUT); } } static void +gpioiic_setsda(device_t dev, int val) +{ + struct gpioiic_softc *sc = device_get_softc(dev); + + gpioiic_setpin(sc, sc->sda_pin, val); +} + +static void gpioiic_setscl(device_t dev, int val) { struct gpioiic_softc *sc = device_get_softc(dev); - if (val == 0) { - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, - GPIO_PIN_OUTPUT); - } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, - GPIO_PIN_INPUT); - } + gpioiic_setpin(sc, sc->scl_pin, val); } static int -gpioiic_getscl(device_t dev) +gpioiic_getpin(struct gpioiic_softc *sc, int pin) { - struct gpioiic_softc *sc = device_get_softc(dev); unsigned int val; - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, - GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, &val); - + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_INPUT); + GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, pin, &val); return ((int)val); } static int -gpioiic_getsda(device_t dev) +gpioiic_getscl(device_t dev) { struct gpioiic_softc *sc = device_get_softc(dev); - unsigned int val; - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, - GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, &val); + return (gpioiic_getpin(sc, sc->scl_pin)); +} - return ((int)val); +static int +gpioiic_getsda(device_t dev) +{ + struct gpioiic_softc *sc = device_get_softc(dev); + + return (gpioiic_getpin(sc, sc->sda_pin)); } static int From owner-svn-src-head@freebsd.org Fri Oct 25 13:42:37 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74C381713AC; Fri, 25 Oct 2019 13:42:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4704zx2T02z4Wgy; Fri, 25 Oct 2019 13:42:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38DDA27382; Fri, 25 Oct 2019 13:42:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PDgbFu063165; Fri, 25 Oct 2019 13:42:37 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PDgbS8063164; Fri, 25 Oct 2019 13:42:37 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251342.x9PDgbS8063164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 13:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354067 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354067 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 13:42:37 -0000 Author: avg Date: Fri Oct 25 13:42:36 2019 New Revision: 354067 URL: https://svnweb.freebsd.org/changeset/base/354067 Log: ow_temp: drop the lock around a call that can sleep This is similar to what is done around other calls that lead to own_command_wait() that can sleep. Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22107 Modified: head/sys/dev/ow/ow_temp.c Modified: head/sys/dev/ow/ow_temp.c ============================================================================== --- head/sys/dev/ow/ow_temp.c Fri Oct 25 12:46:06 2019 (r354066) +++ head/sys/dev/ow/ow_temp.c Fri Oct 25 13:42:36 2019 (r354067) @@ -143,7 +143,9 @@ ow_temp_event_thread(void *arg) pause("owtstart", device_get_unit(sc->dev) * hz / 100); // 10ms stagger mtx_lock(&sc->temp_lock); sc->flags |= OW_TEMP_RUNNING; + mtx_unlock(&sc->temp_lock); ow_temp_read_power_supply(sc->dev, &sc->parasite); + mtx_lock(&sc->temp_lock); if (sc->parasite) device_printf(sc->dev, "Running in parasitic mode unsupported\n"); while ((sc->flags & OW_TEMP_DONE) == 0) { From owner-svn-src-head@freebsd.org Fri Oct 25 13:47:18 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 920DD171490; Fri, 25 Oct 2019 13:47:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47055L2rwwz4WsR; Fri, 25 Oct 2019 13:47:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41E9727387; Fri, 25 Oct 2019 13:47:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PDlI3F063452; Fri, 25 Oct 2019 13:47:18 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PDlH4k063451; Fri, 25 Oct 2019 13:47:17 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251347.x9PDlH4k063451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 13:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354068 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354068 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 13:47:18 -0000 Author: avg Date: Fri Oct 25 13:47:17 2019 New Revision: 354068 URL: https://svnweb.freebsd.org/changeset/base/354068 Log: ow_temp: better scopes for the lock The lock is used only for start / stop signaling. It is used only for 'flags' field and the related condition variable. This change is a follow-up to r354067, it was suggested by Warner in D22107. Suggested by: imp MFC after: 1 week Modified: head/sys/dev/ow/ow_temp.c Modified: head/sys/dev/ow/ow_temp.c ============================================================================== --- head/sys/dev/ow/ow_temp.c Fri Oct 25 13:42:36 2019 (r354067) +++ head/sys/dev/ow/ow_temp.c Fri Oct 25 13:47:17 2019 (r354068) @@ -145,9 +145,9 @@ ow_temp_event_thread(void *arg) sc->flags |= OW_TEMP_RUNNING; mtx_unlock(&sc->temp_lock); ow_temp_read_power_supply(sc->dev, &sc->parasite); - mtx_lock(&sc->temp_lock); if (sc->parasite) device_printf(sc->dev, "Running in parasitic mode unsupported\n"); + mtx_lock(&sc->temp_lock); while ((sc->flags & OW_TEMP_DONE) == 0) { mtx_unlock(&sc->temp_lock); ow_temp_convert_t(sc->dev); @@ -155,10 +155,9 @@ ow_temp_event_thread(void *arg) msleep(sc, &sc->temp_lock, 0, "owtcvt", hz); if (sc->flags & OW_TEMP_DONE) break; + mtx_unlock(&sc->temp_lock); for (retries = 5; retries > 0; retries--) { - mtx_unlock(&sc->temp_lock); rv = ow_temp_read_scratchpad(sc->dev, scratch, sizeof(scratch)); - mtx_lock(&sc->temp_lock); if (rv == 0) { crc = own_crc(sc->dev, scratch, sizeof(scratch) - 1); if (crc == scratch[8]) { @@ -182,6 +181,7 @@ ow_temp_event_thread(void *arg) } else sc->bad_reads++; } + mtx_lock(&sc->temp_lock); msleep(sc, &sc->temp_lock, 0, "owtcvt", sc->reading_interval); } sc->flags &= ~OW_TEMP_RUNNING; From owner-svn-src-head@freebsd.org Fri Oct 25 14:21:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D1A1171F6F; Fri, 25 Oct 2019 14:21:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4705rD1Pxlz4Yj0; Fri, 25 Oct 2019 14:21:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 151D427916; Fri, 25 Oct 2019 14:21:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PEKxtc083903; Fri, 25 Oct 2019 14:20:59 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PEKxxS083902; Fri, 25 Oct 2019 14:20:59 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251420.x9PEKxxS083902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 14:20:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354069 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354069 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 14:21:00 -0000 Author: avg Date: Fri Oct 25 14:20:59 2019 New Revision: 354069 URL: https://svnweb.freebsd.org/changeset/base/354069 Log: owc_gpiobus_read_data: disable preemption earlier Now this is done before starting the low pulse that has rather tight timing. Reviewed by: imp (D22108) MFC after: 2 weeks Modified: head/sys/dev/ow/owc_gpiobus.c Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 13:47:17 2019 (r354068) +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 14:20:59 2019 (r354069) @@ -279,6 +279,8 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * if (error != 0) return (error); + critical_enter(); + /* Force low for t_lowr microseconds */ then = sbinuptime(); OUTPIN(sc); @@ -291,7 +293,6 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * * master's pushing the line low. */ INPIN(sc); - critical_enter(); do { now = sbinuptime(); GETPIN(sc, &sample); From owner-svn-src-head@freebsd.org Fri Oct 25 14:30:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B22D17227A; Fri, 25 Oct 2019 14:30:28 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4706376ykfz4Z8W; Fri, 25 Oct 2019 14:30:27 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE1A527AA6; Fri, 25 Oct 2019 14:30:27 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PEURiV087323; Fri, 25 Oct 2019 14:30:27 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PEURH4087322; Fri, 25 Oct 2019 14:30:27 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910251430.x9PEURH4087322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 25 Oct 2019 14:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354070 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354070 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 14:30:28 -0000 Author: andrew Date: Fri Oct 25 14:30:27 2019 New Revision: 354070 URL: https://svnweb.freebsd.org/changeset/base/354070 Log: Make special register names lowercase so they don't conflict with future ID register macros. MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/identcpu.c Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Fri Oct 25 14:20:59 2019 (r354069) +++ head/sys/arm64/arm64/identcpu.c Fri Oct 25 14:30:27 2019 (r354070) @@ -1187,15 +1187,15 @@ identify_cpu(void) cpu_desc[cpu].mpidr = get_mpidr(); CPU_AFFINITY(cpu) = cpu_desc[cpu].mpidr & CPU_AFF_MASK; - cpu_desc[cpu].id_aa64dfr0 = READ_SPECIALREG(ID_AA64DFR0_EL1); - cpu_desc[cpu].id_aa64dfr1 = READ_SPECIALREG(ID_AA64DFR1_EL1); - cpu_desc[cpu].id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1); - cpu_desc[cpu].id_aa64isar1 = READ_SPECIALREG(ID_AA64ISAR1_EL1); - cpu_desc[cpu].id_aa64mmfr0 = READ_SPECIALREG(ID_AA64MMFR0_EL1); - cpu_desc[cpu].id_aa64mmfr1 = READ_SPECIALREG(ID_AA64MMFR1_EL1); - cpu_desc[cpu].id_aa64mmfr2 = READ_SPECIALREG(ID_AA64MMFR2_EL1); - cpu_desc[cpu].id_aa64pfr0 = READ_SPECIALREG(ID_AA64PFR0_EL1); - cpu_desc[cpu].id_aa64pfr1 = READ_SPECIALREG(ID_AA64PFR1_EL1); + cpu_desc[cpu].id_aa64dfr0 = READ_SPECIALREG(id_aa64dfr0_el1); + cpu_desc[cpu].id_aa64dfr1 = READ_SPECIALREG(id_aa64dfr1_el1); + cpu_desc[cpu].id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1); + cpu_desc[cpu].id_aa64isar1 = READ_SPECIALREG(id_aa64isar1_el1); + cpu_desc[cpu].id_aa64mmfr0 = READ_SPECIALREG(id_aa64mmfr0_el1); + cpu_desc[cpu].id_aa64mmfr1 = READ_SPECIALREG(id_aa64mmfr1_el1); + cpu_desc[cpu].id_aa64mmfr2 = READ_SPECIALREG(id_aa64mmfr2_el1); + cpu_desc[cpu].id_aa64pfr0 = READ_SPECIALREG(id_aa64pfr0_el1); + cpu_desc[cpu].id_aa64pfr1 = READ_SPECIALREG(id_aa64pfr1_el1); if (cpu != 0) { /* From owner-svn-src-head@freebsd.org Fri Oct 25 14:46:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DA95172846; Fri, 25 Oct 2019 14:46:10 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4706PF6SSsz4bHJ; Fri, 25 Oct 2019 14:46:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C23E427E74; Fri, 25 Oct 2019 14:46:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PEk9ie098952; Fri, 25 Oct 2019 14:46:09 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PEk9mX098951; Fri, 25 Oct 2019 14:46:09 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910251446.x9PEk9mX098951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 25 Oct 2019 14:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354072 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 354072 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 14:46:10 -0000 Author: andrew Date: Fri Oct 25 14:46:09 2019 New Revision: 354072 URL: https://svnweb.freebsd.org/changeset/base/354072 Log: Remove the arm4 ID register masks, they are not needed after r353641. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/include/armreg.h Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Fri Oct 25 14:33:07 2019 (r354071) +++ head/sys/arm64/include/armreg.h Fri Oct 25 14:46:09 2019 (r354072) @@ -176,7 +176,6 @@ #define ICC_SRE_EL2_EN (1U << 3) /* ID_AA64DFR0_EL1 */ -#define ID_AA64DFR0_MASK UL(0x0000000ff0f0ffff) #define ID_AA64DFR0_DebugVer_SHIFT 0 #define ID_AA64DFR0_DebugVer_MASK (UL(0xf) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_DebugVer(x) ((x) & ID_AA64DFR0_DebugVer_MASK) @@ -214,7 +213,6 @@ #define ID_AA64DFR0_PMSVer_V1 (UL(0x1) << ID_AA64DFR0_PMSVer_SHIFT) /* ID_AA64ISAR0_EL1 */ -#define ID_AA64ISAR0_MASK UL(0x0000fffff0fffff0) #define ID_AA64ISAR0_AES_SHIFT 4 #define ID_AA64ISAR0_AES_MASK (UL(0xf) << ID_AA64ISAR0_AES_SHIFT) #define ID_AA64ISAR0_AES(x) ((x) & ID_AA64ISAR0_AES_MASK) @@ -269,7 +267,6 @@ #define ID_AA64ISAR0_DP_IMPL (UL(0x1) << ID_AA64ISAR0_DP_SHIFT) /* ID_AA64ISAR1_EL1 */ -#define ID_AA64ISAR1_MASK UL(0x00000000ffffffff) #define ID_AA64ISAR1_DPB_SHIFT 0 #define ID_AA64ISAR1_DPB_MASK (UL(0xf) << ID_AA64ISAR1_DPB_SHIFT) #define ID_AA64ISAR1_DPB(x) ((x) & ID_AA64ISAR1_DPB_MASK) @@ -312,7 +309,6 @@ #define ID_AA64ISAR1_GPI_IMPL (UL(0x1) << ID_AA64ISAR1_GPI_SHIFT) /* ID_AA64MMFR0_EL1 */ -#define ID_AA64MMFR0_MASK UL(0x00000000ffffffff) #define ID_AA64MMFR0_PARange_SHIFT 0 #define ID_AA64MMFR0_PARange_MASK (UL(0xf) << ID_AA64MMFR0_PARange_SHIFT) #define ID_AA64MMFR0_PARange(x) ((x) & ID_AA64MMFR0_PARange_MASK) @@ -360,7 +356,6 @@ #define ID_AA64MMFR0_TGran4_NONE (UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT) /* ID_AA64MMFR1_EL1 */ -#define ID_AA64MMFR1_MASK UL(0x00000000ffffffff) #define ID_AA64MMFR1_HAFDBS_SHIFT 0 #define ID_AA64MMFR1_HAFDBS_MASK (UL(0xf) << ID_AA64MMFR1_HAFDBS_SHIFT) #define ID_AA64MMFR1_HAFDBS(x) ((x) & ID_AA64MMFR1_HAFDBS_MASK) @@ -407,7 +402,6 @@ /* ID_AA64MMFR2_EL1 */ #define ID_AA64MMFR2_EL1 S3_0_C0_C7_2 -#define ID_AA64MMFR2_MASK UL(0x000000000fffffff) #define ID_AA64MMFR2_CnP_SHIFT 0 #define ID_AA64MMFR2_CnP_MASK (UL(0xf) << ID_AA64MMFR2_CnP_SHIFT) #define ID_AA64MMFR2_CnP(x) ((x) & ID_AA64MMFR2_CnP_MASK) @@ -445,7 +439,6 @@ #define ID_AA64MMFR2_NV_IMPL (UL(0x1) << ID_AA64MMFR2_NV_SHIFT) /* ID_AA64PFR0_EL1 */ -#define ID_AA64PFR0_MASK UL(0x0000000fffffffff) #define ID_AA64PFR0_EL0_SHIFT 0 #define ID_AA64PFR0_EL0_MASK (UL(0xf) << ID_AA64PFR0_EL0_SHIFT) #define ID_AA64PFR0_EL0(x) ((x) & ID_AA64PFR0_EL0_MASK) From owner-svn-src-head@freebsd.org Fri Oct 25 15:38:09 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAD18173B28; Fri, 25 Oct 2019 15:38:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4707YF4z8Mz4drB; Fri, 25 Oct 2019 15:38:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DB6B28770; Fri, 25 Oct 2019 15:38:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PFc9vO028314; Fri, 25 Oct 2019 15:38:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PFc9ii028313; Fri, 25 Oct 2019 15:38:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251538.x9PFc9ii028313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 15:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354076 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354076 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:38:09 -0000 Author: avg Date: Fri Oct 25 15:38:09 2019 New Revision: 354076 URL: https://svnweb.freebsd.org/changeset/base/354076 Log: owc_gpiobus_read_data: compare times in sbintime_t units Previously the code used sbttous() before microseconds comparison in one place, sbttons() and nanoseconds in another, division by SBT_1US and microseconds in yet another. Now the code consistently uses multiplication by SBT_1US to convert microseconds to sbintime_t before comparing them with periods between calls to sbinuptime(). This is fast, this is precise enough (below 0.03%) and the periods defined by the protocol cannot overflow. Reviewed by: imp (D22108) MFC after: 2 weeks Modified: head/sys/dev/ow/owc_gpiobus.c Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019 (r354075) +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 (r354076) @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * do { now = sbinuptime(); GETPIN(sc, &sample); - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); critical_exit(); - if (sbttons(now - then) < t->t_rdv * 1000) + if (now - then < t->t_rdv * SBT_1US) *bit = 1; else *bit = 0; @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * /* Wait out the rest of t_slot */ do { now = sbinuptime(); - } while ((now - then) / SBT_1US < t->t_slot); + } while (now - then < t->t_slot * SBT_1US); RELBUS(sc); From owner-svn-src-head@freebsd.org Fri Oct 25 15:39:46 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4AB4173BD3; Fri, 25 Oct 2019 15:39:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4707b63wMpz4f0J; Fri, 25 Oct 2019 15:39:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69E4028771; Fri, 25 Oct 2019 15:39:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PFdk0G028420; Fri, 25 Oct 2019 15:39:46 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PFdk6Y028419; Fri, 25 Oct 2019 15:39:46 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251539.x9PFdk6Y028419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 15:39:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354077 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354077 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:39:46 -0000 Author: avg Date: Fri Oct 25 15:39:46 2019 New Revision: 354077 URL: https://svnweb.freebsd.org/changeset/base/354077 Log: owc_gpiobus_read_data: add recovery time to the read slot Reviewed by: imp MFC after: 2 weeks Modified: head/sys/dev/ow/owc_gpiobus.c Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 (r354076) +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:39:46 2019 (r354077) @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * /* Wait out the rest of t_slot */ do { now = sbinuptime(); - } while (now - then < t->t_slot * SBT_1US); + } while (now - then < (t->t_slot + t->t_rec)* SBT_1US); RELBUS(sc); From owner-svn-src-head@freebsd.org Fri Oct 25 15:46:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AFF8174028; Fri, 25 Oct 2019 15:46:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4707lM2h7pz4g1g; Fri, 25 Oct 2019 15:46:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C6DC2893D; Fri, 25 Oct 2019 15:46:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PFktWH034696; Fri, 25 Oct 2019 15:46:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PFktG8034695; Fri, 25 Oct 2019 15:46:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251546.x9PFktG8034695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 15:46:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354078 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354078 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:46:55 -0000 Author: avg Date: Fri Oct 25 15:46:54 2019 New Revision: 354078 URL: https://svnweb.freebsd.org/changeset/base/354078 Log: owc_gpiobus: add missing space in r354077 Modified: head/sys/dev/ow/owc_gpiobus.c Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:39:46 2019 (r354077) +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:46:54 2019 (r354078) @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * /* Wait out the rest of t_slot */ do { now = sbinuptime(); - } while (now - then < (t->t_slot + t->t_rec)* SBT_1US); + } while (now - then < (t->t_slot + t->t_rec) * SBT_1US); RELBUS(sc); From owner-svn-src-head@freebsd.org Fri Oct 25 15:47:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFBAE174058 for ; Fri, 25 Oct 2019 15:47:04 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4707lX3cwkz4g80 for ; Fri, 25 Oct 2019 15:47:03 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1572018422; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=j1ULjZMjYS0stPqOs88zgFfnRUU2kWRw/81VqEqOBnFxwyS53A/l0vu3ylKaX4jDDiY27+6gGD36b im5UUeFIGtbnOvd9ZR6AstiKetCPYoIWwL1F0H3NOFwR+wAbmqD1m8ISNnIbaJnCpNEkk7DuqPQZat XgBqCEoCiUBUCS7pg/uYTXD1fk6Kh1UcxMrTBkuNt1vm7dCpERUrGkUQrwWKmuGh5CthZwB21ZaYue RCt8IZHIiWK0CXG9cElK2iqiGEc7teqEtBrhnGn8ehS9UTcj98IV/cOHRJrVdahd+lC6GNAkx17Xzu pZW3aI0VFKLDCeOYs8guqaVZVVolmUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=DeOvwX+j/vkqLTfZ6ysoPHwoQy3ark/1CetsbHtK/mM=; b=Ru8PD816A3mcPR195/iBt5mMGOBRXWKAyeNNIwgZ6hDqFTRNK12IRAUMqcZf3G0rNDWK+v47JSOBq vpzco2dzvdke9uOsfByIaCylbc2fFxyqIZ7wY/H552PXsEf9R/3FehgttLpA2cw4Jg3VKhbAoPuqqq zmQGxOE2TnXTsaJw2WSswjy65O9GcK5wovaFLlRAn0twy5jzr1jss2gedcmdnBic4Lq1AnmOwU2quO KHhpBE8wqee8tSRmiab5MynVNSqFfnIkWSsss3xsfoZaZrMsyEt2yXPREu45+kV/IXoOeUwB0+dqGT uw0IQlRyReZFeG5ZA+1yeLIn4xk0lDg== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=DeOvwX+j/vkqLTfZ6ysoPHwoQy3ark/1CetsbHtK/mM=; b=QIQ56jbZDknrHD6EDIibIZNIoXU2tozx7+y/Doo0CQHWfyJ8XcwKc7e2pjildBPBa2AkRaZjm2sR/ m36W7AZH0F+jPNwXpBhx/pteh3bC6eXJTgiRXlhpkLuezFKzK+p4vixzBjmyZO5ygqdD5/KO3heMPd VB7Yg3VoapCATIBytDau9tOPGRRlbk2VWXiS/1ppmmaUqftgtjmrNPxVjFpjqftIZ7KTxQsyoeCTeQ eiX9odOF//EA/Q3UaVd/ky6BjnJC452TCAdr3v475PdcTb0BUN0K0ZvNSE35jHDbarXieAqHDdr5SI OIC2+q3yDuWpmel/QvPlrG3o8EvnUHg== X-MHO-RoutePath: aGlwcGll X-MHO-User: ae8f26c1-f73e-11e9-b80b-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id ae8f26c1-f73e-11e9-b80b-052b4a66b6b2; Fri, 25 Oct 2019 15:47:01 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x9PFkxJQ049685; Fri, 25 Oct 2019 09:46:59 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r354076 - head/sys/dev/ow From: Ian Lepore To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 25 Oct 2019 09:46:59 -0600 In-Reply-To: <201910251538.x9PFc9ii028313@repo.freebsd.org> References: <201910251538.x9PFc9ii028313@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4707lX3cwkz4g80 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.89)[-0.892,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:47:05 -0000 On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: > Author: avg > Date: Fri Oct 25 15:38:09 2019 > New Revision: 354076 > URL: https://svnweb.freebsd.org/changeset/base/354076 > > Log: > owc_gpiobus_read_data: compare times in sbintime_t units > > Previously the code used sbttous() before microseconds comparison > in one > place, sbttons() and nanoseconds in another, division by SBT_1US > and > microseconds in yet another. > > Now the code consistently uses multiplication by SBT_1US to convert > microseconds to sbintime_t before comparing them with periods > between > calls to sbinuptime(). This is fast, this is precise enough (below > 0.03%) and the periods defined by the protocol cannot overflow. > > Reviewed by: imp (D22108) > MFC after: 2 weeks > > Modified: > head/sys/dev/ow/owc_gpiobus.c > > Modified: head/sys/dev/ow/owc_gpiobus.c > ===================================================================== > ========= > --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019 (r354 > 075) > +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 (r354 > 076) > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct > ow_timing * > do { > now = sbinuptime(); > GETPIN(sc, &sample); > - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); > + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); > critical_exit(); > > - if (sbttons(now - then) < t->t_rdv * 1000) > + if (now - then < t->t_rdv * SBT_1US) > *bit = 1; > else > *bit = 0; > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct > ow_timing * > /* Wait out the rest of t_slot */ > do { > now = sbinuptime(); > - } while ((now - then) / SBT_1US < t->t_slot); > + } while (now - then < t->t_slot * SBT_1US); > > RELBUS(sc); > Unit conversions with sbt times should be done using the macros that carefully avoid roundoff errors. I don't understand why you've changed the code that correctly did use those macros to inline math. -- Ian From owner-svn-src-head@freebsd.org Fri Oct 25 15:51:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 966691741F4; Fri, 25 Oct 2019 15:51:24 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 4707rW3C2Fz3C5W; Fri, 25 Oct 2019 15:51:22 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf1-f66.google.com with SMTP id z12so2145748lfj.9; Fri, 25 Oct 2019 08:51:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=es2WYxOdDw9tTbPIjIDfLqFV4mEFWacwxPd9JPD89dM=; b=Kyh+8Rt+494zrpiaCqJjGiiMjdpOHRjN6b9oaZS2KUoozab2sk+ExHvNewPUFvot25 Orb+6gwLdm57Zfo1ppXupQOfmymBYviBGtzQcxHYT0RzQcCAQGY8q5I8FWP+H5OvFXoe 0wg3XsHKxwkImsQS2iXDm+Su74cNZH/wswBuLFQOJprAelJ5mFGQPGsmwWhwgQVZQGhv BTXKC9303Tyk1CXLmgyuB0cNTNQetOCQw5Wgfi5pSePXUAUM+UmQwaeaQ3u2yanmz3nS 6m6oboISlj51bHaHAXfZBB6ZxTE5Xt4OlPx3R9+QueEbY6RaNcf0O08EWmsIzO6aS9/6 /A0A== X-Gm-Message-State: APjAAAXEmQTxAfV3P7KFRk5a9uSs745Ah5mMS1zgT5PgO1Wseea+l1qM 18rtHm8Ak+qePzyrCxHWrlvSrqu8PDE= X-Google-Smtp-Source: APXvYqw6lKSmHkypFcuixzTP3+7MDmpPe/CK1lVaTsmzp5lplNadU8QQCte6SeAtyM5vTKBTjKHbww== X-Received: by 2002:a19:6e0a:: with SMTP id j10mr3389505lfc.131.1572018678557; Fri, 25 Oct 2019 08:51:18 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id s6sm1034807ljg.43.2019.10.25.08.51.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Oct 2019 08:51:17 -0700 (PDT) Subject: Re: svn commit: r354076 - head/sys/dev/ow To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910251538.x9PFc9ii028313@repo.freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> Date: Fri, 25 Oct 2019 18:51:16 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.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: 4707rW3C2Fz3C5W X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.167.66 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.02 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[FreeBSD.org]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.02)[ip: (0.22), ipnet: 209.85.128.0/17(-3.22), asn: 15169(-2.05), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[66.167.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[66.167.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:51:24 -0000 On 25/10/2019 18:46, Ian Lepore wrote: > On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: >> Author: avg >> Date: Fri Oct 25 15:38:09 2019 >> New Revision: 354076 >> URL: https://svnweb.freebsd.org/changeset/base/354076 >> >> Log: >> owc_gpiobus_read_data: compare times in sbintime_t units >> >> Previously the code used sbttous() before microseconds comparison >> in one >> place, sbttons() and nanoseconds in another, division by SBT_1US >> and >> microseconds in yet another. >> >> Now the code consistently uses multiplication by SBT_1US to convert >> microseconds to sbintime_t before comparing them with periods >> between >> calls to sbinuptime(). This is fast, this is precise enough (below >> 0.03%) and the periods defined by the protocol cannot overflow. >> >> Reviewed by: imp (D22108) >> MFC after: 2 weeks >> >> Modified: >> head/sys/dev/ow/owc_gpiobus.c >> >> Modified: head/sys/dev/ow/owc_gpiobus.c >> ===================================================================== >> ========= >> --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019 (r354 >> 075) >> +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 (r354 >> 076) >> @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct >> ow_timing * >> do { >> now = sbinuptime(); >> GETPIN(sc, &sample); >> - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); >> + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); >> critical_exit(); >> >> - if (sbttons(now - then) < t->t_rdv * 1000) >> + if (now - then < t->t_rdv * SBT_1US) >> *bit = 1; >> else >> *bit = 0; >> @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct >> ow_timing * >> /* Wait out the rest of t_slot */ >> do { >> now = sbinuptime(); >> - } while ((now - then) / SBT_1US < t->t_slot); >> + } while (now - then < t->t_slot * SBT_1US); >> >> RELBUS(sc); >> > > Unit conversions with sbt times should be done using the macros that > carefully avoid roundoff errors. I don't understand why you've changed > the code that correctly did use those macros to inline math. I think that the commit message explains it: This is fast, this is precise enough (below 0.03%) and the periods defined by the protocol cannot overflow. Do you disagree? Could you please explain in which of the three lines changed the new code is worse and why? -- Andriy Gapon From owner-svn-src-head@freebsd.org Fri Oct 25 15:56:20 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54DBF174462 for ; Fri, 25 Oct 2019 15:56:20 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4707yD0fbwz3CN5 for ; Fri, 25 Oct 2019 15:56:19 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1572018977; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=h5ct80jdIctMuDRxbR/iMVwZkYn7Nkoie4Tv9MSVQD3ZPSwL2ajN6Rj4VFzR1nfIJ6yENdFWPiGBT MFXflWDCsOYn4RS74ruijMcNz7EMcFJru2t+WcS658xcT9vzvFLmiXE0FElAnpEL1yfpmSIcXhVb+T 4nehOJQ8pEGIsZ1X6PtQH5IpqxGvym9R2WGFQpM7rFuZgbVQXZq9/FYcF8pzaazt+laV0qtZ630sSX vIpCMUvM+DiKYLv9MGlRKSM8ZGGS1dbjiK+wFl7sok+Njs0+zQ+FjB2D+j1yYKWObao2krXFvjxKAB ekmvA6BmrhEaEcvOugdVEY0a2cpRRxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=Q8RMfUnzVUfcbCTWzUmi3r1VqWc4wptLSpGU0mMHrt0=; b=ac6B0hWJsfqSuq1ScatdVqZYbbHOJdlgUYGchIvWpwTr5gsRzEhlLC1ZJvNCx6Pfazc1J6LXB0X7i 4POAFMFiuIgJYmAvSqlE5ph5i/KPiovOfClWwAeUnt2ZmvTOIiW08FOr7BQhWC4pK5dmGNKP/S6Hdb FAFfdZZtPoX27c22aMW1gwlIQ62g0MPQjAUjKRjvJ5PCuy7xvyL6D1NohffImrz+f9Z8WcjuiHCwhq Du5U4qfirk/CbZmeK2p7YdDkSOkhUAJMoviIdRaeMgy/f7Yb3yQmr2mcpITf57sT9uQhFAUrxSeN0Q dboKM/IYOgNlwWoi0Zt3FxjtUzy2S2A== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=Q8RMfUnzVUfcbCTWzUmi3r1VqWc4wptLSpGU0mMHrt0=; b=JDA7eg8WJkwNHSUGto2ECluBTSiaVtZGhs141VXOEz4lx6iRSWg5Gd6OVw5p9gZeHtRvV4rfiXG3q iyMmhZcNVFNscrGxnwWcaI/LrNiA7ZzMaltCm7GTNt8LUm90wFXQPm0bw/OBaX8o24tHAA3Ecy4kZ7 RuFQp6fgWE4d+IptMGwRfo2a2i3bL9DMUEgQ/Wh+GJnP0nB5ejfvKSUOw7tQIWC2kT30b9ZM8g/Dh6 RrS7q413cc7trZZ7Ovnz5RrlnImFNIZkJA8UGcrA/hW6yXKjJ15Q3jGzJZF27fB9awPxuRdS7W2q9L KGsI8v8rxJJ+XMmkeMtU6f7fSof7EzQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: f972ee63-f73f-11e9-b80b-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id f972ee63-f73f-11e9-b80b-052b4a66b6b2; Fri, 25 Oct 2019 15:56:16 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x9PFuEgQ049723; Fri, 25 Oct 2019 09:56:14 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <0877c65ce11b0509dcc9e3ee491a37cc2a488f93.camel@freebsd.org> Subject: Re: svn commit: r354076 - head/sys/dev/ow From: Ian Lepore To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 25 Oct 2019 09:56:14 -0600 In-Reply-To: <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> References: <201910251538.x9PFc9ii028313@repo.freebsd.org> <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4707yD0fbwz3CN5 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.89)[-0.892,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:56:20 -0000 On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote: > On 25/10/2019 18:46, Ian Lepore wrote: > > On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: > > > Author: avg > > > Date: Fri Oct 25 15:38:09 2019 > > > New Revision: 354076 > > > URL: https://svnweb.freebsd.org/changeset/base/354076 > > > > > > Log: > > > owc_gpiobus_read_data: compare times in sbintime_t units > > > > > > Previously the code used sbttous() before microseconds > > > comparison > > > in one > > > place, sbttons() and nanoseconds in another, division by > > > SBT_1US > > > and > > > microseconds in yet another. > > > > > > Now the code consistently uses multiplication by SBT_1US to > > > convert > > > microseconds to sbintime_t before comparing them with periods > > > between > > > calls to sbinuptime(). This is fast, this is precise enough > > > (below > > > 0.03%) and the periods defined by the protocol cannot overflow. > > > > > > Reviewed by: imp (D22108) > > > MFC after: 2 weeks > > > > > > Modified: > > > head/sys/dev/ow/owc_gpiobus.c > > > > > > Modified: head/sys/dev/ow/owc_gpiobus.c > > > ================================================================= > > > ==== > > > ========= > > > --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019 ( > > > r354 > > > 075) > > > +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 ( > > > r354 > > > 076) > > > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct > > > ow_timing * > > > do { > > > now = sbinuptime(); > > > GETPIN(sc, &sample); > > > - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); > > > + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); > > > critical_exit(); > > > > > > - if (sbttons(now - then) < t->t_rdv * 1000) > > > + if (now - then < t->t_rdv * SBT_1US) > > > *bit = 1; > > > else > > > *bit = 0; > > > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct > > > ow_timing * > > > /* Wait out the rest of t_slot */ > > > do { > > > now = sbinuptime(); > > > - } while ((now - then) / SBT_1US < t->t_slot); > > > + } while (now - then < t->t_slot * SBT_1US); > > > > > > RELBUS(sc); > > > > > > > Unit conversions with sbt times should be done using the macros > > that > > carefully avoid roundoff errors. I don't understand why you've > > changed > > the code that correctly did use those macros to inline math. > > I think that the commit message explains it: > This is fast, this is precise enough (below 0.03%) and the periods > defined by > the protocol cannot overflow. > > Do you disagree? > Could you please explain in which of the three lines changed the new > code is > worse and why? > I absolutely disagree (or I wouldn't have replied). Unit conversions using sbt times should use the predefined macros, NOT incline multiplication and division. I don't know how to say it more clearly than that. The conversion macros are idiomatic (at least, they would be if people stopped writing inline conversion expressions). -- Ian From owner-svn-src-head@freebsd.org Fri Oct 25 16:03:54 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A766717476A; Fri, 25 Oct 2019 16:03:54 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47086x1QXtz3CnP; Fri, 25 Oct 2019 16:03:52 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lj1-f196.google.com with SMTP id 139so3119961ljf.1; Fri, 25 Oct 2019 09:03:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=GYqBfrWc5dSH51xNwAjbZr3KIG2z9Qh3PYDnrdKAJYk=; b=UrW8S/Hyg/j3cPrzDn4R06MsAl3EATAXUA3Ghb3y2ukxOw+zqb3TQRp0WUXOlqyQZP ckzKghSsPiZ87fYoLz2F5Mqo1/U2a8ly7G+3+hFKz+1ykz3702V7CcptMAKx7Ck/Ckl2 cH7m5T7JWj3O+uIlWTJLFHftBv0wNBuAK090iDlAAtvQr33WBuQYB3ov1gOi3rz5e8zB 6pX9XQkpy34o7gDXzJkmA7et/WFywlXI3fVsPXPchCeTehhI2T7K78rT31XCnETiKRRK GcAXcBSKSDFnWEzGEeCjpaXngYFtpkA7B0U2pJtqwFB09VJfkO/eJ4EY3R6N6dHP5w/Q g3Kw== X-Gm-Message-State: APjAAAVNDVwymr2bo6wnZF7v8TvxR8FdESRJFrdtRNNIMJ7El2ZsbM4B dHTABMdhsgx9EHVEUJ8gEvj86GGRlOA= X-Google-Smtp-Source: APXvYqxbmQgF3ODMKNMtv51MhZOYxzOeCb23nyRo+rWojdi8YE1S2AP6jLcpkS9SIBrRp51eXxVaMw== X-Received: by 2002:a2e:3617:: with SMTP id d23mr3040338lja.169.1572019429392; Fri, 25 Oct 2019 09:03:49 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id b2sm641883ljk.64.2019.10.25.09.03.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Oct 2019 09:03:48 -0700 (PDT) Subject: Re: svn commit: r354076 - head/sys/dev/ow To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910251538.x9PFc9ii028313@repo.freebsd.org> <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> <0877c65ce11b0509dcc9e3ee491a37cc2a488f93.camel@freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <01c62f31-1b10-6856-eb33-9238dcb0d9c6@FreeBSD.org> Date: Fri, 25 Oct 2019 19:03:47 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <0877c65ce11b0509dcc9e3ee491a37cc2a488f93.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47086x1QXtz3CnP X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.208.196 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.13 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[FreeBSD.org]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.13)[ip: (-0.34), ipnet: 209.85.128.0/17(-3.22), asn: 15169(-2.05), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[196.208.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[196.208.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:03:54 -0000 On 25/10/2019 18:56, Ian Lepore wrote: > On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote: >> On 25/10/2019 18:46, Ian Lepore wrote: >>> On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: >>>> Author: avg >>>> Date: Fri Oct 25 15:38:09 2019 >>>> New Revision: 354076 >>>> URL: https://svnweb.freebsd.org/changeset/base/354076 >>>> >>>> Log: >>>> owc_gpiobus_read_data: compare times in sbintime_t units >>>> >>>> Previously the code used sbttous() before microseconds >>>> comparison >>>> in one >>>> place, sbttons() and nanoseconds in another, division by >>>> SBT_1US >>>> and >>>> microseconds in yet another. >>>> >>>> Now the code consistently uses multiplication by SBT_1US to >>>> convert >>>> microseconds to sbintime_t before comparing them with periods >>>> between >>>> calls to sbinuptime(). This is fast, this is precise enough >>>> (below >>>> 0.03%) and the periods defined by the protocol cannot overflow. >>>> >>>> Reviewed by: imp (D22108) >>>> MFC after: 2 weeks >>>> >>>> Modified: >>>> head/sys/dev/ow/owc_gpiobus.c >>>> >>>> Modified: head/sys/dev/ow/owc_gpiobus.c >>>> ================================================================= >>>> ==== >>>> ========= >>>> --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019 ( >>>> r354 >>>> 075) >>>> +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 ( >>>> r354 >>>> 076) >>>> @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct >>>> ow_timing * >>>> do { >>>> now = sbinuptime(); >>>> GETPIN(sc, &sample); >>>> - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); >>>> + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); >>>> critical_exit(); >>>> >>>> - if (sbttons(now - then) < t->t_rdv * 1000) >>>> + if (now - then < t->t_rdv * SBT_1US) >>>> *bit = 1; >>>> else >>>> *bit = 0; >>>> @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct >>>> ow_timing * >>>> /* Wait out the rest of t_slot */ >>>> do { >>>> now = sbinuptime(); >>>> - } while ((now - then) / SBT_1US < t->t_slot); >>>> + } while (now - then < t->t_slot * SBT_1US); >>>> >>>> RELBUS(sc); >>>> >>> >>> Unit conversions with sbt times should be done using the macros >>> that >>> carefully avoid roundoff errors. I don't understand why you've >>> changed >>> the code that correctly did use those macros to inline math. >> >> I think that the commit message explains it: >> This is fast, this is precise enough (below 0.03%) and the periods >> defined by >> the protocol cannot overflow. >> >> Do you disagree? >> Could you please explain in which of the three lines changed the new >> code is >> worse and why? >> > > I absolutely disagree (or I wouldn't have replied). Unit conversions > using sbt times should use the predefined macros, NOT incline > multiplication and division. I don't know how to say it more clearly > than that. The conversion macros are idiomatic (at least, they would > be if people stopped writing inline conversion expressions). I can agree that I should have used ustosbt() instead of multiplication by SBT_1US, but I don't agree with your original message that I changed the code that correctly used the macros. But again, I know the times being converted, they are fixed by the protocol and I do not see why I have to use this: static __inline sbintime_t ustosbt(int64_t _us) { sbintime_t sb = 0; #ifdef KASSERT KASSERT(_us >= 0, ("Negative values illegal for ustosbt: %jd", _us)); #endif if (_us >= SBT_1S) { sb = (_us / 1000000) * SBT_1S; _us = _us % 1000000; } /* 9223372036855 = ceil(2^63 / 1000000) */ sb += ((_us * 9223372036855ull) + 0x7fffffff) >> 31; return (sb); } instead of this x * (((sbintime_t)1 << 32) / 1000000) The times: static struct ow_timing timing_regular = { .t_slot = 60, /* 60 to 120 */ .t_low0 = 60, /* really 60 to 120 */ .t_low1 = 1, /* really 1 to 15 */ .t_release = 45, /* <= 45us */ .t_rec = 1, /* at least 1us */ .t_rdv = 15, /* 15us */ .t_rstl = 480, /* 480us or more */ .t_rsth = 480, /* 480us or more */ .t_pdl = 60, /* 60us to 240us */ .t_pdh = 60, /* 15us to 60us */ .t_lowr = 1, /* 1us */ }; -- Andriy Gapon From owner-svn-src-head@freebsd.org Fri Oct 25 16:06:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE2BF174867 for ; Fri, 25 Oct 2019 16:06:48 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4708BJ4sF7z3D1V for ; Fri, 25 Oct 2019 16:06:48 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1572019606; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=L+toUX5s4CxFvqvE31bwLoKhKNqjCrMPwpOxNFU8yXEmO8lIRLcmwOl/Jb8xWbwkNq1YaeFnUK7HI L4e2503DggNGnpLBx7ETPQTIpl4fLCG1bITAPSMJbHBoOSeTfkx/OjYzmwvkIyktFzFme9hyoUyVH+ B5uKWRS9mAkzpqtwCHwwiDE9a+ETDjT7M1N94f2fl8WYe/rWrestsXLwIIj993zVthqoSRQDapgMTK JeHTN9dy+KhcrMv1/Kbm+pNImR3gGTNLxKOhbiKgYzlAFzk8nuIOc48PNMMpTj6XXYzk8htc5juCP8 M3/lpkhO2nsWjWS71ZoVsG3K2NM3Iqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=gpoP4SXFH0cauPXFsSGBf/VsBP5Eh/wKP4kGxvzq/NU=; b=NZYlRmC0Jf/Uy3jD0yWpl+wiznlqreyeCKttZRh4+YwpeQM2xhPARtmmjsr7l555Ccn4eNHF6IIxn lc60WJUfiIkmQdcpFqwBtnBc76CMv380RvQhR/H2VvEklQU+m9dxbxquupS89h+LWxyUhOzoxMG3M1 kVc3WiZgSAn11Z/LghKFLaA2FP/FUQqCwJA/mgsxggm7y/RofG/NnKRM6LakmLjedx9EeHvGt8F4wp IILZvze3odV72/oKlvkohG1sjneVLIRjdfW7/+bjpO269qYVPKaKJVHqoE8/sL51+BgGxUaYr4LGpP wRXrRbBoldbiPScdh9ytiEDkkHYbUFg== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=gpoP4SXFH0cauPXFsSGBf/VsBP5Eh/wKP4kGxvzq/NU=; b=cn4Xn7hFiTGGWvz6HuEdG3aDtUWWA9w1UZTnKjsb7A4kWuvvb8lKiSd3WwbgkVh6YRDXQxcscd900 zwl8P1R8iBSJwQ6KNlWES41DZAhINcFGdFanxyJpv0PiVgLHZU+eZt+9fpS5frNYrdCJvnM+xIExpj Tsxl1MnUG6sje6A0BbnZxhv4GsuV0iUWcXeBwqCM8NbkvFsnOjBKLIujsrB3mBNd10FjfhXsymWTaM IC7uVfROOFJFHCR2z+i6AhjYKJ3ekw7XZyRIYluX06b8JqhGx1WLtK9nH0STSlCrcR/ktqNwJYUygD COjkocGmnk3WIh51/4pLgo+fT2TBk8Q== X-MHO-RoutePath: aGlwcGll X-MHO-User: 7078f7db-f741-11e9-b80b-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 7078f7db-f741-11e9-b80b-052b4a66b6b2; Fri, 25 Oct 2019 16:06:45 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x9PG6iFH049768; Fri, 25 Oct 2019 10:06:44 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <8baac891351521c9e7148a0c0db9978645158dce.camel@freebsd.org> Subject: Re: svn commit: r354076 - head/sys/dev/ow From: Ian Lepore To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 25 Oct 2019 10:06:44 -0600 In-Reply-To: <01c62f31-1b10-6856-eb33-9238dcb0d9c6@FreeBSD.org> References: <201910251538.x9PFc9ii028313@repo.freebsd.org> <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> <0877c65ce11b0509dcc9e3ee491a37cc2a488f93.camel@freebsd.org> <01c62f31-1b10-6856-eb33-9238dcb0d9c6@FreeBSD.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4708BJ4sF7z3D1V X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.86 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.861,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:06:48 -0000 On Fri, 2019-10-25 at 19:03 +0300, Andriy Gapon wrote: > On 25/10/2019 18:56, Ian Lepore wrote: > > On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote: > > > On 25/10/2019 18:46, Ian Lepore wrote: > > > > On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: > > > > > Author: avg > > > > > Date: Fri Oct 25 15:38:09 2019 > > > > > New Revision: 354076 > > > > > URL: https://svnweb.freebsd.org/changeset/base/354076 > > > > > > > > > > Log: > > > > > owc_gpiobus_read_data: compare times in sbintime_t units > > > > > > > > > > Previously the code used sbttous() before microseconds > > > > > comparison > > > > > in one > > > > > place, sbttons() and nanoseconds in another, division by > > > > > SBT_1US > > > > > and > > > > > microseconds in yet another. > > > > > > > > > > Now the code consistently uses multiplication by SBT_1US to > > > > > convert > > > > > microseconds to sbintime_t before comparing them with > > > > > periods > > > > > between > > > > > calls to sbinuptime(). This is fast, this is precise > > > > > enough > > > > > (below > > > > > 0.03%) and the periods defined by the protocol cannot > > > > > overflow. > > > > > > > > > > Reviewed by: imp (D22108) > > > > > MFC after: 2 weeks > > > > > > > > > > Modified: > > > > > head/sys/dev/ow/owc_gpiobus.c > > > > > > > > > > Modified: head/sys/dev/ow/owc_gpiobus.c > > > > > ============================================================= > > > > > ==== > > > > > ==== > > > > > ========= > > > > > --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 > > > > > 2019 ( > > > > > r354 > > > > > 075) > > > > > +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 > > > > > 2019 ( > > > > > r354 > > > > > 076) > > > > > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, > > > > > struct > > > > > ow_timing * > > > > > do { > > > > > now = sbinuptime(); > > > > > GETPIN(sc, &sample); > > > > > - } while (sbttous(now - then) < t->t_rdv + 2 && sample > > > > > == 0); > > > > > + } while (now - then < (t->t_rdv + 2) * SBT_1US && > > > > > sample == 0); > > > > > critical_exit(); > > > > > > > > > > - if (sbttons(now - then) < t->t_rdv * 1000) > > > > > + if (now - then < t->t_rdv * SBT_1US) > > > > > *bit = 1; > > > > > else > > > > > *bit = 0; > > > > > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, > > > > > struct > > > > > ow_timing * > > > > > /* Wait out the rest of t_slot */ > > > > > do { > > > > > now = sbinuptime(); > > > > > - } while ((now - then) / SBT_1US < t->t_slot); > > > > > + } while (now - then < t->t_slot * SBT_1US); > > > > > > > > > > RELBUS(sc); > > > > > > > > > > > > > Unit conversions with sbt times should be done using the macros > > > > that > > > > carefully avoid roundoff errors. I don't understand why you've > > > > changed > > > > the code that correctly did use those macros to inline math. > > > > > > I think that the commit message explains it: > > > This is fast, this is precise enough (below 0.03%) and the > > > periods > > > defined by > > > the protocol cannot overflow. > > > > > > Do you disagree? > > > Could you please explain in which of the three lines changed the > > > new > > > code is > > > worse and why? > > > > > > > I absolutely disagree (or I wouldn't have replied). Unit > > conversions > > using sbt times should use the predefined macros, NOT incline > > multiplication and division. I don't know how to say it more > > clearly > > than that. The conversion macros are idiomatic (at least, they > > would > > be if people stopped writing inline conversion expressions). > > I can agree that I should have used ustosbt() instead of > multiplication by > SBT_1US, but I don't agree with your original message that I changed > the code > that correctly used the macros. > > But again, I know the times being converted, they are fixed by the > protocol and > I do not see why I have to use this: > > static __inline sbintime_t > ustosbt(int64_t _us) > { > sbintime_t sb = 0; > > #ifdef KASSERT > KASSERT(_us >= 0, ("Negative values illegal for ustosbt: > %jd", _us)); > #endif > if (_us >= SBT_1S) { > sb = (_us / 1000000) * SBT_1S; > _us = _us % 1000000; > } > /* 9223372036855 = ceil(2^63 / 1000000) */ > sb += ((_us * 9223372036855ull) + 0x7fffffff) >> 31; > return (sb); > } > > instead of this > x * (((sbintime_t)1 << 32) / 1000000) > > The times: > static struct ow_timing timing_regular = { > .t_slot = 60, /* 60 to 120 */ > .t_low0 = 60, /* really 60 to 120 */ > .t_low1 = 1, /* really 1 to 15 */ > .t_release = 45, /* <= 45us */ > .t_rec = 1, /* at least 1us */ > .t_rdv = 15, /* 15us */ > .t_rstl = 480, /* 480us or more */ > .t_rsth = 480, /* 480us or more */ > .t_pdl = 60, /* 60us to 240us */ > .t_pdh = 60, /* 15us to 60us */ > .t_lowr = 1, /* 1us */ > }; > > The fact that you could say all that means that there is nothing I can say that is going to change your mind. I will say if you ever do anything like this to code I wrote, I will revert it immediately. -- Ian From owner-svn-src-head@freebsd.org Fri Oct 25 16:07:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82F6A1748EA; Fri, 25 Oct 2019 16:07:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4708C12wRXz3D8C; Fri, 25 Oct 2019 16:07:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42EC328CCB; Fri, 25 Oct 2019 16:07:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PG7PuB046985; Fri, 25 Oct 2019 16:07:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PG7OR8046983; Fri, 25 Oct 2019 16:07:24 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251607.x9PG7OR8046983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 16:07:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354079 - head/sys/dev/superio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/superio X-SVN-Commit-Revision: 354079 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:07:25 -0000 Author: avg Date: Fri Oct 25 16:07:24 2019 New Revision: 354079 URL: https://svnweb.freebsd.org/changeset/base/354079 Log: superio: add a simple ioctl interface MFC after: 1 week Added: head/sys/dev/superio/superio_io.h (contents, props changed) Modified: head/sys/dev/superio/superio.c Modified: head/sys/dev/superio/superio.c ============================================================================== --- head/sys/dev/superio/superio.c Fri Oct 25 15:46:54 2019 (r354078) +++ head/sys/dev/superio/superio.c Fri Oct 25 16:07:24 2019 (r354079) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "isa_if.h" @@ -84,6 +85,7 @@ struct siosc { struct mtx conf_lock; STAILQ_HEAD(, superio_devinfo) devlist; struct resource* io_res; + struct cdev *chardev; int io_rid; uint16_t io_port; const struct sio_conf_methods *methods; @@ -96,6 +98,14 @@ struct siosc { uint8_t enable_reg; }; +static d_ioctl_t superio_ioctl; + +static struct cdevsw superio_cdevsw = { + .d_version = D_VERSION, + .d_ioctl = superio_ioctl, + .d_name = "superio", +}; + #define NUMPORTS 2 static uint8_t @@ -621,6 +631,12 @@ superio_attach(device_t dev) bus_generic_probe(dev); bus_generic_attach(dev); + + sc->chardev = make_dev(&superio_cdevsw, device_get_unit(dev), + UID_ROOT, GID_WHEEL, 0600, "superio%d", device_get_unit(dev)); + if (sc->chardev == NULL) + device_printf(dev, "failed to create character device\n"); + sc->chardev->si_drv1 = sc; return (0); } @@ -633,6 +649,8 @@ superio_detach(device_t dev) error = bus_generic_detach(dev); if (error != 0) return (error); + if (sc->chardev != NULL) + destroy_dev(sc->chardev); device_delete_children(dev); bus_release_resource(dev, SYS_RES_IOPORT, sc->io_rid, sc->io_res); mtx_destroy(&sc->conf_lock); @@ -913,6 +931,31 @@ superio_find_dev(device_t superio, superio_dev_type_t return (dinfo->dev); } return (NULL); +} + +static int +superio_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, + struct thread *td) +{ + struct siosc *sc; + struct superiocmd *s; + + sc = dev->si_drv1; + s = (struct superiocmd *)data; + switch (cmd) { + case SUPERIO_CR_READ: + sio_conf_enter(sc); + s->val = sio_ldn_read(sc, s->ldn, s->cr); + sio_conf_exit(sc); + return (0); + case SUPERIO_CR_WRITE: + sio_conf_enter(sc); + sio_ldn_write(sc, s->ldn, s->cr, s->val); + sio_conf_exit(sc); + return (0); + default: + return (ENOTTY); + } } static devclass_t superio_devclass; Added: head/sys/dev/superio/superio_io.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/superio/superio_io.h Fri Oct 25 16:07:24 2019 (r354079) @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2019 Andriy Gapon + * + * 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 SUPERIO_IO_H +#define SUPERIO_IO_H + +#include + +struct superiocmd { + uint8_t ldn; + uint8_t cr; + uint8_t val; +}; + +#define SUPERIO_CR_READ _IOWR('s', 0, struct superiocmd) +#define SUPERIO_CR_WRITE _IOW('s', 1, struct superiocmd) + +#endif /*SUPERIO_IO_H*/ From owner-svn-src-head@freebsd.org Fri Oct 25 16:10:17 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52A671749E0; Fri, 25 Oct 2019 16:10:17 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 4708GJ1ZHJz3DJT; Fri, 25 Oct 2019 16:10:15 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf1-f50.google.com with SMTP id i15so2197889lfo.7; Fri, 25 Oct 2019 09:10:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=vhGppseBBPVuKp7TNctLQmzqwJKoKd5PKO8Xkud/9UM=; b=jL/crt/Awa1fH1ZCDT7q6oEQf3qf4gFwFZiY+RAEYn1s8yul7UOZmK1AHMdXS8vAHP e9LBxkTSavoVfh17ACTbDxtVJuetqyloCvUFYtSBynYex92BfBVp8ATUk+7zrCL5Kj5E CIAMNxpRYLy8D3HXimOuX+X6sG0BlNX92eHYKbomyhQO97nhInTKzChrWbjSRZQ+3LQN syYaUexYLQBOVEsRG8VxECUz7UoMdf2cSOqrOMJckzLibxF9tRZgZOplTkTTbOqH8EOI NVaTZo/yv4SzfYU7rZuwUXV/zr0d5TZ1h9yFCp0R0Q0WVqvvSbPDu0yokIHG/asbIO5i S6UQ== X-Gm-Message-State: APjAAAU7pRuv5ZFlGvZBasfIlER+AsD3CazOvpDf4sWVqnTs5ZoL7vnw UGxPxa7To+2DkWlrzKgHkzVohv8NcUo= X-Google-Smtp-Source: APXvYqzpv58iLhtIev080DYGNqPUp0dnKjcU6I8MLRE3N2krVhgfNPbTDRr05TLEz+LOMPOYb9T0xQ== X-Received: by 2002:a19:6e0a:: with SMTP id j10mr3448174lfc.131.1572019814108; Fri, 25 Oct 2019 09:10:14 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id 12sm2228271lje.92.2019.10.25.09.10.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Oct 2019 09:10:13 -0700 (PDT) Subject: Re: svn commit: r354076 - head/sys/dev/ow To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910251538.x9PFc9ii028313@repo.freebsd.org> <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> <0877c65ce11b0509dcc9e3ee491a37cc2a488f93.camel@freebsd.org> <01c62f31-1b10-6856-eb33-9238dcb0d9c6@FreeBSD.org> <8baac891351521c9e7148a0c0db9978645158dce.camel@freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: Date: Fri, 25 Oct 2019 19:10:12 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <8baac891351521c9e7148a0c0db9978645158dce.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4708GJ1ZHJz3DJT X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.167.50 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.17 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.17)[ip: (-0.54), ipnet: 209.85.128.0/17(-3.22), asn: 15169(-2.05), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[50.167.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[50.167.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:10:17 -0000 On 25/10/2019 19:06, Ian Lepore wrote: > I will say if you ever do > anything like this to code I wrote, I will revert it immediately. I hope you never write code like: - if (sbttons(now - then) < t->t_rdv * 1000) - } while ((now - then) / SBT_1US < t->t_slot); -- Andriy Gapon From owner-svn-src-head@freebsd.org Fri Oct 25 16:28:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E0AD174FBE; Fri, 25 Oct 2019 16:28:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4708gX1MBwz3F98; Fri, 25 Oct 2019 16:28:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1200C2903C; Fri, 25 Oct 2019 16:28:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PGSd9C058468; Fri, 25 Oct 2019 16:28:39 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PGSdVm058467; Fri, 25 Oct 2019 16:28:39 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251628.x9PGSdVm058467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 16:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354080 - head/sys/dev/superio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/superio X-SVN-Commit-Revision: 354080 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:28:40 -0000 Author: avg Date: Fri Oct 25 16:28:39 2019 New Revision: 354080 URL: https://svnweb.freebsd.org/changeset/base/354080 Log: superio_io.h: fix the copyright MFC after: 1 week Modified: head/sys/dev/superio/superio_io.h Modified: head/sys/dev/superio/superio_io.h ============================================================================== --- head/sys/dev/superio/superio_io.h Fri Oct 25 16:07:24 2019 (r354079) +++ head/sys/dev/superio/superio_io.h Fri Oct 25 16:28:39 2019 (r354080) @@ -1,4 +1,6 @@ -/* + /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2019 Andriy Gapon * * Redistribution and use in source and binary forms, with or without @@ -10,7 +12,7 @@ * 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 + * 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 From owner-svn-src-head@freebsd.org Fri Oct 25 16:29:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 500E117503F; Fri, 25 Oct 2019 16:29:10 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4708h61RFVz3FJl; Fri, 25 Oct 2019 16:29:10 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14A9E2903E; Fri, 25 Oct 2019 16:29:10 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PGT99m058534; Fri, 25 Oct 2019 16:29:09 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PGT9Fo058533; Fri, 25 Oct 2019 16:29:09 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910251629.x9PGT9Fo058533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 25 Oct 2019 16:29:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354081 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354081 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:29:10 -0000 Author: bz Date: Fri Oct 25 16:29:09 2019 New Revision: 354081 URL: https://svnweb.freebsd.org/changeset/base/354081 Log: frag6: do not leak counter in error cases When allocating the IPv6 fragement packet queue entry we do checks against counters and if we pass we increment one of the counters to claim the spot. Right after that we have two cases (malloc and MAC) which can both fail in which case we free the entry but never released our claim on the counter. In theory this can lead to not accepting new fragments after a long time, especially if it would be MAC "refusing" them. Rather than immediately subtracting the value in the error case, only increment it after these two cases so we can no longer leak it. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Fri Oct 25 16:28:39 2019 (r354080) +++ head/sys/netinet6/frag6.c Fri Oct 25 16:29:09 2019 (r354081) @@ -528,7 +528,6 @@ frag6_input(struct mbuf **mp, int *offp, int proto) atomic_load_int(&V_frag6_nfragpackets) >= (u_int)V_ip6_maxfragpackets) goto dropfrag; - atomic_add_int(&V_frag6_nfragpackets, 1); /* Allocate IPv6 fragement packet queue entry. */ q6 = (struct ip6q *)malloc(sizeof(struct ip6q), M_FRAG6, @@ -542,6 +541,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } mac_ip6q_create(m, q6); #endif + atomic_add_int(&V_frag6_nfragpackets, 1); /* ip6q_nxt will be filled afterwards, from 1st fragment. */ TAILQ_INIT(&q6->ip6q_frags); From owner-svn-src-head@freebsd.org Fri Oct 25 16:30:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C58E017512C; Fri, 25 Oct 2019 16:30:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4708jX4tfCz3FYJ; Fri, 25 Oct 2019 16:30:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B1E929043; Fri, 25 Oct 2019 16:30:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PGUOdi058794; Fri, 25 Oct 2019 16:30:24 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PGUOml058793; Fri, 25 Oct 2019 16:30:24 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251630.x9PGUOml058793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 16:30:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354082 - head/sys/dev/superio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/superio X-SVN-Commit-Revision: 354082 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:30:24 -0000 Author: avg Date: Fri Oct 25 16:30:24 2019 New Revision: 354082 URL: https://svnweb.freebsd.org/changeset/base/354082 Log: superio: do not crash if failed to create the character device MFC after: 1 week Modified: head/sys/dev/superio/superio.c Modified: head/sys/dev/superio/superio.c ============================================================================== --- head/sys/dev/superio/superio.c Fri Oct 25 16:29:09 2019 (r354081) +++ head/sys/dev/superio/superio.c Fri Oct 25 16:30:24 2019 (r354082) @@ -636,7 +636,8 @@ superio_attach(device_t dev) UID_ROOT, GID_WHEEL, 0600, "superio%d", device_get_unit(dev)); if (sc->chardev == NULL) device_printf(dev, "failed to create character device\n"); - sc->chardev->si_drv1 = sc; + else + sc->chardev->si_drv1 = sc; return (0); } From owner-svn-src-head@freebsd.org Fri Oct 25 16:59:55 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B70CB175817; Fri, 25 Oct 2019 16:59:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4709Mb4NW9z3GqS; Fri, 25 Oct 2019 16:59:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76901295C4; Fri, 25 Oct 2019 16:59:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PGxtxM076417; Fri, 25 Oct 2019 16:59:55 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PGxtLX076416; Fri, 25 Oct 2019 16:59:55 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910251659.x9PGxtLX076416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 25 Oct 2019 16:59:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354083 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354083 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:59:55 -0000 Author: glebius Date: Fri Oct 25 16:59:54 2019 New Revision: 354083 URL: https://svnweb.freebsd.org/changeset/base/354083 Log: Add couple more assertions to vm_pager_assert_in(). The bogus page is not allowed at ends of the request, and all non-bogus pages must be consecutive. Reviewed by: kib Modified: head/sys/vm/vm_pager.c Modified: head/sys/vm/vm_pager.c ============================================================================== --- head/sys/vm/vm_pager.c Fri Oct 25 16:30:24 2019 (r354082) +++ head/sys/vm/vm_pager.c Fri Oct 25 16:59:54 2019 (r354083) @@ -257,15 +257,20 @@ vm_pager_assert_in(vm_object_t object, vm_page_t *m, i { #ifdef INVARIANTS - VM_OBJECT_ASSERT_WLOCKED(object); - KASSERT(count > 0, ("%s: 0 count", __func__)); /* - * All pages must be busied, not mapped, not fully valid, - * not dirty and belong to the proper object. + * All pages must be consecutive, busied, not mapped, not fully valid, + * not dirty and belong to the proper object. Some pages may be the + * bogus page, but the first and last pages must be a real ones. */ + + VM_OBJECT_ASSERT_WLOCKED(object); + KASSERT(count > 0, ("%s: 0 count", __func__)); for (int i = 0 ; i < count; i++) { - if (m[i] == bogus_page) + if (m[i] == bogus_page) { + KASSERT(i != 0 && i != count - 1, + ("%s: page %d is the bogus page", __func__, i)); continue; + } vm_page_assert_xbusied(m[i]); KASSERT(!pmap_page_is_mapped(m[i]), ("%s: page %p is mapped", __func__, m[i])); @@ -275,6 +280,8 @@ vm_pager_assert_in(vm_object_t object, vm_page_t *m, i ("%s: page %p is dirty", __func__, m[i])); KASSERT(m[i]->object == object, ("%s: wrong object %p/%p", __func__, object, m[i]->object)); + KASSERT(m[i]->pindex == m[0]->pindex + i, + ("%s: page %p isn't consecutive", __func__, m[i])); } #endif } From owner-svn-src-head@freebsd.org Fri Oct 25 17:41:08 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1C93176237; Fri, 25 Oct 2019 17:41:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470BH84JgNz3JfS; Fri, 25 Oct 2019 17:41:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 78A5229E8F; Fri, 25 Oct 2019 17:41:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PHf8Dq000611; Fri, 25 Oct 2019 17:41:08 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PHf8Go000610; Fri, 25 Oct 2019 17:41:08 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910251741.x9PHf8Go000610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 25 Oct 2019 17:41:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354084 - head/tests/sys/netinet6/frag6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/tests/sys/netinet6/frag6 X-SVN-Commit-Revision: 354084 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 17:41:08 -0000 Author: bz Date: Fri Oct 25 17:41:08 2019 New Revision: 354084 URL: https://svnweb.freebsd.org/changeset/base/354084 Log: frag6-test: update for r354046, conform to 8200 for overlapping fragments The change to conform to RFC 8200 for overlapping fragments now frees the entire reassembly queue if the overlapping fragments are not an exact match. As a result we do see one less packet in the timeout statistics from expiry. No other statistics change as the event is not counted. It can be argued that we should improve the statistics counters in that case. This test case update should have been committed alongside the original commit. Pointyhat to: bz MFC after: 3 weeks X-MFC with: r354046 Sponsored by: Netflix Modified: head/tests/sys/netinet6/frag6/frag6_14.sh Modified: head/tests/sys/netinet6/frag6/frag6_14.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_14.sh Fri Oct 25 16:59:54 2019 (r354083) +++ head/tests/sys/netinet6/frag6/frag6_14.sh Fri Oct 25 17:41:08 2019 (r354084) @@ -95,7 +95,7 @@ EOF 0 6 2 - 4 + 3 0 0 0 From owner-svn-src-head@freebsd.org Fri Oct 25 17:56:25 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85F921767D5; Fri, 25 Oct 2019 17:56:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Bcn322Hz3KML; Fri, 25 Oct 2019 17:56:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B1BE2A0E6; Fri, 25 Oct 2019 17:56:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PHuP1u011440; Fri, 25 Oct 2019 17:56:25 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PHuPW2011439; Fri, 25 Oct 2019 17:56:25 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910251756.x9PHuPW2011439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 25 Oct 2019 17:56:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354086 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 354086 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 17:56:25 -0000 Author: manu Date: Fri Oct 25 17:56:24 2019 New Revision: 354086 URL: https://svnweb.freebsd.org/changeset/base/354086 Log: flash: Add GigaDevice gd25q128 flash Add this flash chip which is a 128Mb spi flash. MFC after: 1 week Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Fri Oct 25 17:54:37 2019 (r354085) +++ head/sys/dev/flash/mx25l.c Fri Oct 25 17:56:24 2019 (r354086) @@ -150,6 +150,7 @@ static struct mx25l_flash_ident flash_devices[] = { /* GigaDevice */ { "gd25q64", 0xc8, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, + { "gd25q128", 0xc8, 0x4018, 64 * 1024, 256, FL_ERASE_4K }, }; static int From owner-svn-src-head@freebsd.org Fri Oct 25 18:08:26 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05C12176D10; Fri, 25 Oct 2019 18:08:26 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Btd6Pmfz3L7B; Fri, 25 Oct 2019 18:08:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF5292A2AA; Fri, 25 Oct 2019 18:08:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PI8PRx017510; Fri, 25 Oct 2019 18:08:25 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PI8Po2017509; Fri, 25 Oct 2019 18:08:25 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910251808.x9PI8Po2017509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 25 Oct 2019 18:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354087 - head/sys/arm64/rockchip/clk X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm64/rockchip/clk X-SVN-Commit-Revision: 354087 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 18:08:26 -0000 Author: manu Date: Fri Oct 25 18:08:25 2019 New Revision: 354087 URL: https://svnweb.freebsd.org/changeset/base/354087 Log: arm64: rk3399: Add clock and gate for usb3 clocks MFC after: 1 month Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk3399_cru.c Fri Oct 25 17:56:24 2019 (r354086) +++ head/sys/arm64/rockchip/clk/rk3399_cru.c Fri Oct 25 18:08:25 2019 (r354087) @@ -54,9 +54,18 @@ __FBSDID("$FreeBSD$"); #define SCLK_USB2PHY0_REF 123 #define SCLK_USB2PHY1_REF 124 +#define SCLK_USB3OTG0_REF 129 +#define SCLK_USB3OTG1_REF 130 +#define SCLK_USB3OTG0_SUSPEND 131 +#define SCLK_USB3OTG1_SUSPEND 132 #define ACLK_EMMC_CORE 241 #define ACLK_EMMC_NOC 242 #define ACLK_EMMC_GRF 243 +#define ACLK_USB3_NOC 245 +#define ACLK_USB3OTG0 246 +#define ACLK_USB3OTG1 247 +#define ACLK_USB3_RKSOC_AXI_PERF 248 +#define ACLK_USB3_GRF 249 #define PCLK_GPIO2 336 #define PCLK_GPIO3 337 #define PCLK_GPIO4 338 @@ -103,6 +112,12 @@ static struct rk_cru_gate rk3399_gates[] = { CRU_GATE(0, "hclk_perilp1_cpll_src", "cpll", 0x320, 1) CRU_GATE(0, "hclk_perilp1_gpll_src", "gpll", 0x320, 0) + /* CRU_CLKGATE_CON12 */ + CRU_GATE(SCLK_USB3OTG0_REF, "sclk_usb3otg0_ref", "xin24m", 0x330, 1) + CRU_GATE(SCLK_USB3OTG1_REF, "sclk_usb3otg1_ref", "xin24m", 0x330, 2) + CRU_GATE(SCLK_USB3OTG0_SUSPEND, "sclk_usb3otg0_suspend", "xin24m", 0x330, 3) + CRU_GATE(SCLK_USB3OTG1_SUSPEND, "sclk_usb3otg1_suspend", "xin24m", 0x330, 4) + /* CRU_CLKGATE_CON20 */ CRU_GATE(HCLK_HOST0, "hclk_host0", "hclk_perihp", 0x350, 5) CRU_GATE(HCLK_HOST0_ARB, "hclk_host0_arb", "hclk_perihp", 0x350, 6) @@ -117,6 +132,13 @@ static struct rk_cru_gate rk3399_gates[] = { CRU_GATE(PCLK_I2C2, "pclk_rki2c2", "pclk_perilp1", 0x358, 9) CRU_GATE(PCLK_I2C3, "pclk_rki2c3", "pclk_perilp1", 0x358, 10) + /* CRU_CLKGATE_CON30 */ + CRU_GATE(ACLK_USB3_NOC, "aclk_usb3_noc", "aclk_usb3", 0x378, 0) + CRU_GATE(ACLK_USB3OTG0, "aclk_usb3otg0", "aclk_usb3", 0x378, 1) + CRU_GATE(ACLK_USB3OTG1, "aclk_usb3otg1", "aclk_usb3", 0x378, 2) + CRU_GATE(ACLK_USB3_RKSOC_AXI_PERF, "aclk_usb3_rksoc_axi_perf", "aclk_usb3", 0x378, 3) + CRU_GATE(ACLK_USB3_GRF, "aclk_usb3_grf", "aclk_usb3", 0x378, 4) + /* CRU_CLKGATE_CON31 */ CRU_GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_alive", 0x37c, 3) CRU_GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_alive", 0x37c, 4) @@ -1066,6 +1088,32 @@ static struct rk_clk_composite_def pclk_perilp1 = { .flags = RK_CLK_COMPOSITE_HAVE_GATE, }; +/* USB3 clock */ + +#define ACLK_USB3 244 +static const char *aclk_usb3_parents[] = {"cpll", "gpll", "npll", "npll"}; +static struct rk_clk_composite_def aclk_usb3 = { + .clkdef = { + .id = ACLK_USB3, + .name = "aclk_usb3", + .parent_names = aclk_usb3_parents, + .parent_cnt = nitems(aclk_usb3_parents), + }, + /* CRU_CLKSET_CON39 */ + .muxdiv_offset = 0x19C, + .mux_shift = 6, + .mux_width = 2, + + .div_shift = 0, + .div_width = 5, + + /* CRU_CLKGATE_CON12 */ + .gate_offset = 0x330, + .gate_shift = 0, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE, +}; + /* * i2c */ @@ -1210,6 +1258,114 @@ static struct rk_clk_composite_def i2c7 = { .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, }; +/* USB3 */ + +#define SCLK_UPHY0_TCPDPHY_REF 125 +#define SCLK_UPHY0_TCPDCORE 126 + +/* Missing xin32k exported by rk808 */ +static const char *uphy0_tcpdphy_ref_parents[] = {"xin24m"}; + +static struct rk_clk_composite_def uphy0_tcpdphy_ref = { + .clkdef = { + .id = SCLK_UPHY0_TCPDPHY_REF, + .name = "uphy0_tcpdphy_ref", + .parent_names = uphy0_tcpdphy_ref_parents, + .parent_cnt = nitems(uphy0_tcpdphy_ref_parents), + }, + /* CRU_CLKSET_CON64 */ + .muxdiv_offset = 0x0200, + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 8, + .div_width = 5, + + /* CRU_CLKGATE_CON13 */ + .gate_offset = 0x0334, + .gate_shift = 4, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +/* Missing xin32k exported by rk808 */ +static const char *uphy0_tcpdcore_parents[] = {"xin24m", "xin24m", "cpll", "gpll"}; + +static struct rk_clk_composite_def uphy0_tcpdcore = { + .clkdef = { + .id = SCLK_UPHY0_TCPDCORE, + .name = "uphy0_tcpdcore", + .parent_names = uphy0_tcpdcore_parents, + .parent_cnt = nitems(uphy0_tcpdcore_parents), + }, + /* CRU_CLKSET_CON64 */ + .muxdiv_offset = 0x0200, + .mux_shift = 6, + .mux_width = 2, + + .div_shift = 0, + .div_width = 5, + + /* CRU_CLKGATE_CON13 */ + .gate_offset = 0x0334, + .gate_shift = 5, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +#define SCLK_UPHY1_TCPDPHY_REF 127 +#define SCLK_UPHY1_TCPDCORE 128 + +/* Missing xin32k exported by rk808 */ +static const char *uphy1_tcpdphy_ref_parents[] = {"xin24m"}; + +static struct rk_clk_composite_def uphy1_tcpdphy_ref = { + .clkdef = { + .id = SCLK_UPHY1_TCPDPHY_REF, + .name = "uphy1_tcpdphy_ref", + .parent_names = uphy1_tcpdphy_ref_parents, + .parent_cnt = nitems(uphy1_tcpdphy_ref_parents), + }, + /* CRU_CLKSET_CON65 */ + .muxdiv_offset = 0x0204, + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 8, + .div_width = 5, + + /* CRU_CLKGATE_CON13 */ + .gate_offset = 0x0334, + .gate_shift = 6, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +/* Missing xin32k exported by rk808 */ +static const char *uphy1_tcpdcore_parents[] = {"xin24m", "xin24m", "cpll", "gpll"}; + +static struct rk_clk_composite_def uphy1_tcpdcore = { + .clkdef = { + .id = SCLK_UPHY1_TCPDCORE, + .name = "uphy1_tcpdcore", + .parent_names = uphy1_tcpdcore_parents, + .parent_cnt = nitems(uphy1_tcpdcore_parents), + }, + /* CRU_CLKSET_CON65 */ + .muxdiv_offset = 0x0204, + .mux_shift = 6, + .mux_width = 2, + + .div_shift = 0, + .div_width = 5, + + /* CRU_CLKGATE_CON13 */ + .gate_offset = 0x0334, + .gate_shift = 7, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + /* * ARM CPU clocks (LITTLE and big) */ @@ -1593,6 +1749,10 @@ static struct rk_clk rk3399_clks[] = { }, { .type = RK_CLK_COMPOSITE, + .clk.composite = &aclk_usb3, + }, + { + .type = RK_CLK_COMPOSITE, .clk.composite = &i2c1, }, { @@ -1614,6 +1774,22 @@ static struct rk_clk rk3399_clks[] = { { .type = RK_CLK_COMPOSITE, .clk.composite = &i2c7, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &uphy0_tcpdphy_ref, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &uphy0_tcpdcore, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &uphy1_tcpdphy_ref, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &uphy1_tcpdcore, }, { From owner-svn-src-head@freebsd.org Fri Oct 25 18:09:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0BDD176D94; Fri, 25 Oct 2019 18:09:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470BvJ3nRWz3LGR; Fri, 25 Oct 2019 18:09:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66B0B2A2AB; Fri, 25 Oct 2019 18:09:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PI90c1017579; Fri, 25 Oct 2019 18:09:00 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PI8xgg017572; Fri, 25 Oct 2019 18:08:59 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910251808.x9PI8xgg017572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 25 Oct 2019 18:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354088 - in head/sys: arm64/conf arm64/rockchip conf X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm64/conf arm64/rockchip conf X-SVN-Commit-Revision: 354088 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 18:09:00 -0000 Author: manu Date: Fri Oct 25 18:08:59 2019 New Revision: 354088 URL: https://svnweb.freebsd.org/changeset/base/354088 Log: arm64: rockchip: Add rk_dwc3 driver This is a simplebus like driver that attaches the dwc3 child node and enable the clocks needed for the module. MFC after: 1 month Added: head/sys/arm64/rockchip/rk_dwc3.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Fri Oct 25 18:08:25 2019 (r354087) +++ head/sys/arm64/conf/GENERIC Fri Oct 25 18:08:59 2019 (r354088) @@ -215,6 +215,7 @@ 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 Added: head/sys/arm64/rockchip/rk_dwc3.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/rockchip/rk_dwc3.c Fri Oct 25 18:08:59 2019 (r354088) @@ -0,0 +1,201 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Emmanuel Vadot + * + * 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. + */ + +/* + * Rockchip DWC3 glue + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +static struct ofw_compat_data compat_data[] = { + { "rockchip,rk3399-dwc3", 1 }, + { NULL, 0 } +}; + +struct rk_dwc3_softc { + struct simplebus_softc sc; + device_t dev; + clk_t clk_ref; + clk_t clk_suspend; + clk_t clk_bus; + clk_t clk_axi_perf; + clk_t clk_usb3; + clk_t clk_grf; + hwreset_t rst_usb3; +}; + +static int +rk_dwc3_probe(device_t dev) +{ + phandle_t node; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + /* Binding says that we need a child node for the actual dwc3 controller */ + node = ofw_bus_get_node(dev); + if (OF_child(node) <= 0) + return (ENXIO); + + device_set_desc(dev, "Rockchip RK3399 DWC3"); + return (BUS_PROBE_DEFAULT); +} + +static int +rk_dwc3_attach(device_t dev) +{ + struct rk_dwc3_softc *sc; + device_t cdev; + phandle_t node, child; + int err; + + sc = device_get_softc(dev); + sc->dev = dev; + node = ofw_bus_get_node(dev); + + /* Mandatory clocks */ + if (clk_get_by_ofw_name(dev, 0, "ref_clk", &sc->clk_ref) != 0) { + device_printf(dev, "Cannot get ref_clk clock\n"); + return (ENXIO); + } + err = clk_enable(sc->clk_ref); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_ref)); + return (ENXIO); + } + if (clk_get_by_ofw_name(dev, 0, "suspend_clk", &sc->clk_suspend) != 0) { + device_printf(dev, "Cannot get suspend_clk clock\n"); + return (ENXIO); + } + err = clk_enable(sc->clk_suspend); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_suspend)); + return (ENXIO); + } + if (clk_get_by_ofw_name(dev, 0, "bus_clk", &sc->clk_bus) != 0) { + device_printf(dev, "Cannot get bus_clk clock\n"); + return (ENXIO); + } + err = clk_enable(sc->clk_bus); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_bus)); + return (ENXIO); + } + if (clk_get_by_ofw_name(dev, 0, "grf_clk", &sc->clk_grf) != 0) { + device_printf(dev, "Cannot get grf_clk clock\n"); + return (ENXIO); + } + err = clk_enable(sc->clk_grf); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_grf)); + return (ENXIO); + } + + /* Optional clocks */ + if (clk_get_by_ofw_name(dev, 0, "aclk_usb3_rksoc_axi_perf", &sc->clk_axi_perf) == 0) { + err = clk_enable(sc->clk_axi_perf); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_axi_perf)); + return (ENXIO); + } + } + if (clk_get_by_ofw_name(dev, 0, "aclk_usb3", &sc->clk_usb3) == 0) { + err = clk_enable(sc->clk_usb3); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_usb3)); + return (ENXIO); + } + } + + /* Put module out of reset */ + if (hwreset_get_by_ofw_name(dev, node, "usb3-otg", &sc->rst_usb3) == 0) { + if (hwreset_deassert(sc->rst_usb3) != 0) { + device_printf(dev, "Cannot deassert reset\n"); + return (ENXIO); + } + } + + simplebus_init(dev, node); + if (simplebus_fill_ranges(node, &sc->sc) < 0) { + device_printf(dev, "could not get ranges\n"); + return (ENXIO); + } + + for (child = OF_child(node); child > 0; child = OF_peer(child)) { + cdev = simplebus_add_device(dev, child, 0, NULL, -1, NULL); + if (cdev != NULL) + device_probe_and_attach(cdev); + } + + return (bus_generic_attach(dev)); +} + +static device_method_t rk_dwc3_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, rk_dwc3_probe), + DEVMETHOD(device_attach, rk_dwc3_attach), + + DEVMETHOD_END +}; + +static devclass_t rk_dwc3_devclass; + +DEFINE_CLASS_1(rk_dwc3, rk_dwc3_driver, rk_dwc3_methods, + sizeof(struct rk_dwc3_softc), simplebus_driver); +DRIVER_MODULE(rk_dwc3, simplebus, rk_dwc3_driver, rk_dwc3_devclass, 0, 0); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Oct 25 18:08:25 2019 (r354087) +++ head/sys/conf/files.arm64 Fri Oct 25 18:08:59 2019 (r354088) @@ -292,6 +292,7 @@ cddl/dev/fbt/aarch64/fbt_isa.c optional dtrace_fbt # RockChip Drivers arm64/rockchip/rk3399_emmcphy.c optional fdt rk_emmcphy soc_rockchip_rk3399 +arm64/rockchip/rk_dwc3.c optional fdt rk_dwc3 soc_rockchip_rk3399 arm64/rockchip/rk_i2c.c optional fdt rk_i2c soc_rockchip_rk3328 | fdt rk_i2c soc_rockchip_rk3399 arm64/rockchip/rk805.c optional fdt rk805 soc_rockchip_rk3328 | fdt rk805 soc_rockchip_rk3399 arm64/rockchip/rk_grf.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 From owner-svn-src-head@freebsd.org Fri Oct 25 18:10:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0DB8176E32; Fri, 25 Oct 2019 18:10:03 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470BwW4WCjz3LQg; Fri, 25 Oct 2019 18:10:03 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65A7E2A2AF; Fri, 25 Oct 2019 18:10:03 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PIA37d017730; Fri, 25 Oct 2019 18:10:03 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PIA3Tg017727; Fri, 25 Oct 2019 18:10:03 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910251810.x9PIA3Tg017727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 25 Oct 2019 18:10:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354089 - in head/sys: arm64/conf arm64/rockchip conf X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm64/conf arm64/rockchip conf X-SVN-Commit-Revision: 354089 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 18:10:03 -0000 Author: manu Date: Fri Oct 25 18:10:02 2019 New Revision: 354089 URL: https://svnweb.freebsd.org/changeset/base/354089 Log: arm64: rockchip: Add RK3399 TypeC phy driver This is a driver for the USB3 PHY present in the RK3399. While the phy support DP (Display Port) the driver doesn't has we have no driver to test this with for now. All the lane and pll configuration is just magic values from rockchip. While the manual have some info on those registers it's really hard to understand how to calculate those values (if there is a way). MFC after: 1 month Added: head/sys/arm64/rockchip/rk_typec_phy.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Fri Oct 25 18:08:59 2019 (r354088) +++ head/sys/arm64/conf/GENERIC Fri Oct 25 18:10:02 2019 (r354089) @@ -208,6 +208,7 @@ device pl011 # USB support device aw_usbphy # Allwinner USB PHY device rk_usb2phy # Rockchip USB2PHY +device rk_typec_phy # Rockchip TypeC PHY device dwcotg # DWC OTG controller device ohci # OHCI USB interface device ehci # EHCI USB interface (USB 2.0) Added: head/sys/arm64/rockchip/rk_typec_phy.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/rockchip/rk_typec_phy.c Fri Oct 25 18:10:02 2019 (r354089) @@ -0,0 +1,474 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Emmanuel Vadot + * + * 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. + */ + +/* + * Rockchip PHY TYPEC + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "syscon_if.h" + +#define GRF_USB3OTG_BASE(x) (0x2430 + (0x10 * x)) +#define GRF_USB3OTG_CON0(x) (GRF_USB3OTG_BASE(x) + 0x0) +#define GRF_USB3OTG_CON1(x) (GRF_USB3OTG_BASE(x) + 0x4) +#define USB3OTG_CON1_U3_DIS (1 << 0) + +#define GRF_USB3PHY_BASE(x) (0x0e580 + (0xc * (x))) +#define GRF_USB3PHY_CON0(x) (GRF_USB3PHY_BASE(x) + 0x0) +#define USB3PHY_CON0_USB2_ONLY (1 << 3) +#define GRF_USB3PHY_CON1(x) (GRF_USB3PHY_BASE(x) + 0x4) +#define GRF_USB3PHY_CON2(x) (GRF_USB3PHY_BASE(x) + 0x8) +#define GRF_USB3PHY_STATUS0 0x0e5c0 +#define GRF_USB3PHY_STATUS1 0x0e5c4 + +#define CMN_PLL0_VCOCAL_INIT (0x84 << 2) +#define CMN_PLL0_VCOCAL_ITER (0x85 << 2) +#define CMN_PLL0_INTDIV (0x94 << 2) +#define CMN_PLL0_FRACDIV (0x95 << 2) +#define CMN_PLL0_HIGH_THR (0x96 << 2) +#define CMN_PLL0_DSM_DIAG (0x97 << 2) +#define CMN_PLL0_SS_CTRL1 (0x98 << 2) +#define CMN_PLL0_SS_CTRL2 (0x99 << 2) +#define CMN_DIAG_PLL0_FBH_OVRD (0x1c0 << 2) +#define CMN_DIAG_PLL0_FBL_OVRD (0x1c1 << 2) +#define CMN_DIAG_PLL0_OVRD (0x1c2 << 2) +#define CMN_DIAG_PLL0_V2I_TUNE (0x1c5 << 2) +#define CMN_DIAG_PLL0_CP_TUNE (0x1c6 << 2) +#define CMN_DIAG_PLL0_LF_PROG (0x1c7 << 2) +#define CMN_DIAG_HSCLK_SEL (0x1e0 << 2) +#define CMN_DIAG_HSCLK_SEL_PLL_CONFIG 0x30 +#define CMN_DIAG_HSCLK_SEL_PLL_MASK 0x33 + +#define TX_TXCC_MGNFS_MULT_000(lane) ((0x4050 | ((lane) << 9)) << 2) +#define XCVR_DIAG_BIDI_CTRL(lane) ((0x40e8 | ((lane) << 9)) << 2) +#define XCVR_DIAG_LANE_FCM_EN_MGN(lane) ((0x40f2 | ((lane) << 9)) << 2) +#define TX_PSC_A0(lane) ((0x4100 | ((lane) << 9)) << 2) +#define TX_PSC_A1(lane) ((0x4101 | ((lane) << 9)) << 2) +#define TX_PSC_A2(lane) ((0x4102 | ((lane) << 9)) << 2) +#define TX_PSC_A3(lane) ((0x4103 | ((lane) << 9)) << 2) +#define TX_RCVDET_EN_TMR(lane) ((0x4122 | ((lane) << 9)) << 2) +#define TX_RCVDET_ST_TMR(lane) ((0x4123 | ((lane) << 9)) << 2) + +#define RX_PSC_A0(lane) ((0x8000 | ((lane) << 9)) << 2) +#define RX_PSC_A1(lane) ((0x8001 | ((lane) << 9)) << 2) +#define RX_PSC_A2(lane) ((0x8002 | ((lane) << 9)) << 2) +#define RX_PSC_A3(lane) ((0x8003 | ((lane) << 9)) << 2) +#define RX_PSC_CAL(lane) ((0x8006 | ((lane) << 9)) << 2) +#define RX_PSC_RDY(lane) ((0x8007 | ((lane) << 9)) << 2) +#define RX_SIGDET_HL_FILT_TMR(lane) ((0x8090 | ((lane) << 9)) << 2) +#define RX_REE_CTRL_DATA_MASK(lane) ((0x81bb | ((lane) << 9)) << 2) +#define RX_DIAG_SIGDET_TUNE(lane) ((0x81dc | ((lane) << 9)) << 2) + +#define PMA_LANE_CFG (0xc000 << 2) +#define PIN_ASSIGN_D_F 0x5100 +#define DP_MODE_CTL (0xc008 << 2) +#define DP_MODE_ENTER_A2 0xc104 +#define PMA_CMN_CTRL1 (0xc800 << 2) +#define PMA_CMN_CTRL1_READY (1 << 0) + +static struct ofw_compat_data compat_data[] = { + { "rockchip,rk3399-typec-phy", 1 }, + { NULL, 0 } +}; + +static struct resource_spec rk_typec_phy_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +struct rk_typec_phy_softc { + device_t dev; + struct resource *res; + struct syscon *grf; + clk_t tcpdcore; + clk_t tcpdphy_ref; + hwreset_t rst_uphy; + hwreset_t rst_pipe; + hwreset_t rst_tcphy; + int mode; + int phy_ctrl_id; +}; + +#define RK_TYPEC_PHY_READ(sc, reg) bus_read_4(sc->res, (reg)) +#define RK_TYPEC_PHY_WRITE(sc, reg, val) bus_write_4(sc->res, (reg), (val)) + +/* Phy class and methods. */ +static int rk_typec_phy_enable(struct phynode *phynode, bool enable); +static int rk_typec_phy_get_mode(struct phynode *phy, int *mode); +static int rk_typec_phy_set_mode(struct phynode *phy, int mode); +static phynode_method_t rk_typec_phy_phynode_methods[] = { + PHYNODEMETHOD(phynode_enable, rk_typec_phy_enable), + PHYNODEMETHOD(phynode_usb_get_mode, rk_typec_phy_get_mode), + PHYNODEMETHOD(phynode_usb_set_mode, rk_typec_phy_set_mode), + + PHYNODEMETHOD_END +}; + +DEFINE_CLASS_1(rk_typec_phy_phynode, rk_typec_phy_phynode_class, + rk_typec_phy_phynode_methods, + sizeof(struct phynode_usb_sc), phynode_usb_class); + +enum RK3399_USBPHY { + RK3399_TYPEC_PHY_DP = 0, + RK3399_TYPEC_PHY_USB3, +}; + +static void +rk_typec_phy_set_usb2_only(struct rk_typec_phy_softc *sc, bool usb2only) +{ + uint32_t reg; + + /* Disable usb3tousb2 only */ + reg = SYSCON_READ_4(sc->grf, GRF_USB3PHY_CON0(sc->phy_ctrl_id)); + if (usb2only) + reg |= USB3PHY_CON0_USB2_ONLY; + else + reg &= ~USB3PHY_CON0_USB2_ONLY; + /* Write Mask */ + reg |= (USB3PHY_CON0_USB2_ONLY) << 16; + SYSCON_WRITE_4(sc->grf, GRF_USB3PHY_CON0(sc->phy_ctrl_id), reg); + + /* Enable the USB3 Super Speed port */ + reg = SYSCON_READ_4(sc->grf, GRF_USB3OTG_CON1(sc->phy_ctrl_id)); + if (usb2only) + reg |= USB3OTG_CON1_U3_DIS; + else + reg &= ~USB3OTG_CON1_U3_DIS; + /* Write Mask */ + reg |= (USB3OTG_CON1_U3_DIS) << 16; + SYSCON_WRITE_4(sc->grf, GRF_USB3OTG_CON1(sc->phy_ctrl_id), reg); +} + +static int +rk_typec_phy_enable(struct phynode *phynode, bool enable) +{ + struct rk_typec_phy_softc *sc; + device_t dev; + intptr_t phy; + uint32_t reg; + int err; + + dev = phynode_get_device(phynode); + phy = phynode_get_id(phynode); + sc = device_get_softc(dev); + + if (phy != RK3399_TYPEC_PHY_USB3) + return (ERANGE); + + rk_typec_phy_set_usb2_only(sc, false); + + err = clk_enable(sc->tcpdcore); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->tcpdcore)); + return (ENXIO); + } + err = clk_enable(sc->tcpdphy_ref); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->tcpdphy_ref)); + clk_disable(sc->tcpdcore); + return (ENXIO); + } + + hwreset_deassert(sc->rst_tcphy); + + /* 24M configuration, magic values from rockchip */ + RK_TYPEC_PHY_WRITE(sc, PMA_CMN_CTRL1, 0x830); + for (int i = 0; i < 4; i++) { + RK_TYPEC_PHY_WRITE(sc, XCVR_DIAG_LANE_FCM_EN_MGN(i), 0x90); + RK_TYPEC_PHY_WRITE(sc, TX_RCVDET_EN_TMR(i), 0x960); + RK_TYPEC_PHY_WRITE(sc, TX_RCVDET_ST_TMR(i), 0x30); + } + reg = RK_TYPEC_PHY_READ(sc, CMN_DIAG_HSCLK_SEL); + reg &= ~CMN_DIAG_HSCLK_SEL_PLL_MASK; + reg |= CMN_DIAG_HSCLK_SEL_PLL_CONFIG; + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_HSCLK_SEL, reg); + + /* PLL configuration, magic values from rockchip */ + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_VCOCAL_INIT, 0xf0); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_VCOCAL_ITER, 0x18); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_INTDIV, 0xd0); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_FRACDIV, 0x4a4a); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_HIGH_THR, 0x34); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_SS_CTRL1, 0x1ee); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_SS_CTRL2, 0x7f03); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_DSM_DIAG, 0x20); + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_PLL0_OVRD, 0); + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_PLL0_FBH_OVRD, 0); + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_PLL0_FBL_OVRD, 0); + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_PLL0_V2I_TUNE, 0x7); + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_PLL0_CP_TUNE, 0x45); + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_PLL0_LF_PROG, 0x8); + + /* Configure the TX and RX line, magic values from rockchip */ + RK_TYPEC_PHY_WRITE(sc, TX_PSC_A0(0), 0x7799); + RK_TYPEC_PHY_WRITE(sc, TX_PSC_A1(0), 0x7798); + RK_TYPEC_PHY_WRITE(sc, TX_PSC_A2(0), 0x5098); + RK_TYPEC_PHY_WRITE(sc, TX_PSC_A3(0), 0x5098); + RK_TYPEC_PHY_WRITE(sc, TX_TXCC_MGNFS_MULT_000(0), 0x0); + RK_TYPEC_PHY_WRITE(sc, XCVR_DIAG_BIDI_CTRL(0), 0xbf); + + RK_TYPEC_PHY_WRITE(sc, RX_PSC_A0(1), 0xa6fd); + RK_TYPEC_PHY_WRITE(sc, RX_PSC_A1(1), 0xa6fd); + RK_TYPEC_PHY_WRITE(sc, RX_PSC_A2(1), 0xa410); + RK_TYPEC_PHY_WRITE(sc, RX_PSC_A3(1), 0x2410); + RK_TYPEC_PHY_WRITE(sc, RX_PSC_CAL(1), 0x23ff); + RK_TYPEC_PHY_WRITE(sc, RX_SIGDET_HL_FILT_TMR(1), 0x13); + RK_TYPEC_PHY_WRITE(sc, RX_REE_CTRL_DATA_MASK(1), 0x03e7); + RK_TYPEC_PHY_WRITE(sc, RX_DIAG_SIGDET_TUNE(1), 0x1004); + RK_TYPEC_PHY_WRITE(sc, RX_PSC_RDY(1), 0x2010); + RK_TYPEC_PHY_WRITE(sc, XCVR_DIAG_BIDI_CTRL(1), 0xfb); + + RK_TYPEC_PHY_WRITE(sc, PMA_LANE_CFG, PIN_ASSIGN_D_F); + + RK_TYPEC_PHY_WRITE(sc, DP_MODE_CTL, DP_MODE_ENTER_A2); + + hwreset_deassert(sc->rst_uphy); + + for (int timeout = 10000; timeout > 0; timeout--) { + reg = RK_TYPEC_PHY_READ(sc, PMA_CMN_CTRL1); + if (reg & PMA_CMN_CTRL1_READY) + break; + DELAY(10); + } + if (timeout == 0) { + device_printf(sc->dev, "Timeout waiting for PMA\n"); + return (ENXIO); + } + + hwreset_deassert(sc->rst_pipe); + + return (0); +} + +static int +rk_typec_phy_get_mode(struct phynode *phynode, int *mode) +{ + struct rk_typec_phy_softc *sc; + intptr_t phy; + device_t dev; + + dev = phynode_get_device(phynode); + phy = phynode_get_id(phynode); + sc = device_get_softc(dev); + + if (phy != RK3399_TYPEC_PHY_USB3) + return (ERANGE); + + *mode = sc->mode; + + return (0); +} + +static int +rk_typec_phy_set_mode(struct phynode *phynode, int mode) +{ + struct rk_typec_phy_softc *sc; + intptr_t phy; + device_t dev; + + dev = phynode_get_device(phynode); + phy = phynode_get_id(phynode); + sc = device_get_softc(dev); + + if (phy != RK3399_TYPEC_PHY_USB3) + return (ERANGE); + + sc->mode = mode; + + return (0); +} + +static int +rk_typec_phy_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Rockchip RK3399 PHY TYPEC"); + return (BUS_PROBE_DEFAULT); +} + +static int +rk_typec_phy_attach(device_t dev) +{ + struct rk_typec_phy_softc *sc; + struct phynode_init_def phy_init; + struct phynode *phynode; + phandle_t node, usb3; + phandle_t reg_prop[4]; + + sc = device_get_softc(dev); + sc->dev = dev; + node = ofw_bus_get_node(dev); + + /* + * Find out which phy we are. + * There is not property for this so we need to know the + * address to use the correct GRF registers. + */ + if (OF_getencprop(node, "reg", reg_prop, sizeof(reg_prop)) <= 0) { + device_printf(dev, "Cannot guess phy controller id\n"); + return (ENXIO); + } + switch (reg_prop[1]) { + case 0xff7c0000: + sc->phy_ctrl_id = 0; + break; + case 0xff800000: + sc->phy_ctrl_id = 1; + break; + default: + device_printf(dev, "Unknown address %x for typec-phy\n", reg_prop[1]); + return (ENXIO); + } + + if (bus_alloc_resources(dev, rk_typec_phy_spec, &sc->res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + goto fail; + } + + if (syscon_get_by_ofw_property(dev, node, + "rockchip,grf", &sc->grf) != 0) { + device_printf(dev, "Cannot get syscon handle\n"); + goto fail; + } + + if (clk_get_by_ofw_name(dev, 0, "tcpdcore", &sc->tcpdcore) != 0) { + device_printf(dev, "Cannot get tcpdcore clock\n"); + goto fail; + } + if (clk_get_by_ofw_name(dev, 0, "tcpdphy-ref", &sc->tcpdphy_ref) != 0) { + device_printf(dev, "Cannot get tcpdphy-ref clock\n"); + goto fail; + } + + if (hwreset_get_by_ofw_name(dev, 0, "uphy", &sc->rst_uphy) != 0) { + device_printf(dev, "Cannot get uphy reset\n"); + goto fail; + } + if (hwreset_get_by_ofw_name(dev, 0, "uphy-pipe", &sc->rst_pipe) != 0) { + device_printf(dev, "Cannot get uphy-pipe reset\n"); + goto fail; + } + if (hwreset_get_by_ofw_name(dev, 0, "uphy-tcphy", &sc->rst_tcphy) != 0) { + device_printf(dev, "Cannot get uphy-tcphy reset\n"); + goto fail; + } + + /* + * Make sure that the module is asserted + * We need to deassert in a certain order when we enable the phy + */ + hwreset_assert(sc->rst_uphy); + hwreset_assert(sc->rst_pipe); + hwreset_assert(sc->rst_tcphy); + + /* Set the assigned clocks parent and freq */ + if (clk_set_assigned(dev, node) != 0) { + device_printf(dev, "clk_set_assigned failed\n"); + goto fail; + } + + /* Only usb3 port is supported right now */ + usb3 = ofw_bus_find_child(node, "usb3-port"); + if (usb3 == 0) { + device_printf(dev, "Cannot find usb3-port child node\n"); + goto fail; + } + /* If the child isn't enable attach the driver + * but do not register the PHY. + */ + if (!ofw_bus_node_status_okay(usb3)) + return (0); + + phy_init.id = RK3399_TYPEC_PHY_USB3; + phy_init.ofw_node = usb3; + phynode = phynode_create(dev, &rk_typec_phy_phynode_class, &phy_init); + if (phynode == NULL) { + device_printf(dev, "failed to create phy usb3-port\n"); + goto fail; + } + if (phynode_register(phynode) == NULL) { + device_printf(dev, "failed to register phy usb3-port\n"); + goto fail; + } + + OF_device_register_xref(OF_xref_from_node(usb3), dev); + + return (0); + +fail: + bus_release_resources(dev, rk_typec_phy_spec, &sc->res); + + return (ENXIO); +} + +static device_method_t rk_typec_phy_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, rk_typec_phy_probe), + DEVMETHOD(device_attach, rk_typec_phy_attach), + + DEVMETHOD_END +}; + +static driver_t rk_typec_phy_driver = { + "rk_typec_phy", + rk_typec_phy_methods, + sizeof(struct rk_typec_phy_softc) +}; + +static devclass_t rk_typec_phy_devclass; +EARLY_DRIVER_MODULE(rk_typec_phy, simplebus, rk_typec_phy_driver, + rk_typec_phy_devclass, 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); +MODULE_VERSION(rk_typec_phy, 1); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Oct 25 18:08:59 2019 (r354088) +++ head/sys/conf/files.arm64 Fri Oct 25 18:10:02 2019 (r354089) @@ -299,6 +299,7 @@ arm64/rockchip/rk_grf.c optional fdt soc_rockchip_rk arm64/rockchip/rk_pinctrl.c optional fdt rk_pinctrl soc_rockchip_rk3328 | fdt rk_pinctrl soc_rockchip_rk3399 arm64/rockchip/rk_gpio.c optional fdt rk_gpio soc_rockchip_rk3328 | fdt rk_gpio soc_rockchip_rk3399 arm64/rockchip/rk_usb2phy.c optional fdt rk_usb2phy soc_rockchip_rk3328 | soc_rockchip_rk3399 +arm64/rockchip/rk_typec_phy.c optional fdt rk_typec_phy soc_rockchip_rk3399 arm64/rockchip/if_dwc_rk.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 dev/dwc/if_dwc.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 dev/dwc/if_dwc_if.m optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 From owner-svn-src-head@freebsd.org Fri Oct 25 18:54:07 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12DF21585E7; Fri, 25 Oct 2019 18:54:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470CvL6kV5z3PQV; Fri, 25 Oct 2019 18:54:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB9012ABB5; Fri, 25 Oct 2019 18:54:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PIs6JH047469; Fri, 25 Oct 2019 18:54:06 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PIs6Vf047467; Fri, 25 Oct 2019 18:54:06 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910251854.x9PIs6Vf047467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 25 Oct 2019 18:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354092 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 354092 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 18:54:07 -0000 Author: bz Date: Fri Oct 25 18:54:06 2019 New Revision: 354092 URL: https://svnweb.freebsd.org/changeset/base/354092 Log: Properly set VNET when nuking recvif from fragment queues. In theory the eventhandler invoke should be in the same VNET as the the current interface. We however cannot guarantee that for all cases in the future. So before checking if the fragmentation handling for this VNET is active, switch the VNET to the VNET of the interface to always get the one we want. Reviewed by: hselasky MFC after: 3 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22153 Modified: head/sys/netinet/ip_reass.c head/sys/netinet6/frag6.c Modified: head/sys/netinet/ip_reass.c ============================================================================== --- head/sys/netinet/ip_reass.c Fri Oct 25 18:46:53 2019 (r354091) +++ head/sys/netinet/ip_reass.c Fri Oct 25 18:54:06 2019 (r354092) @@ -632,14 +632,17 @@ ipreass_cleanup(void *arg __unused, struct ifnet *ifp) KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); + CURVNET_SET_QUIET(ifp->if_vnet); + /* * Skip processing if IPv4 reassembly is not initialised or * torn down by ipreass_destroy(). */ - if (V_ipq_zone == NULL) + if (V_ipq_zone == NULL) { + CURVNET_RESTORE(); return; + } - CURVNET_SET_QUIET(ifp->if_vnet); for (i = 0; i < IPREASS_NHASH; i++) { IPQ_LOCK(i); /* Scan fragment list. */ Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Fri Oct 25 18:46:53 2019 (r354091) +++ head/sys/netinet6/frag6.c Fri Oct 25 18:54:06 2019 (r354092) @@ -307,16 +307,18 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); + CURVNET_SET_QUIET(ifp->if_vnet); #ifdef VIMAGE /* * Skip processing if IPv6 reassembly is not initialised or * torn down by frag6_destroy(). */ - if (!V_frag6_on) + if (!V_frag6_on) { + CURVNET_RESTORE(); return; + } #endif - CURVNET_SET_QUIET(ifp->if_vnet); for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { IP6QB_LOCK(bucket); head = IP6QB_HEAD(bucket); From owner-svn-src-head@freebsd.org Fri Oct 25 19:38:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 093801598B8; Fri, 25 Oct 2019 19:38:03 +0000 (UTC) (envelope-from peterj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Dt26D25z3yt7; Fri, 25 Oct 2019 19:38:02 +0000 (UTC) (envelope-from peterj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B44362B30F; Fri, 25 Oct 2019 19:38:02 +0000 (UTC) (envelope-from peterj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PJc2Mr074992; Fri, 25 Oct 2019 19:38:02 GMT (envelope-from peterj@FreeBSD.org) Received: (from peterj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PJc2cu074991; Fri, 25 Oct 2019 19:38:02 GMT (envelope-from peterj@FreeBSD.org) Message-Id: <201910251938.x9PJc2cu074991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peterj set sender to peterj@FreeBSD.org using -f From: Peter Jeremy Date: Fri, 25 Oct 2019 19:38:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354094 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: peterj X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 354094 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 19:38:03 -0000 Author: peterj Date: Fri Oct 25 19:38:02 2019 New Revision: 354094 URL: https://svnweb.freebsd.org/changeset/base/354094 Log: Fix use of uninitialised variable. The RK805 regs array was being allocated before it's required size was known, causing the driver to use memory it didn't own. That memory was subsequently allocated and used elsewhere causing later fatal data aborts in rk805_map(). Whilst I'm here, add a sanity check to catch unsupported PMICs (this shouldn't ever get hit because the probe should have failed). Reviewed by: manu MFC after: 1 week Sponsored by: Google Modified: head/sys/arm64/rockchip/rk805.c Modified: head/sys/arm64/rockchip/rk805.c ============================================================================== --- head/sys/arm64/rockchip/rk805.c Fri Oct 25 18:56:46 2019 (r354093) +++ head/sys/arm64/rockchip/rk805.c Fri Oct 25 19:38:02 2019 (r354094) @@ -467,9 +467,6 @@ rk805_attach(device_t dev) if (config_intrhook_establish(&sc->intr_hook) != 0) return (ENOMEM); - sc->regs = malloc(sizeof(struct rk805_reg_sc *) * sc->nregs, - M_RK805_REG, M_WAITOK | M_ZERO); - sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; switch (sc->type) { case RK805: @@ -480,7 +477,13 @@ rk805_attach(device_t dev) regdefs = rk808_regdefs; sc->nregs = nitems(rk808_regdefs); break; + default: + device_printf(dev, "Unknown type %d\n", sc->type); + return (ENXIO); } + + sc->regs = malloc(sizeof(struct rk805_reg_sc *) * sc->nregs, + M_RK805_REG, M_WAITOK | M_ZERO); rnode = ofw_bus_find_child(ofw_bus_get_node(dev), "regulators"); if (rnode > 0) { From owner-svn-src-head@freebsd.org Fri Oct 25 20:09:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4AAC15A07B; Fri, 25 Oct 2019 20:09:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470FZc5Tryz40yj; Fri, 25 Oct 2019 20:09:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AFE82B850; Fri, 25 Oct 2019 20:09:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PK9iqN092668; Fri, 25 Oct 2019 20:09:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PK9gIV092660; Fri, 25 Oct 2019 20:09:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910252009.x9PK9gIV092660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 25 Oct 2019 20:09:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include kern X-SVN-Commit-Revision: 354095 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 20:09:45 -0000 Author: kib Date: Fri Oct 25 20:09:42 2019 New Revision: 354095 URL: https://svnweb.freebsd.org/changeset/base/354095 Log: amd64: move pcb out of kstack to struct thread. This saves 320 bytes of the precious stack space. The only negative aspect of the change I can think of is that the struct thread increased by 320 bytes obviously, and that 320 bytes are not swapped out anymore. I believe the freed stack space is much more important than that. Also, current struct thread size is 1392 bytes on amd64, so UMA will allocate two thread structures per (4KB) slab, which leaves a space for pcb without increasing zone memory use. Reviewed by: alc, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D22138 Modified: head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/genassym.c head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/vm_machdep.c head/sys/amd64/include/md_var.h head/sys/amd64/include/pcpu_aux.h head/sys/amd64/include/proc.h head/sys/kern/kern_thread.c Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/amd64/cpu_switch.S Fri Oct 25 20:09:42 2019 (r354095) @@ -74,7 +74,7 @@ END(cpu_throw) */ ENTRY(cpu_switch) /* Switch to new thread. First, save context. */ - movq TD_PCB(%rdi),%r8 + leaq TD_MD_PCB(%rdi),%r8 movq (%rsp),%rax /* Hardware registers */ movq %r15,PCB_R15(%r8) @@ -140,7 +140,7 @@ ctx_switch_xsave: callq pmap_activate_sw movq %r15,TD_LOCK(%r13) /* Release the old thread */ sw1: - movq TD_PCB(%r12),%r8 + leaq TD_MD_PCB(%r12),%r8 #if defined(SCHED_ULE) && defined(SMP) movq $blocked_lock, %rdx movq TD_LOCK(%r12),%rcx @@ -193,11 +193,12 @@ do_kthread: cmpq %rax,%rdx jne do_tss done_tss: - movq %r8,PCPU(RSP0) + movq TD_MD_STACK_BASE(%r12),%r9 + movq %r9,PCPU(RSP0) movq %r8,PCPU(CURPCB) movq PCPU(PTI_RSP0),%rax cmpq $~0,PCPU(UCR3) - cmove %r8,%rax + cmove %r9,%rax movq %rax,TSS_RSP0(%rdx) movq %r12,PCPU(CURTHREAD) /* into next thread */ Modified: head/sys/amd64/amd64/genassym.c ============================================================================== --- head/sys/amd64/amd64/genassym.c Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/amd64/genassym.c Fri Oct 25 20:09:42 2019 (r354095) @@ -87,6 +87,8 @@ ASSYM(TD_PFLAGS, offsetof(struct thread, td_pflags)); ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_FRAME, offsetof(struct thread, td_frame)); ASSYM(TD_MD, offsetof(struct thread, td_md)); +ASSYM(TD_MD_PCB, offsetof(struct thread, td_md.md_pcb)); +ASSYM(TD_MD_STACK_BASE, offsetof(struct thread, td_md.md_stack_base)); ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/amd64/machdep.c Fri Oct 25 20:09:42 2019 (r354095) @@ -1789,12 +1789,12 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) amd64_conf_fast_syscall(); /* - * Temporary forge some valid pointer to PCB, for exception - * handlers. It is reinitialized properly below after FPU is - * set up. Also set up td_critnest to short-cut the page - * fault handler. + * We initialize the PCB pointer early so that exception + * handlers will work. Also set up td_critnest to short-cut + * the page fault handler. */ cpu_max_ext_state_size = sizeof(struct savefpu); + set_top_of_stack_td(&thread0); thread0.td_pcb = get_pcb_td(&thread0); thread0.td_critnest = 1; @@ -1850,11 +1850,10 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) fpuinit(); /* - * Set up thread0 pcb after fpuinit calculated pcb + fpu save + * Set up thread0 pcb save area after fpuinit calculated fpu save * area size. Zero out the extended state header in fpu save * area. */ - thread0.td_pcb = get_pcb_td(&thread0); thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0); bzero(get_pcb_user_save_td(&thread0), cpu_max_ext_state_size); if (use_xsave) { @@ -1863,7 +1862,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) xhdr->xstate_bv = xsave_mask; } /* make an initial tss so cpu can get interrupt stack on syscall! */ - rsp0 = (vm_offset_t)thread0.td_pcb; + rsp0 = thread0.td_md.md_stack_base; /* Ensure the stack is aligned to 16 bytes */ rsp0 &= ~0xFul; common_tss[0].tss_rsp0 = rsp0; @@ -1899,7 +1898,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) TSEXIT(); /* Location of kernel stack for locore */ - return ((u_int64_t)thread0.td_pcb); + return (thread0.td_md.md_stack_base); } void Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/amd64/vm_machdep.c Fri Oct 25 20:09:42 2019 (r354095) @@ -87,37 +87,41 @@ __FBSDID("$FreeBSD$"); _Static_assert(OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf), "OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf."); -struct savefpu * -get_pcb_user_save_td(struct thread *td) +void +set_top_of_stack_td(struct thread *td) { - vm_offset_t p; - - p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE - + td->td_md.md_stack_base = td->td_kstack + + td->td_kstack_pages * PAGE_SIZE - roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN); - KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area")); - return ((struct savefpu *)p); } struct savefpu * -get_pcb_user_save_pcb(struct pcb *pcb) +get_pcb_user_save_td(struct thread *td) { vm_offset_t p; - p = (vm_offset_t)(pcb + 1); + p = td->td_md.md_stack_base; + KASSERT((p % XSAVE_AREA_ALIGN) == 0, + ("Unaligned pcb_user_save area ptr %#lx td %p", p, td)); return ((struct savefpu *)p); } struct pcb * get_pcb_td(struct thread *td) { - vm_offset_t p; - p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE - - roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) - - sizeof(struct pcb); - return ((struct pcb *)p); + return (&td->td_md.md_pcb); } +struct savefpu * +get_pcb_user_save_pcb(struct pcb *pcb) +{ + struct thread *td; + + td = __containerof(pcb, struct thread, td_md.md_pcb); + return (get_pcb_user_save_td(td)); +} + void * alloc_fpusave(int flags) { @@ -165,9 +169,9 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t fpuexit(td1); update_pcb_bases(td1->td_pcb); - /* Point the pcb to the top of the stack */ - pcb2 = get_pcb_td(td2); - td2->td_pcb = pcb2; + /* Point the stack and pcb to the actual location */ + set_top_of_stack_td(td2); + td2->td_pcb = pcb2 = get_pcb_td(td2); /* Copy td1's pcb */ bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); @@ -186,7 +190,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. */ - td2->td_frame = (struct trapframe *)td2->td_pcb - 1; + td2->td_frame = (struct trapframe *)td2->td_md.md_stack_base - 1; bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); td2->td_frame->tf_rax = 0; /* Child returns zero */ @@ -351,8 +355,9 @@ cpu_thread_alloc(struct thread *td) struct pcb *pcb; struct xstate_hdr *xhdr; + set_top_of_stack_td(td); td->td_pcb = pcb = get_pcb_td(td); - td->td_frame = (struct trapframe *)pcb - 1; + td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; pcb->pcb_save = get_pcb_user_save_pcb(pcb); if (use_xsave) { xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); @@ -490,7 +495,6 @@ cpu_copy_thread(struct thread *td, struct thread *td0) { struct pcb *pcb2; - /* Point the pcb to the top of the stack. */ pcb2 = td->td_pcb; /* Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/include/md_var.h Fri Oct 25 20:09:42 2019 (r354095) @@ -83,6 +83,7 @@ void fpstate_drop(struct thread *td); void pagezero(void *addr); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist); void sse2_pagezero(void *addr); +void set_top_of_stack_td(struct thread *td); struct savefpu *get_pcb_user_save_td(struct thread *td); struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb); void pci_early_quirks(void); Modified: head/sys/amd64/include/pcpu_aux.h ============================================================================== --- head/sys/amd64/include/pcpu_aux.h Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/include/pcpu_aux.h Fri Oct 25 20:09:42 2019 (r354095) @@ -57,16 +57,6 @@ __curthread(void) return (td); } #define curthread (__curthread()) - -static __inline __pure2 struct pcb * -__curpcb(void) -{ - struct pcb *pcb; - - __asm("movq %%gs:%P1,%0" : "=r" (pcb) : "n" (offsetof(struct pcpu, - pc_curpcb))); - return (pcb); -} -#define curpcb (__curpcb()) +#define curpcb (&curthread->td_md.md_pcb) #endif /* _MACHINE_PCPU_AUX_H_ */ Modified: head/sys/amd64/include/proc.h ============================================================================== --- head/sys/amd64/include/proc.h Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/include/proc.h Fri Oct 25 20:09:42 2019 (r354095) @@ -36,6 +36,7 @@ #define _MACHINE_PROC_H_ #include +#include #include /* @@ -72,6 +73,8 @@ struct mdthread { struct pmap_invl_gen md_invl_gen; register_t md_efirt_tmp; /* (k) */ int md_efirt_dis_pf; /* (k) */ + struct pcb md_pcb; + vm_offset_t md_stack_base; }; struct mdproc { Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/kern/kern_thread.c Fri Oct 25 20:09:42 2019 (r354095) @@ -84,7 +84,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == 0 "struct thread KBI td_pflags"); _Static_assert(offsetof(struct thread, td_frame) == 0x478, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x540, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x690, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0xb0, "struct proc KBI p_flag"); From owner-svn-src-head@freebsd.org Fri Oct 25 20:15:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BF4615A379; Fri, 25 Oct 2019 20:15:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Fhn1lYKz41Vd; Fri, 25 Oct 2019 20:15:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F4022BA6E; Fri, 25 Oct 2019 20:15:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PKF5So098216; Fri, 25 Oct 2019 20:15:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PKF4Tu098215; Fri, 25 Oct 2019 20:15:05 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910252015.x9PKF4Tu098215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 25 Oct 2019 20:15:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354096 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354096 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 20:15:05 -0000 Author: markj Date: Fri Oct 25 20:15:04 2019 New Revision: 354096 URL: https://svnweb.freebsd.org/changeset/base/354096 Log: Apply kernel module linker scripts to firmware files. Use a separate make variable to specify the linker script so that it is only applied at link time and not during intermediate generation of .fwo files. This ensures that the .text padding inserted by the amd64 linker script is applied to the stub module load handlers embedded in firmware modules. Reviewed by: kib MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22125 Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Fri Oct 25 20:09:42 2019 (r354095) +++ head/sys/conf/kmod.mk Fri Oct 25 20:15:04 2019 (r354096) @@ -242,8 +242,8 @@ EXPORT_SYMS?= NO CLEANFILES+= export_syms .endif -.if !defined(FIRMWS) && exists(${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH}) -_LDFLAGS+=-T ${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH} +.if exists(${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH}) +LDSCRIPT_FLAGS?= -T ${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH} .endif .if ${__KLD_SHARED} == yes @@ -251,7 +251,8 @@ ${KMOD}.kld: ${OBJS} .else ${FULLPROG}: ${OBJS} .endif - ${LD} -m ${LD_EMULATION} ${_LDFLAGS} -r -d -o ${.TARGET} ${OBJS} + ${LD} -m ${LD_EMULATION} ${_LDFLAGS} ${LDSCRIPT_FLAGS} -r -d \ + -o ${.TARGET} ${OBJS} .if ${MK_CTF} != "no" ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} .endif From owner-svn-src-head@freebsd.org Fri Oct 25 21:00:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EA4C15B395; Fri, 25 Oct 2019 21:00:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Gjc3C12z43RV; Fri, 25 Oct 2019 21:00:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 376582C230; Fri, 25 Oct 2019 21:00:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PL0qCT022105; Fri, 25 Oct 2019 21:00:52 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PL0oYV022095; Fri, 25 Oct 2019 21:00:50 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910252100.x9PL0oYV022095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 25 Oct 2019 21:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354097 - in head/contrib/llvm: lib/Object lib/Support lib/Target/ARM lib/Target/ARM/AsmParser lib/Target/ARM/MCTargetDesc tools/clang/lib/Basic/Targets tools/clang/lib/Driver/ToolChain... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/llvm: lib/Object lib/Support lib/Target/ARM lib/Target/ARM/AsmParser lib/Target/ARM/MCTargetDesc tools/clang/lib/Basic/Targets tools/clang/lib/Driver/ToolChains/Arch X-SVN-Commit-Revision: 354097 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:00:52 -0000 Author: dim Date: Fri Oct 25 21:00:49 2019 New Revision: 354097 URL: https://svnweb.freebsd.org/changeset/base/354097 Log: Pull in r372186 from upstream llvm trunk (by Eli Friedman): [ARM] VFPv2 only supports 16 D registers. r361845 changed the way we handle "D16" vs. "D32" targets; there used to be a negative "d16" which removed instructions from the instruction set, and now there's a "d32" feature which adds instructions to the instruction set. This is good, but there was an oversight in the implementation: the behavior of VFPv2 was changed. In particular, the "vfp2" feature was changed to imply "d32". This is wrong: VFPv2 only supports 16 D registers. In practice, this means if you specify -mfpu=vfpv2, the compiler will generate illegal instructions. This patch gets rid of "vfp2d16" and "vfp2d16sp", and fixes "vfp2" and "vfp2sp" so they don't imply "d32". Differential Revision: https://reviews.llvm.org/D67375 Pull in r372187 from upstream clang trunk (by Eli Friedman): [ARM] Update clang for removal of vfp2d16 and vfp2d16sp Matching fix for https://reviews.llvm.org/D67375 (r372186). Differential Revision: https://reviews.llvm.org/D67467 This should fix clang generating invalid opcodes for floating point operations on armv6. Requested by: mmel MFC after: 3 days Modified: head/contrib/llvm/lib/Object/ELFObjectFile.cpp head/contrib/llvm/lib/Support/ARMTargetParser.cpp head/contrib/llvm/lib/Target/ARM/ARM.td head/contrib/llvm/lib/Target/ARM/ARMPredicates.td head/contrib/llvm/lib/Target/ARM/ARMSubtarget.h head/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp head/contrib/llvm/tools/clang/lib/Basic/Targets/ARM.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/ARM.cpp Modified: head/contrib/llvm/lib/Object/ELFObjectFile.cpp ============================================================================== --- head/contrib/llvm/lib/Object/ELFObjectFile.cpp Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Object/ELFObjectFile.cpp Fri Oct 25 21:00:49 2019 (r354097) @@ -194,7 +194,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() default: break; case ARMBuildAttrs::Not_Allowed: - Features.AddFeature("vfp2d16sp", false); + Features.AddFeature("vfp2sp", false); Features.AddFeature("vfp3d16sp", false); Features.AddFeature("vfp4d16sp", false); break; Modified: head/contrib/llvm/lib/Support/ARMTargetParser.cpp ============================================================================== --- head/contrib/llvm/lib/Support/ARMTargetParser.cpp Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Support/ARMTargetParser.cpp Fri Oct 25 21:00:49 2019 (r354097) @@ -176,10 +176,8 @@ bool ARM::getFPUFeatures(unsigned FPUKind, std::vector // exist). {"+fpregs", "-fpregs", FPUVersion::VFPV2, FPURestriction::SP_D16}, - {"+vfp2", "-vfp2", FPUVersion::VFPV2, FPURestriction::None}, - {"+vfp2d16", "-vfp2d16", FPUVersion::VFPV2, FPURestriction::D16}, - {"+vfp2d16sp", "-vfp2d16sp", FPUVersion::VFPV2, FPURestriction::SP_D16}, - {"+vfp2sp", "-vfp2sp", FPUVersion::VFPV2, FPURestriction::None}, + {"+vfp2", "-vfp2", FPUVersion::VFPV2, FPURestriction::D16}, + {"+vfp2sp", "-vfp2sp", FPUVersion::VFPV2, FPURestriction::SP_D16}, {"+vfp3", "-vfp3", FPUVersion::VFPV3, FPURestriction::None}, {"+vfp3d16", "-vfp3d16", FPUVersion::VFPV3, FPURestriction::D16}, {"+vfp3d16sp", "-vfp3d16sp", FPUVersion::VFPV3, FPURestriction::SP_D16}, @@ -195,7 +193,7 @@ bool ARM::getFPUFeatures(unsigned FPUKind, std::vector {"+fp-armv8sp", "-fp-armv8sp", FPUVersion::VFPV5, FPURestriction::None}, {"+fullfp16", "-fullfp16", FPUVersion::VFPV5_FULLFP16, FPURestriction::SP_D16}, {"+fp64", "-fp64", FPUVersion::VFPV2, FPURestriction::D16}, - {"+d32", "-d32", FPUVersion::VFPV2, FPURestriction::None}, + {"+d32", "-d32", FPUVersion::VFPV3, FPURestriction::None}, }; for (const auto &Info: FPUFeatureInfoList) { Modified: head/contrib/llvm/lib/Target/ARM/ARM.td ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARM.td Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Target/ARM/ARM.td Fri Oct 25 21:00:49 2019 (r354097) @@ -57,12 +57,15 @@ def FeatureD32 : SubtargetFeature<"d32", "H "Extend FP to 32 double registers">; multiclass VFPver prev = [], - list otherimplies = []> { + list prev, + list otherimplies, + list vfp2prev = []> { def _D16_SP: SubtargetFeature< name#"d16sp", query#"D16SP", "true", description#" with only 16 d-registers and no double precision", - !foreach(v, prev, !cast(v # "_D16_SP")) # otherimplies>; + !foreach(v, prev, !cast(v # "_D16_SP")) # + !foreach(v, vfp2prev, !cast(v # "_SP")) # + otherimplies>; def _SP: SubtargetFeature< name#"sp", query#"SP", "true", description#" with no double precision", @@ -72,6 +75,7 @@ multiclass VFPver(v # "_D16")) # + vfp2prev # otherimplies # [FeatureFP64, !cast(NAME # "_D16_SP")]>; def "": SubtargetFeature< name, query, "true", description, @@ -80,11 +84,17 @@ multiclass VFPver(NAME # "_SP")]>; } -defm FeatureVFP2: VFPver<"vfp2", "HasVFPv2", "Enable VFP2 instructions", - [], [FeatureFPRegs]>; +def FeatureVFP2_SP : SubtargetFeature<"vfp2sp", "HasVFPv2SP", "true", + "Enable VFP2 instructions with " + "no double precision", + [FeatureFPRegs]>; +def FeatureVFP2 : SubtargetFeature<"vfp2", "HasVFPv2", "true", + "Enable VFP2 instructions", + [FeatureFP64, FeatureVFP2_SP]>; + defm FeatureVFP3: VFPver<"vfp3", "HasVFPv3", "Enable VFP3 instructions", - [FeatureVFP2]>; + [], [], [FeatureVFP2]>; def FeatureNEON : SubtargetFeature<"neon", "HasNEON", "true", "Enable NEON instructions", @@ -98,7 +108,7 @@ defm FeatureVFP4: VFPver<"vfp4", "HasVFPv4", "Enable V [FeatureVFP3], [FeatureFP16]>; defm FeatureFPARMv8: VFPver<"fp-armv8", "HasFPARMv8", "Enable ARMv8 FP", - [FeatureVFP4]>; + [FeatureVFP4], []>; def FeatureFullFP16 : SubtargetFeature<"fullfp16", "HasFullFP16", "true", "Enable full half-precision " Modified: head/contrib/llvm/lib/Target/ARM/ARMPredicates.td ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMPredicates.td Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Target/ARM/ARMPredicates.td Fri Oct 25 21:00:49 2019 (r354097) @@ -71,7 +71,7 @@ def HasV8_5a : Predicate<"Subtarget->hasV8_5aO AssemblerPredicate<"HasV8_5aOps", "armv8.5a">; def NoVFP : Predicate<"!Subtarget->hasVFP2Base()">; def HasVFP2 : Predicate<"Subtarget->hasVFP2Base()">, - AssemblerPredicate<"FeatureVFP2_D16_SP", "VFP2">; + AssemblerPredicate<"FeatureVFP2_SP", "VFP2">; def HasVFP3 : Predicate<"Subtarget->hasVFP3Base()">, AssemblerPredicate<"FeatureVFP3_D16_SP", "VFP3">; def HasVFP4 : Predicate<"Subtarget->hasVFP4Base()">, Modified: head/contrib/llvm/lib/Target/ARM/ARMSubtarget.h ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMSubtarget.h Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Target/ARM/ARMSubtarget.h Fri Oct 25 21:00:49 2019 (r354097) @@ -179,11 +179,9 @@ class ARMSubtarget : public ARMGenSubtargetInfo { (pro bool HasVFPv3SP = false; bool HasVFPv4SP = false; bool HasFPARMv8SP = false; - bool HasVFPv2D16 = false; bool HasVFPv3D16 = false; bool HasVFPv4D16 = false; bool HasFPARMv8D16 = false; - bool HasVFPv2D16SP = false; bool HasVFPv3D16SP = false; bool HasVFPv4D16SP = false; bool HasFPARMv8D16SP = false; @@ -600,7 +598,7 @@ class ARMSubtarget : public ARMGenSubtargetInfo { (pro bool hasARMOps() const { return !NoARM; } - bool hasVFP2Base() const { return HasVFPv2D16SP; } + bool hasVFP2Base() const { return HasVFPv2SP; } bool hasVFP3Base() const { return HasVFPv3D16SP; } bool hasVFP4Base() const { return HasVFPv4D16SP; } bool hasFPARMv8Base() const { return HasFPARMv8D16SP; } Modified: head/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Fri Oct 25 21:00:49 2019 (r354097) @@ -11694,14 +11694,14 @@ bool ARMAsmParser::parseDirectiveArchExtension(SMLoc L { ARM::AEK_CRYPTO, {Feature_HasV8Bit}, {ARM::FeatureCrypto, ARM::FeatureNEON, ARM::FeatureFPARMv8} }, { ARM::AEK_FP, {Feature_HasV8Bit}, - {ARM::FeatureVFP2_D16_SP, ARM::FeatureFPARMv8} }, + {ARM::FeatureVFP2_SP, ARM::FeatureFPARMv8} }, { (ARM::AEK_HWDIVTHUMB | ARM::AEK_HWDIVARM), {Feature_HasV7Bit, Feature_IsNotMClassBit}, {ARM::FeatureHWDivThumb, ARM::FeatureHWDivARM} }, { ARM::AEK_MP, {Feature_HasV7Bit, Feature_IsNotMClassBit}, {ARM::FeatureMP} }, { ARM::AEK_SIMD, {Feature_HasV8Bit}, - {ARM::FeatureNEON, ARM::FeatureVFP2_D16_SP, ARM::FeatureFPARMv8} }, + {ARM::FeatureNEON, ARM::FeatureVFP2_SP, ARM::FeatureFPARMv8} }, { ARM::AEK_SEC, {Feature_HasV6KBit}, {ARM::FeatureTrustZone} }, // FIXME: Only available in A-class, isel not predicated { ARM::AEK_VIRT, {Feature_HasV7Bit}, {ARM::FeatureVirtualization} }, Modified: head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp Fri Oct 25 21:00:49 2019 (r354097) @@ -249,12 +249,12 @@ void ARMTargetStreamer::emitTargetAttributes(const MCS : ARM::FK_VFPV3_D16) : (STI.hasFeature(ARM::FeatureFP16) ? ARM::FK_VFPV3XD_FP16 : ARM::FK_VFPV3XD))); - else if (STI.hasFeature(ARM::FeatureVFP2_D16_SP)) + else if (STI.hasFeature(ARM::FeatureVFP2_SP)) emitFPU(ARM::FK_VFPV2); } // ABI_HardFP_use attribute to indicate single precision FP. - if (STI.hasFeature(ARM::FeatureVFP2_D16_SP) && !STI.hasFeature(ARM::FeatureFP64)) + if (STI.hasFeature(ARM::FeatureVFP2_SP) && !STI.hasFeature(ARM::FeatureFP64)) emitAttribute(ARMBuildAttrs::ABI_HardFP_use, ARMBuildAttrs::HardFPSinglePrecision); Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/ARM.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets/ARM.cpp Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets/ARM.cpp Fri Oct 25 21:00:49 2019 (r354097) @@ -427,11 +427,10 @@ bool ARMTargetInfo::handleTargetFeatures(std::vector Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B54715B921; Fri, 25 Oct 2019 21:21:22 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470H9F6y5wz44cj; Fri, 25 Oct 2019 21:21:21 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2BA42C5D6; Fri, 25 Oct 2019 21:21:21 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLLLf8036357; Fri, 25 Oct 2019 21:21:21 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLLL5h036356; Fri, 25 Oct 2019 21:21:21 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201910252121.x9PLLL5h036356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 25 Oct 2019 21:21:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354100 - head/sys/arm64/rockchip/clk X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/arm64/rockchip/clk X-SVN-Commit-Revision: 354100 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:21:22 -0000 Author: gonzo Date: Fri Oct 25 21:21:21 2019 New Revision: 354100 URL: https://svnweb.freebsd.org/changeset/base/354100 Log: arm64: rk3399: Add clock and gate for SPI clocks MFC after: 1 month Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk3399_cru.c Fri Oct 25 21:20:04 2019 (r354099) +++ head/sys/arm64/rockchip/clk/rk3399_cru.c Fri Oct 25 21:21:21 2019 (r354100) @@ -75,6 +75,11 @@ __FBSDID("$FreeBSD$"); #define PCLK_I2C5 344 #define PCLK_I2C6 345 #define PCLK_I2C7 346 +#define PCLK_SPI0 347 +#define PCLK_SPI1 348 +#define PCLK_SPI2 349 +#define PCLK_SPI4 350 +#define PCLK_SPI5 351 #define HCLK_HOST0 456 #define HCLK_HOST0_ARB 457 #define HCLK_HOST1 458 @@ -132,6 +137,12 @@ static struct rk_cru_gate rk3399_gates[] = { CRU_GATE(PCLK_I2C2, "pclk_rki2c2", "pclk_perilp1", 0x358, 9) CRU_GATE(PCLK_I2C3, "pclk_rki2c3", "pclk_perilp1", 0x358, 10) + /* CRU_CLKGATE_CON23 */ + CRU_GATE(PCLK_SPI0, "pclk_spi0", "pclk_perilp1", 0x35C, 10) + CRU_GATE(PCLK_SPI1, "pclk_spi1", "pclk_perilp1", 0x35C, 11) + CRU_GATE(PCLK_SPI2, "pclk_spi2", "pclk_perilp1", 0x35C, 12) + CRU_GATE(PCLK_SPI4, "pclk_spi4", "pclk_perilp1", 0x35C, 13) + /* CRU_CLKGATE_CON30 */ CRU_GATE(ACLK_USB3_NOC, "aclk_usb3_noc", "aclk_usb3", 0x378, 0) CRU_GATE(ACLK_USB3OTG0, "aclk_usb3otg0", "aclk_usb3", 0x378, 1) @@ -151,6 +162,9 @@ static struct rk_cru_gate rk3399_gates[] = { /* CRU_CLKGATE_CON33 */ CRU_GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_sd", 0x384, 8) + + /* CRU_CLKGATE_CON34 */ + CRU_GATE(PCLK_SPI4, "pclk_spi5", "pclk_perilp1", 0x388, 5) }; @@ -1367,6 +1381,127 @@ static struct rk_clk_composite_def uphy1_tcpdcore = { }; /* + * spi + */ +static const char *spi_parents[] = {"cpll", "gpll"}; + +#define SCLK_SPI0 71 +#define SCLK_SPI1 72 +#define SCLK_SPI2 73 +#define SCLK_SPI4 74 +#define SCLK_SPI5 75 + +static struct rk_clk_composite_def spi0 = { + .clkdef = { + .id = SCLK_SPI0, + .name = "clk_spi0", + .parent_names = spi_parents, + .parent_cnt = nitems(spi_parents), + }, + /* CRU_CLKSEL_CON59 */ + .muxdiv_offset = 0x01ec, + .mux_shift = 7, + .mux_width = 1, + + .div_shift = 0, + .div_width = 7, + + /* CRU_CLKGATE_CON9 */ + .gate_offset = 0x0324, + .gate_shift = 12, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static struct rk_clk_composite_def spi1 = { + .clkdef = { + .id = SCLK_SPI1, + .name = "clk_spi1", + .parent_names = spi_parents, + .parent_cnt = nitems(spi_parents), + }, + /* CRU_CLKSEL_CON59 */ + .muxdiv_offset = 0x01ec, + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 8, + .div_width = 7, + + /* CRU_CLKGATE_CON9 */ + .gate_offset = 0x0324, + .gate_shift = 13, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static struct rk_clk_composite_def spi2 = { + .clkdef = { + .id = SCLK_SPI2, + .name = "clk_spi2", + .parent_names = spi_parents, + .parent_cnt = nitems(spi_parents), + }, + /* CRU_CLKSEL_CON60 */ + .muxdiv_offset = 0x01f0, + .mux_shift = 7, + .mux_width = 1, + + .div_shift = 0, + .div_width = 7, + + /* CRU_CLKGATE_CON9 */ + .gate_offset = 0x0324, + .gate_shift = 14, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static struct rk_clk_composite_def spi4 = { + .clkdef = { + .id = SCLK_SPI4, + .name = "clk_spi4", + .parent_names = spi_parents, + .parent_cnt = nitems(spi_parents), + }, + /* CRU_CLKSEL_CON60 */ + .muxdiv_offset = 0x01f0, + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 8, + .div_width = 7, + + /* CRU_CLKGATE_CON9 */ + .gate_offset = 0x0324, + .gate_shift = 15, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static struct rk_clk_composite_def spi5 = { + .clkdef = { + .id = SCLK_SPI5, + .name = "clk_spi5", + .parent_names = spi_parents, + .parent_cnt = nitems(spi_parents), + }, + /* CRU_CLKSEL_CON58 */ + .muxdiv_offset = 0x01e8, + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 8, + .div_width = 7, + + /* CRU_CLKGATE_CON13 */ + .gate_offset = 0x0334, + .gate_shift = 13, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +/* * ARM CPU clocks (LITTLE and big) */ #define ARMCLKL 8 @@ -1790,6 +1925,27 @@ static struct rk_clk rk3399_clks[] = { { .type = RK_CLK_COMPOSITE, .clk.composite = &uphy1_tcpdcore, + }, + + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &spi0, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &spi1, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &spi2, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &spi4, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &spi5, }, { From owner-svn-src-head@freebsd.org Fri Oct 25 21:32:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0A1715BE1E; Fri, 25 Oct 2019 21:32:29 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470HQ53pTcz45J7; Fri, 25 Oct 2019 21:32:29 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 675342C957; Fri, 25 Oct 2019 21:32:29 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLWTGC045286; Fri, 25 Oct 2019 21:32:29 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLWTOZ045285; Fri, 25 Oct 2019 21:32:29 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201910252132.x9PLWTOZ045285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Fri, 25 Oct 2019 21:32:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354102 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 354102 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:32:29 -0000 Author: rpokala Date: Fri Oct 25 21:32:28 2019 New Revision: 354102 URL: https://svnweb.freebsd.org/changeset/base/354102 Log: Args for buf_track() might be unused If neither FULL_BUF_TRACKING nor BUF_TRACKING are defined, then the body of buf_track() becomes empty. Mark the arguments with "__unused" so the compiler doesn't complain about unused arguments in that case. Reported by: Bruce Leverett (Panasas) Reviewed by: cem (on IRC) MFC after: 1 month Sponsored by: Panasas Modified: head/sys/sys/buf.h Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Fri Oct 25 21:23:44 2019 (r354101) +++ head/sys/sys/buf.h Fri Oct 25 21:32:28 2019 (r354102) @@ -457,7 +457,7 @@ buf_countdeps(struct buf *bp, int i) } static __inline void -buf_track(struct buf *bp, const char *location) +buf_track(struct buf *bp __unused, const char *location __unused) { #if defined(FULL_BUF_TRACKING) From owner-svn-src-head@freebsd.org Fri Oct 25 21:38:40 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2816015BF75; Fri, 25 Oct 2019 21:38:40 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470HYD0pr8z45cj; Fri, 25 Oct 2019 21:38:40 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4B8E2C96B; Fri, 25 Oct 2019 21:38:39 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLcd0p045610; Fri, 25 Oct 2019 21:38:39 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLcdYV045607; Fri, 25 Oct 2019 21:38:39 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201910252138.x9PLcdYV045607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 25 Oct 2019 21:38:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354103 - in head/sys: arm64/conf arm64/rockchip conf X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in head/sys: arm64/conf arm64/rockchip conf X-SVN-Commit-Revision: 354103 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:38:40 -0000 Author: gonzo Date: Fri Oct 25 21:38:38 2019 New Revision: 354103 URL: https://svnweb.freebsd.org/changeset/base/354103 Log: arm64: rk3399: add SPI driver and include it in GENERIC config SPI driver for Rockchip's RK3399 SoC. Implements PIO mode, CS selection, SPI mode and frequency configuration. Reviewed by: manu MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D22148 Added: head/sys/arm64/rockchip/rk_spi.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Fri Oct 25 21:32:28 2019 (r354102) +++ head/sys/arm64/conf/GENERIC Fri Oct 25 21:38:38 2019 (r354103) @@ -286,6 +286,7 @@ device mv_thermal # Marvell Thermal Sensor Controller # SPI device spibus device bcm2835_spi # Broadcom BCM283x SPI bus +device rk_spi # RockChip SPI controller # PWM device pwm Added: head/sys/arm64/rockchip/rk_spi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/rockchip/rk_spi.c Fri Oct 25 21:38:38 2019 (r354103) @@ -0,0 +1,483 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Oleksandr Tymoshenko + * + * 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$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include "spibus_if.h" + +#define RK_SPI_CTRLR0 0x0000 +#define CTRLR0_OPM_MASTER (0 << 20) +#define CTRLR0_XFM_TR (0 << 18) +#define CTRLR0_FRF_MOTO (0 << 16) +#define CTRLR0_BHT_8BIT (1 << 13) +#define CTRLR0_EM_BIG (1 << 11) +#define CTRLR0_SSD_ONE (1 << 10) +#define CTRLR0_SCPOL (1 << 7) +#define CTRLR0_SCPH (1 << 6) +#define CTRLR0_DFS_8BIT (1 << 0) +#define RK_SPI_CTRLR1 0x0004 +#define RK_SPI_ENR 0x0008 +#define RK_SPI_SER 0x000c +#define RK_SPI_BAUDR 0x0010 +#define RK_SPI_TXFTLR 0x0014 +#define RK_SPI_RXFTLR 0x0018 +#define RK_SPI_TXFLR 0x001c +#define RK_SPI_RXFLR 0x0020 +#define RK_SPI_SR 0x0024 +#define SR_BUSY (1 << 0) +#define RK_SPI_IPR 0x0028 +#define RK_SPI_IMR 0x002c +#define IMR_RFFIM (1 << 4) +#define IMR_TFEIM (1 << 0) +#define RK_SPI_ISR 0x0030 +#define ISR_RFFIS (1 << 4) +#define ISR_TFEIS (1 << 0) +#define RK_SPI_RISR 0x0034 +#define RK_SPI_ICR 0x0038 +#define RK_SPI_DMACR 0x003c +#define RK_SPI_DMATDLR 0x0040 +#define RK_SPI_DMARDLR 0x0044 +#define RK_SPI_TXDR 0x0400 +#define RK_SPI_RXDR 0x0800 + +#define CS_MAX 1 + +static struct ofw_compat_data compat_data[] = { + { "rockchip,rk3399-spi", 1 }, + { NULL, 0 } +}; + +static struct resource_spec rk_spi_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE | RF_SHAREABLE }, + { -1, 0 } +}; + +struct rk_spi_softc { + device_t dev; + device_t spibus; + struct resource *res[2]; + struct mtx mtx; + clk_t clk_apb; + clk_t clk_spi; + void * intrhand; + int transfer; + uint32_t fifo_size; + uint64_t max_freq; + + uint32_t intreg; + uint8_t *rxbuf; + uint32_t rxidx; + uint8_t *txbuf; + uint32_t txidx; + uint32_t txlen; + uint32_t rxlen; +}; + +#define RK_SPI_LOCK(sc) mtx_lock(&(sc)->mtx) +#define RK_SPI_UNLOCK(sc) mtx_unlock(&(sc)->mtx) +#define RK_SPI_READ_4(sc, reg) bus_read_4((sc)->res[0], (reg)) +#define RK_SPI_WRITE_4(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val)) + +static int rk_spi_probe(device_t dev); +static int rk_spi_attach(device_t dev); +static int rk_spi_detach(device_t dev); +static void rk_spi_intr(void *arg); + +static void +rk_spi_enable_chip(struct rk_spi_softc *sc, int enable) +{ + + RK_SPI_WRITE_4(sc, RK_SPI_ENR, enable ? 1 : 0); +} + +static int +rk_spi_set_cs(struct rk_spi_softc *sc, uint32_t cs, bool active) +{ + uint32_t reg; + + if (cs & SPIBUS_CS_HIGH) { + device_printf(sc->dev, "SPIBUS_CS_HIGH is not supported\n"); + return (EINVAL); + } + + if (cs > CS_MAX) + return (EINVAL); + + reg = RK_SPI_READ_4(sc, RK_SPI_SER); + if (active) + reg |= (1 << cs); + else + reg &= ~(1 << cs); + RK_SPI_WRITE_4(sc, RK_SPI_SER, reg); + + return (0); +} + +static void +rk_spi_hw_setup(struct rk_spi_softc *sc, uint32_t mode, uint32_t freq) +{ + uint32_t cr0; + uint32_t div; + + cr0 = CTRLR0_OPM_MASTER | CTRLR0_XFM_TR | CTRLR0_FRF_MOTO | + CTRLR0_BHT_8BIT | CTRLR0_EM_BIG | CTRLR0_SSD_ONE | + CTRLR0_DFS_8BIT; + + if (mode & SPIBUS_MODE_CPHA) + cr0 |= CTRLR0_SCPH; + if (mode & SPIBUS_MODE_CPOL) + cr0 |= CTRLR0_SCPOL; + + /* minimum divider is 2 */ + if (sc->max_freq < freq*2) { + clk_set_freq(sc->clk_spi, 2 * freq, CLK_SET_ROUND_DOWN); + clk_get_freq(sc->clk_spi, &sc->max_freq); + } + + div = ((sc->max_freq + freq - 1) / freq); + div = (div + 1) & 0xfffe; + RK_SPI_WRITE_4(sc, RK_SPI_BAUDR, div); + + RK_SPI_WRITE_4(sc, RK_SPI_CTRLR0, cr0); +} + +static uint32_t +rk_spi_fifo_size(struct rk_spi_softc *sc) +{ + uint32_t txftlr, reg; + + for (txftlr = 2; txftlr < 32; txftlr++) { + RK_SPI_WRITE_4(sc, RK_SPI_TXFTLR, txftlr); + reg = RK_SPI_READ_4(sc, RK_SPI_TXFTLR); + if (reg != txftlr) + break; + } + RK_SPI_WRITE_4(sc, RK_SPI_TXFTLR, 0); + + if (txftlr == 31) + return 0; + + return txftlr; +} + +static void +rk_spi_empty_rxfifo(struct rk_spi_softc *sc) +{ + uint32_t rxlevel; + rxlevel = RK_SPI_READ_4(sc, RK_SPI_RXFLR); + while (sc->rxidx < sc->rxlen && + (rxlevel-- > 0)) { + sc->rxbuf[sc->rxidx++] = (uint8_t)RK_SPI_READ_4(sc, RK_SPI_RXDR); + } +} + +static void +rk_spi_fill_txfifo(struct rk_spi_softc *sc) +{ + uint32_t txlevel; + txlevel = RK_SPI_READ_4(sc, RK_SPI_TXFLR); + int cnt = 0; + + while (sc->txidx < sc->txlen && txlevel < sc->fifo_size) { + RK_SPI_WRITE_4(sc, RK_SPI_TXDR, sc->txbuf[sc->txidx++]); + txlevel++; + cnt++; + } + + if (sc->txidx != sc->txlen) + sc->intreg |= (IMR_TFEIM | IMR_RFFIM); +} + +static int +rk_spi_xfer_buf(struct rk_spi_softc *sc, void *rxbuf, void *txbuf, uint32_t len) +{ + int err; + + if (len == 0) + return (0); + + sc->rxbuf = rxbuf; + sc->rxlen = len; + sc->rxidx = 0; + sc->txbuf = txbuf; + sc->txlen = len; + sc->txidx = 0; + sc->intreg = 0; + rk_spi_fill_txfifo(sc); + + RK_SPI_WRITE_4(sc, RK_SPI_IMR, sc->intreg); + + err = 0; + while (err == 0 && sc->intreg != 0) + err = msleep(sc, &sc->mtx, 0, "rk_spi", 10 * hz); + + while (err == 0 && sc->rxidx != sc->txidx) { + /* read residual data from RX fifo */ + rk_spi_empty_rxfifo(sc); + } + + if (sc->rxidx != sc->rxlen || sc->txidx != sc->txlen) + err = EIO; + + return (err); +} + +static int +rk_spi_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, "Rockchip SPI"); + return (BUS_PROBE_DEFAULT); +} + +static int +rk_spi_attach(device_t dev) +{ + struct rk_spi_softc *sc; + int error; + + sc = device_get_softc(dev); + sc->dev = dev; + + mtx_init(&sc->mtx, device_get_nameunit(dev), NULL, MTX_DEF); + + if (bus_alloc_resources(dev, rk_spi_spec, sc->res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + error = ENXIO; + goto fail; + } + + if (bus_setup_intr(dev, sc->res[1], + INTR_TYPE_MISC | INTR_MPSAFE, NULL, rk_spi_intr, sc, + &sc->intrhand)) { + bus_release_resources(dev, rk_spi_spec, sc->res); + device_printf(dev, "cannot setup interrupt handler\n"); + return (ENXIO); + } + + /* Activate the module clock. */ + error = clk_get_by_ofw_name(dev, 0, "apb_pclk", &sc->clk_apb); + if (error != 0) { + device_printf(dev, "cannot get apb_pclk clock\n"); + goto fail; + } + error = clk_get_by_ofw_name(dev, 0, "spiclk", &sc->clk_spi); + if (error != 0) { + device_printf(dev, "cannot get spiclk clock\n"); + goto fail; + } + error = clk_enable(sc->clk_apb); + if (error != 0) { + device_printf(dev, "cannot enable ahb clock\n"); + goto fail; + } + error = clk_enable(sc->clk_spi); + if (error != 0) { + device_printf(dev, "cannot enable spiclk clock\n"); + goto fail; + } + clk_get_freq(sc->clk_spi, &sc->max_freq); + + sc->fifo_size = rk_spi_fifo_size(sc); + if (sc->fifo_size == 0) { + device_printf(dev, "failed to get fifo size\n"); + goto fail; + } + + sc->spibus = device_add_child(dev, "spibus", -1); + + RK_SPI_WRITE_4(sc, RK_SPI_IMR, 0); + RK_SPI_WRITE_4(sc, RK_SPI_TXFTLR, sc->fifo_size/2 - 1); + RK_SPI_WRITE_4(sc, RK_SPI_RXFTLR, sc->fifo_size/2 - 1); + + return (bus_generic_attach(dev)); + +fail: + rk_spi_detach(dev); + return (error); +} + +static int +rk_spi_detach(device_t dev) +{ + struct rk_spi_softc *sc; + + sc = device_get_softc(dev); + + bus_generic_detach(sc->dev); + if (sc->spibus != NULL) + device_delete_child(dev, sc->spibus); + + if (sc->clk_spi != NULL) + clk_release(sc->clk_spi); + if (sc->clk_apb) + clk_release(sc->clk_apb); + + if (sc->intrhand != NULL) + bus_teardown_intr(sc->dev, sc->res[1], sc->intrhand); + + bus_release_resources(dev, rk_spi_spec, sc->res); + mtx_destroy(&sc->mtx); + + return (0); +} + +static void +rk_spi_intr(void *arg) +{ + struct rk_spi_softc *sc; + uint32_t intreg, isr; + + sc = arg; + + RK_SPI_LOCK(sc); + intreg = RK_SPI_READ_4(sc, RK_SPI_IMR); + isr = RK_SPI_READ_4(sc, RK_SPI_ISR); + RK_SPI_WRITE_4(sc, RK_SPI_ICR, isr); + + if (isr & ISR_RFFIS) + rk_spi_empty_rxfifo(sc); + + if (isr & ISR_TFEIS) + rk_spi_fill_txfifo(sc); + + /* no bytes left, disable interrupt */ + if (sc->txidx == sc->txlen) { + sc->intreg = 0; + wakeup(sc); + } + + if (sc->intreg != intreg) { + (void)RK_SPI_WRITE_4(sc, RK_SPI_IMR, sc->intreg); + (void)RK_SPI_READ_4(sc, RK_SPI_IMR); + } + + RK_SPI_UNLOCK(sc); +} + +static phandle_t +rk_spi_get_node(device_t bus, device_t dev) +{ + + return ofw_bus_get_node(bus); +} + +static int +rk_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) +{ + struct rk_spi_softc *sc; + uint32_t cs, mode, clock; + int err = 0; + + sc = device_get_softc(dev); + + spibus_get_cs(child, &cs); + spibus_get_clock(child, &clock); + spibus_get_mode(child, &mode); + + RK_SPI_LOCK(sc); + rk_spi_hw_setup(sc, mode, clock); + rk_spi_enable_chip(sc, 1); + err = rk_spi_set_cs(sc, cs, true); + if (err != 0) { + rk_spi_enable_chip(sc, 0); + RK_SPI_UNLOCK(sc); + return (err); + } + + /* Transfer command then data bytes. */ + err = 0; + if (cmd->tx_cmd_sz > 0) + err = rk_spi_xfer_buf(sc, cmd->rx_cmd, cmd->tx_cmd, + cmd->tx_cmd_sz); + if (cmd->tx_data_sz > 0 && err == 0) + err = rk_spi_xfer_buf(sc, cmd->rx_data, cmd->tx_data, + cmd->tx_data_sz); + + rk_spi_set_cs(sc, cs, false); + rk_spi_enable_chip(sc, 0); + RK_SPI_UNLOCK(sc); + + return (err); +} + +static device_method_t rk_spi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, rk_spi_probe), + DEVMETHOD(device_attach, rk_spi_attach), + DEVMETHOD(device_detach, rk_spi_detach), + + /* spibus_if */ + DEVMETHOD(spibus_transfer, rk_spi_transfer), + + /* ofw_bus_if */ + DEVMETHOD(ofw_bus_get_node, rk_spi_get_node), + + DEVMETHOD_END +}; + +static driver_t rk_spi_driver = { + "spi", + rk_spi_methods, + sizeof(struct rk_spi_softc), +}; + +static devclass_t rk_spi_devclass; + +DRIVER_MODULE(rk_spi, simplebus, rk_spi_driver, rk_spi_devclass, 0, 0); +DRIVER_MODULE(ofw_spibus, rk_spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); +MODULE_DEPEND(rk_spi, ofw_spibus, 1, 1, 1); +SIMPLEBUS_PNP_INFO(compat_data); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Oct 25 21:32:28 2019 (r354102) +++ head/sys/conf/files.arm64 Fri Oct 25 21:38:38 2019 (r354103) @@ -298,6 +298,7 @@ arm64/rockchip/rk805.c optional fdt rk805 soc_rockch arm64/rockchip/rk_grf.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 arm64/rockchip/rk_pinctrl.c optional fdt rk_pinctrl soc_rockchip_rk3328 | fdt rk_pinctrl soc_rockchip_rk3399 arm64/rockchip/rk_gpio.c optional fdt rk_gpio soc_rockchip_rk3328 | fdt rk_gpio soc_rockchip_rk3399 +arm64/rockchip/rk_spi.c optional fdt rk_spi arm64/rockchip/rk_usb2phy.c optional fdt rk_usb2phy soc_rockchip_rk3328 | soc_rockchip_rk3399 arm64/rockchip/rk_typec_phy.c optional fdt rk_typec_phy soc_rockchip_rk3399 arm64/rockchip/if_dwc_rk.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 From owner-svn-src-head@freebsd.org Fri Oct 25 21:39:30 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0619615BFFE; Fri, 25 Oct 2019 21:39:30 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470HZ96DFMz45lw; Fri, 25 Oct 2019 21:39:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8D9A2C972; Fri, 25 Oct 2019 21:39:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLdTX1045690; Fri, 25 Oct 2019 21:39:29 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLdTWZ045689; Fri, 25 Oct 2019 21:39:29 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201910252139.x9PLdTWZ045689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 25 Oct 2019 21:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354104 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 354104 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:39:30 -0000 Author: mhorne Date: Fri Oct 25 21:39:29 2019 New Revision: 354104 URL: https://svnweb.freebsd.org/changeset/base/354104 Log: RISC-V: skip cpu-map when parsing elf_hwcap The fill_elf_hwcap() function expects to find only cpu nodes under the /cpus entry of the device tree. Newer versions of QEMU insert a cpu-map node which describes the CPU topology, breaking this function. To fix this, simply skip any non-cpu entries. Reviewed by: markj, kp, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22151 Modified: head/sys/riscv/riscv/identcpu.c Modified: head/sys/riscv/riscv/identcpu.c ============================================================================== --- head/sys/riscv/riscv/identcpu.c Fri Oct 25 21:38:38 2019 (r354103) +++ head/sys/riscv/riscv/identcpu.c Fri Oct 25 21:39:29 2019 (r354104) @@ -142,11 +142,9 @@ fill_elf_hwcap(void *dummy __unused) * ISAs, keep only the extension bits that are common to all harts. */ for (node = OF_child(node); node > 0; node = OF_peer(node)) { - if (!ofw_bus_node_is_compatible(node, "riscv")) { - if (bootverbose) - printf("fill_elf_hwcap: Can't find cpu\n"); - return; - } + /* Skip any non-CPU nodes, such as cpu-map. */ + if (!ofw_bus_node_is_compatible(node, "riscv")) + continue; len = OF_getprop(node, "riscv,isa", isa, sizeof(isa)); KASSERT(len <= ISA_NAME_MAXLEN, ("ISA string truncated")); From owner-svn-src-head@freebsd.org Fri Oct 25 21:53:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2D5915CC7D; Fri, 25 Oct 2019 21:53:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Hst4n6Hz478W; Fri, 25 Oct 2019 21:53:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8899E2CD08; Fri, 25 Oct 2019 21:53:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLr6cq057280; Fri, 25 Oct 2019 21:53:06 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLr5JP057277; Fri, 25 Oct 2019 21:53:05 GMT (envelope-from np@FreeBSD.org) Message-Id: <201910252153.x9PLr5JP057277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 25 Oct 2019 21:53:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354106 - in head/sys/dev/cxgbe: . common iw_cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common iw_cxgbe X-SVN-Commit-Revision: 354106 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:53:06 -0000 Author: np Date: Fri Oct 25 21:53:05 2019 New Revision: 354106 URL: https://svnweb.freebsd.org/changeset/base/354106 Log: cxgbe(4): Use correct FetchBurstMin values for T6. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_regs_values.h head/sys/dev/cxgbe/iw_cxgbe/qp.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/common/t4_regs_values.h ============================================================================== --- head/sys/dev/cxgbe/common/t4_regs_values.h Fri Oct 25 21:52:02 2019 (r354105) +++ head/sys/dev/cxgbe/common/t4_regs_values.h Fri Oct 25 21:53:05 2019 (r354106) @@ -147,6 +147,11 @@ #define X_FETCHBURSTMIN_64B 2 #define X_FETCHBURSTMIN_128B 3 +/* T6 and later use a single-bit encoding for FetchBurstMin */ +#define X_FETCHBURSTMIN_SHIFT_T6 6 +#define X_FETCHBURSTMIN_64B_T6 0 +#define X_FETCHBURSTMIN_128B_T6 1 + #define X_FETCHBURSTMAX_SHIFT 6 #define X_FETCHBURSTMAX_64B 0 #define X_FETCHBURSTMAX_128B 1 Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/qp.c Fri Oct 25 21:52:02 2019 (r354105) +++ head/sys/dev/cxgbe/iw_cxgbe/qp.c Fri Oct 25 21:53:05 2019 (r354106) @@ -266,7 +266,8 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4 res->u.sqrq.dcaen_to_eqsize = cpu_to_be32( V_FW_RI_RES_WR_DCAEN(0) | V_FW_RI_RES_WR_DCACPU(0) | - V_FW_RI_RES_WR_FBMIN(2) | + V_FW_RI_RES_WR_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | V_FW_RI_RES_WR_FBMAX(3) | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | V_FW_RI_RES_WR_CIDXFTHRESH(0) | @@ -288,7 +289,8 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4 res->u.sqrq.dcaen_to_eqsize = cpu_to_be32( V_FW_RI_RES_WR_DCAEN(0) | V_FW_RI_RES_WR_DCACPU(0) | - V_FW_RI_RES_WR_FBMIN(2) | + V_FW_RI_RES_WR_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | V_FW_RI_RES_WR_FBMAX(3) | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | V_FW_RI_RES_WR_CIDXFTHRESH(0) | Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Fri Oct 25 21:52:02 2019 (r354105) +++ head/sys/dev/cxgbe/t4_netmap.c Fri Oct 25 21:53:05 2019 (r354106) @@ -159,7 +159,7 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq (black_hole == 2 ? F_FW_IQ_CMD_FL0PACKEN : 0)); c.fl0dcaen_to_fl0cidxfthresh = htobe16(V_FW_IQ_CMD_FL0FBMIN(chip_id(sc) <= CHELSIO_T5 ? - X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B) | + X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B_T6) | V_FW_IQ_CMD_FL0FBMAX(chip_id(sc) <= CHELSIO_T5 ? X_FETCHBURSTMAX_512B : X_FETCHBURSTMAX_256B)); c.fl0size = htobe16(na->num_rx_desc / 8 + sp->spg_len / EQ_ESIZE); @@ -274,9 +274,11 @@ alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq htobe32(V_FW_EQ_ETH_CMD_HOSTFCMODE(X_HOSTFCMODE_NONE) | V_FW_EQ_ETH_CMD_PCIECHN(vi->pi->tx_chan) | F_FW_EQ_ETH_CMD_FETCHRO | V_FW_EQ_ETH_CMD_IQID(sc->sge.nm_rxq[nm_txq->iqidx].iq_cntxt_id)); - c.dcaen_to_eqsize = htobe32(V_FW_EQ_ETH_CMD_FBMIN(X_FETCHBURSTMIN_64B) | - V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) | - V_FW_EQ_ETH_CMD_EQSIZE(len / EQ_ESIZE)); + c.dcaen_to_eqsize = + htobe32(V_FW_EQ_ETH_CMD_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | + V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) | + V_FW_EQ_ETH_CMD_EQSIZE(len / EQ_ESIZE)); c.eqaddr = htobe64(nm_txq->ba); rc = -t4_wr_mbox(sc, sc->mbox, &c, sizeof(c), &c); Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Fri Oct 25 21:52:02 2019 (r354105) +++ head/sys/dev/cxgbe/t4_sge.c Fri Oct 25 21:53:05 2019 (r354106) @@ -3212,7 +3212,7 @@ alloc_iq_fl(struct vi_info *vi, struct sge_iq *iq, str } c.fl0dcaen_to_fl0cidxfthresh = htobe16(V_FW_IQ_CMD_FL0FBMIN(chip_id(sc) <= CHELSIO_T5 ? - X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B) | + X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B_T6) | V_FW_IQ_CMD_FL0FBMAX(chip_id(sc) <= CHELSIO_T5 ? X_FETCHBURSTMAX_512B : X_FETCHBURSTMAX_256B)); c.fl0size = htobe16(fl->qsize); @@ -3798,7 +3798,8 @@ ctrl_eq_alloc(struct adapter *sc, struct sge_eq *eq) V_FW_EQ_CTRL_CMD_PCIECHN(eq->tx_chan) | F_FW_EQ_CTRL_CMD_FETCHRO | V_FW_EQ_CTRL_CMD_IQID(eq->iqid)); c.dcaen_to_eqsize = - htobe32(V_FW_EQ_CTRL_CMD_FBMIN(X_FETCHBURSTMIN_64B) | + htobe32(V_FW_EQ_CTRL_CMD_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | V_FW_EQ_CTRL_CMD_FBMAX(X_FETCHBURSTMAX_512B) | V_FW_EQ_CTRL_CMD_CIDXFTHRESH(qsize_to_fthresh(qsize)) | V_FW_EQ_CTRL_CMD_EQSIZE(qsize)); @@ -3842,9 +3843,11 @@ eth_eq_alloc(struct adapter *sc, struct vi_info *vi, s htobe32(V_FW_EQ_ETH_CMD_HOSTFCMODE(X_HOSTFCMODE_NONE) | V_FW_EQ_ETH_CMD_PCIECHN(eq->tx_chan) | F_FW_EQ_ETH_CMD_FETCHRO | V_FW_EQ_ETH_CMD_IQID(eq->iqid)); - c.dcaen_to_eqsize = htobe32(V_FW_EQ_ETH_CMD_FBMIN(X_FETCHBURSTMIN_64B) | - V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) | - V_FW_EQ_ETH_CMD_EQSIZE(qsize)); + c.dcaen_to_eqsize = + htobe32(V_FW_EQ_ETH_CMD_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | + V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) | + V_FW_EQ_ETH_CMD_EQSIZE(qsize)); c.eqaddr = htobe64(eq->ba); rc = -t4_wr_mbox(sc, sc->mbox, &c, sizeof(c), &c); @@ -3886,7 +3889,8 @@ ofld_eq_alloc(struct adapter *sc, struct vi_info *vi, V_FW_EQ_OFLD_CMD_PCIECHN(eq->tx_chan) | F_FW_EQ_OFLD_CMD_FETCHRO | V_FW_EQ_OFLD_CMD_IQID(eq->iqid)); c.dcaen_to_eqsize = - htobe32(V_FW_EQ_OFLD_CMD_FBMIN(X_FETCHBURSTMIN_64B) | + htobe32(V_FW_EQ_OFLD_CMD_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | V_FW_EQ_OFLD_CMD_FBMAX(X_FETCHBURSTMAX_512B) | V_FW_EQ_OFLD_CMD_CIDXFTHRESH(qsize_to_fthresh(qsize)) | V_FW_EQ_OFLD_CMD_EQSIZE(qsize)); From owner-svn-src-head@freebsd.org Fri Oct 25 22:39:27 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CDC115DCB2; Fri, 25 Oct 2019 22:39:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470JvM0h4Jz49T4; Fri, 25 Oct 2019 22:39:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAB282D453; Fri, 25 Oct 2019 22:39:26 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PMdQ6g081256; Fri, 25 Oct 2019 22:39:26 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PMdQ4Q081255; Fri, 25 Oct 2019 22:39:26 GMT (envelope-from np@FreeBSD.org) Message-Id: <201910252239.x9PMdQ4Q081255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 25 Oct 2019 22:39:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354110 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 354110 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 22:39:27 -0000 Author: np Date: Fri Oct 25 22:39:26 2019 New Revision: 354110 URL: https://svnweb.freebsd.org/changeset/base/354110 Log: Fix typo in cxgbe.4. MFC after: 1 week Modified: head/share/man/man4/cxgbe.4 Modified: head/share/man/man4/cxgbe.4 ============================================================================== --- head/share/man/man4/cxgbe.4 Fri Oct 25 22:17:24 2019 (r354109) +++ head/share/man/man4/cxgbe.4 Fri Oct 25 22:39:26 2019 (r354110) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Sep 24, 2018 +.Dd Oct 25, 2019 .Dt CXGBE 4 .Os .Sh NAME @@ -292,7 +292,7 @@ Settings can be displayed and controlled on a per-port dev..X.pause_settings sysctl. .It Va hw.cxgbe.fec FEC (Forward Error Correction) settings. -0 diables FEC. +0 disables FEC. Bit 0 enables RS FEC, bit 1 enables BASE-R FEC (aka Firecode FEC). The default is -1 which lets the driver pick a value. This tunable establishes the default FEC settings for all ports. From owner-svn-src-head@freebsd.org Sat Oct 26 00:51:29 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 405AC161575; Sat, 26 Oct 2019 00:51:29 +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 470Mqj0Qclz4GCB; Sat, 26 Oct 2019 00:51:28 +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 x9Q0pK0K058677; Fri, 25 Oct 2019 17:51:20 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x9Q0pKl3058676; Fri, 25 Oct 2019 17:51:20 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201910260051.x9Q0pKl3058676@gndrsh.dnsmgr.net> Subject: Re: svn commit: r354076 - head/sys/dev/ow In-Reply-To: <8baac891351521c9e7148a0c0db9978645158dce.camel@freebsd.org> To: Ian Lepore Date: Fri, 25 Oct 2019 17:51:20 -0700 (PDT) CC: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@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: 470Mqj0Qclz4GCB X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.985,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 00:51:29 -0000 > On Fri, 2019-10-25 at 19:03 +0300, Andriy Gapon wrote: > > On 25/10/2019 18:56, Ian Lepore wrote: > > > On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote: > > > > On 25/10/2019 18:46, Ian Lepore wrote: > > > > > On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: > > > > > > Author: avg > > > > > > Date: Fri Oct 25 15:38:09 2019 > > > > > > New Revision: 354076 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/354076 > > > > > > > > > > > > Log: > > > > > > owc_gpiobus_read_data: compare times in sbintime_t units > > > > > > > > > > > > Previously the code used sbttous() before microseconds > > > > > > comparison > > > > > > in one > > > > > > place, sbttons() and nanoseconds in another, division by > > > > > > SBT_1US > > > > > > and > > > > > > microseconds in yet another. > > > > > > > > > > > > Now the code consistently uses multiplication by SBT_1US to > > > > > > convert > > > > > > microseconds to sbintime_t before comparing them with > > > > > > periods > > > > > > between > > > > > > calls to sbinuptime(). This is fast, this is precise > > > > > > enough > > > > > > (below > > > > > > 0.03%) and the periods defined by the protocol cannot > > > > > > overflow. > > > > > > > > > > > > Reviewed by: imp (D22108) > > > > > > MFC after: 2 weeks > > > > > > > > > > > > Modified: > > > > > > head/sys/dev/ow/owc_gpiobus.c > > > > > > > > > > > > Modified: head/sys/dev/ow/owc_gpiobus.c > > > > > > ============================================================= > > > > > > ==== > > > > > > ==== > > > > > > ========= > > > > > > --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 > > > > > > 2019 ( > > > > > > r354 > > > > > > 075) > > > > > > +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 > > > > > > 2019 ( > > > > > > r354 > > > > > > 076) > > > > > > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, > > > > > > struct > > > > > > ow_timing * > > > > > > do { > > > > > > now = sbinuptime(); > > > > > > GETPIN(sc, &sample); > > > > > > - } while (sbttous(now - then) < t->t_rdv + 2 && sample > > > > > > == 0); > > > > > > + } while (now - then < (t->t_rdv + 2) * SBT_1US && > > > > > > sample == 0); > > > > > > critical_exit(); > > > > > > > > > > > > - if (sbttons(now - then) < t->t_rdv * 1000) > > > > > > + if (now - then < t->t_rdv * SBT_1US) > > > > > > *bit = 1; > > > > > > else > > > > > > *bit = 0; > > > > > > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, > > > > > > struct > > > > > > ow_timing * > > > > > > /* Wait out the rest of t_slot */ > > > > > > do { > > > > > > now = sbinuptime(); > > > > > > - } while ((now - then) / SBT_1US < t->t_slot); > > > > > > + } while (now - then < t->t_slot * SBT_1US); > > > > > > > > > > > > RELBUS(sc); > > > > > > > > > > > > > > > > Unit conversions with sbt times should be done using the macros > > > > > that > > > > > carefully avoid roundoff errors. I don't understand why you've > > > > > changed > > > > > the code that correctly did use those macros to inline math. > > > > > > > > I think that the commit message explains it: > > > > This is fast, this is precise enough (below 0.03%) and the > > > > periods > > > > defined by > > > > the protocol cannot overflow. > > > > > > > > Do you disagree? > > > > Could you please explain in which of the three lines changed the > > > > new > > > > code is > > > > worse and why? > > > > > > > > > > I absolutely disagree (or I wouldn't have replied). Unit > > > conversions > > > using sbt times should use the predefined macros, NOT incline > > > multiplication and division. I don't know how to say it more > > > clearly > > > than that. The conversion macros are idiomatic (at least, they > > > would > > > be if people stopped writing inline conversion expressions). > > > > I can agree that I should have used ustosbt() instead of > > multiplication by > > SBT_1US, but I don't agree with your original message that I changed > > the code > > that correctly used the macros. > > > > But again, I know the times being converted, they are fixed by the > > protocol and > > I do not see why I have to use this: > > > > static __inline sbintime_t > > ustosbt(int64_t _us) > > { > > sbintime_t sb = 0; > > > > #ifdef KASSERT > > KASSERT(_us >= 0, ("Negative values illegal for ustosbt: > > %jd", _us)); > > #endif > > if (_us >= SBT_1S) { > > sb = (_us / 1000000) * SBT_1S; > > _us = _us % 1000000; > > } > > /* 9223372036855 = ceil(2^63 / 1000000) */ > > sb += ((_us * 9223372036855ull) + 0x7fffffff) >> 31; > > return (sb); > > } > > > > instead of this > > x * (((sbintime_t)1 << 32) / 1000000) > > > > The times: > > static struct ow_timing timing_regular = { > > .t_slot = 60, /* 60 to 120 */ > > .t_low0 = 60, /* really 60 to 120 */ > > .t_low1 = 1, /* really 1 to 15 */ > > .t_release = 45, /* <= 45us */ > > .t_rec = 1, /* at least 1us */ > > .t_rdv = 15, /* 15us */ > > .t_rstl = 480, /* 480us or more */ > > .t_rsth = 480, /* 480us or more */ > > .t_pdl = 60, /* 60us to 240us */ > > .t_pdh = 60, /* 15us to 60us */ > > .t_lowr = 1, /* 1us */ > > }; Should this chunk of code now have a bit fat NB: if you modify these be careful, there is other code that assumes the values here can not cause overflow? > > > > > > The fact that you could say all that means that there is nothing I can > say that is going to change your mind. I will say if you ever do > anything like this to code I wrote, I will revert it immediately. > > -- Ian > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sat Oct 26 01:14:24 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74C90161FB6 for ; Sat, 26 Oct 2019 01:14:24 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 470NL733xFz4H55 for ; Sat, 26 Oct 2019 01:14:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x841.google.com with SMTP id c21so6013439qtj.12 for ; Fri, 25 Oct 2019 18:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iDTb7mnkdmlYk/CMcfOg6K8Z5nBnAroUgHhF+RPa50M=; b=z/faNAO/2PY/8+4iMKe3OPxa6HEys9b6ZlTtbv4jRt3zL4udlNd1StaI01LG/05Juf E7nULWN2uPKiuQP5HmFc5fGx+f/asBxX3l8FC6Ibqvf3KRCq0O8IKMnw7DmAXRodkQ7R gqs/qako3y1qGoGNUUs+jY/GwexG8nenjNK+QABuB8FBihJAsKqBFtuXh3JwXzoAfL+e uRV0qUnU2VIF1m2xmxU2a99MhSCxDJFdhsnfjxaS1HA/xRK55+OO0msCNt4Y2UNRvwfJ czkbyrrmjgQHS6qi7GT+9QMyvOxgHICL9VpXs5ji0VC/vqZzC0xwF32x4Ik7NRwuGbC2 LG7w== 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=iDTb7mnkdmlYk/CMcfOg6K8Z5nBnAroUgHhF+RPa50M=; b=Kqvl9QT7MVBcr1DFw91+DnX/fflALu/k9Gqg8e4FtmkRRppFFN2uTl4cFPJFcTWO3c ylt/ai6GImf+v687lDGF/89wj498Y/xniIvZh09E+QfS2uDrD2HjTrOdGy1qrcGCMojG LjuL02Zsntp5cGUe8JhccjPRIKSojmy+xP3wgX3C9ZAA7YMzWr17SiB7EUKrb1NzN/J0 8LOm5C0qgoUsHNgmEDM1MXsVqT4+RvuzVRuSxBvrmVRqpcRtOI4+ZgA0IBK4I+YYSOUw 8VnoUzeDT34VHvvFcnjd19GHFzRnp3Ac9ivb0XC4ONSSXlzB4a4ikYnFNNDQi9t5IeqO bPqQ== X-Gm-Message-State: APjAAAVKz3zqlN7jOLnrxD76P89RTmM1KX6MoSbcXOWXIFDh4707Hlau AjQ1tpqufVkBSbF84C9L8bLWRfugkL6YUfk9OvhcFw== X-Google-Smtp-Source: APXvYqxfSAqg+j5NMbGF7U9dVwq+/r5O/iPTvQF3F//BxJHL0u3yWSDKNoPdL9fZYjuNTP1o8aYtWOf20z2W5Xlewrs= X-Received: by 2002:a0c:ee49:: with SMTP id m9mr6439446qvs.118.1572052462146; Fri, 25 Oct 2019 18:14:22 -0700 (PDT) MIME-Version: 1.0 References: <8baac891351521c9e7148a0c0db9978645158dce.camel@freebsd.org> <201910260051.x9Q0pKl3058676@gndrsh.dnsmgr.net> In-Reply-To: <201910260051.x9Q0pKl3058676@gndrsh.dnsmgr.net> From: Warner Losh Date: Fri, 25 Oct 2019 19:14:10 -0600 Message-ID: Subject: Re: svn commit: r354076 - head/sys/dev/ow To: "Rodney W. Grimes" Cc: Ian Lepore , Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 470NL733xFz4H55 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=z/faNAO/; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::841) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.40 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.991,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[1.4.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.41)[ip: (2.48), ipnet: 2607:f8b0::/32(-2.40), asn: 15169(-2.05), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 01:14:24 -0000 On Fri, Oct 25, 2019, 6:51 PM Rodney W. Grimes wrote: > > On Fri, 2019-10-25 at 19:03 +0300, Andriy Gapon wrote: > > > On 25/10/2019 18:56, Ian Lepore wrote: > > > > On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote: > > > > > On 25/10/2019 18:46, Ian Lepore wrote: > > > > > > On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: > > > > > > > Author: avg > > > > > > > Date: Fri Oct 25 15:38:09 2019 > > > > > > > New Revision: 354076 > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/354076 > > > > > > > > > > > > > > Log: > > > > > > > owc_gpiobus_read_data: compare times in sbintime_t units > > > > > > > > > > > > > > Previously the code used sbttous() before microseconds > > > > > > > comparison > > > > > > > in one > > > > > > > place, sbttons() and nanoseconds in another, division by > > > > > > > SBT_1US > > > > > > > and > > > > > > > microseconds in yet another. > > > > > > > > > > > > > > Now the code consistently uses multiplication by SBT_1US to > > > > > > > convert > > > > > > > microseconds to sbintime_t before comparing them with > > > > > > > periods > > > > > > > between > > > > > > > calls to sbinuptime(). This is fast, this is precise > > > > > > > enough > > > > > > > (below > > > > > > > 0.03%) and the periods defined by the protocol cannot > > > > > > > overflow. > > > > > > > > > > > > > > Reviewed by: imp (D22108) > > > > > > > MFC after: 2 weeks > > > > > > > > > > > > > > Modified: > > > > > > > head/sys/dev/ow/owc_gpiobus.c > > > > > > > > > > > > > > Modified: head/sys/dev/ow/owc_gpiobus.c > > > > > > > ============================================================= > > > > > > > ==== > > > > > > > ==== > > > > > > > ========= > > > > > > > --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 > > > > > > > 2019 ( > > > > > > > r354 > > > > > > > 075) > > > > > > > +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 > > > > > > > 2019 ( > > > > > > > r354 > > > > > > > 076) > > > > > > > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, > > > > > > > struct > > > > > > > ow_timing * > > > > > > > do { > > > > > > > now = sbinuptime(); > > > > > > > GETPIN(sc, &sample); > > > > > > > - } while (sbttous(now - then) < t->t_rdv + 2 && sample > > > > > > > == 0); > > > > > > > + } while (now - then < (t->t_rdv + 2) * SBT_1US && > > > > > > > sample == 0); > > > > > > > critical_exit(); > > > > > > > > > > > > > > - if (sbttons(now - then) < t->t_rdv * 1000) > > > > > > > + if (now - then < t->t_rdv * SBT_1US) > > > > > > > *bit = 1; > > > > > > > else > > > > > > > *bit = 0; > > > > > > > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, > > > > > > > struct > > > > > > > ow_timing * > > > > > > > /* Wait out the rest of t_slot */ > > > > > > > do { > > > > > > > now = sbinuptime(); > > > > > > > - } while ((now - then) / SBT_1US < t->t_slot); > > > > > > > + } while (now - then < t->t_slot * SBT_1US); > > > > > > > > > > > > > > RELBUS(sc); > > > > > > > > > > > > > > > > > > > Unit conversions with sbt times should be done using the macros > > > > > > that > > > > > > carefully avoid roundoff errors. I don't understand why you've > > > > > > changed > > > > > > the code that correctly did use those macros to inline math. > > > > > > > > > > I think that the commit message explains it: > > > > > This is fast, this is precise enough (below 0.03%) and the > > > > > periods > > > > > defined by > > > > > the protocol cannot overflow. > > > > > > > > > > Do you disagree? > > > > > Could you please explain in which of the three lines changed the > > > > > new > > > > > code is > > > > > worse and why? > > > > > > > > > > > > > I absolutely disagree (or I wouldn't have replied). Unit > > > > conversions > > > > using sbt times should use the predefined macros, NOT incline > > > > multiplication and division. I don't know how to say it more > > > > clearly > > > > than that. The conversion macros are idiomatic (at least, they > > > > would > > > > be if people stopped writing inline conversion expressions). > > > > > > I can agree that I should have used ustosbt() instead of > > > multiplication by > > > SBT_1US, but I don't agree with your original message that I changed > > > the code > > > that correctly used the macros. > > > > > > But again, I know the times being converted, they are fixed by the > > > protocol and > > > I do not see why I have to use this: > > > > > > static __inline sbintime_t > > > ustosbt(int64_t _us) > > > { > > > sbintime_t sb = 0; > > > > > > #ifdef KASSERT > > > KASSERT(_us >= 0, ("Negative values illegal for ustosbt: > > > %jd", _us)); > > > #endif > > > if (_us >= SBT_1S) { > > > sb = (_us / 1000000) * SBT_1S; > > > _us = _us % 1000000; > > > } > > > /* 9223372036855 = ceil(2^63 / 1000000) */ > > > sb += ((_us * 9223372036855ull) + 0x7fffffff) >> 31; > > > return (sb); > > > } > > > > > > instead of this > > > x * (((sbintime_t)1 << 32) / 1000000) > > > > > > The times: > > > static struct ow_timing timing_regular = { > > > .t_slot = 60, /* 60 to 120 */ > > > .t_low0 = 60, /* really 60 to 120 */ > > > .t_low1 = 1, /* really 1 to 15 */ > > > .t_release = 45, /* <= 45us */ > > > .t_rec = 1, /* at least 1us */ > > > .t_rdv = 15, /* 15us */ > > > .t_rstl = 480, /* 480us or more */ > > > .t_rsth = 480, /* 480us or more */ > > > .t_pdl = 60, /* 60us to 240us */ > > > .t_pdh = 60, /* 15us to 60us */ > > > .t_lowr = 1, /* 1us */ > > > }; > > Should this chunk of code now have a bit fat NB: if you > modify these be careful, there is other code that assumes > the values here can not cause overflow? > No. The values won't com close to overflowing even at the slowest transfer speeds. The macros are most needed for nanosecond stuff, and these are all at most tens of microseconds... Warner > > > > > > > > > The fact that you could say all that means that there is nothing I can > > say that is going to change your mind. I will say if you ever do > > anything like this to code I wrote, I will revert it immediately. > > > > -- Ian > > > > > > -- > Rod Grimes > rgrimes@freebsd.org > From owner-svn-src-head@freebsd.org Sat Oct 26 06:24:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FF5B160260; Sat, 26 Oct 2019 06:24:22 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 470WCp0Pwcz3Jy0; Sat, 26 Oct 2019 06:24:21 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt1-f195.google.com with SMTP id u22so6682446qtq.13; Fri, 25 Oct 2019 23:24:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ahW9qVMNt/ZHgXI3B4iGEn55aASqNM3T9o0h0jcuAsU=; b=F3cXKaA2K5U+wZj9uRpNoNaL/OuCYJUKWf4CeZejpoALKbLc3wprH+3NOjsXwwJNPa 1/ll1EOkSF2GGcM3rPheKN5u8bH388WWs44S6e3rvf4CWFhgagVBns/Egz9LsN1sRZIu sVuhdK/mE5M8Rww5Etdp+h8L/z+/YsJ9EUOUDG4OLbN2W40BRbqrkmdoT5dVccevhdLR w2MfA3iRhnGHFlafnG16u4rR1+Odk5WUZLUggOvKJeMzBGOOApu4o4QzOaiZ2ttpg+L5 8vd2hMBMo1NOPWaQhylRkxoZ2S+G6ZnPyLTBI2C8E3bHBuTvkIcRgxvz+wqs040G/uOm SkSA== X-Gm-Message-State: APjAAAVciTEVrpWYD1uhAwJQTPA0lpDxWquab16xtgmx5q3I1Y047KVV cYupp1JTSnoX/I3Bx2eBgg9j+TZSPSxc0InvtsyPYDV7 X-Google-Smtp-Source: APXvYqzNzjLJZ5xtLiLxoF8Y7q8hkYxk9vzdxG5Pk/ytN1reAdOQOjQtIf3mR/nNKo68PkMLvp5wZXP4JslIUFuza3E= X-Received: by 2002:ad4:44b3:: with SMTP id n19mr1344349qvt.133.1572071060329; Fri, 25 Oct 2019 23:24:20 -0700 (PDT) MIME-Version: 1.0 References: <201910252009.x9PK9gIV092660@repo.freebsd.org> In-Reply-To: <201910252009.x9PK9gIV092660@repo.freebsd.org> From: Antoine Brodin Date: Sat, 26 Oct 2019 08:24:09 +0200 Message-ID: Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Gerald Pfeifer Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 470WCp0Pwcz3Jy0 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 06:24:22 -0000 On Fri, Oct 25, 2019 at 10:09 PM Konstantin Belousov wrote: > > Author: kib > Date: Fri Oct 25 20:09:42 2019 > New Revision: 354095 > URL: https://svnweb.freebsd.org/changeset/base/354095 > > Log: > amd64: move pcb out of kstack to struct thread. > > This saves 320 bytes of the precious stack space. > > The only negative aspect of the change I can think of is that the > struct thread increased by 320 bytes obviously, and that 320 bytes are > not swapped out anymore. I believe the freed stack space is much more > important than that. Also, current struct thread size is 1392 bytes > on amd64, so UMA will allocate two thread structures per (4KB) slab, > which leaves a space for pcb without increasing zone memory use. > > Reviewed by: alc, markj > Tested by: pho > Sponsored by: The FreeBSD Foundation > MFC after: 2 weeks > Differential revision: https://reviews.freebsd.org/D22138 Hi, It seems that this breaks at least some versions of gcc: In file included from /usr/include/sys/proc.h:75, from /usr/include/sys/user.h:51, from ./md-unwind-support.h:34, from /wrkdirs/usr/ports/lang/gcc10-devel/work/gcc-10-20191020/libgcc/unwind-dw2.c:412: /usr/include/machine/proc.h:76:13: error: field 'md_pcb' has incomplete type 76 | struct pcb md_pcb; | ^~~~~~ Antoine From owner-svn-src-head@freebsd.org Sat Oct 26 07:00:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1912161840; Sat, 26 Oct 2019 07:00:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470X0w4jB9z3LLH; Sat, 26 Oct 2019 07:00:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84A8C42A4; Sat, 26 Oct 2019 07:00:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9Q7002d078085; Sat, 26 Oct 2019 07:00:00 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9Q700CJ078075; Sat, 26 Oct 2019 07:00:00 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910260700.x9Q700CJ078075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 26 Oct 2019 07:00:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354112 - in head: contrib/libexecinfo lib/libexecinfo X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: contrib/libexecinfo lib/libexecinfo X-SVN-Commit-Revision: 354112 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 07:00:00 -0000 Author: cem Date: Sat Oct 26 06:59:59 2019 New Revision: 354112 URL: https://svnweb.freebsd.org/changeset/base/354112 Log: Sync up with NetBSD libexecinfo changes 2014-2019 Drop portions that are unlit or redundant with llvm-libunwind: builtin.c, unwind.h, and unwind_arm_ehabi_stub.c. This code should now work with -fPIE binaries, should we choose to build any that way. When backtrace() array is full, signal an error so the underlying Itanium-style C++ exception handling library (llvm-libunwind) knows to stop tracing instead of continuing. (It should stop on its own when it finishes unwinding, so this is mostly an extra seatbelt against an infinite loop bug in the unwinder.) Deleted: head/contrib/libexecinfo/builtin.c head/contrib/libexecinfo/unwind.h head/contrib/libexecinfo/unwind_arm_ehabi_stub.c Modified: head/contrib/libexecinfo/symtab.c head/contrib/libexecinfo/unwind.c head/lib/libexecinfo/Makefile Modified: head/contrib/libexecinfo/symtab.c ============================================================================== --- head/contrib/libexecinfo/symtab.c Sat Oct 26 03:07:28 2019 (r354111) +++ head/contrib/libexecinfo/symtab.c Sat Oct 26 06:59:59 2019 (r354112) @@ -1,4 +1,4 @@ -/* $NetBSD: symtab.c,v 1.2 2013/08/29 15:01:57 christos Exp $ */ +/* $NetBSD: symtab.c,v 1.5 2016/04/20 14:00:16 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,12 +29,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: symtab.c,v 1.2 2013/08/29 15:01:57 christos Exp $"); +__RCSID("$NetBSD: symtab.c,v 1.5 2016/04/20 14:00:16 christos Exp $"); #include #include #include #include +#include #include #include @@ -47,7 +48,6 @@ __RCSID("$NetBSD: symtab.c,v 1.2 2013/08/29 15:01:57 c #define ELF_ST_TYPE(x) (((unsigned int)x) & 0xf) #endif - #include "symtab.h" struct symbol { @@ -59,6 +59,7 @@ struct symbol { struct symtab { size_t nsymbols; struct symbol *symbols; + bool ispie; }; static int @@ -86,6 +87,7 @@ symtab_create(int fd, int bind, int type) Elf *elf; symtab_t *st; Elf_Scn *scn = NULL; + GElf_Ehdr ehdr; if (elf_version(EV_CURRENT) == EV_NONE) { warnx("Elf Library is out of date."); @@ -103,7 +105,14 @@ symtab_create(int fd, int bind, int type) elf_end(elf); return NULL; } + if (gelf_getehdr(elf, &ehdr) == NULL) { + warnx("Error getting ELF Ehdr"); + elf_end(elf); + return NULL; + } + st->ispie = ehdr.e_type == ET_DYN; + while ((scn = elf_nextscn(elf, scn)) != NULL) { GElf_Shdr shdr; Elf_Data *edata; @@ -127,6 +136,13 @@ symtab_create(int fd, int bind, int type) GElf_Sym sym; gelf_getsym(edata, (int)i, &sym); +#ifdef SYMTAB_DEBUG + fprintf(stderr, "%s: %s@%#jx=%d,%d\n", __func__, + elf_strptr(elf, shdr.sh_link, sym.st_name), + (uintmax_t)sym.st_value, ELF_ST_BIND(sym.st_info), + ELF_ST_TYPE(sym.st_info)); +#endif + if (bind != -1 && (unsigned)bind != ELF_ST_BIND(sym.st_info)) continue; @@ -159,7 +175,7 @@ out: return NULL; } - + int symtab_find(const symtab_t *st, const void *p, Dl_info *dli) { @@ -168,8 +184,15 @@ symtab_find(const symtab_t *st, const void *p, Dl_info size_t hi = ns; size_t lo = 0; size_t mid = ns / 2; - uintptr_t dd, sd, me = (uintptr_t)p; + uintptr_t fbase = st->ispie ? (uintptr_t)dli->dli_fbase : 0; + uintptr_t dd, sd, me = (uintptr_t)p - fbase; + uintptr_t ad = (uintptr_t)dli->dli_saddr - fbase; +#ifdef SYMTAB_DEBUG + fprintf(stderr, "%s: [fbase=%#jx, saddr=%p, me=%#jx ad=%#jx]\n", + __func__, (uintmax_t)fbase, dli->dli_saddr, (uintmax_t)me, + (uintmax_t)ad); +#endif for (;;) { if (s[mid].st_value < me) lo = mid; @@ -183,11 +206,20 @@ symtab_find(const symtab_t *st, const void *p, Dl_info } mid = (hi + lo) / 2; } - dd = me - (uintptr_t)dli->dli_saddr; + dd = me - ad; sd = me - s[mid].st_value; if (dd > sd) { dli->dli_saddr = (void *)s[mid].st_value; dli->dli_sname = s[mid].st_name; +#ifdef SYMTAB_DEBUG + fprintf(stderr, "%s: me=%#jx -> [%#jx, %s]\n", __func__, + (uintmax_t)me, (uintmax_t)sd, dli->dli_sname); +#endif } +#ifdef SYMTAB_DEBUG + else + fprintf(stderr, "%s: %#jx -> [%#jx, ***]\n", __func__, + (uintmax_t)me, (uintmax_t)sd); +#endif return 1; } Modified: head/contrib/libexecinfo/unwind.c ============================================================================== --- head/contrib/libexecinfo/unwind.c Sat Oct 26 03:07:28 2019 (r354111) +++ head/contrib/libexecinfo/unwind.c Sat Oct 26 06:59:59 2019 (r354112) @@ -1,4 +1,4 @@ -/* $NetBSD: unwind.c,v 1.1 2012/05/26 22:02:29 christos Exp $ */ +/* $NetBSD: unwind.c,v 1.3 2019/01/30 22:46:49 mrg Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -51,8 +51,10 @@ tracer(struct _Unwind_Context *ctx, void *arg) return 0; } if (t->n < t->len) - t->arr[t->n++] = _Unwind_GetIP(ctx); - return 0; + t->arr[t->n++] = (void *)_Unwind_GetIP(ctx); + else + return _URC_END_OF_STACK; + return _URC_NO_REASON; } size_t Modified: head/lib/libexecinfo/Makefile ============================================================================== --- head/lib/libexecinfo/Makefile Sat Oct 26 03:07:28 2019 (r354111) +++ head/lib/libexecinfo/Makefile Sat Oct 26 06:59:59 2019 (r354112) @@ -10,6 +10,7 @@ SHLIB_MAJOR= 1 INCS= execinfo.h SRCS= backtrace.c symtab.c unwind.c +CFLAGS+= -I${SRCTOP}/contrib/libunwind/include LIBADD= elf From owner-svn-src-head@freebsd.org Sat Oct 26 08:27:04 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E6DE1650DE; Sat, 26 Oct 2019 08:27:04 +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) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470YxM64qrz3Pjp; Sat, 26 Oct 2019 08:27:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x9Q8Qt1H023601 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 26 Oct 2019 11:26:58 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x9Q8Qt1H023601 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x9Q8Qtoc023600; Sat, 26 Oct 2019 11:26:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 26 Oct 2019 11:26:55 +0300 From: Konstantin Belousov To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Gerald Pfeifer Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern Message-ID: <20191026082655.GJ73312@kib.kiev.ua> References: <201910252009.x9PK9gIV092660@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 470YxM64qrz3Pjp X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 08:27:04 -0000 On Sat, Oct 26, 2019 at 08:24:09AM +0200, Antoine Brodin wrote: > On Fri, Oct 25, 2019 at 10:09 PM Konstantin Belousov wrote: > > > > Author: kib > > Date: Fri Oct 25 20:09:42 2019 > > New Revision: 354095 > > URL: https://svnweb.freebsd.org/changeset/base/354095 > > > > Log: > > amd64: move pcb out of kstack to struct thread. > > > > This saves 320 bytes of the precious stack space. > > > > The only negative aspect of the change I can think of is that the > > struct thread increased by 320 bytes obviously, and that 320 bytes are > > not swapped out anymore. I believe the freed stack space is much more > > important than that. Also, current struct thread size is 1392 bytes > > on amd64, so UMA will allocate two thread structures per (4KB) slab, > > which leaves a space for pcb without increasing zone memory use. > > > > Reviewed by: alc, markj > > Tested by: pho > > Sponsored by: The FreeBSD Foundation > > MFC after: 2 weeks > > Differential revision: https://reviews.freebsd.org/D22138 > > Hi, > > It seems that this breaks at least some versions of gcc: > > In file included from /usr/include/sys/proc.h:75, > from /usr/include/sys/user.h:51, > from ./md-unwind-support.h:34, > from > /wrkdirs/usr/ports/lang/gcc10-devel/work/gcc-10-20191020/libgcc/unwind-dw2.c:412: > /usr/include/machine/proc.h:76:13: error: field 'md_pcb' has incomplete type > 76 | struct pcb md_pcb; > | ^~~~~~ > It is very strange. Are gcc 9 or 8 affected ? As a blind guess, please try this patch. diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h index 44e34fa5c83..9758e684da2 100644 --- a/sys/amd64/include/pcb.h +++ b/sys/amd64/include/pcb.h @@ -45,7 +45,7 @@ #include #include -#ifdef __amd64__ +#if defined(__amd64__) || defined(__x86_64__) /* * NB: The fields marked with (*) are used by kernel debuggers. Their * ABI should be preserved. From owner-svn-src-head@freebsd.org Sat Oct 26 10:45:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 909EF16AF3D; Sat, 26 Oct 2019 10:45:28 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (hamza.pair.com [209.68.5.143]) (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 470d1307cCz41dC; Sat, 26 Oct 2019 10:45:26 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (localhost [127.0.0.1]) by hamza.pair.com (Postfix) with ESMTP id D38C033E13; Sat, 26 Oct 2019 06:45:24 -0400 (EDT) Received: from anthias (unknown [178.114.204.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hamza.pair.com (Postfix) with ESMTPSA id F282E33E12; Sat, 26 Oct 2019 06:45:23 -0400 (EDT) Date: Sat, 26 Oct 2019 12:45:21 +0200 (CEST) From: Gerald Pfeifer To: Konstantin Belousov cc: Antoine Brodin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern In-Reply-To: <20191026082655.GJ73312@kib.kiev.ua> Message-ID: References: <201910252009.x9PK9gIV092660@repo.freebsd.org> <20191026082655.GJ73312@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 470d1307cCz41dC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of gerald@pfeifer.com designates 209.68.5.143 as permitted sender) smtp.mailfrom=gerald@pfeifer.com X-Spamd-Result: default: False [-4.49 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:hamza.pair.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[pfeifer.com]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[143.5.68.209.list.dnswl.org : 127.0.10.0]; IP_SCORE(-2.19)[ip: (-7.74), ipnet: 209.68.0.0/18(-2.02), asn: 7859(-1.15), country: US(-0.05)]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:7859, ipnet:209.68.0.0/18, country:US]; RCVD_TLS_LAST(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 10:45:28 -0000 On Sat, 26 Oct 2019, Konstantin Belousov wrote: > It is very strange. Are gcc 9 or 8 affected ? So far I have only received notification from the head-amd64-default package builder for lang/gcc10-devel, none of the other ports. Gerald > As a blind guess, please try this patch. Thank you! I'm not able to do so (no suitable system with root access); hopefully someone else can. Antoine, can you? From owner-svn-src-head@freebsd.org Sat Oct 26 11:51:32 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E841116DFAC; Sat, 26 Oct 2019 11:51:32 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 470fTJ21RSz44BY; Sat, 26 Oct 2019 11:51:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id BA4E53A057E; Sat, 26 Oct 2019 22:51:27 +1100 (AEDT) Date: Sat, 26 Oct 2019 22:51:25 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andriy Gapon cc: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354076 - head/sys/dev/ow In-Reply-To: <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> Message-ID: <20191026204953.A894@besplex.bde.org> References: <201910251538.x9PFc9ii028313@repo.freebsd.org> <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=La-k9SJ9Jmyq5Ap1hsAA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 470fTJ21RSz44BY X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.986,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 11:51:33 -0000 On Fri, 25 Oct 2019, Andriy Gapon wrote: > On 25/10/2019 18:46, Ian Lepore wrote: >> On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: >>> Author: avg >>> Date: Fri Oct 25 15:38:09 2019 >>> New Revision: 354076 >>> URL: https://svnweb.freebsd.org/changeset/base/354076 >>> >>> Log: >>> owc_gpiobus_read_data: compare times in sbintime_t units >>> >>> Previously the code used sbttous() before microseconds comparison >>> in one >>> place, sbttons() and nanoseconds in another, division by SBT_1US >>> and >>> microseconds in yet another. >>> >>> Now the code consistently uses multiplication by SBT_1US to convert >>> microseconds to sbintime_t before comparing them with periods >>> between >>> calls to sbinuptime(). This is fast, this is precise enough (below >>> 0.03%) and the periods defined by the protocol cannot overflow. >>> >>> Reviewed by: imp (D22108) >>> MFC after: 2 weeks >>> >>> Modified: >>> head/sys/dev/ow/owc_gpiobus.c >>> >>> Modified: head/sys/dev/ow/owc_gpiobus.c >>> ===================================================================== >>> ========= >>> --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019 (r354 >>> 075) >>> +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 (r354 >>> 076) >>> @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct >>> ow_timing * >>> do { >>> now = sbinuptime(); >>> GETPIN(sc, &sample); >>> - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); >>> + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); >>> critical_exit(); >>> >>> - if (sbttons(now - then) < t->t_rdv * 1000) >>> + if (now - then < t->t_rdv * SBT_1US) >>> *bit = 1; >>> else >>> *bit = 0; >>> @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct >>> ow_timing * >>> /* Wait out the rest of t_slot */ >>> do { >>> now = sbinuptime(); >>> - } while ((now - then) / SBT_1US < t->t_slot); >>> + } while (now - then < t->t_slot * SBT_1US); >>> >>> RELBUS(sc); >>> >> >> Unit conversions with sbt times should be done using the macros that >> carefully avoid roundoff errors. I don't understand why you've changed >> the code that correctly did use those macros to inline math. > > I think that the commit message explains it: > This is fast, this is precise enough (below 0.03%) and the periods defined by > the protocol cannot overflow. > > Do you disagree? > Could you please explain in which of the three lines changed the new code is > worse and why? The old code is worse. This is partly because the inline functions are over-engineered and poorly implemented and don't even work. The first thing improved in the change is: >>> do { >>> now = sbinuptime(); >>> GETPIN(sc, &sample); >>> - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); >>> + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); sbintime_t is signed so that negative differences work. Scaling negative differences by SBT_1*S works right. Scaling of negative difference by the inline functions attempts to panic, but even the panic is broken (unreachable). Here 'now' is an uptime and 'then' is presumably a previous uptime, so now < then "can't happen". Similar code with non-monotonic or untrusted times might produce a negative difference. For efficiency, t_rdv + 2 could be kept as an sbintime. Scaling it at runtime gives the cleaner code: } while (now - then < ustosbt(t->t_rdv + 2) && sample == 0); Sign extension bugs are further away in this expression. The arg (t->t_rdv + 2) is more obviously >= 0 since it is a limit, and all of the inline functions return a signed type (sbintime_t or int64_t) so that signed differences work. The next thing improved is: >>> - if (sbttons(now - then) < t->t_rdv * 1000) >>> + if (now - then < t->t_rdv * SBT_1US) This preserves full accuracy and signs for 'now - then' but loses a little more accuracy than needed for conversion of t_rdv. But accuracy of t_rdv is apparently unimportant. If the last bit in it were important, then it should be kept as an sbintime and difference like 'now - then' should never be scaled since even perfect rounding would lose bits. The final thing improved is: >>> - } while ((now - then) / SBT_1US < t->t_slot); >>> + } while (now - then < t->t_slot * SBT_1US); This already used the unscaled 'now - then', but with a style bug (excessive parentheses. imp still hasn't replied to my mails that fix some of the bugs in the overengineerined committed version. My version is even more overengineered. I maintain the following version but only use the non-comment parts of sbttons(). First look at the bugs in the committed sbtons(): XX /* XX * Large comment. The function is not very overengineered except in the XX * comment. Half the detals are wrong. XX */ XX static __inline int64_t XX sbttons(sbintime_t _sbt) XX { XX uint64_t ns; XX XX #ifdef KASSERT XX KASSERT(_sbt >= 0, ("Negative values illegal for sbttons: %jx", _sbt)); XX #endif Multiplication by SBT_1NS used to be the proper conversion KPI. It loses some accuracy, but works for negative _sbt (since SBT_1NS is signed). Here the conversion is more complicated. It still uses mostly signed types (0xffffffffu gets promoted), but doesn't work if )sbt is negative. The above attempts to detect and panic for this, but has no effect in most cases, since due tp standard namespace pollution in , is always included before , so KASSERT in only defined here for kernel files for kernel files that have style bugs in their #include order or selection. XX ns = _sbt; Bad style (use ns as scratch for an sbtbintime_t variable). XX if (ns >= SBT_1S) XX ns = (ns >> 32) * 1000000000; XX else XX ns = 0; This avoids overflow for ns large and < 0. For ns large and < 0, it doesn't reduce adjust ns, so later code adds a garbage bs (unscaled ns = full _sbt) to the fractional part of _sbt. XX XX return (ns + (1000000000 * (_sbt & 0xffffffffu) >> 32)); XX } The large buggy comment is attached only to this function, but only applies to function converting in the other direction. In this direction, the complications and overengineering are small. The functions just avoid overflow for large ns. XX --- /home/bde/sys13/sys/time.h 2019-09-19 17:44:48.507873000 +0000 XX +++ time.h 2018-11-16 07:19:07.542131000 +0000 XX @@ -30,5 +30,5 @@ XX * XX * @(#)time.h 8.5 (Berkeley) 5/4/95 XX - * $FreeBSD: head/sys/sys/time.h 346176 2019-04-13 04:46:35Z imp $ XX + * $FreeBSD: head/sys/sys/time.h 340450 2018-11-15 16:02:13Z imp $ XX */ XX XX @@ -98,9 +98,9 @@ XX uint64_t _p1, _p2; XX XX - _p1 = (_bt->frac & 0xffffffffull) * _x; XX + _p1 = (_bt->frac & 0xffffffff) * _x; XX _p2 = (_bt->frac >> 32) * _x + (_p1 >> 32); XX _bt->sec *= _x; XX _bt->sec += (_p2 >> 32); XX - _bt->frac = (_p2 << 32) | (_p1 & 0xffffffffull); XX + _bt->frac = (_p2 << 32) | (_p1 & 0xffffffff); XX } XX Vestiges of my old fixes for similar problems converting between bintimes and timevals/timespecs. Although bintimes have much more precision, they can't represent timevals or timespecs exactly, so conversions to bintimes and back tend to lose a bit. E.g., 1 second survives, but 999999 usec becomes 999998 usec. The use of ull is just a style bug here. We just want to extract low bits from _bt->frac. The type of the sub-expression remains as uint64_t. XX @@ -163,38 +163,60 @@ XX * microsecond functions are also provided for completeness. XX * XX - * These functions return the smallest sbt larger or equal to the XX - * number of seconds requested so that sbttoX(Xtosbt(y)) == y. Unlike These functions are not as accurate as claimed. XX - * top of second computations below, which require that we tick at the XX - * top of second, these need to be rounded up so we do whatever for at XX - * least as long as requested. XX - * XX - * The naive computation we'd do is this XX - * ((unit * 2^64 / SIFACTOR) + 2^32-1) >> 32 XX - * However, that overflows. Instead, we compute XX - * ((unit * 2^63 / SIFACTOR) + 2^31-1) >> 32 XX - * and use pre-computed constants that are the ceil of the 2^63 / SIFACTOR XX - * term to ensure we are using exactly the right constant. We use the lesser This method is routine and shouldn't be documented here. Howver, there are some complications and shortcuts in the details that should be documented or avoided. XX - * evil of ull rather than a uint64_t cast to ensure we have well defined XX - * right shift semantics. With these changes, we get all the ns, us and ms XX - * conversions back and forth right. Using ull instead of the correct cast is just a gross style bug. Using any unsigned type asks for unsign extension bugs but may be needed for technical reasons (we start with int64_t types and must handle negative values before combinining with uint64_t constants. XX - * Note: This file is used for both kernel and userland includes, so we can't XX - * rely on KASSERT being defined, nor can we pollute the namespace by including XX - * assert.h. Remove nonense about KASSERT. XX + * Violate the comment about "Background information": phk didn't like my rounding fixes for bintimes and responded by adding the the "Background information" comment. This demands always perfectly rounding down. The sbintime conversion functions violate this by always rounding up. Multiplication by SBT1_*S rounds down a bit too much, but always perfectly rounding down would do much the same after a few iterations. XX + * XX + * All these functions do sloppy scaling and/or rounding, but it is arranged XX + * that the errors compensate for each other so that sbttoX(Xtosbt(x)) == x XX + * for all valid args. XX + * XX + * Sloppy scaling in the decimal->sbt functions tends to give a result that XX + * is significantly far below the floor of the correctly rounded result (call XX + * this the "true floor"). Similary sloppy scaling in the sbt->decimal XX + * functions reduces further below the true floor. The result was that XX + * sbttoX(Xtosbt(x)) was 1 too small for all cases except x = 0. XX + * XX + * Doing correct even scaling and rounding up to the true ceiling in the XX + * decimal->sbt functions alone is useless for fixing this, since, the XX + * sbt->decimal functions reduc even true ceilings to below true floors. XX + * XX + * Instead of correcting all the functions, return a fake ceiling in the XX + * decimal->sbt functions. This ceiling is approx. 1 decimal unit above the XX + * sloppily scaled value. It is thus above the true ceiling but not 1 XX + * decimal unit or more above. It is unobvious that the sbt->decimal XX + * functions don't reduce even this fake ceiling to below the true floor. XX + * Exhaustive testing shows that they don't. The fake ceiling must be XX + * significantly more than 1 sbt unit above the true ceiling for the XX + * reduction to be not too large. Fortunately, there are no numerical XX + * accidents that give a too-low fake ceiling. XX + * XX + * The previous version claimed to calculate true ceilings. These never XX + * work. But it actually calculated fake ceilings of 2**32-1 sbt units XX + * above the sloppily scaled value. This value is nonsense, but worked XX + * accidentally in some cases. The decimal unit of 1 nsec is XX + * 2**64/10**9 ~= 18e9 sbt units. 2**32-1 is thus about 4.29 times too XX + * small to work non-accidentally. In practice, it worked accidentally in XX + * about 92% of cases. For conversions of microseconds, the value used was XX + * about 4.29e3 times too small, but worked accidentally in all except 32 XX + * cases. For conversions of milliseconds, the value used was about 4.29e6 XX + * times too small, but worked accidentally in all cases. XX + * XX + * Note that the range of valid args is significantly limited, since the XX + * efficient sloppy scaling and rounding methods used here only work up to 1 XX + * second. E.g., _ms must be between 0 and 999 inclusive, since XX + * ustosbt(1000) = 0 due to overflow of of the multiplication to almost XX + * exactly 0. This allows exhaustive testing that the sloppy methods work XX + * It is unclear if similar sloppy scaling would work above 1 second, but XX + * non-sloppy scaling is very easy for whole seconds (see tstosbt()). XX + * XX + * Uncommitted code for ts/tv<->bt was more careful, but was disapproved and XX + * the comment about "Background information" was added to inhibit commits XX + * in this area. It does non-sloppy scaling of fractional parts, then rounds XX + * to nearest. I don't remember doing exhaustive testing of it, and now don't XX + * see why rounding to nearest is enough. XX */ XX static __inline int64_t XX sbttons(sbintime_t _sbt) XX { XX - uint64_t ns; XX - XX -#ifdef KASSERT XX - KASSERT(_sbt >= 0, ("Negative values illegal for sbttons: %jx", _sbt)); XX -#endif XX - ns = _sbt; XX - if (ns >= SBT_1S) XX - ns = (ns >> 32) * 1000000000; XX - else XX - ns = 0; XX XX - return (ns + (1000000000 * (_sbt & 0xffffffffu) >> 32)); XX + return ((1000000000 * _sbt) >> 32); XX } In this direction, I just removed the buggy overflow handling (but kept the accurate scaling). Overflow occurs after only ~2 seconds for nanoseconds. XX XX @@ -202,16 +224,78 @@ XX nstosbt(int64_t _ns) XX { XX - sbintime_t sb = 0; XX XX -#ifdef KASSERT XX - KASSERT(_ns >= 0, ("Negative values illegal for nstosbt: %jd", _ns)); XX + /* XX + * The adjustment is essentially to add SBT_1NS to the result of XX + * sloppy scaling and rounding down. That happens to work too, but XX + * use the slightly less sloppy method of combining shifts and XX + * subtracting 1. The result in most cses is much higher than the XX + * true ceiling, but sloppy rounding for the reverse conversion XX + * discards the extras. XX + * XX + * E.g., 2**64/10**9 has a fractional part of ~0.71. Multiplying XX + * this by the maximum valid _ns of 10**9-1 gives ~0.71e9, so XX + * rounding down after scaling gives a raw sbt that is ~0.71e9 below XX + * the true floor (only ~0.17 below the true floor in seconds). XX + * Replacing _ns by (_ns + 1) gives a raw sbt that is ~0.29e9 above XX + * the true ceiling (only ~0.068 above the true ceiling in seconds). XX + * Subtracting 1 from this makes no significant difference. Sloppy XX + * scaling and rounding in the reverse conversion recovers the XX + * original value: the sloppy scaling reduces the value from above the XX + * true ceiling to below the true ceiling (but not below the true XX + * floor); then rounding down recovers the true floor. XX + * XX + * Similarly for _all_ valid args and for the us and ms conversions. XX + * It is fairly obvious that the result of conversion back to ns is XX + * never 1 too low (since we add 1), but not obvious that the result XX + * is never 1 too high (since adding 1 risks this). XX + * XX + * Conversion from sbt to decimal and back has no chance of always XX + * restoring the original values since the decimal formats have less XX + * precision. Adding 1 is too sloppy to do anything good for this XX + * direction. The uncommitted ts/tv<->bt conversions are supposed to XX + * work as well as possible in both directions. Rounding to nearest XX + * works better and non-sloppy scaling is obviously needed to work in XX + * both directions. However, non-sloppy scaling doesn't work with XX + * mixed or sloppy rounding. In the above example with _ns = 10**9-1, XX + * it gives a raw sbt that is just 1 below the true floor. Adding 1 XX + * to this gives the true ceiling in the sbt, but unless the reverse XX + * conversion is changed similarly, it reduces from the true ceiling XX + * to below the true floor, so the result of converting back has much XX + * the same off-by-1 errors as simpler method (always 1 too low except XX + * for an arg of 0). XX + * XX + * Further examples: XX + * - when _ns = 0, sbt is SBT_1NS, but converting this back to ns XX + * gives 0. If we start with this sbt, oue conversion functions XX + * are still unusable for printing it in nsec. XX + * - when _ns = 10**9-1, we are close to overflow. Adding 1 to it XX + * doesn't quite reach the overflow threshold. XX + * - in previous versions, when _ns = 10**9, overflow was not quite XX + * reached, and the result of a double conversion had the usual XX + * off-by-1 error. XX + * - when _ns = 10**9, overflow now occurs and the result of a double XX + * conversion is 0 XX + * - when _ns = 10**9+1, overflow occurs in previous versions and the XX + * result of a double conversion is 0 (overflow gives an off-by-10**9 XX + * error and then the usual off-by-1-error occurs. XX + */ XX +#if 1 XX + /* XX + * This version does non-sloppy scaling which after rounding down is XX + * close to or equal 1 below the true ceiling for all nonzero args. XX + * Then adding 1 gives an adequate true or fake ceiling. Some of the XX + * above comments are wrong about the true ceiling not working. XX + * Unfortunately, this is about 30% slower (a whole cycle extra in XX + * the test). The unnecessary subtraction of 1 in the main version XX + * costs about 1/2 of a cycle in the test. XX + */ XX + uint64_t factor, frac; XX + XX + factor = ((uint64_t)1 << 63) / 500000000; XX + frac = ((0 - factor * 1000000000) << 32) / 1000000000; XX + return (((_ns * factor + ((_ns * frac) >> 32)) >> 32) + 1); This is the fully overengineered version. It is too slow to use. XX +#else XX + return (((_ns + 1) * (((uint64_t)1 << 63) / 500000000) - 1) >> 32); XX #endif XX - if (_ns >= SBT_1S) { XX - sb = (_ns / 1000000000) * SBT_1S; XX - _ns = _ns % 1000000000; XX - } XX - /* 9223372037 = ceil(2^63 / 1000000000) */ XX - sb += ((_ns * 9223372037ull) + 0x7fffffff) >> 31; Rounding to the ceiling gives an intger scale factor which is a bit too high; after multiplying by _ns the error in nanoseconds can be more than 1 and so can the error in sbintimes. Using (_ns + 1) instead of _ns is supposed to fix this. The version that I actually use is: sb += (__ns << 32) / 1000000000 + (_ns == 0 : 0 : 1) This does simpler scaling to first round down, then violates the "Background information" comment by always rounding up except for _ns == 0, so that it it is clear that the rounding is as intended (don't do extra work to avoid rounding up if _ns is exactly representable. XX - return (sb); XX } XX XX @@ -226,16 +310,6 @@ XX ustosbt(int64_t _us) XX { XX - sbintime_t sb = 0; XX XX -#ifdef KASSERT XX - KASSERT(_us >= 0, ("Negative values illegal for ustosbt: %jd", _us)); XX -#endif XX - if (_us >= SBT_1S) { XX - sb = (_us / 1000000) * SBT_1S; XX - _us = _us % 1000000; XX - } XX - /* 9223372036855 = ceil(2^63 / 1000000) */ XX - sb += ((_us * 9223372036855ull) + 0x7fffffff) >> 31; XX - return (sb); XX + return (((_us + 1) * (((uint64_t)1 << 63) / 500000) - 1) >> 32); XX } XX XX @@ -250,16 +324,6 @@ XX mstosbt(int64_t _ms) XX { XX - sbintime_t sb = 0; XX XX -#ifdef KASSERT XX - KASSERT(_ms >= 0, ("Negative values illegal for mstosbt: %jd", _ms)); XX -#endif XX - if (_ms >= SBT_1S) { XX - sb = (_ms / 1000) * SBT_1S; XX - _ms = _ms % 1000; XX - } XX - /* 9223372036854776 = ceil(2^63 / 1000) */ XX - sb += ((_ms * 9223372036854776ull) + 0x7fffffff) >> 31; XX - return (sb); XX + return (((_ms + 1) * (((uint64_t)1 << 63) / 500) - 1) >> 32); XX } XX Bruce From owner-svn-src-head@freebsd.org Sat Oct 26 12:16:33 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C588D16F891; Sat, 26 Oct 2019 12:16:33 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 470g285r3bz45w7; Sat, 26 Oct 2019 12:16:32 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt1-f194.google.com with SMTP id y39so2169410qty.0; Sat, 26 Oct 2019 05:16:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Lol3MMf7s/sjVmbpieHfsCoGPRSQUqLuyPvXpqjKTMk=; b=mrznCoUZdEZK3eacliEcKZ6V5TRzabi/e+bMcvgsze3/XVA/X7LSdCG1qO6wzkzqob G/s7Fv01qWlPdWMnNPwxnKoUIIiNDdhDfDmwhxfoCBrpqBW+5xsJUfFuP+jX6G4vLtxP qHCCvYkou8WO8LwA94OmeVtBBZZOD60sC1f60wypwE/DidujN25y/Cw3tOHmmn81mU5m vgDt2+DuRYhYfJpQo7fQXnRdHgmfwIOOfKK0fd/o3i4yfCCGLRGmeK0FSIOmG5qxDaJo HRs/wnhv50kSlZLv493tLUYeVO+z3e5bfshOnBeblfrZ3TsznHqw8wwDWGOS6rAQM1XM IVrQ== X-Gm-Message-State: APjAAAU2KrGShGSeFWV/UOvuCuA/mWl6sq52JlxumzNQP2MNUsVooE6m 9qh4HsAWkNRys/40VxuN//XzdL2mGRjT+AvXCJ8= X-Google-Smtp-Source: APXvYqwkWLBh/z51XdZxK3LAyWoI8mMobkmtbmNH6bnRtOiUuk4rTEyd9cEW70Nzx/IeiC3ghawNFoFyHG0mYlXX6NU= X-Received: by 2002:ac8:1413:: with SMTP id k19mr8316578qtj.360.1572092191288; Sat, 26 Oct 2019 05:16:31 -0700 (PDT) MIME-Version: 1.0 References: <201910252009.x9PK9gIV092660@repo.freebsd.org> <20191026082655.GJ73312@kib.kiev.ua> In-Reply-To: <20191026082655.GJ73312@kib.kiev.ua> From: Antoine Brodin Date: Sat, 26 Oct 2019 14:16:19 +0200 Message-ID: Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Gerald Pfeifer Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 470g285r3bz45w7 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of antoinebrodinfreebsd@gmail.com designates 209.85.160.194 as permitted sender) smtp.mailfrom=antoinebrodinfreebsd@gmail.com X-Spamd-Result: default: False [-4.14 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; 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,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; RWL_MAILSPIKE_GOOD(0.00)[194.160.85.209.rep.mailspike.net : 127.0.0.18]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[194.160.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.14)[ip: (-5.40), ipnet: 209.85.128.0/17(-3.22), asn: 15169(-2.05), country: US(-0.05)]; FORGED_SENDER(0.30)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 12:16:33 -0000 On Sat, Oct 26, 2019 at 10:27 AM Konstantin Belousov wrote: > On Sat, Oct 26, 2019 at 08:24:09AM +0200, Antoine Brodin wrote: > > On Fri, Oct 25, 2019 at 10:09 PM Konstantin Belousov wrote: > > > > > > Author: kib > > > Date: Fri Oct 25 20:09:42 2019 > > > New Revision: 354095 > > > URL: https://svnweb.freebsd.org/changeset/base/354095 > > > > > > Log: > > > amd64: move pcb out of kstack to struct thread. > > > > > > This saves 320 bytes of the precious stack space. > > > > > > The only negative aspect of the change I can think of is that the > > > struct thread increased by 320 bytes obviously, and that 320 bytes are > > > not swapped out anymore. I believe the freed stack space is much more > > > important than that. Also, current struct thread size is 1392 bytes > > > on amd64, so UMA will allocate two thread structures per (4KB) slab, > > > which leaves a space for pcb without increasing zone memory use. > > > > > > Reviewed by: alc, markj > > > Tested by: pho > > > Sponsored by: The FreeBSD Foundation > > > MFC after: 2 weeks > > > Differential revision: https://reviews.freebsd.org/D22138 > > > > Hi, > > > > It seems that this breaks at least some versions of gcc: > > > > In file included from /usr/include/sys/proc.h:75, > > from /usr/include/sys/user.h:51, > > from ./md-unwind-support.h:34, > > from > > /wrkdirs/usr/ports/lang/gcc10-devel/work/gcc-10-20191020/libgcc/unwind-dw2.c:412: > > /usr/include/machine/proc.h:76:13: error: field 'md_pcb' has incomplete type > > 76 | struct pcb md_pcb; > > | ^~~~~~ > > > > It is very strange. Are gcc 9 or 8 affected ? gcc 8 and 9 are affected too. > As a blind guess, please try this patch. > > diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h > index 44e34fa5c83..9758e684da2 100644 > --- a/sys/amd64/include/pcb.h > +++ b/sys/amd64/include/pcb.h > @@ -45,7 +45,7 @@ > #include > #include > > -#ifdef __amd64__ > +#if defined(__amd64__) || defined(__x86_64__) > /* > * NB: The fields marked with (*) are used by kernel debuggers. Their > * ABI should be preserved. I will test this. Antoine From owner-svn-src-head@freebsd.org Sat Oct 26 13:00:57 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD647171538; Sat, 26 Oct 2019 13:00: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) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470h1P3BtJz480d; Sat, 26 Oct 2019 13:00:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x9QD0mGm095893 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 26 Oct 2019 16:00:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x9QD0mGm095893 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x9QD0ma8095892; Sat, 26 Oct 2019 16:00:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 26 Oct 2019 16:00:48 +0300 From: Konstantin Belousov To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Gerald Pfeifer Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern Message-ID: <20191026130048.GL73312@kib.kiev.ua> References: <201910252009.x9PK9gIV092660@repo.freebsd.org> <20191026082655.GJ73312@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 470h1P3BtJz480d X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 13:00:57 -0000 On Sat, Oct 26, 2019 at 02:16:19PM +0200, Antoine Brodin wrote: > On Sat, Oct 26, 2019 at 10:27 AM Konstantin Belousov > wrote: > > On Sat, Oct 26, 2019 at 08:24:09AM +0200, Antoine Brodin wrote: > > > On Fri, Oct 25, 2019 at 10:09 PM Konstantin Belousov wrote: > > > > > > > > Author: kib > > > > Date: Fri Oct 25 20:09:42 2019 > > > > New Revision: 354095 > > > > URL: https://svnweb.freebsd.org/changeset/base/354095 > > > > > > > > Log: > > > > amd64: move pcb out of kstack to struct thread. > > > > > > > > This saves 320 bytes of the precious stack space. > > > > > > > > The only negative aspect of the change I can think of is that the > > > > struct thread increased by 320 bytes obviously, and that 320 bytes are > > > > not swapped out anymore. I believe the freed stack space is much more > > > > important than that. Also, current struct thread size is 1392 bytes > > > > on amd64, so UMA will allocate two thread structures per (4KB) slab, > > > > which leaves a space for pcb without increasing zone memory use. > > > > > > > > Reviewed by: alc, markj > > > > Tested by: pho > > > > Sponsored by: The FreeBSD Foundation > > > > MFC after: 2 weeks > > > > Differential revision: https://reviews.freebsd.org/D22138 > > > > > > Hi, > > > > > > It seems that this breaks at least some versions of gcc: > > > > > > In file included from /usr/include/sys/proc.h:75, > > > from /usr/include/sys/user.h:51, > > > from ./md-unwind-support.h:34, > > > from > > > /wrkdirs/usr/ports/lang/gcc10-devel/work/gcc-10-20191020/libgcc/unwind-dw2.c:412: > > > /usr/include/machine/proc.h:76:13: error: field 'md_pcb' has incomplete type > > > 76 | struct pcb md_pcb; > > > | ^~~~~~ > > > > > > > It is very strange. Are gcc 9 or 8 affected ? > > gcc 8 and 9 are affected too. Then this is a completely different cause then I guessed below, and I think I know why. All of 8/9/10 gcc ports have support for multiarch, and the error must happen for gcc or xgcc invocation with -m32, am I right ? If yes, please try the patch at the end of the message instead. > > > As a blind guess, please try this patch. > > > > diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h > > index 44e34fa5c83..9758e684da2 100644 > > --- a/sys/amd64/include/pcb.h > > +++ b/sys/amd64/include/pcb.h > > @@ -45,7 +45,7 @@ > > #include > > #include > > > > -#ifdef __amd64__ > > +#if defined(__amd64__) || defined(__x86_64__) > > /* > > * NB: The fields marked with (*) are used by kernel debuggers. Their > > * ABI should be preserved. > > I will test this. Please use this instead diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h index 44e34fa5c83..8800b355c9a 100644 --- a/sys/amd64/include/pcb.h +++ b/sys/amd64/include/pcb.h @@ -116,6 +116,10 @@ struct susppcb { /* fpu context for suspend/resume */ void *sp_fpususpend; }; +#else /* 32bit */ +struct pcb { + uint64_t pcb_dummy[40]; +}; #endif #ifdef _KERNEL From owner-svn-src-head@freebsd.org Sat Oct 26 13:25:48 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6823317242A; Sat, 26 Oct 2019 13:25:48 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (hamza.pair.com [209.68.5.143]) (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 470hZ30lGHz49QR; Sat, 26 Oct 2019 13:25:46 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (localhost [127.0.0.1]) by hamza.pair.com (Postfix) with ESMTP id D9F0A33E0E; Sat, 26 Oct 2019 09:25:45 -0400 (EDT) Received: from anthias (unknown [178.114.204.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hamza.pair.com (Postfix) with ESMTPSA id F3AFD33E0D; Sat, 26 Oct 2019 09:25:44 -0400 (EDT) Date: Sat, 26 Oct 2019 15:25:43 +0200 (CEST) From: Gerald Pfeifer To: Konstantin Belousov cc: Antoine Brodin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern In-Reply-To: <20191026130048.GL73312@kib.kiev.ua> Message-ID: References: <201910252009.x9PK9gIV092660@repo.freebsd.org> <20191026082655.GJ73312@kib.kiev.ua> <20191026130048.GL73312@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 470hZ30lGHz49QR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of gerald@pfeifer.com designates 209.68.5.143 as permitted sender) smtp.mailfrom=gerald@pfeifer.com X-Spamd-Result: default: False [-4.50 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:hamza.pair.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[pfeifer.com]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[143.5.68.209.list.dnswl.org : 127.0.10.0]; IP_SCORE(-2.20)[ip: (-7.77), ipnet: 209.68.0.0/18(-2.05), asn: 7859(-1.16), country: US(-0.05)]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:7859, ipnet:209.68.0.0/18, country:US]; RCVD_TLS_LAST(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 13:25:48 -0000 On Sat, 26 Oct 2019, Konstantin Belousov wrote: >>> It is very strange. Are gcc 9 or 8 affected ? >> gcc 8 and 9 are affected too. > Then this is a completely different cause then I guessed below, and I think > I know why. All of 8/9/10 gcc ports have support for multiarch, and the > error must happen for gcc or xgcc invocation with -m32, am I right ? Here is what I got in terms of just being bombarded with build failure reports across the board, the two below being for lang/gcc8: Date: Sat, 26 Oct 2019 11:46:37 GMT Subject: [package - head-amd64-default][lang/gcc8] Failed for gcc8-8.3.0_3 in build Log URL: http://beefy19.nyi.freebsd.org/data/head-amd64-default/2019-10-26_10h54m41s/logs/gcc8-8.3.0_3.log Build URL: http://beefy19.nyi.freebsd.org/build.html?mastername=head-amd64-default&build=2019-10-26_10h54m41s -and- Date: Sat, 26 Oct 2019 12:59:10 GMT Subject: [package - head-amd64-pcb-default][lang/gcc8] Failed for gcc8-8.3.0_3 in build Log URL: http://beefy19.nyi.freebsd.org/data/head-amd64-pcb-default/2019-10-26_12h17m09s/logs/gcc8-8.3.0_3.log Build URL: http://beefy19.nyi.freebsd.org/build.html?mastername=head-amd64-pcb-default&build=2019-10-26_12h17m09s Indeed I see -m32 in the last invocation of xgcc here in both case. Gerald From owner-svn-src-head@freebsd.org Sat Oct 26 14:34:22 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D293175539; Sat, 26 Oct 2019 14:34:22 +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) server-signature RSA-PSS (4096 bits) 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 470k596cWVz4GLY; Sat, 26 Oct 2019 14:34:21 +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 "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 9C7B31EF02; Sat, 26 Oct 2019 14:34:21 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::80c4:747d:baa2:7d92] (unknown [IPv6:2001:470:7a58:0:80c4:747d:baa2:7d92]) (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 323B44D1B4; Sat, 26 Oct 2019 16:34:20 +0200 (CEST) From: Dimitry Andric Message-Id: <67F6BDD3-B633-4C85-AE85-9B075FF0E49E@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_48607C31-39D2-4632-979A-EBE534FAA450"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r353937 - in head/share: man/man5 mk Date: Sat, 26 Oct 2019 16:34:14 +0200 In-Reply-To: <20191024124910.GA93913@FreeBSD.org> Cc: Enji Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Alexey Dokuchaev References: <201910231702.x9NH2jQv045130@repo.freebsd.org> <2B855247-5097-442D-8D4A-77D68D2F6186@gmail.com> <20191024124910.GA93913@FreeBSD.org> X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 14:34:22 -0000 --Apple-Mail=_48607C31-39D2-4632-979A-EBE534FAA450 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > On 24 Oct 2019, at 14:49, Alexey Dokuchaev wrote: > > On Wed, Oct 23, 2019 at 11:31:41AM -0700, Enji Cooper wrote: >>> On Oct 23, 2019, at 10:02, Dimitry Andric wrote: >>> New Revision: 353937 >>> URL: https://svnweb.freebsd.org/changeset/base/353937 >>> >>> Log: >>> Build toolchain components as dynamically linked executables by default > > What are the benefits of the new order? The advantages and disadvantages of dynamic linking are a contentious and almost religious issue, so I hope you don't mind that I will not go into this. >>> In this day and age, we have boot environments, virtual machine >>> snapshots, cloud backups, and other much more reliable methods to >>> restore systems to working order. So I think the time is ripe to flip > > What about those of us who cannot use BEs, VMs, and other "cloudy" tech > because, well, they might not work as well and reliably as one might think? There are many possibilities, such as making backups, using WITHOUT_SHARED_TOOLCHAIN (and hoping that you can compile/link your way out of a botched installation), or even using NO_SHARED. >> Using dynamic binaries instead of static binaries might actually regress >> performance in a way you don't expect, depending on -j values, etc. Static >> binaries avoid the dynamic linker, which (obviously) results in a perf hit >> at scale [...] > > Very good point. But if you take this point to its logical conclusion, then you should link everything statically, and never use dynamic linking at all. :) >> Did you calculate the perf trade offs for the static binaries at low -j vs >> high -j, system and user time, etc? > > I'd like to know the answer to this question (and the results) as well. I only tested -j24 on a 32-core system, but I could probably repeat the experiment with lower and higher -j values: * host system (and dynamic linker): head r346082 (2019-04-10) * base/head checkout at r354065 * clang and lld compiled from r354065, dynamically linked: text data bss dec hex filename 69007497 52320 290469 69350286 0x422338e bin-dynamic/cc 45708182 35280 320613 46064075 0x2bee1cb bin-dynamic/ld * clang and lld compiled from r354065, statically linked: text data bss dec hex filename 70828318 71656 2592977 73492951 0x46169d7 bin-static/cc 47533406 54776 2623121 50211303 0x2fe29e7 bin-static/ld * built world with __MAKE_CONF and SRCCONF set to /dev/null, and CC, CXX, CPP and LD set to point to either the dynamic or static binaries * verified that the cross-tools stage did /not/ attempt to bootstrap the compiler and linker * repeated experiment 7 times, for each case * measured real, user and system time of each experiment Results for real time: --------------------------------------------------------------------------- x static-real.txt + dynamic-real.txt N Min Max Median Avg Stddev x 7 1851.71 1892.11 1868.79 1868.6829 13.569253 + 7 1882.95 1940.74 1912.9 1912.6886 17.510156 Difference at 95.0% confidence 44.0057 +/- 18.2444 2.35491% +/- 0.985013% (Student's t, pooled s = 15.6641) Results for user time: --------------------------------------------------------------------------- x static-user.txt + dynamic-user.txt N Min Max Median Avg Stddev x 7 31734.75 32055.47 31983.16 31942.131 118.2333 + 7 32957 33282.1 33224.25 33150.727 137.84805 Difference at 95.0% confidence 1208.6 +/- 149.569 3.7837% +/- 0.47584% (Student's t, pooled s = 128.416) Results for user time: --------------------------------------------------------------------------- x static-sys.txt + dynamic-sys.txt N Min Max Median Avg Stddev x 7 2434.98 2661.22 2461.95 2516.3843 100.88134 + 7 2545.07 2813.8 2655.65 2682.5243 116.80319 Difference at 95.0% confidence 166.14 +/- 127.11 6.60233% +/- 5.1964% (Student's t, pooled s = 109.133) So ~2.3% difference in real time, which is not too bad I think. There are probably opportunities to improve the performance of the dynamic linker, which would be beneficial to every program in the system. -Dimitry --Apple-Mail=_48607C31-39D2-4632-979A-EBE534FAA450 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 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXbRZZgAKCRCwXqMKLiCW o2BUAJ9ndlMld+F7K83SDJeJ3Y6G78mkKgCfYUfcFVxZsFLdl9uvFwvYmCRVuN8= =ER9l -----END PGP SIGNATURE----- --Apple-Mail=_48607C31-39D2-4632-979A-EBE534FAA450-- From owner-svn-src-head@freebsd.org Sat Oct 26 17:10:28 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3EF90179E0E; Sat, 26 Oct 2019 17:10:28 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470nYJ0xzSz4Nt7; Sat, 26 Oct 2019 17:10:28 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03A82B031; Sat, 26 Oct 2019 17:10:28 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QHARer039596; Sat, 26 Oct 2019 17:10:27 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QHARnn039594; Sat, 26 Oct 2019 17:10:27 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910261710.x9QHARnn039594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 26 Oct 2019 17:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354115 - head/usr.bin/dtc X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/usr.bin/dtc X-SVN-Commit-Revision: 354115 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 17:10:28 -0000 Author: manu Date: Sat Oct 26 17:10:27 2019 New Revision: 354115 URL: https://svnweb.freebsd.org/changeset/base/354115 Log: dtc: Allow multiple dts-v1 tag Some dts are including dtsi that also contain a /dts-v1/ tag at the top. GNU DTC doesn't seems to have a problem with that so fix our dtc to behave the same. Reviewed by: kevans MFC after: 1 week Modified: head/usr.bin/dtc/fdt.cc Modified: head/usr.bin/dtc/fdt.cc ============================================================================== --- head/usr.bin/dtc/fdt.cc Sat Oct 26 10:33:21 2019 (r354114) +++ head/usr.bin/dtc/fdt.cc Sat Oct 26 17:10:27 2019 (r354115) @@ -1563,11 +1563,11 @@ device_tree::parse_file(text_input_buffer &input, { input.next_token(); // Read the header - if (input.consume("/dts-v1/;")) + while (input.consume("/dts-v1/;")) { read_header = true; + input.next_token(); } - input.next_token(); if (input.consume("/plugin/;")) { is_plugin = true; From owner-svn-src-head@freebsd.org Sat Oct 26 17:11:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 394F6179EB9; Sat, 26 Oct 2019 17:11:05 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470nZ11SPzz4P91; Sat, 26 Oct 2019 17:11:05 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1538AB17B; Sat, 26 Oct 2019 17:11:05 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QHB4vl040406; Sat, 26 Oct 2019 17:11:04 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QHB308040398; Sat, 26 Oct 2019 17:11:03 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201910261711.x9QHB308040398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 26 Oct 2019 17:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354116 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Commit-Revision: 354116 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 17:11:05 -0000 Author: asomers Date: Sat Oct 26 17:11:02 2019 New Revision: 354116 URL: https://svnweb.freebsd.org/changeset/base/354116 Log: MFZoL: Avoid retrieving unused snapshot props This patch modifies the zfs_ioc_snapshot_list_next() ioctl to enable it to take input parameters that alter the way looping through the list of snapshots is performed. The idea here is to restrict functions that throw away some of the snapshots returned by the ioctl to a range of snapshots that these functions actually use. This improves efficiency and execution speed for some rollback and send operations. Reviewed-by: Tom Caputi Reviewed-by: Brian Behlendorf Reviewed by: Matt Ahrens Signed-off-by: Alek Pinchuk Closes #8077 zfsonlinux/zfs@4c0883fb4af0d5565459099b98fcf90ecbfa1ca1 MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Sat Oct 26 17:10:27 2019 (r354115) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Sat Oct 26 17:11:02 2019 (r354116) @@ -139,7 +139,7 @@ zfs_callback(zfs_handle_t *zhp, void *data) ZFS_TYPE_BOOKMARK)) == 0) && include_snaps) (void) zfs_iter_snapshots(zhp, (cb->cb_flags & ZFS_ITER_SIMPLE) != 0, zfs_callback, - data); + data, 0, 0); if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT | ZFS_TYPE_BOOKMARK)) == 0) && include_bmarks) (void) zfs_iter_bookmarks(zhp, zfs_callback, data); Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 26 17:10:27 2019 (r354115) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 26 17:11:02 2019 (r354116) @@ -30,7 +30,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Igor Kozhukhov . * Copyright 2016 Nexenta Systems, Inc. - * Copyright (c) 2018 Datto Inc. + * Copyright (c) 2019 Datto Inc. */ #include @@ -1174,7 +1174,7 @@ destroy_print_snapshots(zfs_handle_t *fs_zhp, destroy_ int err = 0; assert(cb->cb_firstsnap == NULL); assert(cb->cb_prevsnap == NULL); - err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb); + err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb, 0, 0); if (cb->cb_firstsnap != NULL) { uint64_t used = 0; if (err == 0) { @@ -3437,6 +3437,7 @@ zfs_do_promote(int argc, char **argv) */ typedef struct rollback_cbdata { uint64_t cb_create; + uint8_t cb_younger_ds_printed; boolean_t cb_first; int cb_doclones; char *cb_target; @@ -3467,15 +3468,20 @@ rollback_check_dependent(zfs_handle_t *zhp, void *data } /* - * Report any snapshots more recent than the one specified. Used when '-r' is - * not specified. We reuse this same callback for the snapshot dependents - if - * 'cb_dependent' is set, then this is a dependent and we should report it - * without checking the transaction group. + * Report some snapshots/bookmarks more recent than the one specified. + * Used when '-r' is not specified. We reuse this same callback for the + * snapshot dependents - if 'cb_dependent' is set, then this is a + * dependent and we should report it without checking the transaction group. */ static int rollback_check(zfs_handle_t *zhp, void *data) { rollback_cbdata_t *cbp = data; + /* + * Max number of younger snapshots and/or bookmarks to display before + * we stop the iteration. + */ + const uint8_t max_younger = 32; if (cbp->cb_doclones) { zfs_close(zhp); @@ -3504,9 +3510,24 @@ rollback_check(zfs_handle_t *zhp, void *data) } else { (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); + cbp->cb_younger_ds_printed++; } } zfs_close(zhp); + + if (cbp->cb_younger_ds_printed == max_younger) { + /* + * This non-recursive rollback is going to fail due to the + * presence of snapshots and/or bookmarks that are younger than + * the rollback target. + * We printed some of the offending objects, now we stop + * zfs_iter_snapshot/bookmark iteration so we can fail fast and + * avoid iterating over the rest of the younger objects + */ + (void) fprintf(stderr, gettext("Output limited to %d " + "snapshots/bookmarks\n"), max_younger); + return (-1); + } return (0); } @@ -3520,6 +3541,7 @@ zfs_do_rollback(int argc, char **argv) zfs_handle_t *zhp, *snap; char parentname[ZFS_MAX_DATASET_NAME_LEN]; char *delim; + uint64_t min_txg = 0; /* check options */ while ((c = getopt(argc, argv, "rRf")) != -1) { @@ -3575,7 +3597,12 @@ zfs_do_rollback(int argc, char **argv) cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG); cb.cb_first = B_TRUE; cb.cb_error = 0; - if ((ret = zfs_iter_snapshots(zhp, B_FALSE, rollback_check, &cb)) != 0) + + if (cb.cb_create > 0) + min_txg = cb.cb_create; + + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, rollback_check, &cb, + min_txg, 0)) != 0) goto out; if ((ret = zfs_iter_bookmarks(zhp, rollback_check, &cb)) != 0) goto out; Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Oct 26 17:10:27 2019 (r354115) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Oct 26 17:11:02 2019 (r354116) @@ -28,7 +28,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Nexenta Systems, Inc. - * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2019 Datto Inc. */ #ifndef _LIBZFS_H @@ -570,8 +570,10 @@ extern int zfs_iter_root(libzfs_handle_t *, zfs_iter_f extern int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *); extern int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *); extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *); -extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *); -extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *); +extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *, + uint64_t, uint64_t); +extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *, + uint64_t, uint64_t); extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *); extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *); Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Oct 26 17:10:27 2019 (r354115) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Oct 26 17:11:02 2019 (r354116) @@ -31,6 +31,7 @@ * Copyright 2017 Nexenta Systems, Inc. * Copyright 2016 Igor Kozhukhov * Copyright 2017-2018 RackTop Systems. + * Copyright (c) 2019 Datto Inc. */ #include @@ -4163,7 +4164,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo rollback_data_t cb = { 0 }; int err; boolean_t restore_resv = 0; - uint64_t old_volsize = 0, new_volsize; + uint64_t min_txg = 0, old_volsize = 0, new_volsize; zfs_prop_t resv_prop; assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM || @@ -4175,7 +4176,13 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo cb.cb_force = force; cb.cb_target = snap->zfs_name; cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG); - (void) zfs_iter_snapshots(zhp, B_FALSE, rollback_destroy, &cb); + + if (cb.cb_create > 0) + min_txg = cb.cb_create; + + (void) zfs_iter_snapshots(zhp, B_FALSE, rollback_destroy, &cb, + min_txg, 0); + (void) zfs_iter_bookmarks(zhp, rollback_destroy, &cb); if (cb.cb_error) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Sat Oct 26 17:10:27 2019 (r354115) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Sat Oct 26 17:11:02 2019 (r354116) @@ -24,6 +24,7 @@ * Copyright (c) 2013, 2015 by Delphix. All rights reserved. * Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2019 Datto Inc. */ #include @@ -139,11 +140,12 @@ zfs_iter_filesystems(zfs_handle_t *zhp, zfs_iter_f fun */ int zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple, zfs_iter_f func, - void *data) + void *data, uint64_t min_txg, uint64_t max_txg) { zfs_cmd_t zc = { 0 }; zfs_handle_t *nzhp; int ret; + nvlist_t *range_nvl = NULL; if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT || zhp->zfs_type == ZFS_TYPE_BOOKMARK) @@ -153,6 +155,24 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple if (zcmd_alloc_dst_nvlist(zhp->zfs_hdl, &zc, 0) != 0) return (-1); + + if (min_txg != 0) { + range_nvl = fnvlist_alloc(); + fnvlist_add_uint64(range_nvl, SNAP_ITER_MIN_TXG, min_txg); + } + if (max_txg != 0) { + if (range_nvl == NULL) + range_nvl = fnvlist_alloc(); + fnvlist_add_uint64(range_nvl, SNAP_ITER_MAX_TXG, max_txg); + } + + if (range_nvl != NULL && + zcmd_write_src_nvlist(zhp->zfs_hdl, &zc, range_nvl) != 0) { + zcmd_free_nvlists(&zc); + fnvlist_free(range_nvl); + return (-1); + } + while ((ret = zfs_do_list_ioctl(zhp, ZFS_IOC_SNAPSHOT_LIST_NEXT, &zc)) == 0) { @@ -165,10 +185,12 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple if ((ret = func(nzhp, data)) != 0) { zcmd_free_nvlists(&zc); + fnvlist_free(range_nvl); return (ret); } } zcmd_free_nvlists(&zc); + fnvlist_free(range_nvl); return ((ret < 0) ? ret : 0); } @@ -276,7 +298,8 @@ zfs_snapshot_compare(const void *larg, const void *rar } int -zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_f callback, void *data) +zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_f callback, void *data, + uint64_t min_txg, uint64_t max_txg) { int ret = 0; zfs_node_t *node; @@ -286,7 +309,8 @@ zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_ avl_create(&avl, zfs_snapshot_compare, sizeof (zfs_node_t), offsetof(zfs_node_t, zn_avlnode)); - ret = zfs_iter_snapshots(zhp, B_FALSE, zfs_sort_snaps, &avl); + ret = zfs_iter_snapshots(zhp, B_FALSE, zfs_sort_snaps, &avl, min_txg, + max_txg); for (node = avl_first(&avl); node != NULL; node = AVL_NEXT(&avl, node)) ret |= callback(node->zn_handle, data); @@ -389,7 +413,7 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *sp } err = zfs_iter_snapshots_sorted(fs_zhp, - snapspec_cb, &ssa); + snapspec_cb, &ssa, 0, 0); if (ret == 0) ret = err; if (ret == 0 && (!ssa.ssa_seenfirst || @@ -429,7 +453,7 @@ zfs_iter_children(zfs_handle_t *zhp, zfs_iter_f func, { int ret; - if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data)) != 0) + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data, 0, 0)) != 0) return (ret); return (zfs_iter_filesystems(zhp, func, data)); @@ -495,7 +519,7 @@ iter_dependents_cb(zfs_handle_t *zhp, void *arg) err = zfs_iter_filesystems(zhp, iter_dependents_cb, ida); if (err == 0) { err = zfs_iter_snapshots(zhp, B_FALSE, - iter_dependents_cb, ida); + iter_dependents_cb, ida, 0, 0); } ida->stack = isf.next; } Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 26 17:10:27 2019 (r354115) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 26 17:11:02 2019 (r354116) @@ -28,6 +28,7 @@ * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Igor Kozhukhov + * Copyright (c) 2019 Datto Inc. */ #include @@ -612,6 +613,7 @@ typedef struct send_data { const char *tosnap; boolean_t recursive; boolean_t verbose; + boolean_t replicate; /* * The header nvlist is of the following format: @@ -789,6 +791,7 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) send_data_t *sd = arg; nvlist_t *nvfs, *nv; int rv = 0; + uint64_t min_txg = 0, max_txg = 0; uint64_t parent_fromsnap_guid_save = sd->parent_fromsnap_guid; uint64_t fromsnap_txg_save = sd->fromsnap_txg; uint64_t tosnap_txg_save = sd->tosnap_txg; @@ -832,10 +835,10 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) goto out; } - VERIFY(0 == nvlist_alloc(&nvfs, NV_UNIQUE_NAME, 0)); - VERIFY(0 == nvlist_add_string(nvfs, "name", zhp->zfs_name)); - VERIFY(0 == nvlist_add_uint64(nvfs, "parentfromsnap", - sd->parent_fromsnap_guid)); + nvfs = fnvlist_alloc(); + fnvlist_add_string(nvfs, "name", zhp->zfs_name); + fnvlist_add_uint64(nvfs, "parentfromsnap", + sd->parent_fromsnap_guid); if (zhp->zfs_dmustats.dds_origin[0]) { zfs_handle_t *origin = zfs_open(zhp->zfs_hdl, @@ -855,14 +858,19 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) nvlist_free(nv); /* iterate over snaps, and set sd->parent_fromsnap_guid */ + if (!sd->replicate && fromsnap_txg != 0) + min_txg = fromsnap_txg; + if (!sd->replicate && tosnap_txg != 0) + max_txg = tosnap_txg; sd->parent_fromsnap_guid = 0; VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0)); VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0)); - (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd); + (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd, + min_txg, max_txg); VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps)); VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops)); - nvlist_free(sd->parent_snaps); - nvlist_free(sd->snapprops); + fnvlist_free(sd->parent_snaps); + fnvlist_free(sd->snapprops); /* add this fs to nvlist */ (void) snprintf(guidstring, sizeof (guidstring), @@ -886,11 +894,12 @@ out: static int gather_nvlist(libzfs_handle_t *hdl, const char *fsname, const char *fromsnap, const char *tosnap, boolean_t recursive, boolean_t verbose, - nvlist_t **nvlp, avl_tree_t **avlp) + boolean_t replicate, nvlist_t **nvlp, avl_tree_t **avlp) { zfs_handle_t *zhp; - send_data_t sd = { 0 }; int error; + uint64_t min_txg = 0, max_txg = 0; + send_data_t sd = { 0 }; zhp = zfs_open(hdl, fsname, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); if (zhp == NULL) @@ -902,6 +911,7 @@ gather_nvlist(libzfs_handle_t *hdl, const char *fsname sd.tosnap = tosnap; sd.recursive = recursive; sd.verbose = verbose; + sd.replicate = replicate; if ((error = send_iterate_fs(zhp, &sd)) != 0) { nvlist_free(sd.fss); @@ -1338,6 +1348,7 @@ static int dump_filesystem(zfs_handle_t *zhp, void *arg) { int rv = 0; + uint64_t min_txg = 0, max_txg = 0; send_dump_data_t *sdd = arg; boolean_t missingfrom = B_FALSE; zfs_cmd_t zc = { 0 }; @@ -1373,7 +1384,15 @@ dump_filesystem(zfs_handle_t *zhp, void *arg) if (sdd->fromsnap == NULL || missingfrom) sdd->seenfrom = B_TRUE; - rv = zfs_iter_snapshots_sorted(zhp, dump_snapshot, arg); + if (!sdd->replicate && sdd->fromsnap != NULL) + min_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, + sdd->fromsnap); + if (!sdd->replicate && sdd->tosnap != NULL) + max_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, + sdd->tosnap); + + rv = zfs_iter_snapshots_sorted(zhp, dump_snapshot, arg, + min_txg, max_txg); if (!sdd->seenfrom) { (void) fprintf(stderr, dgettext(TEXT_DOMAIN, "WARNING: could not send %s@%s:\n" @@ -1834,7 +1853,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, cons err = gather_nvlist(zhp->zfs_hdl, zhp->zfs_name, fromsnap, tosnap, flags->replicate, flags->verbose, - &fss, &fsavl); + flags->replicate, &fss, &fsavl); if (err) goto err_out; VERIFY(0 == nvlist_add_nvlist(hdrnv, "fss", fss)); @@ -2477,7 +2496,7 @@ again: VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0)); if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL, - recursive, B_FALSE, &local_nv, &local_avl)) != 0) + recursive, B_FALSE, B_FALSE, &local_nv, &local_avl)) != 0) return (error); /* @@ -3554,7 +3573,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const */ *cp = '\0'; if (gather_nvlist(hdl, zc.zc_value, NULL, NULL, B_FALSE, - B_FALSE, &local_nv, &local_avl) == 0) { + B_FALSE, B_FALSE, &local_nv, &local_avl) == 0) { *cp = '@'; fs = fsavl_find(local_avl, drrb->drr_toguid, NULL); fsavl_destroy(local_avl); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 26 17:10:27 2019 (r354115) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 26 17:11:02 2019 (r354116) @@ -33,7 +33,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome * Copyright 2017 RackTop Systems. - * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2019 Datto Inc. */ /* @@ -2345,7 +2345,8 @@ dataset_name_hidden(const char *name) * inputs: * zc_name name of filesystem * zc_cookie zap cursor - * zc_nvlist_dst_size size of buffer for property nvlist + * zc_nvlist_src iteration range nvlist + * zc_nvlist_src_size size of iteration range nvlist * * outputs: * zc_name name of next filesystem @@ -2414,9 +2415,24 @@ top: static int zfs_ioc_snapshot_list_next(zfs_cmd_t *zc) { - objset_t *os; int error; + objset_t *os, *ossnap; + dsl_dataset_t *ds; + uint64_t min_txg = 0, max_txg = 0; + if (zc->zc_nvlist_src_size != 0) { + nvlist_t *props = NULL; + error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, + zc->zc_iflags, &props); + if (error != 0) + return (error); + (void) nvlist_lookup_uint64(props, SNAP_ITER_MIN_TXG, + &min_txg); + (void) nvlist_lookup_uint64(props, SNAP_ITER_MAX_TXG, + &max_txg); + nvlist_free(props); + } + error = dmu_objset_hold(zc->zc_name, FTAG, &os); if (error != 0) { return (error == ENOENT ? ESRCH : error); @@ -2432,26 +2448,52 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc) return (SET_ERROR(ESRCH)); } - error = dmu_snapshot_list_next(os, - sizeof (zc->zc_name) - strlen(zc->zc_name), - zc->zc_name + strlen(zc->zc_name), &zc->zc_obj, &zc->zc_cookie, - NULL); + while (error == 0) { + if (issig(JUSTLOOKING) && issig(FORREAL)) { + error = SET_ERROR(EINTR); + break; + } - if (error == 0 && !zc->zc_simple) { - dsl_dataset_t *ds; - dsl_pool_t *dp = os->os_dsl_dataset->ds_dir->dd_pool; + error = dmu_snapshot_list_next(os, + sizeof (zc->zc_name) - strlen(zc->zc_name), + zc->zc_name + strlen(zc->zc_name), &zc->zc_obj, + &zc->zc_cookie, NULL); + if (error == ENOENT) { + error = SET_ERROR(ESRCH); + break; + } else if (error != 0) { + break; + } - error = dsl_dataset_hold_obj(dp, zc->zc_obj, FTAG, &ds); - if (error == 0) { - objset_t *ossnap; + error = dsl_dataset_hold_obj(dmu_objset_pool(os), zc->zc_obj, + FTAG, &ds); + if (error != 0) + break; - error = dmu_objset_from_ds(ds, &ossnap); - if (error == 0) - error = zfs_ioc_objset_stats_impl(zc, ossnap); + if ((min_txg != 0 && dsl_get_creationtxg(ds) < min_txg) || + (max_txg != 0 && dsl_get_creationtxg(ds) > max_txg)) { dsl_dataset_rele(ds, FTAG); + /* undo snapshot name append */ + *(strchr(zc->zc_name, '@') + 1) = '\0'; + /* skip snapshot */ + continue; } - } else if (error == ENOENT) { - error = SET_ERROR(ESRCH); + + if (zc->zc_simple) { + dsl_dataset_rele(ds, FTAG); + break; + } + + if ((error = dmu_objset_from_ds(ds, &ossnap)) != 0) { + dsl_dataset_rele(ds, FTAG); + break; + } + if ((error = zfs_ioc_objset_stats_impl(zc, ossnap)) != 0) { + dsl_dataset_rele(ds, FTAG); + break; + } + dsl_dataset_rele(ds, FTAG); + break; } dmu_objset_rele(os, FTAG); Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Oct 26 17:10:27 2019 (r354115) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Oct 26 17:11:02 2019 (r354116) @@ -26,7 +26,7 @@ * Copyright (c) 2012, Martin Matuska . All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Joyent, Inc. - * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2019 Datto Inc. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -1122,6 +1122,13 @@ typedef enum { #define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT) #define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024) #define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT) + +/* + * nvlist name constants. Facilitate restricting snapshot iteration range for + * the "list next snapshot" ioctl + */ +#define SNAP_ITER_MIN_TXG "snap_iter_min_txg" +#define SNAP_ITER_MAX_TXG "snap_iter_max_txg" /* * Sysevent payload members. ZFS will generate the following sysevents with the From owner-svn-src-head@freebsd.org Sat Oct 26 17:49:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D5E917B2D4; Sat, 26 Oct 2019 17:49:52 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 470pQl4jvdz4RMS; Sat, 26 Oct 2019 17:49:51 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt1-f193.google.com with SMTP id z22so8283864qtq.11; Sat, 26 Oct 2019 10:49:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YYjBQeOqXdwq0ULNQPnsrKlpNITOIU7jPXhFmSLzK1E=; b=U1FqTL6kzaX0D3puGhGDz3+teOcC4+Zn5TQxcCrQxJpGvST3KSgAK4yg1ulIwPfBsF PPmpv9N0iUOoobnSKGmug0jaLHHePz+vHRqvF0nFz/NrAICrZo7d5Em0mF4VaqD/5ZKf EYKZ2KmLdEcQlGv9cbh7kO9XwhGg3yCtddmzvmwtIpYcXwhTfyfuY3CgEXRn846JdWza KmVwlNuYMssTr+uyBcRlxUGIgFhMyFtw6mL8dmNywwXMres3N4fsQeXntJV/hBKu8DGN pL1s0jnjc39bGA0cInUlNG4fvSNf2BurzTQ8U70+Q32W80oU7snqGUJESXUShJMMcS54 QLNw== X-Gm-Message-State: APjAAAVafUkB34I/9MIFbCy6/6iu1hGXSHfserH2aBaRBqW39rldz7Va rsG2PDK8Nk4mra6g5d/yatHTPEsC3dD91FR8f40= X-Google-Smtp-Source: APXvYqyAU3vafLBF+EKhPq7fMNYpMoxd37+HN0wRwghf6P9OoZ743Y6shTPnmfNT0OENkPUurBTOuY2M4vCxpwAswNg= X-Received: by 2002:ac8:1413:: with SMTP id k19mr9700010qtj.360.1572112190050; Sat, 26 Oct 2019 10:49:50 -0700 (PDT) MIME-Version: 1.0 References: <201910252009.x9PK9gIV092660@repo.freebsd.org> <20191026082655.GJ73312@kib.kiev.ua> <20191026130048.GL73312@kib.kiev.ua> In-Reply-To: <20191026130048.GL73312@kib.kiev.ua> From: Antoine Brodin Date: Sat, 26 Oct 2019 19:49:38 +0200 Message-ID: Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Gerald Pfeifer Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 470pQl4jvdz4RMS X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of antoinebrodinfreebsd@gmail.com designates 209.85.160.193 as permitted sender) smtp.mailfrom=antoinebrodinfreebsd@gmail.com X-Spamd-Result: default: False [-3.55 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; RWL_MAILSPIKE_GOOD(0.00)[193.160.85.209.rep.mailspike.net : 127.0.0.18]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[193.160.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.55)[ip: (-2.42), ipnet: 209.85.128.0/17(-3.22), asn: 15169(-2.05), country: US(-0.05)]; FORGED_SENDER(0.30)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 17:49:52 -0000 On Sat, Oct 26, 2019 at 3:01 PM Konstantin Belousov wrote: > On Sat, Oct 26, 2019 at 02:16:19PM +0200, Antoine Brodin wrote: > > On Sat, Oct 26, 2019 at 10:27 AM Konstantin Belousov > > wrote: > > > On Sat, Oct 26, 2019 at 08:24:09AM +0200, Antoine Brodin wrote: > > > > On Fri, Oct 25, 2019 at 10:09 PM Konstantin Belousov wrote: > > > > > > > > > > Author: kib > > > > > Date: Fri Oct 25 20:09:42 2019 > > > > > New Revision: 354095 > > > > > URL: https://svnweb.freebsd.org/changeset/base/354095 > > > > > > > > > > Log: > > > > > amd64: move pcb out of kstack to struct thread. > > > > > > > > > > This saves 320 bytes of the precious stack space. > > > > > > > > > > The only negative aspect of the change I can think of is that the > > > > > struct thread increased by 320 bytes obviously, and that 320 bytes are > > > > > not swapped out anymore. I believe the freed stack space is much more > > > > > important than that. Also, current struct thread size is 1392 bytes > > > > > on amd64, so UMA will allocate two thread structures per (4KB) slab, > > > > > which leaves a space for pcb without increasing zone memory use. > > > > > > > > > > Reviewed by: alc, markj > > > > > Tested by: pho > > > > > Sponsored by: The FreeBSD Foundation > > > > > MFC after: 2 weeks > > > > > Differential revision: https://reviews.freebsd.org/D22138 > > > > > > > > Hi, > > > > > > > > It seems that this breaks at least some versions of gcc: > > > > > > > > In file included from /usr/include/sys/proc.h:75, > > > > from /usr/include/sys/user.h:51, > > > > from ./md-unwind-support.h:34, > > > > from > > > > /wrkdirs/usr/ports/lang/gcc10-devel/work/gcc-10-20191020/libgcc/unwind-dw2.c:412: > > > > /usr/include/machine/proc.h:76:13: error: field 'md_pcb' has incomplete type > > > > 76 | struct pcb md_pcb; > > > > | ^~~~~~ > > > > > > > > > > It is very strange. Are gcc 9 or 8 affected ? > > > > gcc 8 and 9 are affected too. > Then this is a completely different cause then I guessed below, and I think > I know why. All of 8/9/10 gcc ports have support for multiarch, and the > error must happen for gcc or xgcc invocation with -m32, am I right ? > > If yes, please try the patch at the end of the message instead. > > diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h > index 44e34fa5c83..8800b355c9a 100644 > --- a/sys/amd64/include/pcb.h > +++ b/sys/amd64/include/pcb.h > @@ -116,6 +116,10 @@ struct susppcb { > /* fpu context for suspend/resume */ > void *sp_fpususpend; > }; > +#else /* 32bit */ > +struct pcb { > + uint64_t pcb_dummy[40]; > +}; > #endif > > #ifdef _KERNEL Hi, It builds fine with this patch. Antoine From owner-svn-src-head@freebsd.org Sat Oct 26 17:51:44 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04A2917B3C7; Sat, 26 Oct 2019 17:51:44 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470pSv6Prdz4RYk; Sat, 26 Oct 2019 17:51:43 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0174B8D4; Sat, 26 Oct 2019 17:51:43 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QHph6j068730; Sat, 26 Oct 2019 17:51:43 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QHphtw068729; Sat, 26 Oct 2019 17:51:43 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910261751.x9QHphtw068729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 26 Oct 2019 17:51:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354117 - head/sys/modules/dtb/rockchip X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/modules/dtb/rockchip X-SVN-Commit-Revision: 354117 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 17:51:44 -0000 Author: manu Date: Sat Oct 26 17:51:43 2019 New Revision: 354117 URL: https://svnweb.freebsd.org/changeset/base/354117 Log: arm64: rockchip: dts: Build the Khadas board DTS We boot on thoses boards so build them. Submitted by: s199p.wa1k9r@gmail.com MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22158 Modified: head/sys/modules/dtb/rockchip/Makefile Modified: head/sys/modules/dtb/rockchip/Makefile ============================================================================== --- head/sys/modules/dtb/rockchip/Makefile Sat Oct 26 17:11:02 2019 (r354116) +++ head/sys/modules/dtb/rockchip/Makefile Sat Oct 26 17:51:43 2019 (r354117) @@ -1,6 +1,9 @@ # $FreeBSD$ DTS= \ + rockchip/rk3399-khadas-edge-captain.dts \ + rockchip/rk3399-khadas-edge.dts \ + rockchip/rk3399-khadas-edge-v.dts \ rockchip/rk3328-rock64.dts \ rockchip/rk3399-rockpro64.dts From owner-svn-src-head@freebsd.org Sat Oct 26 18:22:52 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCE4E17C8B7; Sat, 26 Oct 2019 18:22:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470q8r4d8hz4TX2; Sat, 26 Oct 2019 18:22:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 804F5C054; Sat, 26 Oct 2019 18:22:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QIMqZb086867; Sat, 26 Oct 2019 18:22:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QIMqN0086866; Sat, 26 Oct 2019 18:22:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910261822.x9QIMqN0086866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 26 Oct 2019 18:22:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354118 - head/sys/amd64/include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/include X-SVN-Commit-Revision: 354118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 18:22:52 -0000 Author: kib Date: Sat Oct 26 18:22:52 2019 New Revision: 354118 URL: https://svnweb.freebsd.org/changeset/base/354118 Log: Provide dummy definition of the amd64 struct pcb for -m32 compilation. I do not see a need in the proper x86/include/pcb.h header. Reported and tested by: antoine MFC after: 1 week Modified: head/sys/amd64/include/pcb.h Modified: head/sys/amd64/include/pcb.h ============================================================================== --- head/sys/amd64/include/pcb.h Sat Oct 26 17:51:43 2019 (r354117) +++ head/sys/amd64/include/pcb.h Sat Oct 26 18:22:52 2019 (r354118) @@ -116,6 +116,10 @@ struct susppcb { /* fpu context for suspend/resume */ void *sp_fpususpend; }; +#else /* 32bit */ +struct pcb { + uint64_t pcb_dummy[40]; +}; #endif #ifdef _KERNEL From owner-svn-src-head@freebsd.org Sat Oct 26 18:29:03 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47E3E17CC0B; Sat, 26 Oct 2019 18:29:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470qHz11Hzz4TnL; Sat, 26 Oct 2019 18:29:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05DC4C06C; Sat, 26 Oct 2019 18:29:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QIT2wi087180; Sat, 26 Oct 2019 18:29:02 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QIT2hY087179; Sat, 26 Oct 2019 18:29:02 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201910261829.x9QIT2hY087179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 26 Oct 2019 18:29:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354119 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 354119 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 18:29:03 -0000 Author: tsoome Date: Sat Oct 26 18:29:02 2019 New Revision: 354119 URL: https://svnweb.freebsd.org/changeset/base/354119 Log: loader: rs_alloc() may return NULL rs_alloc() in zfs reader code may return NULL, so we need to check the return value and error out if needed. MFC after: 1 week Modified: head/stand/libsa/zfs/zfsimpl.c Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Sat Oct 26 18:22:52 2019 (r354118) +++ head/stand/libsa/zfs/zfsimpl.c Sat Oct 26 18:29:02 2019 (r354119) @@ -840,12 +840,17 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 list_t stack; spa_t *spa = vd->spa; zio_t *zio = arg; + remap_segment_t *rs; list_create(&stack, sizeof (remap_segment_t), offsetof(remap_segment_t, rs_node)); - for (remap_segment_t *rs = rs_alloc(vd, offset, asize, 0); - rs != NULL; rs = list_remove_head(&stack)) { + rs = rs_alloc(vd, offset, asize, 0); + if (rs == NULL) { + printf("vdev_indirect_remap: out of memory.\n"); + zio->io_error = ENOMEM; + } + for ( ; rs != NULL; rs = list_remove_head(&stack)) { vdev_t *v = rs->rs_vd; uint64_t num_entries = 0; /* vdev_indirect_mapping_t *vim = v->v_mapping; */ @@ -853,6 +858,9 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 vdev_indirect_mapping_duplicate_adjacent_entries(v, rs->rs_offset, rs->rs_asize, &num_entries); + if (num_entries == 0) + zio->io_error = ENOMEM; + for (uint64_t i = 0; i < num_entries; i++) { vdev_indirect_mapping_entry_phys_t *m = &mapping[i]; uint64_t size = DVA_GET_ASIZE(&m->vimep_dst); @@ -865,9 +873,18 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 vdev_t *dst_v = vdev_lookup_top(spa, dst_vdev); if (dst_v->v_read == vdev_indirect_read) { - list_insert_head(&stack, - rs_alloc(dst_v, dst_offset + inner_offset, - inner_size, rs->rs_split_offset)); + remap_segment_t *o; + + o = rs_alloc(dst_v, dst_offset + inner_offset, + inner_size, rs->rs_split_offset); + if (o == NULL) { + printf("vdev_indirect_remap: " + "out of memory.\n"); + zio->io_error = ENOMEM; + break; + } + + list_insert_head(&stack, o); } vdev_indirect_gather_splits(rs->rs_split_offset, dst_v, dst_offset + inner_offset, From owner-svn-src-head@freebsd.org Sat Oct 26 18:37:05 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A80017CF30; Sat, 26 Oct 2019 18:37:05 +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 470qTF0VVxz4VCt; Sat, 26 Oct 2019 18:37:04 +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 36F861456F; Sat, 26 Oct 2019 13:36:58 -0500 (CDT) Date: Sat, 26 Oct 2019 13:36:57 -0500 (CDT) From: Dan Mack X-X-Sender: mack@localhost.local To: Alan Somers cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354116 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs In-Reply-To: <201910261711.x9QHB308040398@repo.freebsd.org> Message-ID: References: <201910261711.x9QHB308040398@repo.freebsd.org> 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: 470qTF0VVxz4VCt X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 18:37:05 -0000 This appears to have broken my buildworld unless I did something wrong on my end: Last Changed Rev: 354116 snip ... ===> lib/ofed/libibumad (all) --- all_subdir_lib/libbe --- /usr/src/lib/libbe/be_info.c:260:67: error: too few arguments to function call, expected 5, have 3 return (zfs_iter_snapshots_sorted(hdl, prop_list_builder_cb, data)); ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ /usr/src/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h:575:1: note: 'zfs_iter_snapshots_sorted' declared here extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *, ^ 1 error generated. *** [be_info.o] Error code 1 On Sat, 26 Oct 2019, Alan Somers wrote: > Author: asomers > Date: Sat Oct 26 17:11:02 2019 > New Revision: 354116 > URL: https://svnweb.freebsd.org/changeset/base/354116 > > Log: > MFZoL: Avoid retrieving unused snapshot props > > This patch modifies the zfs_ioc_snapshot_list_next() ioctl to enable it > to take input parameters that alter the way looping through the list of > snapshots is performed. The idea here is to restrict functions that > throw away some of the snapshots returned by the ioctl to a range of > snapshots that these functions actually use. This improves efficiency > and execution speed for some rollback and send operations. > > Reviewed-by: Tom Caputi > Reviewed-by: Brian Behlendorf > Reviewed by: Matt Ahrens > Signed-off-by: Alek Pinchuk > Closes #8077 > zfsonlinux/zfs@4c0883fb4af0d5565459099b98fcf90ecbfa1ca1 > > MFC after: 2 weeks > > Modified: > head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c > head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c > head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h > > Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Sat Oct 26 17:10:27 2019 (r354115) > +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Sat Oct 26 17:11:02 2019 (r354116) > @@ -139,7 +139,7 @@ zfs_callback(zfs_handle_t *zhp, void *data) > ZFS_TYPE_BOOKMARK)) == 0) && include_snaps) > (void) zfs_iter_snapshots(zhp, > (cb->cb_flags & ZFS_ITER_SIMPLE) != 0, zfs_callback, > - data); > + data, 0, 0); > if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT | > ZFS_TYPE_BOOKMARK)) == 0) && include_bmarks) > (void) zfs_iter_bookmarks(zhp, zfs_callback, data); > > Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 26 17:10:27 2019 (r354115) > +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 26 17:11:02 2019 (r354116) > @@ -30,7 +30,7 @@ > * Copyright (c) 2014 Integros [integros.com] > * Copyright 2016 Igor Kozhukhov . > * Copyright 2016 Nexenta Systems, Inc. > - * Copyright (c) 2018 Datto Inc. > + * Copyright (c) 2019 Datto Inc. > */ > > #include > @@ -1174,7 +1174,7 @@ destroy_print_snapshots(zfs_handle_t *fs_zhp, destroy_ > int err = 0; > assert(cb->cb_firstsnap == NULL); > assert(cb->cb_prevsnap == NULL); > - err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb); > + err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb, 0, 0); > if (cb->cb_firstsnap != NULL) { > uint64_t used = 0; > if (err == 0) { > @@ -3437,6 +3437,7 @@ zfs_do_promote(int argc, char **argv) > */ > typedef struct rollback_cbdata { > uint64_t cb_create; > + uint8_t cb_younger_ds_printed; > boolean_t cb_first; > int cb_doclones; > char *cb_target; > @@ -3467,15 +3468,20 @@ rollback_check_dependent(zfs_handle_t *zhp, void *data > } > > /* > - * Report any snapshots more recent than the one specified. Used when '-r' is > - * not specified. We reuse this same callback for the snapshot dependents - if > - * 'cb_dependent' is set, then this is a dependent and we should report it > - * without checking the transaction group. > + * Report some snapshots/bookmarks more recent than the one specified. > + * Used when '-r' is not specified. We reuse this same callback for the > + * snapshot dependents - if 'cb_dependent' is set, then this is a > + * dependent and we should report it without checking the transaction group. > */ > static int > rollback_check(zfs_handle_t *zhp, void *data) > { > rollback_cbdata_t *cbp = data; > + /* > + * Max number of younger snapshots and/or bookmarks to display before > + * we stop the iteration. > + */ > + const uint8_t max_younger = 32; > > if (cbp->cb_doclones) { > zfs_close(zhp); > @@ -3504,9 +3510,24 @@ rollback_check(zfs_handle_t *zhp, void *data) > } else { > (void) fprintf(stderr, "%s\n", > zfs_get_name(zhp)); > + cbp->cb_younger_ds_printed++; > } > } > zfs_close(zhp); > + > + if (cbp->cb_younger_ds_printed == max_younger) { > + /* > + * This non-recursive rollback is going to fail due to the > + * presence of snapshots and/or bookmarks that are younger than > + * the rollback target. > + * We printed some of the offending objects, now we stop > + * zfs_iter_snapshot/bookmark iteration so we can fail fast and > + * avoid iterating over the rest of the younger objects > + */ > + (void) fprintf(stderr, gettext("Output limited to %d " > + "snapshots/bookmarks\n"), max_younger); > + return (-1); > + } > return (0); > } > > @@ -3520,6 +3541,7 @@ zfs_do_rollback(int argc, char **argv) > zfs_handle_t *zhp, *snap; > char parentname[ZFS_MAX_DATASET_NAME_LEN]; > char *delim; > + uint64_t min_txg = 0; > > /* check options */ > while ((c = getopt(argc, argv, "rRf")) != -1) { > @@ -3575,7 +3597,12 @@ zfs_do_rollback(int argc, char **argv) > cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG); > cb.cb_first = B_TRUE; > cb.cb_error = 0; > - if ((ret = zfs_iter_snapshots(zhp, B_FALSE, rollback_check, &cb)) != 0) > + > + if (cb.cb_create > 0) > + min_txg = cb.cb_create; > + > + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, rollback_check, &cb, > + min_txg, 0)) != 0) > goto out; > if ((ret = zfs_iter_bookmarks(zhp, rollback_check, &cb)) != 0) > goto out; > > Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h > ============================================================================== > --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Oct 26 17:10:27 2019 (r354115) > +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Oct 26 17:11:02 2019 (r354116) > @@ -28,7 +28,7 @@ > * Copyright (c) 2013 Steven Hartland. All rights reserved. > * Copyright (c) 2014 Integros [integros.com] > * Copyright 2016 Nexenta Systems, Inc. > - * Copyright (c) 2017 Datto Inc. > + * Copyright (c) 2019 Datto Inc. > */ > > #ifndef _LIBZFS_H > @@ -570,8 +570,10 @@ extern int zfs_iter_root(libzfs_handle_t *, zfs_iter_f > extern int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *); > extern int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *); > extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *); > -extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *); > -extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *); > +extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *, > + uint64_t, uint64_t); > +extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *, > + uint64_t, uint64_t); > extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *); > extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *); > > > Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c > ============================================================================== > --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Oct 26 17:10:27 2019 (r354115) > +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Oct 26 17:11:02 2019 (r354116) > @@ -31,6 +31,7 @@ > * Copyright 2017 Nexenta Systems, Inc. > * Copyright 2016 Igor Kozhukhov > * Copyright 2017-2018 RackTop Systems. > + * Copyright (c) 2019 Datto Inc. > */ > > #include > @@ -4163,7 +4164,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo > rollback_data_t cb = { 0 }; > int err; > boolean_t restore_resv = 0; > - uint64_t old_volsize = 0, new_volsize; > + uint64_t min_txg = 0, old_volsize = 0, new_volsize; > zfs_prop_t resv_prop; > > assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM || > @@ -4175,7 +4176,13 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo > cb.cb_force = force; > cb.cb_target = snap->zfs_name; > cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG); > - (void) zfs_iter_snapshots(zhp, B_FALSE, rollback_destroy, &cb); > + > + if (cb.cb_create > 0) > + min_txg = cb.cb_create; > + > + (void) zfs_iter_snapshots(zhp, B_FALSE, rollback_destroy, &cb, > + min_txg, 0); > + > (void) zfs_iter_bookmarks(zhp, rollback_destroy, &cb); > > if (cb.cb_error) > > Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c > ============================================================================== > --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Sat Oct 26 17:10:27 2019 (r354115) > +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Sat Oct 26 17:11:02 2019 (r354116) > @@ -24,6 +24,7 @@ > * Copyright (c) 2013, 2015 by Delphix. All rights reserved. > * Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved. > * Copyright 2014 Nexenta Systems, Inc. All rights reserved. > + * Copyright (c) 2019 Datto Inc. > */ > > #include > @@ -139,11 +140,12 @@ zfs_iter_filesystems(zfs_handle_t *zhp, zfs_iter_f fun > */ > int > zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple, zfs_iter_f func, > - void *data) > + void *data, uint64_t min_txg, uint64_t max_txg) > { > zfs_cmd_t zc = { 0 }; > zfs_handle_t *nzhp; > int ret; > + nvlist_t *range_nvl = NULL; > > if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT || > zhp->zfs_type == ZFS_TYPE_BOOKMARK) > @@ -153,6 +155,24 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple > > if (zcmd_alloc_dst_nvlist(zhp->zfs_hdl, &zc, 0) != 0) > return (-1); > + > + if (min_txg != 0) { > + range_nvl = fnvlist_alloc(); > + fnvlist_add_uint64(range_nvl, SNAP_ITER_MIN_TXG, min_txg); > + } > + if (max_txg != 0) { > + if (range_nvl == NULL) > + range_nvl = fnvlist_alloc(); > + fnvlist_add_uint64(range_nvl, SNAP_ITER_MAX_TXG, max_txg); > + } > + > + if (range_nvl != NULL && > + zcmd_write_src_nvlist(zhp->zfs_hdl, &zc, range_nvl) != 0) { > + zcmd_free_nvlists(&zc); > + fnvlist_free(range_nvl); > + return (-1); > + } > + > while ((ret = zfs_do_list_ioctl(zhp, ZFS_IOC_SNAPSHOT_LIST_NEXT, > &zc)) == 0) { > > @@ -165,10 +185,12 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple > > if ((ret = func(nzhp, data)) != 0) { > zcmd_free_nvlists(&zc); > + fnvlist_free(range_nvl); > return (ret); > } > } > zcmd_free_nvlists(&zc); > + fnvlist_free(range_nvl); > return ((ret < 0) ? ret : 0); > } > > @@ -276,7 +298,8 @@ zfs_snapshot_compare(const void *larg, const void *rar > } > > int > -zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_f callback, void *data) > +zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_f callback, void *data, > + uint64_t min_txg, uint64_t max_txg) > { > int ret = 0; > zfs_node_t *node; > @@ -286,7 +309,8 @@ zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_ > avl_create(&avl, zfs_snapshot_compare, > sizeof (zfs_node_t), offsetof(zfs_node_t, zn_avlnode)); > > - ret = zfs_iter_snapshots(zhp, B_FALSE, zfs_sort_snaps, &avl); > + ret = zfs_iter_snapshots(zhp, B_FALSE, zfs_sort_snaps, &avl, min_txg, > + max_txg); > > for (node = avl_first(&avl); node != NULL; node = AVL_NEXT(&avl, node)) > ret |= callback(node->zn_handle, data); > @@ -389,7 +413,7 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *sp > } > > err = zfs_iter_snapshots_sorted(fs_zhp, > - snapspec_cb, &ssa); > + snapspec_cb, &ssa, 0, 0); > if (ret == 0) > ret = err; > if (ret == 0 && (!ssa.ssa_seenfirst || > @@ -429,7 +453,7 @@ zfs_iter_children(zfs_handle_t *zhp, zfs_iter_f func, > { > int ret; > > - if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data)) != 0) > + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data, 0, 0)) != 0) > return (ret); > > return (zfs_iter_filesystems(zhp, func, data)); > @@ -495,7 +519,7 @@ iter_dependents_cb(zfs_handle_t *zhp, void *arg) > err = zfs_iter_filesystems(zhp, iter_dependents_cb, ida); > if (err == 0) { > err = zfs_iter_snapshots(zhp, B_FALSE, > - iter_dependents_cb, ida); > + iter_dependents_cb, ida, 0, 0); > } > ida->stack = isf.next; > } > > Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c > ============================================================================== > --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 26 17:10:27 2019 (r354115) > +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 26 17:11:02 2019 (r354116) > @@ -28,6 +28,7 @@ > * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. > * Copyright (c) 2014 Integros [integros.com] > * Copyright 2016 Igor Kozhukhov > + * Copyright (c) 2019 Datto Inc. > */ > > #include > @@ -612,6 +613,7 @@ typedef struct send_data { > const char *tosnap; > boolean_t recursive; > boolean_t verbose; > + boolean_t replicate; > > /* > * The header nvlist is of the following format: > @@ -789,6 +791,7 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) > send_data_t *sd = arg; > nvlist_t *nvfs, *nv; > int rv = 0; > + uint64_t min_txg = 0, max_txg = 0; > uint64_t parent_fromsnap_guid_save = sd->parent_fromsnap_guid; > uint64_t fromsnap_txg_save = sd->fromsnap_txg; > uint64_t tosnap_txg_save = sd->tosnap_txg; > @@ -832,10 +835,10 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) > goto out; > } > > - VERIFY(0 == nvlist_alloc(&nvfs, NV_UNIQUE_NAME, 0)); > - VERIFY(0 == nvlist_add_string(nvfs, "name", zhp->zfs_name)); > - VERIFY(0 == nvlist_add_uint64(nvfs, "parentfromsnap", > - sd->parent_fromsnap_guid)); > + nvfs = fnvlist_alloc(); > + fnvlist_add_string(nvfs, "name", zhp->zfs_name); > + fnvlist_add_uint64(nvfs, "parentfromsnap", > + sd->parent_fromsnap_guid); > > if (zhp->zfs_dmustats.dds_origin[0]) { > zfs_handle_t *origin = zfs_open(zhp->zfs_hdl, > @@ -855,14 +858,19 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) > nvlist_free(nv); > > /* iterate over snaps, and set sd->parent_fromsnap_guid */ > + if (!sd->replicate && fromsnap_txg != 0) > + min_txg = fromsnap_txg; > + if (!sd->replicate && tosnap_txg != 0) > + max_txg = tosnap_txg; > sd->parent_fromsnap_guid = 0; > VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0)); > VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0)); > - (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd); > + (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd, > + min_txg, max_txg); > VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps)); > VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops)); > - nvlist_free(sd->parent_snaps); > - nvlist_free(sd->snapprops); > + fnvlist_free(sd->parent_snaps); > + fnvlist_free(sd->snapprops); > > /* add this fs to nvlist */ > (void) snprintf(guidstring, sizeof (guidstring), > @@ -886,11 +894,12 @@ out: > static int > gather_nvlist(libzfs_handle_t *hdl, const char *fsname, const char *fromsnap, > const char *tosnap, boolean_t recursive, boolean_t verbose, > - nvlist_t **nvlp, avl_tree_t **avlp) > + boolean_t replicate, nvlist_t **nvlp, avl_tree_t **avlp) > { > zfs_handle_t *zhp; > - send_data_t sd = { 0 }; > int error; > + uint64_t min_txg = 0, max_txg = 0; > + send_data_t sd = { 0 }; > > zhp = zfs_open(hdl, fsname, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); > if (zhp == NULL) > @@ -902,6 +911,7 @@ gather_nvlist(libzfs_handle_t *hdl, const char *fsname > sd.tosnap = tosnap; > sd.recursive = recursive; > sd.verbose = verbose; > + sd.replicate = replicate; > > if ((error = send_iterate_fs(zhp, &sd)) != 0) { > nvlist_free(sd.fss); > @@ -1338,6 +1348,7 @@ static int > dump_filesystem(zfs_handle_t *zhp, void *arg) > { > int rv = 0; > + uint64_t min_txg = 0, max_txg = 0; > send_dump_data_t *sdd = arg; > boolean_t missingfrom = B_FALSE; > zfs_cmd_t zc = { 0 }; > @@ -1373,7 +1384,15 @@ dump_filesystem(zfs_handle_t *zhp, void *arg) > if (sdd->fromsnap == NULL || missingfrom) > sdd->seenfrom = B_TRUE; > > - rv = zfs_iter_snapshots_sorted(zhp, dump_snapshot, arg); > + if (!sdd->replicate && sdd->fromsnap != NULL) > + min_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, > + sdd->fromsnap); > + if (!sdd->replicate && sdd->tosnap != NULL) > + max_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, > + sdd->tosnap); > + > + rv = zfs_iter_snapshots_sorted(zhp, dump_snapshot, arg, > + min_txg, max_txg); > if (!sdd->seenfrom) { > (void) fprintf(stderr, dgettext(TEXT_DOMAIN, > "WARNING: could not send %s@%s:\n" > @@ -1834,7 +1853,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, cons > > err = gather_nvlist(zhp->zfs_hdl, zhp->zfs_name, > fromsnap, tosnap, flags->replicate, flags->verbose, > - &fss, &fsavl); > + flags->replicate, &fss, &fsavl); > if (err) > goto err_out; > VERIFY(0 == nvlist_add_nvlist(hdrnv, "fss", fss)); > @@ -2477,7 +2496,7 @@ again: > VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0)); > > if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL, > - recursive, B_FALSE, &local_nv, &local_avl)) != 0) > + recursive, B_FALSE, B_FALSE, &local_nv, &local_avl)) != 0) > return (error); > > /* > @@ -3554,7 +3573,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const > */ > *cp = '\0'; > if (gather_nvlist(hdl, zc.zc_value, NULL, NULL, B_FALSE, > - B_FALSE, &local_nv, &local_avl) == 0) { > + B_FALSE, B_FALSE, &local_nv, &local_avl) == 0) { > *cp = '@'; > fs = fsavl_find(local_avl, drrb->drr_toguid, NULL); > fsavl_destroy(local_avl); > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 26 17:10:27 2019 (r354115) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 26 17:11:02 2019 (r354116) > @@ -33,7 +33,7 @@ > * Copyright (c) 2014 Integros [integros.com] > * Copyright 2016 Toomas Soome > * Copyright 2017 RackTop Systems. > - * Copyright (c) 2017 Datto Inc. > + * Copyright (c) 2019 Datto Inc. > */ > > /* > @@ -2345,7 +2345,8 @@ dataset_name_hidden(const char *name) > * inputs: > * zc_name name of filesystem > * zc_cookie zap cursor > - * zc_nvlist_dst_size size of buffer for property nvlist > + * zc_nvlist_src iteration range nvlist > + * zc_nvlist_src_size size of iteration range nvlist > * > * outputs: > * zc_name name of next filesystem > @@ -2414,9 +2415,24 @@ top: > static int > zfs_ioc_snapshot_list_next(zfs_cmd_t *zc) > { > - objset_t *os; > int error; > + objset_t *os, *ossnap; > + dsl_dataset_t *ds; > + uint64_t min_txg = 0, max_txg = 0; > > + if (zc->zc_nvlist_src_size != 0) { > + nvlist_t *props = NULL; > + error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, > + zc->zc_iflags, &props); > + if (error != 0) > + return (error); > + (void) nvlist_lookup_uint64(props, SNAP_ITER_MIN_TXG, > + &min_txg); > + (void) nvlist_lookup_uint64(props, SNAP_ITER_MAX_TXG, > + &max_txg); > + nvlist_free(props); > + } > + > error = dmu_objset_hold(zc->zc_name, FTAG, &os); > if (error != 0) { > return (error == ENOENT ? ESRCH : error); > @@ -2432,26 +2448,52 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc) > return (SET_ERROR(ESRCH)); > } > > - error = dmu_snapshot_list_next(os, > - sizeof (zc->zc_name) - strlen(zc->zc_name), > - zc->zc_name + strlen(zc->zc_name), &zc->zc_obj, &zc->zc_cookie, > - NULL); > + while (error == 0) { > + if (issig(JUSTLOOKING) && issig(FORREAL)) { > + error = SET_ERROR(EINTR); > + break; > + } > > - if (error == 0 && !zc->zc_simple) { > - dsl_dataset_t *ds; > - dsl_pool_t *dp = os->os_dsl_dataset->ds_dir->dd_pool; > + error = dmu_snapshot_list_next(os, > + sizeof (zc->zc_name) - strlen(zc->zc_name), > + zc->zc_name + strlen(zc->zc_name), &zc->zc_obj, > + &zc->zc_cookie, NULL); > + if (error == ENOENT) { > + error = SET_ERROR(ESRCH); > + break; > + } else if (error != 0) { > + break; > + } > > - error = dsl_dataset_hold_obj(dp, zc->zc_obj, FTAG, &ds); > - if (error == 0) { > - objset_t *ossnap; > + error = dsl_dataset_hold_obj(dmu_objset_pool(os), zc->zc_obj, > + FTAG, &ds); > + if (error != 0) > + break; > > - error = dmu_objset_from_ds(ds, &ossnap); > - if (error == 0) > - error = zfs_ioc_objset_stats_impl(zc, ossnap); > + if ((min_txg != 0 && dsl_get_creationtxg(ds) < min_txg) || > + (max_txg != 0 && dsl_get_creationtxg(ds) > max_txg)) { > dsl_dataset_rele(ds, FTAG); > + /* undo snapshot name append */ > + *(strchr(zc->zc_name, '@') + 1) = '\0'; > + /* skip snapshot */ > + continue; > } > - } else if (error == ENOENT) { > - error = SET_ERROR(ESRCH); > + > + if (zc->zc_simple) { > + dsl_dataset_rele(ds, FTAG); > + break; > + } > + > + if ((error = dmu_objset_from_ds(ds, &ossnap)) != 0) { > + dsl_dataset_rele(ds, FTAG); > + break; > + } > + if ((error = zfs_ioc_objset_stats_impl(zc, ossnap)) != 0) { > + dsl_dataset_rele(ds, FTAG); > + break; > + } > + dsl_dataset_rele(ds, FTAG); > + break; > } > > dmu_objset_rele(os, FTAG); > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Oct 26 17:10:27 2019 (r354115) > +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Oct 26 17:11:02 2019 (r354116) > @@ -26,7 +26,7 @@ > * Copyright (c) 2012, Martin Matuska . All rights reserved. > * Copyright (c) 2014 Integros [integros.com] > * Copyright 2017 Joyent, Inc. > - * Copyright (c) 2017 Datto Inc. > + * Copyright (c) 2019 Datto Inc. > */ > > /* Portions Copyright 2010 Robert Milkowski */ > @@ -1122,6 +1122,13 @@ typedef enum { > #define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT) > #define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024) > #define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT) > + > +/* > + * nvlist name constants. Facilitate restricting snapshot iteration range for > + * the "list next snapshot" ioctl > + */ > +#define SNAP_ITER_MIN_TXG "snap_iter_min_txg" > +#define SNAP_ITER_MAX_TXG "snap_iter_max_txg" > > /* > * Sysevent payload members. ZFS will generate the following sysevents with the > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Sat Oct 26 19:12:10 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7241417DDE5; Sat, 26 Oct 2019 19:12:10 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 470rFj4j6gz4X35; Sat, 26 Oct 2019 19:12:09 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f49.google.com with SMTP id 94so4258949oty.8; Sat, 26 Oct 2019 12:12:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Yi0JN2o4i86NL+YaFGIAI2SSyoZt5F9u6aiN1Jv6eGk=; b=Bc+bqqt6CtHFh7VhlYXNMi1mWL0mXnRTtRjcwIsXEni2Y4yMJ6SYTbZ90zxSZMfkxd O63Rkq5vffClHsAIxvHTUUHaXhdSzNDSzoo56xBejlfdmFiuJbMtAY5pSwUHyBYQGal+ LzIklWiy9UU4Dx1B/c840SaAdM4bqzeC1AVF+/d6n36CfXvycoDUGSJgP7DQ3c9isvsP X1Gzk4WyNx36IaYC2jyuUwqJn+NCmtrMGmAzjHQqTeQcbrno3tM+N3a9uuWOsElfqx3v ml+C4X+Q0Fp2ws4B43S9RjAxO/7Ys5rDfdD3AcrK6TbTgy/dxpy8/rJZGOqavpZ2x03z dbqQ== X-Gm-Message-State: APjAAAW/LK229HTEB4wY8CJjCJDPIhpYzofehROVn/VnroFKT6Y/YycE KbZB0eGFkFP4fW4gmCPcrx3evReSUnyhOMFdA4mvl0zU X-Google-Smtp-Source: APXvYqz6EMQVgSUhr+gbiaEwG6R9EDjqJMw7YVbTfjD4B8U8YC0pB8iRXmaip/IYSXofwbQiG61K3Su42fVaJL9ebmw= X-Received: by 2002:a9d:5f0f:: with SMTP id f15mr7314245oti.251.1572117127979; Sat, 26 Oct 2019 12:12:07 -0700 (PDT) MIME-Version: 1.0 References: <201910261711.x9QHB308040398@repo.freebsd.org> In-Reply-To: From: Alan Somers Date: Sat, 26 Oct 2019 13:11:56 -0600 Message-ID: Subject: Re: svn commit: r354116 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs To: Dan Mack Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 470rFj4j6gz4X35 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.210.49 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-2.12 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[freebsd.org]; URI_COUNT_ODD(1.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[49.210.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.12)[ip: (-0.26), ipnet: 209.85.128.0/17(-3.22), asn: 15169(-2.05), country: US(-0.05)]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 19:12:10 -0000 Ack, my bad. Fix coming... On Sat, Oct 26, 2019 at 12:37 PM Dan Mack wrote: > > This appears to have broken my buildworld unless I did something wrong on > my end: Last Changed Rev: 354116 > > > snip ... > > ===> lib/ofed/libibumad (all) > --- all_subdir_lib/libbe --- > /usr/src/lib/libbe/be_info.c:260:67: error: too few arguments to function > call, expected 5, have 3 > return (zfs_iter_snapshots_sorted(hdl, prop_list_builder_cb, > data)); > ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ > /usr/src/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h:575:1: note: > 'zfs_iter_snapshots_sorted' declared here > extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *, > ^ > 1 error generated. > *** [be_info.o] Error code 1 > > On Sat, 26 Oct 2019, Alan Somers wrote: > > > Author: asomers > > Date: Sat Oct 26 17:11:02 2019 > > New Revision: 354116 > > URL: https://svnweb.freebsd.org/changeset/base/354116 > > > > Log: > > MFZoL: Avoid retrieving unused snapshot props > > > > This patch modifies the zfs_ioc_snapshot_list_next() ioctl to enable it > > to take input parameters that alter the way looping through the list of > > snapshots is performed. The idea here is to restrict functions that > > throw away some of the snapshots returned by the ioctl to a range of > > snapshots that these functions actually use. This improves efficiency > > and execution speed for some rollback and send operations. > > > > Reviewed-by: Tom Caputi > > Reviewed-by: Brian Behlendorf > > Reviewed by: Matt Ahrens > > Signed-off-by: Alek Pinchuk > > Closes #8077 > > zfsonlinux/zfs@4c0883fb4af0d5565459099b98fcf90ecbfa1ca1 > > > > MFC after: 2 weeks > > > > Modified: > > head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c > > head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c > > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h > > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c > > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c > > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c > > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c > > head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h > > From owner-svn-src-head@freebsd.org Sat Oct 26 19:21:00 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05B1D17E092; Sat, 26 Oct 2019 19:21:00 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470rRv6NjWz4XHV; Sat, 26 Oct 2019 19:20:59 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BFAE8C97A; Sat, 26 Oct 2019 19:20:59 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QJKxQk017424; Sat, 26 Oct 2019 19:20:59 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QJKx7r017423; Sat, 26 Oct 2019 19:20:59 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201910261920.x9QJKx7r017423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 26 Oct 2019 19:20:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354120 - head/lib/libbe X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/lib/libbe X-SVN-Commit-Revision: 354120 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 19:21:00 -0000 Author: asomers Date: Sat Oct 26 19:20:59 2019 New Revision: 354120 URL: https://svnweb.freebsd.org/changeset/base/354120 Log: Commit missing file from r354116 Pointy-hat-to: Me Reported by: Dan Mack MFC after: 2 weeks MFC-With: 354116 Modified: head/lib/libbe/be_info.c Modified: head/lib/libbe/be_info.c ============================================================================== --- head/lib/libbe/be_info.c Sat Oct 26 18:29:02 2019 (r354119) +++ head/lib/libbe/be_info.c Sat Oct 26 19:20:59 2019 (r354120) @@ -257,7 +257,8 @@ static int snapshot_proplist_update(zfs_handle_t *hdl, prop_data_t *data) { - return (zfs_iter_snapshots_sorted(hdl, prop_list_builder_cb, data)); + return (zfs_iter_snapshots_sorted(hdl, prop_list_builder_cb, data, + 0, 0)); } From owner-svn-src-head@freebsd.org Sat Oct 26 20:30:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E49A217FE62; Sat, 26 Oct 2019 20:30:59 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (hamza.pair.com [209.68.5.143]) (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 470t0g30Ghz4ZqS; Sat, 26 Oct 2019 20:30:59 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (localhost [127.0.0.1]) by hamza.pair.com (Postfix) with ESMTP id 8263633E10; Sat, 26 Oct 2019 16:30:57 -0400 (EDT) Received: from anthias (unknown [178.114.204.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hamza.pair.com (Postfix) with ESMTPSA id A2CC533E0F; Sat, 26 Oct 2019 16:30:56 -0400 (EDT) Date: Sat, 26 Oct 2019 22:30:55 +0200 (CEST) From: Gerald Pfeifer To: Antoine Brodin cc: Konstantin Belousov , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern In-Reply-To: Message-ID: References: <201910252009.x9PK9gIV092660@repo.freebsd.org> <20191026082655.GJ73312@kib.kiev.ua> <20191026130048.GL73312@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 470t0g30Ghz4ZqS X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.984,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 20:31:00 -0000 On Sat, 26 Oct 2019, Antoine Brodin wrote: > It builds fine with this patch. Thank you for the quick report and testing, Antoine, and the quick fix, Konstantin! Gerald From owner-svn-src-head@freebsd.org Sat Oct 26 21:19:56 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A5A81596D4; Sat, 26 Oct 2019 21:19:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470v5837jfz4cwd; Sat, 26 Oct 2019 21:19:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5024FDF81; Sat, 26 Oct 2019 21:19:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QLJusd086966; Sat, 26 Oct 2019 21:19:56 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QLJtF2086963; Sat, 26 Oct 2019 21:19:55 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910262119.x9QLJtF2086963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 26 Oct 2019 21:19:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354121 - in head/tests/sys/netpfil: common pf X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head/tests/sys/netpfil: common pf X-SVN-Commit-Revision: 354121 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 21:19:56 -0000 Author: bz Date: Sat Oct 26 21:19:55 2019 New Revision: 354121 URL: https://svnweb.freebsd.org/changeset/base/354121 Log: Upgrade (scapy) py2 tests to work on py3. In order to move python2 out of the test framework to avoid py2 vs. py3 confusions upgrade the remaining test cases using scapy to work with py3. That means only one version of scapy needs to be installed in the CI system. It also gives a path forward for testing i386 issues observed in the CI system with some of these tests. Fixes are: - Use default python from environment (which is 3.x these days). - properly ident some lines as common for the rest of the file to avoid errors. - cast the calculated offset to an int as the division result is considered a float which is not accepted input. - when comparing payload to a magic number make sure we always add the payload properly to the packet and do not try to compare string in the result but convert the data payload back into an integer. - fix print formating. Discussed with: lwhsu, kp (taking it off his todo :) MFC after: 2 weeks Modified: head/tests/sys/netpfil/common/pft_ping.py head/tests/sys/netpfil/pf/CVE-2019-5597.py head/tests/sys/netpfil/pf/CVE-2019-5598.py Modified: head/tests/sys/netpfil/common/pft_ping.py ============================================================================== --- head/tests/sys/netpfil/common/pft_ping.py Sat Oct 26 19:20:59 2019 (r354120) +++ head/tests/sys/netpfil/common/pft_ping.py Sat Oct 26 21:19:55 2019 (r354121) @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/bin/env python import argparse import scapy.all as sp @@ -34,15 +34,15 @@ def check_ping4_request(args, packet): raw = packet.getlayer(sp.Raw) if not raw: return False - if raw.load != str(PAYLOAD_MAGIC): + if int(raw.load) != PAYLOAD_MAGIC: return False # Wait to check expectations until we've established this is the packet we # sent. if args.expect_tos: if ip.tos != int(args.expect_tos[0]): - print "Unexpected ToS value %d, expected %s" \ - % (ip.tos, args.expect_tos[0]) + print("Unexpected ToS value %d, expected %d" \ + % (ip.tos, int(args.expect_tos[0]))) return False return True @@ -62,7 +62,7 @@ def check_ping6_request(args, packet): icmp = packet.getlayer(sp.ICMPv6EchoRequest) if not icmp: return False - if icmp.data != str(PAYLOAD_MAGIC): + if int(icmp.data) != PAYLOAD_MAGIC: return False return True @@ -71,7 +71,7 @@ def ping(send_if, dst_ip, args): ether = sp.Ether() ip = sp.IP(dst=dst_ip) icmp = sp.ICMP(type='echo-request') - raw = sp.Raw(str(PAYLOAD_MAGIC)) + raw = sp.raw(str(PAYLOAD_MAGIC)) if args.send_tos: ip.tos = int(args.send_tos[0]) @@ -82,7 +82,7 @@ def ping(send_if, dst_ip, args): def ping6(send_if, dst_ip, args): ether = sp.Ether() ip6 = sp.IPv6(dst=dst_ip) - icmp = sp.ICMPv6EchoRequest(data=PAYLOAD_MAGIC) + icmp = sp.ICMPv6EchoRequest(data=sp.raw(str(PAYLOAD_MAGIC))) req = ether / ip6 / icmp sp.sendp(req, iface=send_if, verbose=False) Modified: head/tests/sys/netpfil/pf/CVE-2019-5597.py ============================================================================== --- head/tests/sys/netpfil/pf/CVE-2019-5597.py Sat Oct 26 19:20:59 2019 (r354120) +++ head/tests/sys/netpfil/pf/CVE-2019-5597.py Sat Oct 26 21:19:55 2019 (r354121) @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/bin/env python import random import scapy.all as sp @@ -18,7 +18,8 @@ def main(): padding = 8 fid = random.randint(0,100000) frag_0 = sp.IPv6ExtHdrFragment(id=fid, nh=UDP_PROTO, m=1, offset=0) - frag_1 = sp.IPv6ExtHdrFragment(id=fid, nh=UDP_PROTO, m=0, offset=padding/8) + foff_1 = (int)(padding/8) + frag_1 = sp.IPv6ExtHdrFragment(id=fid, nh=UDP_PROTO, m=0, offset=foff_1) pkt1_opts = sp.AH(nh=AH_PROTO, payloadlen=200) \ / sp.Raw('XXXX' * 199) \ Modified: head/tests/sys/netpfil/pf/CVE-2019-5598.py ============================================================================== --- head/tests/sys/netpfil/pf/CVE-2019-5598.py Sat Oct 26 19:20:59 2019 (r354120) +++ head/tests/sys/netpfil/pf/CVE-2019-5598.py Sat Oct 26 21:19:55 2019 (r354121) @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/bin/env python import argparse import scapy.all as sp @@ -38,18 +38,18 @@ def main(): args = parser.parse_args() - # Send the allowed packet to establish state - udp = sp.Ether() / \ - sp.IP(src=args.src[0], dst=args.to[0]) / \ - sp.UDP(dport=53, sport=1234) - sp.sendp(udp, iface=args.sendif[0], verbose=False) + # Send the allowed packet to establish state + udp = sp.Ether() / \ + sp.IP(src=args.src[0], dst=args.to[0]) / \ + sp.UDP(dport=53, sport=1234) + sp.sendp(udp, iface=args.sendif[0], verbose=False) # Start sniffing on recvif sniffer = Sniffer(args, check_icmp_error) # Send the bad error packet icmp_reachable = sp.Ether() / \ - sp.IP(src=args.src[0], dst=args.to[0]) / \ + sp.IP(src=args.src[0], dst=args.to[0]) / \ sp.ICMP(type=3, code=3) / \ sp.IP(src="4.3.2.1", dst="1.2.3.4") / \ sp.UDP(dport=53, sport=1234)